From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: x86@kernel.org, kvm@vger.kernel.org,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
gleb@redhat.com, Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCHv7 3/8] kvm_para: guest side for eoi avoidance
Date: Mon, 18 Jun 2012 17:50:41 +0300 [thread overview]
Message-ID: <20120618145041.GE26540@redhat.com> (raw)
In-Reply-To: <4FDF3874.2050208@redhat.com>
On Mon, Jun 18, 2012 at 05:17:24PM +0300, Avi Kivity wrote:
> On 06/14/2012 04:53 PM, Michael S. Tsirkin wrote:
> > The idea is simple: there's a bit, per APIC, in guest memory,
> > that tells the guest that it does not need EOI.
> > Guest tests it using a single est and clear operation - this is
> > necessary so that host can detect interrupt nesting - and if set, it can
> > skip the EOI MSR.
> >
> > I run a simple microbenchmark to show exit reduction
> > (note: for testing, need to apply follow-up patch
> > 'kvm: host side for eoi optimization' + a qemu patch
> > I posted separately, on host):
> >
> >
> > diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
> > index a6983b2..47f9eff 100644
> > --- a/arch/x86/include/asm/bitops.h
> > +++ b/arch/x86/include/asm/bitops.h
> > @@ -28,11 +28,13 @@
> > #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
> > /* Technically wrong, but this avoids compilation errors on some gcc
> > versions. */
> > -#define BITOP_ADDR(x) "=m" (*(volatile long *) (x))
> > +#define BITOP_ADDR_CONSTRAINT "=m"
> > #else
> > -#define BITOP_ADDR(x) "+m" (*(volatile long *) (x))
> > +#define BITOP_ADDR_CONSTRAINT "+m"
> > #endif
> >
> > +#define BITOP_ADDR(x) BITOP_ADDR_CONSTRAINT (*(volatile long *) (x))
> > +
> > #define ADDR BITOP_ADDR(addr)
>
> What's this doing here?
Ugh. More leftovers from when I had inline asm here.
Will remove.
> >
> > +/* size alignment is implied but just to make it explicit. */
> > +static DEFINE_PER_CPU(unsigned long, kvm_apic_eoi) __aligned(2) =
> > + KVM_PV_EOI_DISABLED;
>
> You're actually breaking the alignment. ulong has 8 byte alignment
> sometimes and you can make it cross cache boundary this way.
No, if you look at the definition of __aligned
you will see that it limits the alignment from below.
Compiler still applies the natural size alignment.
You are not the first to get confused. So I wonder: is it better
to add a comment or simply remove __aligned here.
> > +
> > void __cpuinit kvm_guest_cpu_init(void)
> > {
> > if (!kvm_para_available())
> > @@ -300,11 +320,17 @@ void __cpuinit kvm_guest_cpu_init(void)
> > smp_processor_id());
> > }
> >
> > + if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) {
> > + __get_cpu_var(kvm_apic_eoi) = 0;
> > + wrmsrl(MSR_KVM_PV_EOI_EN, __pa(&__get_cpu_var(kvm_apic_eoi)) |
> > + KVM_MSR_ENABLED);
>
> Bad formatting.
I guess temporary will make it prettier.
unsigned long pa;
__get_cpu_var(kvm_apic_eoi) = 0;
pa = __pa(&__get_cpu_var(kvm_apic_eoi)) | KVM_MSR_ENABLED;
wrmsrl(MSR_KVM_PV_EOI_EN, pa);
or did I miss the point?
> > + }
> > +
> > if (has_steal_clock)
> > kvm_register_steal_time();
> > }
> >
>
>
> Please check that the kexec path also disables pveoi.
The chunk in kvm_pv_guest_cpu_reboot does this, doesn't it?
> --
> error compiling committee.c: too many arguments to function
>
next prev parent reply other threads:[~2012-06-18 14:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-14 13:52 [PATCHv7 0/8] kvm: eoi optimization support Michael S. Tsirkin
2012-06-14 13:52 ` [PATCHv7 1/8] kvm: document lapic regs field Michael S. Tsirkin
2012-06-14 13:53 ` [PATCHv7 2/8] kvm: optimize ISR lookups Michael S. Tsirkin
2012-06-14 13:53 ` [PATCHv7 3/8] kvm_para: guest side for eoi avoidance Michael S. Tsirkin
2012-06-18 14:17 ` Avi Kivity
2012-06-18 14:50 ` Michael S. Tsirkin [this message]
2012-06-18 15:01 ` Avi Kivity
2012-06-18 17:15 ` Michael S. Tsirkin
2012-06-14 13:53 ` [PATCHv7 4/8] x86/bitops: note on __test_and_clear_bit atomicity Michael S. Tsirkin
2012-06-14 13:53 ` [PATCHv7 5/8] kvm: eoi msi documentation Michael S. Tsirkin
2012-06-18 14:20 ` Avi Kivity
2012-06-18 14:56 ` Michael S. Tsirkin
2012-06-18 15:03 ` Avi Kivity
2012-06-18 16:01 ` Michael S. Tsirkin
2012-06-18 15:00 ` Michael S. Tsirkin
2012-06-14 13:53 ` [PATCHv7 6/8] kvm: only sync when attention bits set Michael S. Tsirkin
2012-06-14 13:53 ` [PATCHv7 7/8] kvm: rearrange injection cancelling code Michael S. Tsirkin
2012-06-14 13:53 ` [PATCHv7 8/8] kvm: host side for eoi optimization 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=20120618145041.GE26540@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=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).