From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXFLw-0005jR-0q for qemu-devel@nongnu.org; Wed, 02 Sep 2015 17:13:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXFLr-00064U-Ge for qemu-devel@nongnu.org; Wed, 02 Sep 2015 17:13:55 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:36510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXFLr-00064O-Al for qemu-devel@nongnu.org; Wed, 02 Sep 2015 17:13:51 -0400 Received: by wibz8 with SMTP id z8so79069256wib.1 for ; Wed, 02 Sep 2015 14:13:50 -0700 (PDT) Sender: Paolo Bonzini References: <1435924905-8926-1-git-send-email-den@openvz.org> <1435924905-8926-12-git-send-email-den@openvz.org> From: Paolo Bonzini Message-ID: <55E76691.7050204@redhat.com> Date: Wed, 2 Sep 2015 23:13:53 +0200 MIME-Version: 1.0 In-Reply-To: <1435924905-8926-12-git-send-email-den@openvz.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 11/12] cpu: Add crash_occurred flag into CPUState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Andrey Smetanin , qemu-devel@nongnu.org, kvm@vger.kernel.org, =?UTF-8?Q?Andreas_F=c3=a4rber?= On 03/07/2015 14:01, Denis V. Lunev wrote: > From: Andrey Smetanin > > 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 > Signed-off-by: Denis V. Lunev > CC: Paolo Bonzini > CC: Andreas Färber Since there's been no answer for two months, I'll send a pull request for this patch when I'm back. Paolo > --- > 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); > } >