kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Tony Luck <tony.luck@intel.com>, kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Joerg Roedel" <joro@8bytes.org>
Subject: Re: [PATCH] KVM: x86: Only print persistent reasons for kvm disabled once
Date: Tue, 27 Aug 2019 08:27:59 +0200	[thread overview]
Message-ID: <87imqjm8b4.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190826182320.9089-1-tony.luck@intel.com>

Tony Luck <tony.luck@intel.com> writes:

> When I boot my server I'm treated to a console log with:
>
> [   40.520510] kvm: disabled by bios
> [   40.551234] kvm: disabled by bios
> [   40.607987] kvm: disabled by bios
> [   40.659701] kvm: disabled by bios
> [   40.691224] kvm: disabled by bios
> [   40.718786] kvm: disabled by bios
> [   40.750122] kvm: disabled by bios
> [   40.797170] kvm: disabled by bios
> [   40.828408] kvm: disabled by bios
>
>  ... many, many more lines, one for every logical CPU

(If I didn't miss anything) we have the following code:

__init vmx_init()
        kvm_init();
            kvm_arch_init()

and we bail on first error so there should be only 1 message per module
load attempt. The question I have is who (and why) is trying to load
kvm-intel (or kvm-amd which is not any different) for each CPU? Is it
udev? Can this be changed?

In particular, I'm worried about eVMCS enablement in vmx_init(), we will
also get a bunch of "KVM: vmx: using Hyper-V Enlightened VMCS" messages
if the consequent kvm_arch_init() fails.

>
> Since it isn't likely that BIOS is going to suddenly enable
> KVM between bringing up one CPU and the next, we might as
> well just print this once.
>
> Same for a few other unchanging reasons that might keep
> kvm from being initialized.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  arch/x86/kvm/x86.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 93b0bd45ac73..56d4a43dd2db 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7007,18 +7007,18 @@ int kvm_arch_init(void *opaque)
>  	struct kvm_x86_ops *ops = opaque;
>  
>  	if (kvm_x86_ops) {
> -		printk(KERN_ERR "kvm: already loaded the other module\n");
> +		pr_err_once("kvm: already loaded the other module\n");
>  		r = -EEXIST;
>  		goto out;
>  	}
>  
>  	if (!ops->cpu_has_kvm_support()) {
> -		printk(KERN_ERR "kvm: no hardware support\n");
> +		pr_err_once("kvm: no hardware support\n");
>  		r = -EOPNOTSUPP;
>  		goto out;
>  	}
>  	if (ops->disabled_by_bios()) {
> -		printk(KERN_ERR "kvm: disabled by bios\n");
> +		pr_err_once("kvm: disabled by bios\n");
>  		r = -EOPNOTSUPP;
>  		goto out;
>  	}
> @@ -7029,7 +7029,7 @@ int kvm_arch_init(void *opaque)
>  	 * vCPU's FPU state as a fxregs_state struct.
>  	 */
>  	if (!boot_cpu_has(X86_FEATURE_FPU) || !boot_cpu_has(X86_FEATURE_FXSR)) {
> -		printk(KERN_ERR "kvm: inadequate fpu\n");
> +		pr_err_once("kvm: inadequate fpu\n");
>  		r = -EOPNOTSUPP;
>  		goto out;
>  	}

The messages themselves may need some love but this is irrelevant to the
patch, so

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly

  reply	other threads:[~2019-08-27  6:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 18:23 [PATCH] KVM: x86: Only print persistent reasons for kvm disabled once Tony Luck
2019-08-27  6:27 ` Vitaly Kuznetsov [this message]
2019-08-27 17:50   ` Luck, Tony
2019-08-27 19:08   ` Radim Krčmář
2019-08-27 19:24     ` Sean Christopherson
2019-09-11 15:30       ` 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=87imqjm8b4.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tony.luck@intel.com \
    --cc=wanpengli@tencent.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).