代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/qemu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From e98147762cb47645c590ee000dbc12c654a6cc2d Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Sun, 16 Jan 2022 19:57:58 -0500
Subject: [PATCH] target/i386: sev: Clear shared_regions_list when reboot CSV
Guest
Also fix memory leak in sev_remove_shared_regions_list().
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
target/i386/kvm/kvm.c | 5 +++++
target/i386/sev.c | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index a5a755db01..5730d0e0c0 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2270,6 +2270,11 @@ void kvm_arch_reset_vcpu(X86CPU *cpu)
env->mp_state = KVM_MP_STATE_RUNNABLE;
}
+ if (cpu_is_bsp(cpu) &&
+ sev_enabled() && has_map_gpa_range) {
+ sev_remove_shared_regions_list(0, -1);
+ }
+
/* enabled by default */
env->poll_control_msr = 1;
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 6ccb22c00a..0b0f589aee 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -1694,9 +1694,9 @@ int sev_load_incoming_page(QEMUFile *f, uint8_t *ptr)
int sev_remove_shared_regions_list(unsigned long start, unsigned long end)
{
SevGuestState *s = sev_guest;
- struct shared_region *pos;
+ struct shared_region *pos, *next_pos;
- QTAILQ_FOREACH(pos, &s->shared_regions_list, list) {
+ QTAILQ_FOREACH_SAFE(pos, &s->shared_regions_list, list, next_pos) {
unsigned long l, r;
unsigned long curr_gfn_end = pos->gfn_end;
@@ -1710,6 +1710,7 @@ int sev_remove_shared_regions_list(unsigned long start, unsigned long end)
if (l <= r) {
if (pos->gfn_start == l && pos->gfn_end == r) {
QTAILQ_REMOVE(&s->shared_regions_list, pos, list);
+ g_free(pos);
} else if (l == pos->gfn_start) {
pos->gfn_start = r;
} else if (r == pos->gfn_end) {
--
2.41.0.windows.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。