public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Cc: pbonzini@redhat.com, "Stéphane Graber" <stgraber@ubuntu.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: SVM: add some info prints to SEV init
Date: Fri, 19 May 2023 11:17:07 -0700	[thread overview]
Message-ID: <ZGe9I+S78pQ/RPs7@google.com> (raw)
In-Reply-To: <20230404122652.275005-3-aleksandr.mikhalitsyn@canonical.com>

On Tue, Apr 04, 2023, Alexander Miqqqqkhalitsyn wrote:
> Let's add a few pr_info's to sev_hardware_setup to make SEV/SEV-ES
> enabling a little bit handier for users. Right now it's too hard
> to guess why SEV/SEV-ES are failing to enable.

Hmm, I'm somewhat torn, but I'm against taking this patch, at least not in its
current form.  I appreciated that determining why KVM isn't enabling SEV/SEV-ES
is annoying, but there's very little actionable information provided here that
isn't also super obvious.  I also don't want to start us down a slippery slope
of printing out messages every time KVM doesn't enable a feature.

If someone tries to enable SEV and doesn't check that their CPU supports SEV,
then IMO that's on them.  Ditto for SEV-ES.

The NPT thing is mildly interesting, but practically speaking I don't expect that
to ever be a hindrace for generic enabling.  Ditto for MMIO caching.

The decode assists check is (a) completely unactionable for the vast, vast majority
of users and (b) is a WARN_ON_ONCE() condition.

The ASID stuff is by far the most interesting, but that's also quite interesting
for when SEV and SEV-ES _are_ fully supported.

So if we want to provide the user more info, I'd prefer to do something like the
below, which I think would be more helpful and would avoid my slippery slope
concerns.

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index c25aeb550cd9..eb4c6e3812d9 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -2216,7 +2216,6 @@ void __init sev_hardware_setup(void)
        if (misc_cg_set_capacity(MISC_CG_RES_SEV, sev_asid_count))
                goto out;
 
-       pr_info("SEV supported: %u ASIDs\n", sev_asid_count);
        sev_supported = true;
 
        /* SEV-ES support requested? */
@@ -2243,11 +2242,16 @@ void __init sev_hardware_setup(void)
        sev_es_asid_count = min_sev_asid - 1;
        if (misc_cg_set_capacity(MISC_CG_RES_SEV_ES, sev_es_asid_count))
                goto out;
-
-       pr_info("SEV-ES supported: %u ASIDs\n", sev_es_asid_count);
        sev_es_supported = true;
 
 out:
+       if (boot_cpu_has(X86_FEATURE_SEV))
+               pr_info("SEV %s (ASIDs %u - %u)\n",
+                       sev_supported ? "enabled" : "disabled", ...);
+       if (boot_cpu_has(X86_FEATURE_SEV_ES))
+               pr_info("SEV-ES %s (ASIDs %u - %u)\n",
+                       sev_es_supported ? "enabled" : "disabled", ...);
+
        sev_enabled = sev_supported;
        sev_es_enabled = sev_es_supported;
 #endif

  parent reply	other threads:[~2023-05-19 18:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 12:26 [PATCH 0/2] KVM: SVM: small tweaks for sev_hardware_setup Alexander Mikhalitsyn
2023-04-04 12:26 ` [PATCH 1/2] KVM: SVM: free sev_*asid_bitmap init if SEV init fails Alexander Mikhalitsyn
2023-04-11 19:47   ` Zhi Wang
2023-04-12 14:52     ` Aleksandr Mikhalitsyn
2023-04-13  5:07       ` Zhi Wang
2023-04-04 12:26 ` [PATCH 2/2] KVM: SVM: add some info prints to SEV init Alexander Mikhalitsyn
2023-04-11 19:43   ` Zhi Wang
2023-04-12 14:55     ` Aleksandr Mikhalitsyn
2023-05-19 18:17   ` Sean Christopherson [this message]
2023-05-19 19:03     ` Aleksandr Mikhalitsyn
2023-05-19 21:02       ` Sean Christopherson
2023-04-06  3:32 ` [PATCH 0/2] KVM: SVM: small tweaks for sev_hardware_setup Sean Christopherson
2023-04-06  7:07   ` Aleksandr Mikhalitsyn

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=ZGe9I+S78pQ/RPs7@google.com \
    --to=seanjc@google.com \
    --cc=aleksandr.mikhalitsyn@canonical.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=stgraber@ubuntu.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