1. 10 6月, 2009 1 次提交
    • M
      KVM: x86: silence preempt warning on kvm_write_guest_time · 2dea4c84
      Matt T. Yourst 提交于
      This issue just appeared in kvm-84 when running on 2.6.28.7 (x86-64)
      with PREEMPT enabled.
      
      We're getting syslog warnings like this many (but not all) times qemu
      tells KVM to run the VCPU:
      
      BUG: using smp_processor_id() in preemptible [00000000] code:
      qemu-system-x86/28938
      caller is kvm_arch_vcpu_ioctl_run+0x5d1/0xc70 [kvm]
      Pid: 28938, comm: qemu-system-x86 2.6.28.7-mtyrel-64bit
      Call Trace:
      debug_smp_processor_id+0xf7/0x100
      kvm_arch_vcpu_ioctl_run+0x5d1/0xc70 [kvm]
      ? __wake_up+0x4e/0x70
      ? wake_futex+0x27/0x40
      kvm_vcpu_ioctl+0x2e9/0x5a0 [kvm]
      enqueue_hrtimer+0x8a/0x110
      _spin_unlock_irqrestore+0x27/0x50
      vfs_ioctl+0x31/0xa0
      do_vfs_ioctl+0x74/0x480
      sys_futex+0xb4/0x140
      sys_ioctl+0x99/0xa0
      system_call_fastpath+0x16/0x1b
      
      As it turns out, the call trace is messed up due to gcc's inlining, but
      I isolated the problem anyway: kvm_write_guest_time() is being used in a
      non-thread-safe manner on preemptable kernels.
      
      Basically kvm_write_guest_time()'s body needs to be surrounded by
      preempt_disable() and preempt_enable(), since the kernel won't let us
      query any per-CPU data (indirectly using smp_processor_id()) without
      preemption disabled. The attached patch fixes this issue by disabling
      preemption inside kvm_write_guest_time().
      
      [marcelo: surround only __get_cpu_var calls since the warning
      is harmless]
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      2dea4c84
  2. 26 5月, 2009 1 次提交
    • A
      KVM: Fix PDPTR reloading on CR4 writes · a2edf57f
      Avi Kivity 提交于
      The processor is documented to reload the PDPTRs while in PAE mode if any
      of the CR4 bits PSE, PGE, or PAE change.  Linux relies on this
      behaviour when zapping the low mappings of PAE kernels during boot.
      
      The code already handled changes to CR4.PAE; augment it to also notice changes
      to PSE and PGE.
      
      This triggered while booting an F11 PAE kernel; the futex initialization code
      runs before any CR3 reloads and writes to a NULL pointer; the futex subsystem
      ended up uninitialized, killing PI futexes and pulseaudio which uses them.
      
      Cc: stable@kernel.org
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      a2edf57f
  3. 11 5月, 2009 2 次提交
  4. 22 4月, 2009 2 次提交
  5. 24 3月, 2009 19 次提交
  6. 15 2月, 2009 3 次提交
    • M
      KVM: x86: disable kvmclock on non constant TSC hosts · abe6655d
      Marcelo Tosatti 提交于
      This is better.
      
      Currently, this code path is posing us big troubles,
      and we won't have a decent patch in time. So, temporarily
      disable it.
      Signed-off-by: NGlauber Costa <glommer@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      abe6655d
    • S
      KVM: Fix racy in kvm_free_assigned_irq · ba4cef31
      Sheng Yang 提交于
      In the past, kvm_get_kvm() and kvm_put_kvm() was called in assigned device irq
      handler and interrupt_work, in order to prevent cancel_work_sync() in
      kvm_free_assigned_irq got a illegal state when waiting for interrupt_work done.
      But it's tricky and still got two problems:
      
      1. A bug ignored two conditions that cancel_work_sync() would return true result
      in a additional kvm_put_kvm().
      
      2. If interrupt type is MSI, we would got a window between cancel_work_sync()
      and free_irq(), which interrupt would be injected again...
      
      This patch discard the reference count used for irq handler and interrupt_work,
      and ensure the legal state by moving the free function at the very beginning of
      kvm_destroy_vm(). And the patch fix the second bug by disable irq before
      cancel_work_sync(), which may result in nested disable of irq but OK for we are
      going to free it.
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      ba4cef31
    • S
      KVM: Add kvm_arch_sync_events to sync with asynchronize events · ad8ba2cd
      Sheng Yang 提交于
      kvm_arch_sync_events is introduced to quiet down all other events may happen
      contemporary with VM destroy process, like IRQ handler and work struct for
      assigned device.
      
      For kvm_arch_sync_events is called at the very beginning of kvm_destroy_vm(), so
      the state of KVM here is legal and can provide a environment to quiet down other
      events.
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      ad8ba2cd
  7. 03 1月, 2009 1 次提交
  8. 31 12月, 2008 11 次提交