Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-28 Thread Michael S. Tsirkin
On Fri, Oct 28, 2016 at 11:39:44AM +0200, Paolo Bonzini wrote: > > > On 27/10/2016 19:06, Radim Krčmář wrote: > > 2016-10-27 19:51+0300, Michael S. Tsirkin: > >> On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: > >>> 2016-10-27 00:42+0300, Michael S. Tsirkin: > On Wed, Oct 26,

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-28 Thread Michael S. Tsirkin
On Fri, Oct 28, 2016 at 11:39:44AM +0200, Paolo Bonzini wrote: > > > On 27/10/2016 19:06, Radim Krčmář wrote: > > 2016-10-27 19:51+0300, Michael S. Tsirkin: > >> On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: > >>> 2016-10-27 00:42+0300, Michael S. Tsirkin: > On Wed, Oct 26,

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-28 Thread Paolo Bonzini
On 27/10/2016 19:06, Radim Krčmář wrote: > 2016-10-27 19:51+0300, Michael S. Tsirkin: >> On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: >>> 2016-10-27 00:42+0300, Michael S. Tsirkin: On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: > 2016-10-14 20:21+0200,

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-28 Thread Paolo Bonzini
On 27/10/2016 19:06, Radim Krčmář wrote: > 2016-10-27 19:51+0300, Michael S. Tsirkin: >> On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: >>> 2016-10-27 00:42+0300, Michael S. Tsirkin: On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: > 2016-10-14 20:21+0200,

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-27 Thread Radim Krčmář
2016-10-27 19:51+0300, Michael S. Tsirkin: > On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: >> 2016-10-27 00:42+0300, Michael S. Tsirkin: >> > On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: >> >> 2016-10-14 20:21+0200, Paolo Bonzini: >> >> > On some benchmarks (e.g.

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-27 Thread Radim Krčmář
2016-10-27 19:51+0300, Michael S. Tsirkin: > On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: >> 2016-10-27 00:42+0300, Michael S. Tsirkin: >> > On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: >> >> 2016-10-14 20:21+0200, Paolo Bonzini: >> >> > On some benchmarks (e.g.

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-27 Thread Michael S. Tsirkin
On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: > 2016-10-27 00:42+0300, Michael S. Tsirkin: > > On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: > >> 2016-10-14 20:21+0200, Paolo Bonzini: > >> > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > >> >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-27 Thread Michael S. Tsirkin
On Thu, Oct 27, 2016 at 06:44:00PM +0200, Radim Krčmář wrote: > 2016-10-27 00:42+0300, Michael S. Tsirkin: > > On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: > >> 2016-10-14 20:21+0200, Paolo Bonzini: > >> > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > >> >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-27 Thread Radim Krčmář
2016-10-27 00:42+0300, Michael S. Tsirkin: > On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: >> 2016-10-14 20:21+0200, Paolo Bonzini: >> > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv >> > posted interrupts turn out to be slower than interrupt injection via >> >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-27 Thread Radim Krčmář
2016-10-27 00:42+0300, Michael S. Tsirkin: > On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: >> 2016-10-14 20:21+0200, Paolo Bonzini: >> > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv >> > posted interrupts turn out to be slower than interrupt injection via >> >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-26 Thread Michael S. Tsirkin
On Wed, Oct 19, 2016 at 04:45:48AM -0700, Paul E. McKenney wrote: > On Sun, Oct 16, 2016 at 05:29:24AM +0300, Michael S. Tsirkin wrote: > > On Sat, Oct 15, 2016 at 03:47:45AM -0400, Paolo Bonzini wrote: > > > > > > > > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini > > > > >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-26 Thread Michael S. Tsirkin
On Wed, Oct 19, 2016 at 04:45:48AM -0700, Paul E. McKenney wrote: > On Sun, Oct 16, 2016 at 05:29:24AM +0300, Michael S. Tsirkin wrote: > > On Sat, Oct 15, 2016 at 03:47:45AM -0400, Paolo Bonzini wrote: > > > > > > > > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini > > > > > wrote: > > > > >>> >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-26 Thread Michael S. Tsirkin
On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: > 2016-10-14 20:21+0200, Paolo Bonzini: > > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > > posted interrupts turn out to be slower than interrupt injection via > > KVM_REQ_EVENT. > > > > This patch optimizes a bit

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-26 Thread Michael S. Tsirkin
On Wed, Oct 26, 2016 at 09:53:45PM +0200, Radim Krčmář wrote: > 2016-10-14 20:21+0200, Paolo Bonzini: > > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > > posted interrupts turn out to be slower than interrupt injection via > > KVM_REQ_EVENT. > > > > This patch optimizes a bit

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-26 Thread Radim Krčmář
2016-10-14 20:21+0200, Paolo Bonzini: > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > posted interrupts turn out to be slower than interrupt injection via > KVM_REQ_EVENT. > > This patch optimizes a bit the IRR update, avoiding expensive atomic > operations in the common case

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-26 Thread Radim Krčmář
2016-10-14 20:21+0200, Paolo Bonzini: > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > posted interrupts turn out to be slower than interrupt injection via > KVM_REQ_EVENT. > > This patch optimizes a bit the IRR update, avoiding expensive atomic > operations in the common case

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-19 Thread Paul E. McKenney
On Sun, Oct 16, 2016 at 05:29:24AM +0300, Michael S. Tsirkin wrote: > On Sat, Oct 15, 2016 at 03:47:45AM -0400, Paolo Bonzini wrote: > > > > > > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: > > > >>> > > > >>> for (i = 0; i <= 7; i++) { > > > >>> -

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-19 Thread Paul E. McKenney
On Sun, Oct 16, 2016 at 05:29:24AM +0300, Michael S. Tsirkin wrote: > On Sat, Oct 15, 2016 at 03:47:45AM -0400, Paolo Bonzini wrote: > > > > > > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: > > > >>> > > > >>> for (i = 0; i <= 7; i++) { > > > >>> - pir_val = xchg([i],

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-17 Thread Paolo Bonzini
On 16/10/2016 05:21, Michael S. Tsirkin wrote: > On Fri, Oct 14, 2016 at 08:21:27PM +0200, Paolo Bonzini wrote: >> On some benchmarks (e.g. netperf with ioeventfd disabled), APICv >> posted interrupts turn out to be slower than interrupt injection via >> KVM_REQ_EVENT. >> >> This patch optimizes

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-17 Thread Paolo Bonzini
On 16/10/2016 05:21, Michael S. Tsirkin wrote: > On Fri, Oct 14, 2016 at 08:21:27PM +0200, Paolo Bonzini wrote: >> On some benchmarks (e.g. netperf with ioeventfd disabled), APICv >> posted interrupts turn out to be slower than interrupt injection via >> KVM_REQ_EVENT. >> >> This patch optimizes

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-15 Thread Michael S. Tsirkin
On Fri, Oct 14, 2016 at 08:21:27PM +0200, Paolo Bonzini wrote: > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > posted interrupts turn out to be slower than interrupt injection via > KVM_REQ_EVENT. > > This patch optimizes a bit the IRR update, avoiding expensive atomic >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-15 Thread Michael S. Tsirkin
On Fri, Oct 14, 2016 at 08:21:27PM +0200, Paolo Bonzini wrote: > On some benchmarks (e.g. netperf with ioeventfd disabled), APICv > posted interrupts turn out to be slower than interrupt injection via > KVM_REQ_EVENT. > > This patch optimizes a bit the IRR update, avoiding expensive atomic >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-15 Thread Michael S. Tsirkin
On Sat, Oct 15, 2016 at 03:47:45AM -0400, Paolo Bonzini wrote: > > > > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: > > >>> > > >>> for (i = 0; i <= 7; i++) { > > >>> - pir_val = xchg([i], 0); > > >>> - if (pir_val) > > >>> +

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-15 Thread Michael S. Tsirkin
On Sat, Oct 15, 2016 at 03:47:45AM -0400, Paolo Bonzini wrote: > > > > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: > > >>> > > >>> for (i = 0; i <= 7; i++) { > > >>> - pir_val = xchg([i], 0); > > >>> - if (pir_val) > > >>> + pir_val =

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-15 Thread Paolo Bonzini
> > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: > >>> > >>> for (i = 0; i <= 7; i++) { > >>> - pir_val = xchg([i], 0); > >>> - if (pir_val) > >>> + pir_val = READ_ONCE(pir[i]); > >> > >> Out of curiosity, do you really need this READ_ONCE?

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-15 Thread Paolo Bonzini
> > On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: > >>> > >>> for (i = 0; i <= 7; i++) { > >>> - pir_val = xchg([i], 0); > >>> - if (pir_val) > >>> + pir_val = READ_ONCE(pir[i]); > >> > >> Out of curiosity, do you really need this READ_ONCE? > > > > The answer

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Nadav Amit
> On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: >>> >>> for (i = 0; i <= 7; i++) { >>> - pir_val = xchg([i], 0); >>> - if (pir_val) >>> + pir_val = READ_ONCE(pir[i]); >> >> Out of curiosity, do you really need this READ_ONCE? > > The

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Nadav Amit
> On Oct 14, 2016, at 11:56 AM, Paolo Bonzini wrote: >>> >>> for (i = 0; i <= 7; i++) { >>> - pir_val = xchg([i], 0); >>> - if (pir_val) >>> + pir_val = READ_ONCE(pir[i]); >> >> Out of curiosity, do you really need this READ_ONCE? > > The answer can only be

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Paolo Bonzini
> > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > > index 23b99f305382..63a442aefc12 100644 > > --- a/arch/x86/kvm/lapic.c > > +++ b/arch/x86/kvm/lapic.c > > @@ -342,9 +342,11 @@ void __kvm_apic_update_irr(u32 *pir, void *regs) > > u32 i, pir_val; > > > > for (i = 0; i <= 7;

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Paolo Bonzini
> > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > > index 23b99f305382..63a442aefc12 100644 > > --- a/arch/x86/kvm/lapic.c > > +++ b/arch/x86/kvm/lapic.c > > @@ -342,9 +342,11 @@ void __kvm_apic_update_irr(u32 *pir, void *regs) > > u32 i, pir_val; > > > > for (i = 0; i <= 7;

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Nadav Amit
> > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index 23b99f305382..63a442aefc12 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -342,9 +342,11 @@ void __kvm_apic_update_irr(u32 *pir, void *regs) > u32 i, pir_val; > > for (i = 0; i <= 7; i++) { >

Re: [PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Nadav Amit
> > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index 23b99f305382..63a442aefc12 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -342,9 +342,11 @@ void __kvm_apic_update_irr(u32 *pir, void *regs) > u32 i, pir_val; > > for (i = 0; i <= 7; i++) { >

[PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Paolo Bonzini
On some benchmarks (e.g. netperf with ioeventfd disabled), APICv posted interrupts turn out to be slower than interrupt injection via KVM_REQ_EVENT. This patch optimizes a bit the IRR update, avoiding expensive atomic operations in the common case where PI.ON=0 at vmentry or the PIR vector is

[PATCH 1/5] KVM: x86: avoid atomic operations on APICv vmentry

2016-10-14 Thread Paolo Bonzini
On some benchmarks (e.g. netperf with ioeventfd disabled), APICv posted interrupts turn out to be slower than interrupt injection via KVM_REQ_EVENT. This patch optimizes a bit the IRR update, avoiding expensive atomic operations in the common case where PI.ON=0 at vmentry or the PIR vector is