From patchwork Thu Jul 2 16:07:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 490718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7D24A1401E7 for ; Fri, 3 Jul 2015 02:12:41 +1000 (AEST) Received: from localhost ([::1]:37524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAh6M-000058-Td for incoming@patchwork.ozlabs.org; Thu, 02 Jul 2015 12:12:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAh2B-0001ud-Cp for qemu-devel@nongnu.org; Thu, 02 Jul 2015 12:08:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAh29-000478-5J for qemu-devel@nongnu.org; Thu, 02 Jul 2015 12:08:19 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:24730 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAh28-00046Z-Mw for qemu-devel@nongnu.org; Thu, 02 Jul 2015 12:08:17 -0400 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id t62G7ti8009416; Thu, 2 Jul 2015 19:08:15 +0300 (MSK) From: "Denis V. Lunev" To: Date: Thu, 2 Jul 2015 19:07:54 +0300 Message-Id: <1435853275-5440-12-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435853275-5440-1-git-send-email-den@openvz.org> References: <1435853275-5440-1-git-send-email-den@openvz.org> MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by relay.sw.ru id t62G7ti8009416 X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Andrey Smetanin , "Denis V. Lunev" , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 11/12] qemu: add crash_occurred flag into CPUState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Andrey Smetanin CPUState->crash_occurred value inside CPUState marks that guest crash occurred. This value added into cpu common migration subsection. Signed-off-by: Andrey Smetanin Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Andreas Färber --- exec.c | 19 +++++++++++++++++++ include/qom/cpu.h | 1 + vl.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/exec.c b/exec.c index f7883d2..adf49e8 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 != 0; +} + +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_UINT32(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..f559a69 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -263,6 +263,7 @@ struct CPUState { bool created; bool stop; bool stopped; + uint32_t crash_occurred; volatile sig_atomic_t exit_request; uint32_t interrupt_request; int singlestep_enabled; diff --git a/vl.c b/vl.c index 38eee1f..9e0aee5 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 = 1; + } qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); vm_stop(RUN_STATE_GUEST_PANICKED); }