Commit 995d5041 authored by Hou Wenlong's avatar Hou Wenlong Committed by Sean Christopherson
Browse files

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
a377ac1c ("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 1650b4eb ("KVM: Disable irq while
unregistering user notifier").  I.e. in practice, the code and comment
has been stale since commit a377ac1c.

Signed-off-by: default avatarHou Wenlong <houwenlong.hwl@antgroup.com>
[sean: rewrite changelog after rebasing, drop lockdep assert]
Reviewed-by: default avatarKai Huang <kai.huang@intel.com>
Link: https://patch.msgid.link/20251030191528.3380553-5-seanjc@google.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 2baa33a8
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -602,18 +602,10 @@ 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);

	for (slot = 0; slot < kvm_nr_uret_msrs; ++slot) {
		values = &msrs->values[slot];
		if (values->host != values->curr) {