* KVM: x86: properly update ready_for_interrupt_injection
@ 2010-05-04 2:04 Marcelo Tosatti
2010-05-04 9:30 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2010-05-04 2:04 UTC (permalink / raw)
To: kvm; +Cc: Gleb Natapov
The recent changes to emulate string instructions without entering guest
mode exposed a bug where pending interrupts are not properly reflected
in ready_for_interrupt_injection.
The result is that userspace overwrites a previously queued interrupt,
when irqchip's are emulated in qemu.
Fix by always updating state before returning to userspace.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 6b2ce1d..dff08e5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4653,7 +4653,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
}
srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
- post_kvm_run_save(vcpu);
vapic_exit(vcpu);
@@ -4703,6 +4702,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
r = __vcpu_run(vcpu);
out:
+ post_kvm_run_save(vcpu);
if (vcpu->sigset_active)
sigprocmask(SIG_SETMASK, &sigsaved, NULL);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: KVM: x86: properly update ready_for_interrupt_injection
2010-05-04 2:04 KVM: x86: properly update ready_for_interrupt_injection Marcelo Tosatti
@ 2010-05-04 9:30 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2010-05-04 9:30 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kvm, Gleb Natapov
On 05/04/2010 05:04 AM, Marcelo Tosatti wrote:
> The recent changes to emulate string instructions without entering guest
> mode exposed a bug where pending interrupts are not properly reflected
> in ready_for_interrupt_injection.
>
> The result is that userspace overwrites a previously queued interrupt,
> when irqchip's are emulated in qemu.
>
>
Applied, thanks.
> Fix by always updating state before returning to userspace.
>
Why are we even doing this if irqchip_in_kernel?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-04 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-04 2:04 KVM: x86: properly update ready_for_interrupt_injection Marcelo Tosatti
2010-05-04 9:30 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox