linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr()
@ 2019-02-14  4:08 Xiaoyao Li
  2019-02-14 12:30 ` Paolo Bonzini
  2019-02-15 16:46 ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 5+ messages in thread
From: Xiaoyao Li @ 2019-02-14  4:08 UTC (permalink / raw)
  To: x86, kvm, linux-kernel
  Cc: Xiaoyao Li, Paolo Bonzini, Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin

Commit ca83b4a7f2d068da79a0 ("x86/KVM/VMX: Add find_msr() helper function")
introduces the helper function find_msr(), which returns -ENOENT when
not find the msr in vmx->msr_autoload.guest/host. Correct checking contion
of no more available entry in vmx->msr_autoload.

Fixes: ca83b4a7f2d0 ("x86/KVM/VMX: Add find_msr() helper function")
Signed-off-by: Xiaoyao Li <xiaoyao.li@linux.intel.com>
---
 arch/x86/kvm/vmx/vmx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 95d618045001..1aaef2d536bd 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -863,7 +863,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
 	if (!entry_only)
 		j = find_msr(&m->host, msr);
 
-	if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) {
+	if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) ||
+		(j < 0 &&  m->host.nr == NR_AUTOLOAD_MSRS)) {
 		printk_once(KERN_WARNING "Not enough msr switch entries. "
 				"Can't add msr %x\n", msr);
 		return;
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr()
  2019-02-14  4:08 [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr() Xiaoyao Li
@ 2019-02-14 12:30 ` Paolo Bonzini
  2019-02-15 16:46 ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2019-02-14 12:30 UTC (permalink / raw)
  To: Xiaoyao Li, x86, kvm, linux-kernel
  Cc: Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin

