From fd35b6e19024e581082b37db82a12b54b5e57d67 Mon Sep 17 00:00:00 2001 From: Bandan Das Date: Tue, 15 Nov 2016 01:36:18 -0500 Subject: [PATCH] kvm: x86: don't print warning messages for unimplemented msrs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Paolo Bonzini Signed-off-by: Radim Krčmář (cherry picked from commit ae0f5499511e5b1723792c848e44d661d0d4e22f) Orabug: 26933160 Signed-off-by: Aaron Young Reviewed-by: Konrad Rzeszutek Wilk Conflicts: arch/x86/kvm/mmu.c arch/x86/kvm/x86.c include/linux/kvm_host.h NOTE: Conflicts were due to unrelated or missing changes which prevented the auto-merge. They were things such as slight tweaks to the vcpu_unimpl() function output strings/parameters to include extra info and leading "0x" strings before hex output. Things like that. --- arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/x86.c | 7 ++++--- include/linux/kvm_host.h | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index fbf95c74b896..900a272c32f6 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4704,7 +4704,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm) * zap all shadow pages. */ if (unlikely(kvm_current_mmio_generation(kvm) == 0)) { - printk_ratelimited(KERN_DEBUG "kvm: zapping shadow pages for mmio generation wraparound\n"); + kvm_debug_ratelimited("kvm: zapping shadow pages for mmio generation wraparound\n"); kvm_mmu_invalidate_zap_all_pages(kvm); } } diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a54c18367581..390ba3df4b28 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2361,8 +2361,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) if (kvm_pmu_msr(vcpu, msr)) return kvm_pmu_set_msr(vcpu, msr_info); if (!ignore_msrs) { - vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n", - msr, data); + vcpu_debug_ratelimited(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n", + msr, data); return 1; } else { vcpu_unimpl(vcpu, "ignored wrmsr: 0x%x data %llx\n", @@ -2678,7 +2678,8 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) if (kvm_pmu_msr(vcpu, msr)) return kvm_pmu_get_msr(vcpu, msr, pdata); if (!ignore_msrs) { - vcpu_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr); + vcpu_debug_ratelimited(vcpu, "unhandled rdmsr: 0x%x\n", + msr); return 1; } else { vcpu_unimpl(vcpu, "ignored rdmsr: 0x%x\n", msr); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d4e9e88a4f33..50716e8a0d1c 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -403,6 +403,9 @@ struct kvm { pr_info("kvm [%i]: " fmt, task_pid_nr(current), ## __VA_ARGS__) #define kvm_debug(fmt, ...) \ pr_debug("kvm [%i]: " fmt, task_pid_nr(current), ## __VA_ARGS__) +#define kvm_debug_ratelimited(fmt, ...) \ + pr_debug_ratelimited("kvm [%i]: " fmt, task_pid_nr(current), \ + ## __VA_ARGS__) #define kvm_pr_unimpl(fmt, ...) \ pr_err_ratelimited("kvm [%i]: " fmt, \ task_tgid_nr(current), ## __VA_ARGS__) @@ -410,6 +413,9 @@ struct kvm { /* The guest did something we don't support. */ #define vcpu_unimpl(vcpu, fmt, ...) \ kvm_pr_unimpl("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__) +#define vcpu_debug_ratelimited(vcpu, fmt, ...) \ + kvm_debug_ratelimited("vcpu%i " fmt, (vcpu)->vcpu_id, \ + ## __VA_ARGS__) static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) { -- 2.50.1