[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 18/22] hmp: synchronize cpu state for lapic info
From: |
Daniel P . Berrangé |
Subject: |
[PATCH v4 18/22] hmp: synchronize cpu state for lapic info |
Date: |
Thu, 28 Oct 2021 16:54:53 +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 8e4b4d600c..fc375ced5a 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -29,6 +29,7 @@
#include "monitor/hmp.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
+#include "sysemu/hw_accel.h"
#include "sysemu/kvm.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-misc-target.h"
@@ -655,7 +656,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
- Re: [PATCH v4 12/22] qapi: introduce x-query-numa QMP command, (continued)
- [PATCH v4 13/22] qapi: introduce x-query-usb QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 14/22] qapi: introduce x-query-rdma QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 15/22] qapi: introduce x-query-ramblock QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 16/22] qapi: introduce x-query-skeys QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 17/22] qapi: introduce x-query-cmma QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 18/22] hmp: synchronize cpu state for lapic info,
Daniel P . Berrangé <=
- [PATCH v4 19/22] qapi: introduce x-query-lapic QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 20/22] qapi: introduce x-query-irq QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 21/22] qapi: introduce x-query-jit QMP command, Daniel P . Berrangé, 2021/10/28
- [PATCH v4 22/22] qapi: introduce x-query-opcount QMP command, Daniel P . Berrangé, 2021/10/28