Re: [kvm-devel] [patch 2/2] KVM: fix kvm_vcpu_kick vs __vcpu_run race

2008-04-13 Thread Avi Kivity
Marcelo Tosatti wrote: On Fri, Apr 11, 2008 at 03:18:19PM +0300, Avi Kivity wrote: kvm_vcpu_kick() can be called from nonatomic contexts, so the vcpu-cpu == cpu check is dangerous (and will warn on preemptible kernels, no?) Doh, right. How's this. --- KVM: fix

Re: [kvm-devel] [patch 2/2] KVM: fix kvm_vcpu_kick vs __vcpu_run race

2008-04-13 Thread Avi Kivity
Avi Kivity wrote: @@ -3944,11 +3950,13 @@ static void vcpu_kick_intr(void *info) void kvm_vcpu_kick(struct kvm_vcpu *vcpu) { int ipi_pcpu = vcpu-cpu; +int cpu = get_cpu(); if (waitqueue_active(vcpu-wq)) { wake_up_interruptible(vcpu-wq);

Re: [kvm-devel] [patch 2/2] KVM: fix kvm_vcpu_kick vs __vcpu_run race

2008-04-13 Thread Avi Kivity
Avi Kivity wrote: Avi Kivity wrote: @@ -3944,11 +3950,13 @@ static void vcpu_kick_intr(void *info) void kvm_vcpu_kick(struct kvm_vcpu *vcpu) { int ipi_pcpu = vcpu-cpu; +int cpu = get_cpu(); if (waitqueue_active(vcpu-wq)) { wake_up_interruptible(vcpu-wq);

Re: [kvm-devel] [patch 2/2] KVM: fix kvm_vcpu_kick vs __vcpu_run race

2008-04-11 Thread Avi Kivity
Marcelo Tosatti wrote: There is a window open between testing of pending IRQ's and assignment of guest_mode in __vcpu_run. Injection of IRQ's can race with __vcpu_run as follows: CPU0CPU1 kvm_x86_ops-run() vcpu-guest_mode = 0SET_IRQ_LINE

[kvm-devel] [patch 2/2] KVM: fix kvm_vcpu_kick vs __vcpu_run race

2008-04-10 Thread Marcelo Tosatti
There is a window open between testing of pending IRQ's and assignment of guest_mode in __vcpu_run. Injection of IRQ's can race with __vcpu_run as follows: CPU0CPU1 kvm_x86_ops-run() vcpu-guest_mode = 0SET_IRQ_LINE ioctl ..