aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2025-03-28 08:06:48 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2025-03-28 08:06:48 -0400
commit911a444ba63e4471917595860cff66d05008ce12 (patch)
treecfb57b3c3fbbd1970b53bccd7cfd1e9ef557fc49
parentf5300db9fa11c4f84e532502a97463efaaf45a19 (diff)
parent0c346576e401d83becb075e70fef207a09afc3e6 (diff)
downloadqemu-911a444ba63e4471917595860cff66d05008ce12.zip
qemu-911a444ba63e4471917595860cff66d05008ce12.tar.gz
qemu-911a444ba63e4471917595860cff66d05008ce12.tar.bz2
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 <m17746591750@163.com>" [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 <stefanha@redhat.com>
-rw-r--r--target/loongarch/cpu.h1
-rw-r--r--target/loongarch/kvm/kvm.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index eae874c..254e4fb 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -426,6 +426,7 @@ struct ArchCPU {
const char *dtb_compatible;
/* used by KVM_REG_LOONGARCH_COUNTER ioctl to access guest time counters */
uint64_t kvm_state_counter;
+ VMChangeStateEntry *vmsentry;
};
/**
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index 7f63e7c..f0e3cfe 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -1080,8 +1080,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
uint64_t val;
int ret;
Error *local_err = NULL;
+ LoongArchCPU *cpu = LOONGARCH_CPU(cs);
- qemu_add_vm_change_state_handler(kvm_loongarch_vm_stage_change, cs);
+ cpu->vmsentry = qemu_add_vm_change_state_handler(
+ kvm_loongarch_vm_stage_change, cs);
if (!kvm_get_one_reg(cs, KVM_REG_LOONGARCH_DEBUG_INST, &val)) {
brk_insn = val;
@@ -1197,6 +1199,9 @@ void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu)
int kvm_arch_destroy_vcpu(CPUState *cs)
{
+ LoongArchCPU *cpu = LOONGARCH_CPU(cs);
+
+ qemu_del_vm_change_state_handler(cpu->vmsentry);
return 0;
}