1. 05 3月, 2008 32 次提交
  2. 04 3月, 2008 8 次提交
    • R
      freezer vs stopped or traced · 13b1c3d4
      Roland McGrath 提交于
      This changes the "freezer" code used by suspend/hibernate in its treatment
      of tasks in TASK_STOPPED (job control stop) and TASK_TRACED (ptrace) states.
      
      As I understand it, the intent of the "freezer" is to hold all tasks
      from doing anything significant.  For this purpose, TASK_STOPPED and
      TASK_TRACED are "frozen enough".  It's possible the tasks might resume
      from ptrace calls (if the tracer were unfrozen) or from signals
      (including ones that could come via timer interrupts, etc).  But this
      doesn't matter as long as they quickly block again while "freezing" is
      in effect.  Some minor adjustments to the signal.c code make sure that
      try_to_freeze() very shortly follows all wakeups from both kinds of
      stop.  This lets the freezer code safely leave stopped tasks unmolested.
      
      Changing this fixes the longstanding bug of seeing after resuming from
      suspend/hibernate your shell report "[1] Stopped" and the like for all
      your jobs stopped by ^Z et al, as if you had freshly fg'd and ^Z'd them.
      It also removes from the freezer the arcane special case treatment for
      ptrace'd tasks, which relied on intimate knowledge of ptrace internals.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      13b1c3d4
    • R
      x86: disable KVM for Voyager and friends · 1a4e3f89
      Randy Dunlap 提交于
      Most classic Pentiums don't have hardware virtualization extension,
      and building kvm with Voyager, Visual Workstation, or NUMAQ
      generates spurious failures.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      1a4e3f89
    • A
      KVM: VMX: Avoid rearranging switched guest msrs while they are loaded · 33f9c505
      Avi Kivity 提交于
      KVM tries to run as much as possible with the guest msrs loaded instead of
      host msrs, since switching msrs is very expensive.  It also tries to minimize
      the number of msrs switched according to the guest mode; for example,
      MSR_LSTAR is needed only by long mode guests.  This optimization is done by
      setup_msrs().
      
      However, we must not change which msrs are switched while we are running with
      guest msr state:
      
       - switch to guest msr state
       - call setup_msrs(), removing some msrs from the list
       - switch to host msr state, leaving a few guest msrs loaded
      
      An easy way to trigger this is to kexec an x86_64 linux guest.  Early during
      setup, the guest will switch EFER to not include SCE.  KVM will stop saving
      MSR_LSTAR, and on the next msr switch it will leave the guest LSTAR loaded.
      The next host syscall will end up in a random location in the kernel.
      
      Fix by reloading the host msrs before changing the msr list.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      33f9c505
    • A
      KVM: MMU: Fix race when instantiating a shadow pte · f7d9c7b7
      Avi Kivity 提交于
      For improved concurrency, the guest walk is performed concurrently with other
      vcpus.  This means that we need to revalidate the guest ptes once we have
      write-protected the guest page tables, at which point they can no longer be
      modified.
      
      The current code attempts to avoid this check if the shadow page table is not
      new, on the assumption that if it has existed before, the guest could not have
      modified the pte without the shadow lock.  However the assumption is incorrect,
      as the racing vcpu could have modified the pte, then instantiated the shadow
      page, before our vcpu regains control:
      
        vcpu0        vcpu1
      
        fault
        walk pte
      
                     modify pte
                     fault in same pagetable
                     instantiate shadow page
      
        lookup shadow page
        conclude it is old
        instantiate spte based on stale guest pte
      
      We could do something clever with generation counters, but a test run by
      Marcelo suggests this is unnecessary and we can just do the revalidation
      unconditionally.  The pte will be in the processor cache and the check can
      be quite fast.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      f7d9c7b7
    • A
      KVM: Route irq 0 to vcpu 0 exclusively · 8c35f237
      Avi Kivity 提交于
      Some Linux versions allow the timer interrupt to be processed by more than
      one cpu, leading to hangs due to tsc instability.  Work around the issue
      by only disaptching the interrupt to vcpu 0.
      
      Problem analyzed (and patch tested) by Sheng Yang.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      8c35f237
    • A
      KVM: Avoid infinite-frequency local apic timer · 0b975a3c
      Avi Kivity 提交于
      If the local apic initial count is zero, don't start a an hrtimer with infinite
      frequency, locking up the host.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      0b975a3c
    • M
      KVM: make MMU_DEBUG compile again · 24993d53
      Marcelo Tosatti 提交于
      the cr3 variable is now inside the vcpu->arch structure.
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      24993d53
    • M
      KVM: move alloc_apic_access_page() outside of non-preemptable region · 5e4a0b3c
      Marcelo Tosatti 提交于
      alloc_apic_access_page() can sleep, while vmx_vcpu_setup is called
      inside a non preemptable region. Move it after put_cpu().
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      5e4a0b3c