From: "Michael S. Tsirkin" <mst@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: x86@kernel.org, kvm@vger.kernel.org,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Avi Kivity <avi@redhat.com>,
gleb@redhat.com, Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv4 3/5] kvm: host side for eoi optimization
Date: Wed, 16 May 2012 21:28:06 +0300 [thread overview]
Message-ID: <20120516182805.GE10769@redhat.com> (raw)
In-Reply-To: <20120516181500.GA23791@amt.cnet>
On Wed, May 16, 2012 at 03:15:00PM -0300, Marcelo Tosatti wrote:
> On Wed, May 16, 2012 at 08:58:57PM +0300, Michael S. Tsirkin wrote:
> > On Wed, May 16, 2012 at 02:20:58PM -0300, Marcelo Tosatti wrote:
> > > On Wed, May 16, 2012 at 07:22:47PM +0300, Michael S. Tsirkin wrote:
> > > > On Wed, May 16, 2012 at 12:49:40PM -0300, Marcelo Tosatti wrote:
> > > > > > @@ -1245,9 +1306,20 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
> > > > > > int vector = kvm_apic_has_interrupt(vcpu);
> > > > > > struct kvm_lapic *apic = vcpu->arch.apic;
> > > > > >
> > > > > > - if (vector == -1)
> > > > > > + /* Detect interrupt nesting and disable EOI optimization */
> > > > > > + if (pv_eoi_enabled(vcpu) && vector == -2)
> > > > > > + pv_eoi_clr_pending(vcpu);
> > > > > > +
> > > > > > + if (vector < 0)
> > > > >
> > > > > With interrupt window exiting, the guest will exit:
> > > > >
> > > > > - as soon as it sets RFLAGS.IF=1 and there is any
> > > > > interrupt pending in IRR.
> > > > > - any new interrupt is set in IRR will kick vcpu
> > > > > out of guest mode and recalculate interrupt-window-exiting.
> > > > >
> > > > > Doesnt this make this bit unnecessary ?
> > > >
> > > > Looks like we could cut it out. But I'm not sure how architectural it is
> > > > that we exit on interrupt window.
> > > > I guess there are reasons to exit on interrupt window but
> > > > isn't it better to make the feature independent of it?
> > >
> > > Hum... not sure. Is it helpful for the Hyper-V interface?
> > >
> > > > This almost never happens in my testing anyway, so
> > > > however we handle it is unlikely to affect performance.
> > >
> > > It decreases the amount of state that must be maintained.
> > >
> > > BTW there is a bug covered by interrupt window exiting:
> > >
> > > vcpu0 host
> > > - irr 5 set
> > > - isr 5 set, irr 5 cleared
> > > - eoi_skip bit not set,
> > > no other bit set in irr.
> > > - enter guest
> > >
> > > irr 4 set
> > > kick vcpu0 out of guest mode
> > >
> > > - eoi pending bit not set
> > > (previous interrupt injection
> > > still pending)
> > > - skip eoi
> > >
> > > If it were not for interrupt window exiting, this would
> > > inject vector 4 on an unrelated exit who knows how long
> > > in the future.
> > >
> > > Also note optimization depends on the fact that the host
> > > kicks vcpu out unconditionally (so it is dependent on
> > > certain kvm implementation details).
> > >
> >
> > Look we can summarize as follows: irq windows exit is
> > required both before and after this patch.
> > But it does not make the check above redundant.
>
> Right, it is not redundant.
>
> The above is still a bug: a case where eoi pending bit is not updated
> properly.
>
> How come is this compatible with hyper-v again? Enlight me.
Set kvm
to point pv_eoi msr data to va and it will just work.
--
MST
next prev parent reply other threads:[~2012-05-16 18:28 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 11:45 [PATCHv4 0/5] apic: eoi optimization support Michael S. Tsirkin
2012-05-16 11:45 ` [PATCHv4 1/5] kvm_para: guest side for eoi avoidance Michael S. Tsirkin
2012-05-16 11:46 ` [PATCHv4 2/5] x86/bitops: note on __test_and_clear_bit atomicity Michael S. Tsirkin
2012-05-16 11:46 ` [PATCHv4 3/5] kvm: host side for eoi optimization Michael S. Tsirkin
2012-05-16 15:49 ` Marcelo Tosatti
2012-05-16 16:22 ` Michael S. Tsirkin
2012-05-16 16:32 ` Gleb Natapov
2012-05-16 16:50 ` Michael S. Tsirkin
2012-05-16 17:04 ` Marcelo Tosatti
2012-05-16 17:21 ` Gleb Natapov
2012-05-16 17:23 ` Marcelo Tosatti
2012-05-16 17:34 ` Gleb Natapov
2012-05-16 17:40 ` Marcelo Tosatti
2012-05-16 17:48 ` Gleb Natapov
2012-05-16 17:53 ` Michael S. Tsirkin
2012-05-16 17:20 ` Marcelo Tosatti
2012-05-16 17:58 ` Michael S. Tsirkin
2012-05-16 18:15 ` Marcelo Tosatti
2012-05-16 18:25 ` Gleb Natapov
2012-05-16 18:29 ` Michael S. Tsirkin
2012-05-16 18:38 ` Gleb Natapov
2012-05-16 19:07 ` Michael S. Tsirkin
2012-05-16 21:37 ` Marcelo Tosatti
2012-05-17 7:28 ` Gleb Natapov
2012-05-17 7:49 ` Michael S. Tsirkin
2012-05-17 7:56 ` Gleb Natapov
2012-05-17 7:57 ` Avi Kivity
2012-05-17 8:07 ` Gleb Natapov
2012-05-17 9:24 ` Avi Kivity
2012-05-17 9:34 ` Gleb Natapov
2012-05-17 9:10 ` Michael S. Tsirkin
2012-05-17 9:12 ` Gleb Natapov
2012-05-17 9:25 ` Avi Kivity
2012-05-16 18:28 ` Michael S. Tsirkin [this message]
2012-05-16 18:35 ` Michael S. Tsirkin
2012-05-17 9:28 ` Avi Kivity
2012-05-16 11:46 ` [PATCHv4 4/5] kvm: eoi msi documentation Michael S. Tsirkin
2012-05-16 11:46 ` [PATCHv4 5/5] kvm: only sync when attention bits set Michael S. Tsirkin
2012-05-16 15:41 ` [PATCHv4 0/5] apic: eoi optimization support Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120516182805.GE10769@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mtosatti@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.