OpenCloudOS-Kernel/virt/kvm
Marcelo Tosatti e5c239cfd5 KVM: Fix kvm_vcpu_block() task state race
There's still a race in kvm_vcpu_block(), if a wake_up_interruptible()
call happens before the task state is set to TASK_INTERRUPTIBLE:

CPU0                            CPU1

kvm_vcpu_block

add_wait_queue

kvm_cpu_has_interrupt = 0
                                set interrupt
                                if (waitqueue_active())
                                        wake_up_interruptible()

kvm_cpu_has_pending_timer
kvm_arch_vcpu_runnable
signal_pending

set_current_state(TASK_INTERRUPTIBLE)
schedule()

Can be fixed by using prepare_to_wait() which sets the task state before
testing for the wait condition.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-05-18 14:37:12 +03:00
..
ioapic.c KVM: Route irq 0 to vcpu 0 exclusively 2008-03-04 15:19:48 +02:00
ioapic.h KVM: Move ioapic code to common directory. 2008-01-30 18:01:19 +02:00
iodev.h KVM: Move drivers/kvm/* to virt/kvm/ 2008-01-30 18:01:18 +02:00
kvm_main.c KVM: Fix kvm_vcpu_block() task state race 2008-05-18 14:37:12 +03:00
kvm_trace.c KVM: Rename debugfs_dir to kvm_debugfs_dir 2008-04-27 18:21:36 +03:00