Skip to contentSkip to conversation

FAILED: patch "[PATCH] LoongArch: KVM: Set vcpu->cpu before IN_GUEST_MODE is set" failed to apply to 6.18-stable tree

PATCH [email protected] 1 participant 1 message Sep 9

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 32d05564a6128d59ea876cf9078fe6866a809e14
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090950-throng-dominion-88fe@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 32d05564a6128d59ea876cf9078fe6866a809e14 Mon Sep 17 00:00:00 2001
From: Bibo Mao <[email protected]>
Date: Mon, 10 Aug 2026 12:21:50 +0800
Subject: [PATCH] LoongArch: KVM: Set vcpu->cpu before IN_GUEST_MODE is set

In function kvm_make_vcpu_request(), it will send IPI to physical CPU when vCPU is in IN_GUEST_MODE mode. And physical CPU is set in function kvm_check_vpid(), thus it should be called before IN_GUEST_MODE is set. Otherwise IPI will send to wrong old physical CPU where vCPU is running.

Fixes 2fc3bd86db4b ("LoongArch: KVM: Implement basic vcpu interfaces")
arch/loongarch/kvm/vcpu.c +1 -1
index 20c207d80e31..fd0dd22a7162 100644
@@ -300,10 +300,10 @@ static int kvm_pre_enter_guest(struct kvm_vcpu *vcpu)
 		 */
 		local_irq_disable();
 		kvm_deliver_exception(vcpu);
+		kvm_check_vpid(vcpu);
 		/* Make sure the vcpu mode has been written */
 		smp_store_mb(vcpu->mode, IN_GUEST_MODE);
 		kvm_deliver_intr(vcpu);
-		kvm_check_vpid(vcpu);
 
 		/*
 		 * Called after function kvm_check_vpid()