On 14/02/19 05:08, Xiaoyao Li wrote:
> Commit ca83b4a7f2d068da79a0 ("x86/KVM/VMX: Add find_msr() helper function")
> introduces the helper function find_msr(), which returns -ENOENT when
> not find the msr in vmx->msr_autoload.guest/host. Correct checking contion
> of no more available entry in vmx->msr_autoload.
> 
> Fixes: ca83b4a7f2d0 ("x86/KVM/VMX: Add find_msr() helper function")
> Signed-off-by: Xiaoyao Li <xiaoyao.li@linux.intel.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 95d618045001..1aaef2d536bd 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -863,7 +863,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
>  	if (!entry_only)
>  		j = find_msr(&m->host, msr);
>  
> -	if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) {
> +	if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) ||
> +		(j < 0 &&  m->host.nr == NR_AUTOLOAD_MSRS)) {
>  		printk_once(KERN_WARNING "Not enough msr switch entries. "
>  				"Can't add msr %x\n", msr);
>  		return;
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr()
  2019-02-14  4:08 [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr() Xiaoyao Li
  2019-02-14 12:30 ` Paolo Bonzini
@ 2019-02-15 16:46 ` Konrad Rzeszutek Wilk
  2019-02-18  8:26   ` linux.intel.com
  1 sibling, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2019-02-15 16:46 UTC (permalink / raw)
  To: Xiaoyao Li
  Cc: x86, kvm, linux-kernel, Paolo Bonzini,
	Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin

On Thu, Feb 14, 2019 at 12:08:58PM +0800, Xiaoyao Li wrote:
> Commit ca83b4a7f2d068da79a0 ("x86/KVM/VMX: Add find_msr() helper function")
> introduces the helper function find_msr(), which returns -ENOENT when
> not find the msr in vmx->msr_autoload.guest/host. Correct checking contion

s/not find/cannot find/
s/contion/condition/ ?

> of no more available entry in vmx->msr_autoload.
> 
> Fixes: ca83b4a7f2d0 ("x86/KVM/VMX: Add find_msr() helper function")
> Signed-off-by: Xiaoyao Li <xiaoyao.li@linux.intel.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 95d618045001..1aaef2d536bd 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -863,7 +863,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
>  	if (!entry_only)
>  		j = find_msr(&m->host, msr);
>  
> -	if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) {
> +	if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) ||
> +		(j < 0 &&  m->host.nr == NR_AUTOLOAD_MSRS)) {
>  		printk_once(KERN_WARNING "Not enough msr switch entries. "
>  				"Can't add msr %x\n", msr);
>  		return;
> -- 
> 2.19.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr()
  2019-02-15 16:46 ` Konrad Rzeszutek Wilk
@ 2019-02-18  8:26   ` linux.intel.com
  2019-02-18 10:45     ` Xiaoyao Li
  0 siblings, 1 reply; 5+ messages in thread
From: linux.intel.com @ 2019-02-18  8:26 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Paolo Bonzini
  Cc: x86, kvm, linux-kernel, Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin

On Fri, 2019-02-15 at 11:46 -0500, Konrad Rzeszutek Wilk wrote:
> On Thu, Feb 14, 2019 at 12:08:58PM +0800, Xiaoyao Li wrote:
> > Commit ca83b4a7f2d068da79a0 ("x86/KVM/VMX: Add find_msr() helper function")
> > introduces the helper function find_msr(), which returns -ENOENT when
> > not find the msr in vmx->msr_autoload.guest/host. Correct checking contion
> 
> s/not find/cannot find/
> s/contion/condition/ ?
> 

Hi Paolo,
Could you correct these typos in KVM tree or when sending a PR?

> > of no more available entry in vmx->msr_autoload.
> > 
> > Fixes: ca83b4a7f2d0 ("x86/KVM/VMX: Add find_msr() helper function")
> > Signed-off-by: Xiaoyao Li <xiaoyao.li@linux.intel.com>
> > ---
> >  arch/x86/kvm/vmx/vmx.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index 95d618045001..1aaef2d536bd 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -863,7 +863,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx,
> > unsigned msr,
> >  	if (!entry_only)
> >  		j = find_msr(&m->host, msr);
> >  
> > -	if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) {
> > +	if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) ||
> > +		(j < 0 &&  m->host.nr == NR_AUTOLOAD_MSRS)) {
> >  		printk_once(KERN_WARNING "Not enough msr switch entries. "
> >  				"Can't add msr %x\n", msr);
> >  		return;
> > -- 
> > 2.19.1
> > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr()
  2019-02-18  8:26   ` linux.intel.com
@ 2019-02-18 10:45     ` Xiaoyao Li
  0 siblings, 0 replies; 5+ messages in thread
From: Xiaoyao Li @ 2019-02-18 10:45 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Paolo Bonzini
  Cc: x86, kvm, linux-kernel, Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin

On Mon, 2019-02-18 at 16:26 +0800, linux.intel.com wrote:
> On Fri, 2019-02-15 at 11:46 -0500, Konrad Rzeszutek Wilk wrote:
> > On Thu, Feb 14, 2019 at 12:08:58PM +0800, Xiaoyao Li wrote:
> > > Commit ca83b4a7f2d068da79a0 ("x86/KVM/VMX: Add find_msr() helper
> > > function")
> > > introduces the helper function find_msr(), which returns -ENOENT when
> > > not find the msr in vmx->msr_autoload.guest/host. Correct checking contion
> > 
> > s/not find/cannot find/
> > s/contion/condition/ ?
> > 
> 
> Hi Paolo,
> Could you correct these typos in KVM tree or when sending a PR?
> 

Please disregard this. I just noticed tha this patch had been merged into
mainline.

> > > of no more available entry in vmx->msr_autoload.
> > > 
> > > Fixes: ca83b4a7f2d0 ("x86/KVM/VMX: Add find_msr() helper function")
> > > Signed-off-by: Xiaoyao Li <xiaoyao.li@linux.intel.com>
> > > ---
> > >  arch/x86/kvm/vmx/vmx.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > > index 95d618045001..1aaef2d536bd 100644
> > > --- a/arch/x86/kvm/vmx/vmx.c
> > > +++ b/arch/x86/kvm/vmx/vmx.c
> > > @@ -863,7 +863,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx
> > > *vmx,
> > > unsigned msr,
> > >  	if (!entry_only)
> > >  		j = find_msr(&m->host, msr);
> > >  
> > > -	if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) {
> > > +	if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) ||
> > > +		(j < 0 &&  m->host.nr == NR_AUTOLOAD_MSRS)) {
> > >  		printk_once(KERN_WARNING "Not enough msr switch entries. "
> > >  				"Can't add msr %x\n", msr);
> > >  		return;
> > > -- 
> > > 2.19.1
> > > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-18 10:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14  4:08 [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr() Xiaoyao Li
2019-02-14 12:30 ` Paolo Bonzini
2019-02-15 16:46 ` Konrad Rzeszutek Wilk
2019-02-18  8:26   ` linux.intel.com
2019-02-18 10:45     ` Xiaoyao Li

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).