RE: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-15 Thread David Laight
From: Paolo Bonzini > Sent: 15 April 2019 09:12 > On 11/04/19 11:06, David Laight wrote: > > It may be possible to generate shorter code that executes just as > > fast by generating a single constant and deriving the others from it. > > - generate 4s - needed first > > - shift right 2 to get 1s (in

Re: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-15 Thread Paolo Bonzini
On 11/04/19 11:06, David Laight wrote: > It may be possible to generate shorter code that executes just as > fast by generating a single constant and deriving the others from it. > - generate 4s - needed first > - shift right 2 to get 1s (in parallel with the xor) > - use lea to get 6s (in parallel

RE: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-11 Thread David Laight
From: Paolo Bonzini > Sent: 10 April 2019 18:09 > On 10/04/19 16:57, Sean Christopherson wrote: > > On Wed, Apr 10, 2019 at 12:55:53PM +, David Laight wrote: > >> From: Paolo Bonzini > >>> Sent: 10 April 2019 10:55 > >>> > >>> This check will soon be done on every nested vmentry and vmexit, > >

Re: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-10 Thread Krish Sadhukhan
On 04/10/2019 02:55 AM, Paolo Bonzini wrote: This check will soon be done on every nested vmentry and vmexit, "parallelize" it using bitwise operations. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mtrr.c| 10 +- arch/x86/kvm/vmx/vmx.c | 2 +- arch/x86/kvm/x86.h | 8 ++

Re: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-10 Thread Paolo Bonzini
On 10/04/19 16:57, Sean Christopherson wrote: > On Wed, Apr 10, 2019 at 12:55:53PM +, David Laight wrote: >> From: Paolo Bonzini >>> Sent: 10 April 2019 10:55 >>> >>> This check will soon be done on every nested vmentry and vmexit, >>> "parallelize" it using bitwise operations. >>> >>> Signed-o

Re: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-10 Thread Sean Christopherson
On Wed, Apr 10, 2019 at 11:55:26AM +0200, Paolo Bonzini wrote: > This check will soon be done on every nested vmentry and vmexit, > "parallelize" it using bitwise operations. > > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Sean Christopherson

Re: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-10 Thread Sean Christopherson
On Wed, Apr 10, 2019 at 12:55:53PM +, David Laight wrote: > From: Paolo Bonzini > > Sent: 10 April 2019 10:55 > > > > This check will soon be done on every nested vmentry and vmexit, > > "parallelize" it using bitwise operations. > > > > Signed-off-by: Paolo Bonzini > > --- > ... > > diff --

RE: [PATCH] KVM: x86: optimize check for valid PAT value

2019-04-10 Thread David Laight
From: Paolo Bonzini > Sent: 10 April 2019 10:55 > > This check will soon be done on every nested vmentry and vmexit, > "parallelize" it using bitwise operations. > > Signed-off-by: Paolo Bonzini > --- ... > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h > index 28406aa1136d..7bc7ac9d2a44 1