[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 29/60] target/i386/monitor: synchronize cpu state for lapic info
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 29/60] target/i386/monitor: synchronize cpu state for lapic info |
Date: |
Mon, 6 Nov 2023 12:03:01 +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.
Reference:
https://lore.kernel.org/all/20211028155457.967291-19-berrange@redhat.com/
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Message-ID: <20231030085336.2681386-1-armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231026211938.162815-1-dongli.zhang@oracle.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/monitor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 6512846327..950ff9ccbc 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 "qapi/error.h"
#include "qapi/qapi-commands-misc-target.h"
@@ -654,7 +655,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.41.0
- [PULL 17/60] target/openrisc: Declare QOM definitions in 'cpu-qom.h', (continued)
- [PULL 17/60] target/openrisc: Declare QOM definitions in 'cpu-qom.h', Philippe Mathieu-Daudé, 2023/11/06
- [PULL 18/60] target/riscv: Move TYPE_RISCV_CPU_BASE definition to 'cpu.h', Philippe Mathieu-Daudé, 2023/11/06
- [PULL 19/60] target/ppc: Use env_archcpu() in helper_book3s_msgsndp(), Philippe Mathieu-Daudé, 2023/11/06
- [PULL 20/60] target/riscv: Use env_archcpu() in [check_]nanbox(), Philippe Mathieu-Daudé, 2023/11/06
- [PULL 23/60] target/i386/hvf: Use x86_cpu in simulate_[rdmsr|wrmsr](), Philippe Mathieu-Daudé, 2023/11/06
- [PULL 24/60] target/i386/hvf: Use env_archcpu() in simulate_[rdmsr/wrmsr](), Philippe Mathieu-Daudé, 2023/11/06
- [PULL 26/60] target/i386/hvf: Rename 'CPUState *cpu' variable as 'cs', Philippe Mathieu-Daudé, 2023/11/06
- [PULL 21/60] target/s390x: Use env_archcpu() in handle_diag_308(), Philippe Mathieu-Daudé, 2023/11/06
- [PULL 27/60] target/i386/hvf: Rename 'X86CPU *x86_cpu' variable as 'cpu', Philippe Mathieu-Daudé, 2023/11/06
- [PULL 22/60] target/xtensa: Use env_archcpu() in update_c[compare|count](), Philippe Mathieu-Daudé, 2023/11/06
- [PULL 29/60] target/i386/monitor: synchronize cpu state for lapic info,
Philippe Mathieu-Daudé <=
- [PULL 25/60] target/i386/hvf: Use CPUState typedef, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 28/60] target/i386/kvm: Correct comment in kvm_cpu_realize(), Philippe Mathieu-Daudé, 2023/11/06
- [PULL 30/60] target/mips: Fix MSA BZ/BNZ opcodes displacement, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 31/60] target/mips: Fix TX79 LQ/SQ opcodes, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 32/60] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 33/60] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 34/60] target/ppc: Restrict KVM objects to system emulation, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 35/60] target/ppc: Prohibit target specific KVM prototypes on user emulation, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 36/60] target/nios2: Create IRQs *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/11/06
- [PULL 37/60] target/alpha: Tidy up alpha_cpu_class_by_name(), Philippe Mathieu-Daudé, 2023/11/06