From: Gleb Natapov <gleb@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
x86@kernel.org, kvm@vger.kernel.org,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Avi Kivity <avi@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: Thu, 17 May 2012 10:28:41 +0300 [thread overview]
Message-ID: <20120517072841.GW32036@redhat.com> (raw)
In-Reply-To: <20120516190757.GA12113@redhat.com>
On Wed, May 16, 2012 at 10:07:58PM +0300, Michael S. Tsirkin wrote:
> > This code is reached from kvm_cpu_get_interrupt(), but this function will
> > not be called in above scenario.
>
> I think I see. So this shall fix it also makes code cleaner
> (no -2 hack). Right? kvm_apic_has_interrupt is called correct?
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index b4f7013..5a38e34 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1273,8 +1273,12 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu)
> highest_irr = apic_find_highest_irr(apic);
> if (highest_irr == -1)
> return -1;
> - if (((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI)))
> - return -2;
> + /* Detect interrupt nesting and disable EOI optimization */
> + if ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI)) {
> + if (pv_eoi_enabled(vcpu))
> + pv_eoi_clr_pending(vcpu);
> + return -1;
> + }
> return highest_irr;
> }
>
I do not like it. kvm_apic_has_interrupt() does not suppose to mutate
state.
> @@ -1306,10 +1310,6 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
> int vector = kvm_apic_has_interrupt(vcpu);
> struct kvm_lapic *apic = vcpu->arch.apic;
>
> - /* Detect interrupt nesting and disable EOI optimization */
> - if (pv_eoi_enabled(vcpu) && vector == -2)
> - pv_eoi_clr_pending(vcpu);
> -
> if (vector < 0)
> return -1;
>
--
Gleb.
next prev parent reply other threads:[~2012-05-17 7: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 [this message]
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
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=20120517072841.GW32036@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mst@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox