Skip to content

Commit 911a444

Browse files
committed
Merge tag 'pull-loongarch-20250327' of https://github.com/gaosong715/qemu into staging
bug fix for 10.0 # -----BEGIN PGP SIGNATURE----- # # iLMEAAEKAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCZ+VEzQAKCRBAov/yOSY+ # 33HaBADRMzbDPYWLlJpaovU7y3mdX/TAMS+sCBiQa2BqqzC65Pgqmu42gdCUrupa # 32xz+7Bb0p65c3kXcjlMUb8mrEGvp/eFBW1mJWCcx9+LfW5qL6jQrjvUw/TYrMCv # 8OvkvfROiDDV02su4Y7cErvyB5sGyVKtI2AwYH9xp+KDxvyrKQ== # =D4AD # -----END PGP SIGNATURE----- # gpg: Signature made Thu 27 Mar 2025 08:30:05 EDT # gpg: using RSA key B8FF1DA0D2FDCB2DA09C6C2C40A2FFF239263EDF # gpg: Good signature from "Song Gao <[email protected]>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: B8FF 1DA0 D2FD CB2D A09C 6C2C 40A2 FFF2 3926 3EDF * tag 'pull-loongarch-20250327' of https://github.com/gaosong715/qemu: target/loongarch: Fix the cpu unplug resource leak Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents f5300db + 0c34657 commit 911a444

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

target/loongarch/cpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ struct ArchCPU {
426426
const char *dtb_compatible;
427427
/* used by KVM_REG_LOONGARCH_COUNTER ioctl to access guest time counters */
428428
uint64_t kvm_state_counter;
429+
VMChangeStateEntry *vmsentry;
429430
};
430431

431432
/**

target/loongarch/kvm/kvm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,8 +1080,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
10801080
uint64_t val;
10811081
int ret;
10821082
Error *local_err = NULL;
1083+
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
10831084

1084-
qemu_add_vm_change_state_handler(kvm_loongarch_vm_stage_change, cs);
1085+
cpu->vmsentry = qemu_add_vm_change_state_handler(
1086+
kvm_loongarch_vm_stage_change, cs);
10851087

10861088
if (!kvm_get_one_reg(cs, KVM_REG_LOONGARCH_DEBUG_INST, &val)) {
10871089
brk_insn = val;
@@ -1197,6 +1199,9 @@ void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu)
11971199

11981200
int kvm_arch_destroy_vcpu(CPUState *cs)
11991201
{
1202+
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
1203+
1204+
qemu_del_vm_change_state_handler(cpu->vmsentry);
12001205
return 0;
12011206
}
12021207

0 commit comments

Comments
 (0)