qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Andrey Smetanin" <asmetanin@virtuozzo.com>,
	"Denis V. Lunev" <den@openvz.org>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 11/12] cpu: Add crash_occurred flag into CPUState
Date: Fri,  3 Jul 2015 15:01:44 +0300	[thread overview]
Message-ID: <1435924905-8926-12-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1435924905-8926-1-git-send-email-den@openvz.org>

From: Andrey Smetanin <asmetanin@virtuozzo.com>

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 <asmetanin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Andreas Färber <afaerber@suse.de>
---
 exec.c            | 19 +++++++++++++++++++
 include/qom/cpu.h |  1 +
 qom/cpu.c         |  1 +
 vl.c              |  3 +++
 4 files changed, 24 insertions(+)

diff --git a/exec.c b/exec.c
index f7883d2..15c9a29 100644
--- a/exec.c
+++ b/exec.c
@@ -465,6 +465,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,
@@ -478,6 +496,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 39f0f19..aae05fd 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -263,6 +263,7 @@ struct CPUState {
     bool created;
     bool stop;
     bool stopped;
+    bool crash_occurred;
     volatile sig_atomic_t exit_request;
     uint32_t interrupt_request;
     int singlestep_enabled;
diff --git a/qom/cpu.c b/qom/cpu.c
index 108bfa2..c3c4674 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -249,6 +249,7 @@ static void cpu_common_reset(CPUState *cpu)
     cpu->icount_decr.u32 = 0;
     cpu->can_do_io = 0;
     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 38eee1f..62bab42 100644
--- a/vl.c
+++ b/vl.c
@@ -1723,6 +1723,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.1.4

  parent reply	other threads:[~2015-07-03 12:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 12:01 [Qemu-devel] [PATCH v6 0/12] HyperV equivalent of pvpanic driver Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 1/12] kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 2/12] kvm: introduce vcpu_debug = kvm_debug + vcpu context Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 3/12] kvm: add hyper-v crash msrs values Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 4/12] kvm/x86: added hyper-v crash msrs into kvm hyperv context Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 5/12] kvm: added KVM_REQ_HV_CRASH value to notify qemu about hyper-v crash Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 6/12] kvm/x86: mark hyper-v crash msrs as partition wide Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 7/12] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers Denis V. Lunev
2015-08-19  0:41   ` Wanpeng Li
2015-08-19  0:47     ` Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 8/12] kvm/x86: add sending hyper-v crash notification to user space Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 09/12] Added generic panic handler qemu_system_guest_panicked() Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 10/12] kvm: Add kvm system event crash handler Denis V. Lunev
2015-07-03 12:01 ` Denis V. Lunev [this message]
2015-09-02 21:13   ` [Qemu-devel] [PATCH 11/12] cpu: Add crash_occurred flag into CPUState Paolo Bonzini
2015-07-03 12:01 ` [Qemu-devel] [PATCH 12/12] i386/kvm: Hyper-v crash msrs set/get'ers and migration Denis V. Lunev
2015-07-07 10:19   ` Paolo Bonzini
2015-07-07 10:21   ` Paolo Bonzini
2015-07-07 10:20 ` [Qemu-devel] [PATCH v6 0/12] HyperV equivalent of pvpanic driver Paolo Bonzini
2015-08-12 11:54   ` Denis V. Lunev
2015-08-12 12:47     ` Paolo Bonzini
2015-08-12 13:22       ` Denis V. Lunev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435924905-8926-12-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=afaerber@suse.de \
    --cc=asmetanin@virtuozzo.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).