diff options
| author | Bibo Mao <maobibo@loongson.cn> | 2026-08-10 12:21:50 +0800 |
|---|---|---|
| committer | Huacai Chen <chenhuacai@loongson.cn> | 2026-08-10 12:21:50 +0800 |
| commit | 32d05564a6128d59ea876cf9078fe6866a809e14 (patch) | |
| tree | d46f0b23c9556bdce4490b3a4944ac8f9e979781 | |
| parent | fd4021529faa931818186b6e83bd46f5de7517eb (diff) | |
| download | linux-32d05564a6128d59ea876cf9078fe6866a809e14.tar.gz linux-32d05564a6128d59ea876cf9078fe6866a809e14.zip | |
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.
Cc: stable@vger.kernel.org
Fixes: 2fc3bd86db4b ("LoongArch: KVM: Implement basic vcpu interfaces")
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
| -rw-r--r-- | arch/loongarch/kvm/vcpu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index 20c207d80e31..fd0dd22a7162 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -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() |
