From: Chao Gao <chao.gao@intel.com>
To: Hou Wenlong <houwenlong.hwl@antgroup.com>
Cc: <kvm@vger.kernel.org>, Sean Christopherson <seanjc@google.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86: Remove outdated comments and code in kvm_on_user_return()
Date: Fri, 12 Sep 2025 16:35:00 +0800 [thread overview]
Message-ID: <aMPbNBofTCFGTCs6@intel.com> (raw)
In-Reply-To: <c10fb477105231e62da28f12c94c5452fa1eff74.1757662000.git.houwenlong.hwl@antgroup.com>
On Fri, Sep 12, 2025 at 03:35:29PM +0800, Hou Wenlong wrote:
>The commit a377ac1cd9d7b ("x86/entry: Move user return notifier out of
>loop") moved fire_user_return_notifiers() into the section with
>interrupts disabled, so the callback kvm_on_user_return() cannot be
>interrupted by kvm_arch_disable_virtualization_cpu() now. Therefore,
>remove the outdated comments and local_irq_save()/local_irq_restore()
>code in kvm_on_user_return().
>
>Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
>---
> arch/x86/kvm/x86.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
>diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>index 33fba801b205..10afbacb1851 100644
>--- a/arch/x86/kvm/x86.c
>+++ b/arch/x86/kvm/x86.c
>@@ -568,18 +568,12 @@ static void kvm_on_user_return(struct user_return_notifier *urn)
> struct kvm_user_return_msrs *msrs
> = container_of(urn, struct kvm_user_return_msrs, urn);
> struct kvm_user_return_msr_values *values;
>- unsigned long flags;
>
>- /*
>- * Disabling irqs at this point since the following code could be
>- * interrupted and executed through kvm_arch_disable_virtualization_cpu()
>- */
>- local_irq_save(flags);
>- if (msrs->registered) {
>- msrs->registered = false;
>- user_return_notifier_unregister(urn);
>- }
>- local_irq_restore(flags);
>+ lockdep_assert_irqs_disabled();
kvm_offline_cpu() may call into this function. But I am not sure if interrupts
are disabled in that path.
Documentation/core-api/cpu_hotplug.rst says that callbacks in the ONLINE section
are invoked with interrupts and preemption enabled.
>+
>+ msrs->registered = false;
>+ user_return_notifier_unregister(urn);
>+
> for (slot = 0; slot < kvm_nr_uret_msrs; ++slot) {
> values = &msrs->values[slot];
> if (values->host != values->curr) {
>--
>2.31.1
>
>
next prev parent reply other threads:[~2025-09-12 8:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 7:35 [PATCH] KVM: x86: Remove outdated comments and code in kvm_on_user_return() Hou Wenlong
2025-09-12 8:35 ` Chao Gao [this message]
2025-09-12 9:38 ` Hou Wenlong
2025-09-12 14:11 ` Hou Wenlong
2025-09-12 14:40 ` Sean Christopherson
2025-09-13 5:06 ` Hou Wenlong
2025-09-16 0:13 ` 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=aMPbNBofTCFGTCs6@intel.com \
--to=chao.gao@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=houwenlong.hwl@antgroup.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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