Skip to contentSkip to conversation

KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs

PATCH In review Pankaj Gupta 2 participants 4 messages Nov 5, 2020 – Nov 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86: handle MSR_IA32_DEBUGCTLMSR with report_ignored_msrs

From: Pankaj Gupta <[email protected]>

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

---
 arch/x86/kvm/x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +3 -3
index f5ede41bf9e6..99c69ae43c69 100644
@@ -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);
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 19 lines · Pankaj Gupta

From: Pankaj Gupta <[email protected]>

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

---
  arch/x86/kvm/x86.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f5ede41bf9e6..99c69ae43c69 100644
@@ -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 */

arch/x86/kvm/x86.c int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · line 3071

Quoted 10 lines
arch/x86/kvm/x86.c +3 -3
  			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

#2 lore raw
Quoted 22 lines
Quoted 22 lines

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

---
  arch/x86/kvm/x86.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +2 -3
index f5ede41bf9e6..99c69ae43c69 100644
@@ -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",
Quoted 8 lines

arch/x86/kvm/x86.c int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · line 3071

Quoted 5 lines
arch/x86/kvm/x86.c +1 -0
+                                 __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

Quoted 3 lines

Paolo

maintainer
#3 lore raw
Quoted 9 lines · Pankaj Gupta

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