Skip to content

Commit 995d504

Browse files
bysuisean-jc
authored andcommitted
KVM: x86: Don't disable IRQs when unregistering user-return notifier
Remove the code to disable IRQs when unregistering KVM's user-return notifier now that KVM doesn't invoke kvm_on_user_return() when disabling virtualization via IPI function call, i.e. now that there's no need to guard against re-entrancy via IPI callback. Note, disabling IRQs has largely been unnecessary since commit a377ac1 ("x86/entry: Move user return notifier out of loop") moved fire_user_return_notifiers() into the section with IRQs disabled. In doing so, the commit somewhat inadvertently fixed the underlying issue that was papered over by commit 1650b4e ("KVM: Disable irq while unregistering user notifier"). I.e. in practice, the code and comment has been stale since commit a377ac1. Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com> [sean: rewrite changelog after rebasing, drop lockdep assert] Reviewed-by: Kai Huang <kai.huang@intel.com> Link: https://patch.msgid.link/20251030191528.3380553-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 2baa33a commit 995d504

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

arch/x86/kvm/x86.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -602,18 +602,10 @@ static void kvm_on_user_return(struct user_return_notifier *urn)
602602
struct kvm_user_return_msrs *msrs
603603
= container_of(urn, struct kvm_user_return_msrs, urn);
604604
struct kvm_user_return_msr_values *values;
605-
unsigned long flags;
606605

607-
/*
608-
* Disabling irqs at this point since the following code could be
609-
* interrupted and executed through kvm_arch_disable_virtualization_cpu()
610-
*/
611-
local_irq_save(flags);
612-
if (msrs->registered) {
613-
msrs->registered = false;
614-
user_return_notifier_unregister(urn);
615-
}
616-
local_irq_restore(flags);
606+
msrs->registered = false;
607+
user_return_notifier_unregister(urn);
608+
617609
for (slot = 0; slot < kvm_nr_uret_msrs; ++slot) {
618610
values = &msrs->values[slot];
619611
if (values->host != values->curr) {

0 commit comments

Comments
 (0)