Skip to content

Commit 5add0db

Browse files
bibo-maochenhuacai
authored andcommitted
LoongArch: KVM: Fix PMU pass-through issue if VM exits to host finally
In function kvm_pre_enter_guest(), it prepares to enter guest and check whether there are pending signals or events. And it will not enter guest if there are, PMU pass-through preparation for guest should be cancelled and host should own PMU hardware. Cc: stable@vger.kernel.org Fixes: f4e40ea ("LoongArch: KVM: Add PMU support for guest") Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 9ea8623 commit 5add0db

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/loongarch/kvm/vcpu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ static int kvm_pre_enter_guest(struct kvm_vcpu *vcpu)
294294
vcpu->arch.aux_inuse &= ~KVM_LARCH_SWCSR_LATEST;
295295

296296
if (kvm_request_pending(vcpu) || xfer_to_guest_mode_work_pending()) {
297+
kvm_lose_pmu(vcpu);
297298
/* make sure the vcpu mode has been written */
298299
smp_store_mb(vcpu->mode, OUTSIDE_GUEST_MODE);
299300
local_irq_enable();

0 commit comments

Comments
 (0)