Skip to content

Commit ae0f549

Browse files
whitebrandyrkrcmar
authored andcommitted
kvm: x86: don't print warning messages for unimplemented msrs
Change unimplemented msrs messages to use pr_debug. If CONFIG_DYNAMIC_DEBUG is set, then these messages can be enabled at run time or else -DDEBUG can be used at compile time to enable them. These messages will still be printed if ignore_msrs=1. Signed-off-by: Bandan Das <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
1 parent bcdde30 commit ae0f549

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

arch/x86/kvm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4959,7 +4959,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, struct kvm_memslots *slots)
49594959
* zap all shadow pages.
49604960
*/
49614961
if (unlikely((slots->generation & MMIO_GEN_MASK) == 0)) {
4962-
printk_ratelimited(KERN_DEBUG "kvm: zapping shadow pages for mmio generation wraparound\n");
4962+
kvm_debug_ratelimited("kvm: zapping shadow pages for mmio generation wraparound\n");
49634963
kvm_mmu_invalidate_zap_all_pages(kvm);
49644964
}
49654965
}

arch/x86/kvm/x86.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,7 +2277,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
22772277
if (kvm_pmu_is_valid_msr(vcpu, msr))
22782278
return kvm_pmu_set_msr(vcpu, msr_info);
22792279
if (!ignore_msrs) {
2280-
vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
2280+
vcpu_debug_ratelimited(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
22812281
msr, data);
22822282
return 1;
22832283
} else {
@@ -2489,7 +2489,8 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
24892489
if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
24902490
return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data);
24912491
if (!ignore_msrs) {
2492-
vcpu_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr_info->index);
2492+
vcpu_debug_ratelimited(vcpu, "unhandled rdmsr: 0x%x\n",
2493+
msr_info->index);
24932494
return 1;
24942495
} else {
24952496
vcpu_unimpl(vcpu, "ignored rdmsr: 0x%x\n", msr_info->index);

include/linux/kvm_host.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ struct kvm {
439439
pr_info("kvm [%i]: " fmt, task_pid_nr(current), ## __VA_ARGS__)
440440
#define kvm_debug(fmt, ...) \
441441
pr_debug("kvm [%i]: " fmt, task_pid_nr(current), ## __VA_ARGS__)
442+
#define kvm_debug_ratelimited(fmt, ...) \
443+
pr_debug_ratelimited("kvm [%i]: " fmt, task_pid_nr(current), \
444+
## __VA_ARGS__)
442445
#define kvm_pr_unimpl(fmt, ...) \
443446
pr_err_ratelimited("kvm [%i]: " fmt, \
444447
task_tgid_nr(current), ## __VA_ARGS__)
@@ -450,6 +453,9 @@ struct kvm {
450453

451454
#define vcpu_debug(vcpu, fmt, ...) \
452455
kvm_debug("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
456+
#define vcpu_debug_ratelimited(vcpu, fmt, ...) \
457+
kvm_debug_ratelimited("vcpu%i " fmt, (vcpu)->vcpu_id, \
458+
## __VA_ARGS__)
453459
#define vcpu_err(vcpu, fmt, ...) \
454460
kvm_err("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
455461

0 commit comments

Comments
 (0)