kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs
@ 2020-11-05 15:39 Pankaj Gupta
  2020-11-05 17:01 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Pankaj Gupta @ 2020-11-05 15:39 UTC (permalink / raw)
  To: kvm
  Cc: pbonzini, sean.j.christopherson, vkuznets, wanpengli, jmattson,
	tglx, oro, mingo, bp, x86, hpa, pankaj.gupta.linux, Pankaj Gupta

From: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>

 Guest tries to enable LBR (last branch/interrupt/exception) repeatedly,
 thus spamming the host kernel logs. As MSR_IA32_DEBUGCTLMSR is not emulated by
 KVM, its better to add the error log only with "report_ignored_msrs".
 
Signed-off-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
---
 arch/x86/kvm/x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f5ede41bf9e6..99c69ae43c69 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3063,9 +3063,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			/* Values other than LBR and BTF are vendor-specific,
 			   thus reserved and should throw a #GP */
 			return 1;
-		}
-		vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
-			    __func__, data);
+		} else if (report_ignored_msrs)
+			vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
+				    __func__, data);
 		break;
 	case 0x200 ... 0x2ff:
 		return kvm_mtrr_set_msr(vcpu, msr, data);
-- 
2.20.1


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

* Re: [PATCH] KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs
  2020-11-05 15:39 [PATCH] KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs Pankaj Gupta
@ 2020-11-05 17:01 ` Paolo Bonzini
  2020-11-05 18:58   ` Pankaj Gupta
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2020-11-05 17:01 UTC (permalink / raw)
  To: Pankaj Gupta, kvm
  Cc: sean.j.christopherson, vkuznets, wanpengli, jmattson, tglx, oro,
	mingo, bp, x86, hpa, Pankaj Gupta

On 05/11/20 16:39, Pankaj Gupta wrote:
> From: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
> 
>   Guest tries to enable LBR (last branch/interrupt/exception) repeatedly,
>   thus spamming the host kernel logs. As MSR_IA32_DEBUGCTLMSR is not emulated by
>   KVM, its better to add the error log only with "report_ignored_msrs".
>   
> Signed-off-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
> ---
>   arch/x86/kvm/x86.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index f5ede41bf9e6..99c69ae43c69 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3063,9 +3063,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>   			/* Values other than LBR and BTF are vendor-specific,
>   			   thus reserved and should throw a #GP */
>   			return 1;
> -		}
> -		vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
> -			    __func__, data);
> +		} else if (report_ignored_msrs)
> +			vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
> +				    __func__, data);
>   		break;
>   	case 0x200 ... 0x2ff:
>   		return kvm_mtrr_set_msr(vcpu, msr, data);
> 

Which guest it is?  (Patch queued, but I'd like to have a better 
description).

Paolo


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

* Re: [PATCH] KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs
  2020-11-05 17:01 ` Paolo Bonzini
@ 2020-11-05 18:58   ` Pankaj Gupta
  2020-11-06 10:08     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Pankaj Gupta @ 2020-11-05 18:58 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Thomas Gleixner, oro, Ingo Molnar, Borislav Petkov,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	H. Peter Anvin, Pankaj Gupta

> >   Guest tries to enable LBR (last branch/interrupt/exception) repeatedly,
> >   thus spamming the host kernel logs. As MSR_IA32_DEBUGCTLMSR is not emulated by
> >   KVM, its better to add the error log only with "report_ignored_msrs".
> >
> > Signed-off-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
> > ---
> >   arch/x86/kvm/x86.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index f5ede41bf9e6..99c69ae43c69 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -3063,9 +3063,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> >                       /* Values other than LBR and BTF are vendor-specific,
> >                          thus reserved and should throw a #GP */
> >                       return 1;
> > -             }
> > -             vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
> > -                         __func__, data);
> > +             } else if (report_ignored_msrs)
> > +                     vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
> > +                                 __func__, data);
> >               break;
> >       case 0x200 ... 0x2ff:
> >               return kvm_mtrr_set_msr(vcpu, msr, data);
> >
>
> Which guest it is?  (Patch queued, but I'd like to have a better
> description).

How about this?

Windows2016 guest tries to enable LBR (last
branch/interrupt/exception) by setting
MSR_IA32_DEBUGCTLMSR. KVM does not emulate MSR_IA32_DEBUGCTLMSR and
spams the host kernel logs with the below error messages.This patch
fixes this by enabling
error logging only with 'report_ignored_msrs'.

"kvm []: vcpu1, guest rIP: 0xfffff800a8b687d3 kvm_set_msr_common:
MSR_IA32_DEBUGCTLMSR 0x1, nop"

Thanks,
Pankaj






>
> Paolo
>

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

* Re: [PATCH] KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs
  2020-11-05 18:58   ` Pankaj Gupta
@ 2020-11-06 10:08     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2020-11-06 10:08 UTC (permalink / raw)
  To: Pankaj Gupta
  Cc: kvm, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Thomas Gleixner, oro, Ingo Molnar, Borislav Petkov,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	H. Peter Anvin, Pankaj Gupta

On 05/11/20 19:58, Pankaj Gupta wrote:
> Windows2016 guest tries to enable LBR (last
> branch/interrupt/exception) by setting
> MSR_IA32_DEBUGCTLMSR. KVM does not emulate MSR_IA32_DEBUGCTLMSR and
> spams the host kernel logs with the below error messages.This patch
> fixes this by enabling
> error logging only with 'report_ignored_msrs'.
> 
> "kvm []: vcpu1, guest rIP: 0xfffff800a8b687d3 kvm_set_msr_common:
> MSR_IA32_DEBUGCTLMSR 0x1, nop"

Sounds good, thanks.

Paolo


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

end of thread, other threads:[~2020-11-06 10:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 15:39 [PATCH] KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs Pankaj Gupta
2020-11-05 17:01 ` Paolo Bonzini
2020-11-05 18:58   ` Pankaj Gupta
2020-11-06 10:08     ` Paolo Bonzini

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