public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Chao Gao <chao.gao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Allocate/free user_return_msrs at kvm.ko (un)loading time
Date: Thu, 13 Nov 2025 13:02:49 -0800	[thread overview]
Message-ID: <aRZHeTNW9o5SlQSK@google.com> (raw)
In-Reply-To: <aRGOu3eJoRnsaV+n@intel.com>

On Mon, Nov 10, 2025, Chao Gao wrote:
> >-static int kvm_init_user_return_msrs(void)
> >+static void kvm_destroy_user_return_msrs(void)
> > {
> >-	user_return_msrs = alloc_percpu(struct kvm_user_return_msrs);
> >-	if (!user_return_msrs) {
> >-		pr_err("failed to allocate percpu user_return_msrs\n");
> >-		return -ENOMEM;
> >-	}
> >+	int cpu;
> >+
> >+	for_each_possible_cpu(cpu)
> >+		WARN_ON_ONCE(per_cpu(user_return_msrs, cpu).registered);
> 
> Could this warning be triggered if the forced shutdown path didn't
> unregister the user return callback (i.e., with the patch [*] applied),
> and then vendor modules got unloaded immediately after the forced shutdown
> (before the CPU exits to the userspace)?

Probably?  But that's more of a feature than a bug, e.g. gives the (privileged!)
user the heads up of how exactly they broke their system when they forced a
reboot.  I'd prefer not to condition it on e.g. !kvm_rebooting unless it's truly
necessary, because it's "just" a WARN, i.e. shouldn't crash the system.

> [*]: https://lore.kernel.org/kvm/20251030191528.3380553-4-seanjc@google.com/

  reply	other threads:[~2025-11-13 21:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08  1:36 [PATCH] KVM: x86: Allocate/free user_return_msrs at kvm.ko (un)loading time Sean Christopherson
2025-11-10  7:05 ` Chao Gao
2025-11-13 21:02   ` Sean Christopherson [this message]
2025-11-21 18:55 ` Sean Christopherson

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=aRZHeTNW9o5SlQSK@google.com \
    --to=seanjc@google.com \
    --cc=chao.gao@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@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