[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 15/19] hmp: synchronize cpu state for lapic info
From: |
Daniel P . Berrangé |
Subject: |
[PATCH v3 15/19] hmp: synchronize cpu state for lapic info |
Date: |
Thu, 30 Sep 2021 14:23:45 +0100 |
From: Dongli Zhang <dongli.zhang@oracle.com>
While the default "info lapic" always synchronizes cpu state ...
mon_get_cpu()
-> mon_get_cpu_sync(mon, true)
-> cpu_synchronize_state(cpu)
-> ioctl KVM_GET_LAPIC (taking KVM as example)
... the cpu state is not synchronized when the apic-id is available as
argument.
The cpu state should be synchronized when apic-id is available. Otherwise
the "info lapic <apic-id>" always returns stale data.
Cc: Joe Jin <joe.jin@oracle.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
target/i386/monitor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 19468c4e85..2a41eac7fd 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -28,6 +28,7 @@
#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
#include "qapi/qmp/qdict.h"
+#include "sysemu/hw_accel.h"
#include "sysemu/kvm.h"
#include "sysemu/sev.h"
#include "qapi/error.h"
@@ -656,7 +657,11 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
if (qdict_haskey(qdict, "apic-id")) {
int id = qdict_get_try_int(qdict, "apic-id", 0);
+
cs = cpu_by_arch_id(id);
+ if (cs) {
+ cpu_synchronize_state(cs);
+ }
} else {
cs = mon_get_cpu(mon);
}
--
2.31.1
- [PATCH v3 01/19] docs/devel: rename file for writing monitor commands, (continued)
- [PATCH v3 01/19] docs/devel: rename file for writing monitor commands, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 06/19] monitor: remove 'info ioapic' HMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 07/19] qapi: introduce x-query-roms QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 08/19] qapi: introduce x-query-profile QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 09/19] qapi: introduce x-query-numa QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 10/19] qapi: introduce x-query-usb QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 11/19] qapi: introduce x-query-rdma QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 12/19] qapi: introduce x-query-ramblock QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 13/19] qapi: introduce x-query-skeys QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 14/19] qapi: introduce x-query-cmma QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 15/19] hmp: synchronize cpu state for lapic info,
Daniel P . Berrangé <=
- [PATCH v3 16/19] qapi: introduce x-query-lapic QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 17/19] qapi: introduce x-query-irq QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 18/19] qapi: introduce x-query-jit QMP command, Daniel P . Berrangé, 2021/09/30
- [PATCH v3 19/19] qapi: introduce x-query-opcount QMP command, Daniel P . Berrangé, 2021/09/30