[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/24] cpu: Add crash_occurred flag into CPUState
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/24] cpu: Add crash_occurred flag into CPUState |
Date: |
Wed, 16 Sep 2015 14:29:36 +0200 |
From: Andrey Smetanin <address@hidden>
CPUState::crash_occurred field inside CPUState marks
that guest crash occurred. This value is added into
cpu common migration subsection.
Signed-off-by: Andrey Smetanin <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Paolo Bonzini <address@hidden>
CC: Andreas Färber <address@hidden>
Message-Id: <address@hidden>
[Document the new field. - Paolo]
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 19 +++++++++++++++++++
include/qom/cpu.h | 2 ++
qom/cpu.c | 1 +
vl.c | 3 +++
4 files changed, 25 insertions(+)
diff --git a/exec.c b/exec.c
index b61126c..07dfeae 100644
--- a/exec.c
+++ b/exec.c
@@ -478,6 +478,24 @@ static const VMStateDescription
vmstate_cpu_common_exception_index = {
}
};
+static bool cpu_common_crash_occurred_needed(void *opaque)
+{
+ CPUState *cpu = opaque;
+
+ return cpu->crash_occurred;
+}
+
+static const VMStateDescription vmstate_cpu_common_crash_occurred = {
+ .name = "cpu_common/crash_occurred",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = cpu_common_crash_occurred_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_BOOL(crash_occurred, CPUState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
const VMStateDescription vmstate_cpu_common = {
.name = "cpu_common",
.version_id = 1,
@@ -491,6 +509,7 @@ const VMStateDescription vmstate_cpu_common = {
},
.subsections = (const VMStateDescription*[]) {
&vmstate_cpu_common_exception_index,
+ &vmstate_cpu_common_crash_occurred,
NULL
}
};
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index c3d610b..302673d 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -223,6 +223,7 @@ struct kvm_run;
* @halted: Nonzero if the CPU is in suspended state.
* @stop: Indicates a pending stop request.
* @stopped: Indicates the CPU has been artificially stopped.
+ * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU
* @tcg_exit_req: Set to force TCG to stop executing linked TBs for this
* CPU and return to its top level loop.
* @singlestep_enabled: Flags for single-stepping.
@@ -269,6 +270,7 @@ struct CPUState {
bool created;
bool stop;
bool stopped;
+ bool crash_occurred;
bool exit_request;
uint32_t interrupt_request;
int singlestep_enabled;
diff --git a/qom/cpu.c b/qom/cpu.c
index 3841f0d..fb80d13 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -251,6 +251,7 @@ static void cpu_common_reset(CPUState *cpu)
cpu->icount_decr.u32 = 0;
cpu->can_do_io = 1;
cpu->exception_index = -1;
+ cpu->crash_occurred = false;
memset(cpu->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *));
}
diff --git a/vl.c b/vl.c
index 066a080..3c6480d 100644
--- a/vl.c
+++ b/vl.c
@@ -1747,6 +1747,9 @@ void qemu_system_reset(bool report)
void qemu_system_guest_panicked(void)
{
+ if (current_cpu) {
+ current_cpu->crash_occurred = true;
+ }
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);
vm_stop(RUN_STATE_GUEST_PANICKED);
}
--
2.5.0
- [Qemu-devel] [PULL 00/24] Misc patches for 2015-09-16, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 01/24] pci: remove Link Training error from AER error list, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 02/24] update Linux headers to 4.3-rc1, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 06/24] kvm: Add kvm system event crash handler, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 03/24] update-linux-headers: copy standard-headers files one by one, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 04/24] target-i386: move asm-x86/hyperv.h to standard-headers, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 05/24] cpu: Add crash_occurred flag into CPUState,
Paolo Bonzini <=
- [Qemu-devel] [PULL 08/24] hmp-commands-info: move info_cmds content out of monitor.c, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 07/24] i386/kvm: Hyper-v crash msrs set/get'ers and migration, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 10/24] hmp-commands.hx: fix end of table info, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 12/24] qemu-char: Use g_new() & friends where that makes obvious sense, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 11/24] monitor: added generation of documentation for hmp-commands-info.hx, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 13/24] cpu-exec: Migrate some generic fns to cpu-exec-common, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 14/24] translate-all: Move tcg_handle_interrupt() to -common, Paolo Bonzini, 2015/09/16
- [Qemu-devel] [PULL 16/24] tcg: Move tci_tb_ptr to -common, Paolo Bonzini, 2015/09/16