Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-20 Thread Avi Kivity
On 09/19/2011 06:57 PM, Marcelo Tosatti wrote: > >Decrement when setting nmi_injected = false, increment when setting > >nmi_injected = true, in vmx/svm.c. > > That gives a queue length of 3: one running nmi and nmi_pending = 2. Increment through the same wrapper that will collapse the second

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Marcelo Tosatti
On Mon, Sep 19, 2011 at 06:37:35PM +0300, Avi Kivity wrote: > On 09/19/2011 06:22 PM, Marcelo Tosatti wrote: > >On Mon, Sep 19, 2011 at 06:09:39PM +0300, Avi Kivity wrote: > >> On 09/19/2011 05:54 PM, Marcelo Tosatti wrote: > >> >On Mon, Sep 19, 2011 at 05:30:27PM +0300, Avi Kivity wrote: > >> >

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Avi Kivity
On 09/19/2011 06:22 PM, Marcelo Tosatti wrote: On Mon, Sep 19, 2011 at 06:09:39PM +0300, Avi Kivity wrote: > On 09/19/2011 05:54 PM, Marcelo Tosatti wrote: > >On Mon, Sep 19, 2011 at 05:30:27PM +0300, Avi Kivity wrote: > >> On 09/19/2011 04:54 PM, Marcelo Tosatti wrote: > >> >>>> > >

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Marcelo Tosatti
On Mon, Sep 19, 2011 at 06:09:39PM +0300, Avi Kivity wrote: > On 09/19/2011 05:54 PM, Marcelo Tosatti wrote: > >On Mon, Sep 19, 2011 at 05:30:27PM +0300, Avi Kivity wrote: > >> On 09/19/2011 04:54 PM, Marcelo Tosatti wrote: > >> >> >> > >> >> >>Yes, due to NMI-blocked-by-STI. A really t

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Avi Kivity
On 09/19/2011 06:09 PM, Avi Kivity wrote: On 09/19/2011 05:54 PM, Marcelo Tosatti wrote: On Mon, Sep 19, 2011 at 05:30:27PM +0300, Avi Kivity wrote: > On 09/19/2011 04:54 PM, Marcelo Tosatti wrote: > >> >> > >> >>Yes, due to NMI-blocked-by-STI. A really touchy area. > >> >And we don't need

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Avi Kivity
On 09/19/2011 05:54 PM, Marcelo Tosatti wrote: On Mon, Sep 19, 2011 at 05:30:27PM +0300, Avi Kivity wrote: > On 09/19/2011 04:54 PM, Marcelo Tosatti wrote: > >> >> > >> >>Yes, due to NMI-blocked-by-STI. A really touchy area. > >> >And we don't need the window exit notification then

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Marcelo Tosatti
On Mon, Sep 19, 2011 at 05:30:27PM +0300, Avi Kivity wrote: > On 09/19/2011 04:54 PM, Marcelo Tosatti wrote: > >> >> > >> >> Yes, due to NMI-blocked-by-STI. A really touchy area. > >> >And we don't need the window exit notification then? I don't understand > >> >what nmi_in_progress is suppo

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Avi Kivity
On 09/19/2011 04:54 PM, Marcelo Tosatti wrote: > >> > >> Yes, due to NMI-blocked-by-STI. A really touchy area. > >And we don't need the window exit notification then? I don't understand > >what nmi_in_progress is supposed to do here. > > We need the window notification in both cases. If

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-19 Thread Marcelo Tosatti
On Thu, Sep 15, 2011 at 08:48:58PM +0300, Avi Kivity wrote: > On 09/15/2011 08:25 PM, Jan Kiszka wrote: > >> > >> I think so. Suppose the vcpu enters just after kvm_make_request(); it > >> sees KVM_REQ_EVENT and clears it, but doesn't see nmi_pending because it > >> wasn't set set. Then comes

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-15 Thread Avi Kivity
On 09/15/2011 08:25 PM, Jan Kiszka wrote: > > I think so. Suppose the vcpu enters just after kvm_make_request(); it > sees KVM_REQ_EVENT and clears it, but doesn't see nmi_pending because it > wasn't set set. Then comes a kick, the guest is reentered with > nmi_pending set but KVM_REQ_EVENT

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-15 Thread Jan Kiszka
On 2011-09-15 19:02, Avi Kivity wrote: > On 09/15/2011 07:01 PM, Jan Kiszka wrote: >> On 2011-09-15 16:45, Avi Kivity wrote: >>> If simultaneous NMIs happen, we're supposed to queue the second >>> and next (collapsing them), but currently we sometimes collapse >>> the second into the first. >> >

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-15 Thread Avi Kivity
On 09/15/2011 07:01 PM, Jan Kiszka wrote: On 2011-09-15 16:45, Avi Kivity wrote: > If simultaneous NMIs happen, we're supposed to queue the second > and next (collapsing them), but currently we sometimes collapse > the second into the first. Can you describe the race in a few more details her

Re: [RFC] KVM: Fix simultaneous NMIs

2011-09-15 Thread Jan Kiszka
On 2011-09-15 16:45, Avi Kivity wrote: > If simultaneous NMIs happen, we're supposed to queue the second > and next (collapsing them), but currently we sometimes collapse > the second into the first. Can you describe the race in a few more details here ("sometimes" sounds like "I don't know when"