linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Dave Jones <dsj@fb.com>
Cc: "Linux Kernel" <linux-kernel@vger.kernel.org>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: RFC: silencing kvm unimplemented msr spew.
Date: Mon, 18 Jul 2016 11:26:50 -0400 (EDT)	[thread overview]
Message-ID: <110045299.8101686.1468855610053.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160715192729.GA4712@fb.com>


> kvm is pretty noisy when you have guests poking at MSRs that the kernel
> doesn't implement.  The conveniently named 'ignore_msrs' option initially
> seemed
> like it was what I was looking for, but it changes the printk instead
> of eliding it.
> 
> Untested patch below converts ignore_msrs to a bitmask and adds an option to
> be
> completely silent. The idea being if after testing, things still work and you
> don't care about those messages, you can deploy in production with the
> silence option.
> 
> Would something like this be acceptable ?

Indeed, ignore_msrs does a completely different thing.  It suppresses
general protection faults in the guest.  It is related to behavior that
KVM injects in the guests, not to the things that KVM spews in the host.

What about just downgrading the printf to KERN_DEBUG?  You could simply
change from vcpu_unimpl to vcpu_debug, but it's probably a good idea to
keep the ratelimiting; there's a kvm_pr_unimpl, so maybe add a new
kvm_pr_debug and vcpu_pr_debug.

Thanks,

Paolo

> 
> 	Dave
> 
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 7da5dd2057a9..f9db287118d0 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -96,8 +96,12 @@ static void __kvm_set_rflags(struct kvm_vcpu *vcpu,
> unsigned long rflags);
>  struct kvm_x86_ops *kvm_x86_ops __read_mostly;
>  EXPORT_SYMBOL_GPL(kvm_x86_ops);
>  
> -static bool __read_mostly ignore_msrs = 0;
> -module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
> +#define UNHANDLED_UNIMPL_MSR 0
> +#define IGNORE_UNIMPL_MSR    1
> +#define SILENT_UNHANDLED_MSR 2
> +#define SILENT_IGNORED_MSR   3
> +static int __read_mostly ignore_msrs = UNHANDLED_UNIMPL_MSR;
> +module_param(ignore_msrs, int, S_IRUGO | S_IWUSR);
>  
>  unsigned int min_timer_period_us = 500;
>  module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
> @@ -2228,15 +2232,22 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct
> msr_data *msr_info)
>  			return xen_hvm_config(vcpu, data);
>  		if (kvm_pmu_is_valid_msr(vcpu, msr))
>  			return kvm_pmu_set_msr(vcpu, msr_info);
> -		if (!ignore_msrs) {
> +
> +		switch (ignore_msrs) {
> +		case UNHANDLED_UNIMPL_MSR:
>  			vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n",
> -				    msr, data);
> +				msr, data);
> +			/* fallthrough */
> +		case SILENT_UNHANDLED_MSR:
>  			return 1;
> -		} else {
> +		case IGNORE_UNIMPL_MSR:
>  			vcpu_unimpl(vcpu, "ignored wrmsr: 0x%x data %llx\n",
> -				    msr, data);
> +				msr, data);
> +			/* fallthrough */
> +		case SILENT_IGNORED_MSR:
>  			break;
>  		}
> +		break;
>  	}
>  	return 0;
>  }
> 

  reply	other threads:[~2016-07-18 15:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 19:27 RFC: silencing kvm unimplemented msr spew Dave Jones
2016-07-18 15:26 ` Paolo Bonzini [this message]
2016-07-19 19:58   ` Dave Jones
2016-07-19 20:24     ` Bandan Das
2016-07-21 20:24       ` Dave Jones
2016-07-21 20:41         ` Bandan Das
2016-07-22  8:48         ` Paolo Bonzini
2016-07-22 16:04           ` Bandan Das
2016-07-22 16:20             ` Paolo Bonzini
2016-07-22 16:37               ` Bandan Das
2016-07-19 22:12     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110045299.8101686.1468855610053.JavaMail.zimbra@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dsj@fb.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).