1. 24 10月, 2010 2 次提交
    • A
      KVM: Check for pending events before attempting injection · 3842d135
      Avi Kivity 提交于
      Instead of blindly attempting to inject an event before each guest entry,
      check for a possible event first in vcpu->requests.  Sites that can trigger
      event injection are modified to set KVM_REQ_EVENT:
      
      - interrupt, nmi window opening
      - ppr updates
      - i8259 output changes
      - local apic irr changes
      - rflags updates
      - gif flag set
      - event set on exit
      
      This improves non-injecting entry performance, and sets the stage for
      non-atomic injection.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      3842d135
    • A
      KVM: i8259: Make ICW1 conform to spec · 9ed049c3
      Avi Kivity 提交于
      ICW is not a full reset, instead it resets a limited number of registers
      in the PIC.  Change ICW1 emulation to only reset those registers.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      9ed049c3
  2. 09 9月, 2010 1 次提交
  3. 02 8月, 2010 1 次提交
  4. 01 8月, 2010 4 次提交
    • C
      KVM: Search the LAPIC's for one that will accept a PIC interrupt · 529df65e
      Chris Lalancette 提交于
      Older versions of 32-bit linux have a "Checking 'hlt' instruction"
      test where they repeatedly call the 'hlt' instruction, and then
      expect a timer interrupt to kick the CPU out of halt.  This happens
      before any LAPIC or IOAPIC setup happens, which means that all of
      the APIC's are in virtual wire mode at this point.  Unfortunately,
      the current implementation of virtual wire mode is hardcoded to
      only kick the BSP, so if a crash+kexec occurs on a different
      vcpu, it will never get kicked.
      
      This patch makes pic_unlock() do the equivalent of
      kvm_irq_delivery_to_apic() for the IOAPIC code.  That is, it runs
      through all of the vcpus looking for one that is in virtual wire
      mode.  In the normal case where LAPICs and IOAPICs are configured,
      this won't be used at all.  In the bootstrap phase of a modern
      OS, before the LAPICs and IOAPICs are configured, this will have
      exactly the same behavior as today; VCPU0 is always looked at
      first, so it will always get out of the loop after the first
      iteration.  This will only go through the loop more than once
      during a kexec/kdump, in which case it will only do it a few times
      until the kexec'ed kernel programs the LAPIC and IOAPIC.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      529df65e
    • A
      KVM: i8259: simplify pic_irq_request() calling sequence · 36633f32
      Avi Kivity 提交于
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      36633f32
    • A
      KVM: i8259: reduce excessive abstraction for pic_irq_request() · 073d4613
      Avi Kivity 提交于
      Part of the i8259 code pretends it isn't part of kvm, but we know better.
      Reduce excessive abstraction, eliminating callbacks and void pointers.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      073d4613
    • A
      KVM: Update Red Hat copyrights · 221d059d
      Avi Kivity 提交于
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      221d059d
  5. 25 4月, 2010 1 次提交
  6. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  7. 01 3月, 2010 4 次提交
  8. 03 12月, 2009 2 次提交
  9. 10 9月, 2009 10 次提交
  10. 24 3月, 2009 3 次提交
  11. 31 12月, 2008 1 次提交
    • A
      KVM: Add locking to virtual i8259 interrupt controller · 3f353858
      Avi Kivity 提交于
      While most accesses to the i8259 are with the kvm mutex taken, the call
      to kvm_pic_read_irq() is not.  We can't easily take the kvm mutex there
      since the function is called with interrupts disabled.
      
      Fix by adding a spinlock to the virtual interrupt controller.  Since we
      can't send an IPI under the spinlock (we also take the same spinlock in
      an irq disabled context), we defer the IPI until the spinlock is released.
      Similarly, we defer irq ack notifications until after spinlock release to
      avoid lock recursion.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      3f353858
  12. 15 10月, 2008 4 次提交
    • M
      KVM: PIC: enhance IPI avoidance · e4825800
      Marcelo Tosatti 提交于
      The PIC code makes little effort to avoid kvm_vcpu_kick(), resulting in
      unnecessary guest exits in some conditions.
      
      For example, if the timer interrupt is routed through the IOAPIC, IRR
      for IRQ 0 will get set but not cleared, since the APIC is handling the
      acks.
      
      This means that everytime an interrupt < 16 is triggered, the priority
      logic will find IRQ0 pending and send an IPI to vcpu0 (in case IRQ0 is
      not masked, which is Linux's case).
      
      Introduce a new variable isr_ack to represent the IRQ's for which the
      guest has been signalled / cleared the ISR. Use it to avoid more than
      one IPI per trigger-ack cycle, in addition to the avoidance when ISR is
      set in get_priority().
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      e4825800
    • M
      KVM: fix i8259 reset irq acking · 85428ac7
      Marcelo Tosatti 提交于
      The irq ack during pic reset has three problems:
      
      - Ignores slave/master PIC, using gsi 0-8 for both.
      - Generates an ACK even if the APIC is in control.
      - Depends upon IMR being clear, which is broken if the irq was masked
      at the time it was generated.
      
      The last one causes the BIOS to hang after the first reboot of
      Windows installation, since PIT interrupts stop.
      
      [avi: fix check whether pic interrupts are seen by cpu]
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      85428ac7
    • M
      KVM: irq ack notification · f5244726
      Marcelo Tosatti 提交于
      Based on a patch from: Ben-Ami Yassour <benami@il.ibm.com>
      which was based on a patch from: Amit Shah <amit.shah@qumranet.com>
      
      Notify IRQ acking on PIC/APIC emulation. The previous patch missed two things:
      
      - Edge triggered interrupts on IOAPIC
      - PIC reset with IRR/ISR set should be equivalent to ack (LAPIC probably
      needs something similar).
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      CC: Amit Shah <amit.shah@qumranet.com>
      CC: Ben-Ami Yassour <benami@il.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      f5244726
    • A
      KVM: Consolidate PIC isr clearing into a function · 7edd0ce0
      Avi Kivity 提交于
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      7edd0ce0
  13. 20 7月, 2008 2 次提交
  14. 31 1月, 2008 1 次提交
  15. 30 1月, 2008 2 次提交
  16. 13 10月, 2007 1 次提交