* [PULL 0/1] bug fix for 10.0
@ 2025-03-28 1:35 Song Gao
2025-03-28 1:35 ` [PULL 1/1] target/loongarch: Fix the cpu unplug resource leak Song Gao
2025-03-28 16:36 ` [PULL 0/1] bug fix for 10.0 Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Song Gao @ 2025-03-28 1:35 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha, maobibo
The following changes since commit b876e721f1c939f3e83ac85bd3c1c2821e12b3fa:
Update version for v10.0.0-rc1 release (2025-03-25 13:58:14 -0400)
are available in the Git repository at:
https://github.com/gaosong715/qemu.git tags/pull-loongarch-20250327
for you to fetch changes up to 0c346576e401d83becb075e70fef207a09afc3e6:
target/loongarch: Fix the cpu unplug resource leak (2025-03-27 20:29:17 +0800)
----------------------------------------------------------------
bug fix for 10.0
----------------------------------------------------------------
Xianglai Li (1):
target/loongarch: Fix the cpu unplug resource leak
target/loongarch/cpu.h | 1 +
target/loongarch/kvm/kvm.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PULL 1/1] target/loongarch: Fix the cpu unplug resource leak
2025-03-28 1:35 [PULL 0/1] bug fix for 10.0 Song Gao
@ 2025-03-28 1:35 ` Song Gao
2025-03-28 16:36 ` [PULL 0/1] bug fix for 10.0 Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Song Gao @ 2025-03-28 1:35 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha, maobibo, Xianglai Li
From: Xianglai Li <lixianglai@loongson.cn>
When the cpu is created, qemu_add_vm_change_state_handler
is called in the kvm_arch_init_vcpu function to create
the VMChangeStateEntry resource.
However, the resource is not released when the cpu is destroyed.
This results in a qemu process segment error when the virtual
machine restarts after the cpu is unplugged.
This patch solves the problem by adding the corresponding resource
release process to the kvm_arch_destroy_vcpu function.
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Message-Id: <20250324123328.518076-1-lixianglai@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
target/loongarch/cpu.h | 1 +
target/loongarch/kvm/kvm.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index eae874c67b..254e4fbdcd 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 7f63e7c8fe..f0e3cfef03 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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PULL 0/1] bug fix for 10.0
2025-03-28 1:35 [PULL 0/1] bug fix for 10.0 Song Gao
2025-03-28 1:35 ` [PULL 1/1] target/loongarch: Fix the cpu unplug resource leak Song Gao
@ 2025-03-28 16:36 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2025-03-28 16:36 UTC (permalink / raw)
To: Song Gao; +Cc: qemu-devel, stefanha, maobibo
[-- Attachment #1: Type: text/plain, Size: 116 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/10.0 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-28 19:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 1:35 [PULL 0/1] bug fix for 10.0 Song Gao
2025-03-28 1:35 ` [PULL 1/1] target/loongarch: Fix the cpu unplug resource leak Song Gao
2025-03-28 16:36 ` [PULL 0/1] bug fix for 10.0 Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.