linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] kvm: x86: don't print warning messages for unimplemented msrs
@ 2016-11-15  6:36 Bandan Das
  2016-11-17 13:19 ` Paolo Bonzini
  2016-11-22 17:42 ` Radim Krčmář
  0 siblings, 2 replies; 3+ messages in thread
From: Bandan Das @ 2016-11-15  6:36 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini, Dave Jones, linux-kernel


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 <bsd@redhat.com>
---
v2:
use kvm_debug_ratelimited for vcpu_debug_ratelimited

This is a follow up to RFC posted by Dave at
https://patchwork.kernel.org/patch/9238227/ which uses pr_debug_ratelimited
when ignore_msrs is not set.

 arch/x86/kvm/mmu.c       | 2 +-
 arch/x86/kvm/x86.c       | 5 +++--
 include/linux/kvm_host.h | 6 ++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d9c7e98..1b3f241 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -4958,7 +4958,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, struct kvm_memslots *slots)
 	 * zap all shadow pages.
 	 */
 	if (unlikely((slots->generation & MMIO_GEN_MASK) == 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 3017de0..5d50403 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2280,7 +2280,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 		if (kvm_pmu_is_valid_msr(vcpu, msr))
 			return kvm_pmu_set_msr(vcpu, msr_info);
 		if (!ignore_msrs) {
-			vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
+			vcpu_debug_ratelimited(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
 				    msr, data);
 			return 1;
 		} else {
@@ -2492,7 +2492,8 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 		if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
 			return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data);
 		if (!ignore_msrs) {
-			vcpu_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr_info->index);
+			vcpu_debug_ratelimited(vcpu, "unhandled rdmsr: 0x%x\n",
+					       msr_info->index);
 			return 1;
 		} else {
 			vcpu_unimpl(vcpu, "ignored rdmsr: 0x%x\n", msr_info->index);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 01c0b9c..274bf34 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -439,6 +439,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__)
@@ -450,6 +453,9 @@ struct kvm {
 
 #define vcpu_debug(vcpu, fmt, ...)					\
 	kvm_debug("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__)
 #define vcpu_err(vcpu, fmt, ...)					\
 	kvm_err("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
 
-- 
2.9.3

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

* Re: [PATCH v2] kvm: x86: don't print warning messages for unimplemented msrs
  2016-11-15  6:36 [PATCH v2] kvm: x86: don't print warning messages for unimplemented msrs Bandan Das
@ 2016-11-17 13:19 ` Paolo Bonzini
  2016-11-22 17:42 ` Radim Krčmář
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-11-17 13:19 UTC (permalink / raw)
  To: Bandan Das, kvm; +Cc: Dave Jones, linux-kernel



On 15/11/2016 07:36, Bandan Das wrote:
> 
> 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 <bsd@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> v2:
> use kvm_debug_ratelimited for vcpu_debug_ratelimited
> 
> This is a follow up to RFC posted by Dave at
> https://patchwork.kernel.org/patch/9238227/ which uses pr_debug_ratelimited
> when ignore_msrs is not set.
> 
>  arch/x86/kvm/mmu.c       | 2 +-
>  arch/x86/kvm/x86.c       | 5 +++--
>  include/linux/kvm_host.h | 6 ++++++
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index d9c7e98..1b3f241 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -4958,7 +4958,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, struct kvm_memslots *slots)
>  	 * zap all shadow pages.
>  	 */
>  	if (unlikely((slots->generation & MMIO_GEN_MASK) == 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 3017de0..5d50403 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2280,7 +2280,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  		if (kvm_pmu_is_valid_msr(vcpu, msr))
>  			return kvm_pmu_set_msr(vcpu, msr_info);
>  		if (!ignore_msrs) {
> -			vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
> +			vcpu_debug_ratelimited(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
>  				    msr, data);
>  			return 1;
>  		} else {
> @@ -2492,7 +2492,8 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  		if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
>  			return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data);
>  		if (!ignore_msrs) {
> -			vcpu_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr_info->index);
> +			vcpu_debug_ratelimited(vcpu, "unhandled rdmsr: 0x%x\n",
> +					       msr_info->index);
>  			return 1;
>  		} else {
>  			vcpu_unimpl(vcpu, "ignored rdmsr: 0x%x\n", msr_info->index);
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 01c0b9c..274bf34 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -439,6 +439,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__)
> @@ -450,6 +453,9 @@ struct kvm {
>  
>  #define vcpu_debug(vcpu, fmt, ...)					\
>  	kvm_debug("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__)
>  #define vcpu_err(vcpu, fmt, ...)					\
>  	kvm_err("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
>  
> 

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

* Re: [PATCH v2] kvm: x86: don't print warning messages for unimplemented msrs
  2016-11-15  6:36 [PATCH v2] kvm: x86: don't print warning messages for unimplemented msrs Bandan Das
  2016-11-17 13:19 ` Paolo Bonzini
@ 2016-11-22 17:42 ` Radim Krčmář
  1 sibling, 0 replies; 3+ messages in thread
From: Radim Krčmář @ 2016-11-22 17:42 UTC (permalink / raw)
  To: Bandan Das; +Cc: kvm, Paolo Bonzini, Dave Jones, linux-kernel

2016-11-15 01:36-0500, Bandan Das:
> 
> 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 <bsd@redhat.com>
> ---

Applied, thanks.

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

end of thread, other threads:[~2016-11-22 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-15  6:36 [PATCH v2] kvm: x86: don't print warning messages for unimplemented msrs Bandan Das
2016-11-17 13:19 ` Paolo Bonzini
2016-11-22 17:42 ` Radim Krčmář

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