From patchwork Thu Jan 30 16:13:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 11358303 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3654B14E3 for ; Thu, 30 Jan 2020 16:16:06 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1229C20707 for ; Thu, 30 Jan 2020 16:16:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ly+2Ete9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1229C20707 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixCT8-00050a-9g; Thu, 30 Jan 2020 16:15:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixCT6-0004zM-Oq for xen-devel@lists.xenproject.org; Thu, 30 Jan 2020 16:15:00 +0000 X-Inumbo-ID: 78caef0e-437b-11ea-a933-bc764e2007e4 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 78caef0e-437b-11ea-a933-bc764e2007e4; Thu, 30 Jan 2020 16:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qmmRLb0NdTnw1b2mbJsYwt47rxkECNQNxPoVyBberGo=; b=Ly+2Ete9oEEq6xuSf8WUSJoHg1 yI3+YrqQJmxvKaUy/TDj/ee/TX5jCtfPanff4H89hrLiCSc4KuuJ8yoQGdMiK7a1THuF8UAlb//lc Z/LCDyOghyXNJYEytQi0rMSpCy5mMfOJpBfv7bc703Yb6VQm7QhCKTHstiteTyOQQLbw0s9+caHZS gXu2woPTzxMwm29gvGkBXbwdDDI+kxJZbbI/ELVN3CQyEMQ6UF3W7mRavGnpdjQHn5QkpSTR6bcB6 1sAfEVjTrDc9XpMwe9dl2U2JjA9EBthh4AuTWx4mbLnvcjf9ru1FGDenSVMUk0IBuC7N5rrb3FWif XKBbf/ZA==; Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ixCRf-0005Tg-42; Thu, 30 Jan 2020 16:13:31 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1ixCRe-009kd9-AK; Thu, 30 Jan 2020 16:13:30 +0000 From: David Woodhouse To: Xen-devel Date: Thu, 30 Jan 2020 16:13:13 +0000 Message-Id: <20200130161330.2324143-5-dwmw2@infradead.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200130161330.2324143-1-dwmw2@infradead.org> References: <20200130161330.2324143-1-dwmw2@infradead.org> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [RFC PATCH v3 05/22] Add KEXEC_TYPE_LIVE_UPDATE X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Varad Gautam , paul@xen.org, Ian Jackson , Hongyan Xia , Amit Shah , =?utf-8?q?Ro?= =?utf-8?q?ger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: David Woodhouse This is identical to the default case... for now. Signed-off-by: David Woodhouse --- xen/common/kexec.c | 18 ++++++++++++++++++ xen/include/public/kexec.h | 12 ++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/xen/common/kexec.c b/xen/common/kexec.c index a262cc5a18..a78aa4f5b0 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -404,6 +404,19 @@ static long kexec_reboot(void *_image) return 0; } +static long kexec_live_update(void *_image) +{ + struct kexec_image *image = _image; + + kexecing = TRUE; + + kexec_common_shutdown(); + machine_reboot_kexec(image); + + BUG(); + return 0; +} + static void do_crashdump_trigger(unsigned char key) { printk("'%c' pressed -> triggering crashdump\n", key); @@ -736,6 +749,7 @@ static int kexec_load_get_bits(int type, int *base, int *bit) switch ( type ) { case KEXEC_TYPE_DEFAULT: + case KEXEC_TYPE_LIVE_UPDATE: *base = KEXEC_IMAGE_DEFAULT_BASE; *bit = KEXEC_FLAG_DEFAULT_POS; break; @@ -837,6 +851,10 @@ static int kexec_exec(XEN_GUEST_HANDLE_PARAM(void) uarg) image = kexec_image[base + pos]; ret = continue_hypercall_on_cpu(0, kexec_reboot, image); break; + case KEXEC_TYPE_LIVE_UPDATE: + image = kexec_image[base + pos]; + ret = continue_hypercall_on_cpu(0, kexec_live_update, image); + break; case KEXEC_TYPE_CRASH: kexec_crash(); /* Does not return */ break; diff --git a/xen/include/public/kexec.h b/xen/include/public/kexec.h index 298381af8d..f5230286d3 100644 --- a/xen/include/public/kexec.h +++ b/xen/include/public/kexec.h @@ -71,18 +71,22 @@ */ /* - * Kexec supports two types of operation: + * Kexec supports three types of operation: * - kexec into a regular kernel, very similar to a standard reboot * - KEXEC_TYPE_DEFAULT is used to specify this type * - kexec into a special "crash kernel", aka kexec-on-panic * - KEXEC_TYPE_CRASH is used to specify this type * - parts of our system may be broken at kexec-on-panic time * - the code should be kept as simple and self-contained as possible + * - Live update into a new Xen, preserving all running domains + * - KEXEC_TYPE_LIVE_UPDATE is used to specify this type + * - Xen performs guest-transparent live migration and stores live + * update state in memory, passing it to the new Xen. */ -#define KEXEC_TYPE_DEFAULT 0 -#define KEXEC_TYPE_CRASH 1 - +#define KEXEC_TYPE_DEFAULT 0 +#define KEXEC_TYPE_CRASH 1 +#define KEXEC_TYPE_LIVE_UPDATE 2 /* The kexec implementation for Xen allows the user to load two * types of kernels, KEXEC_TYPE_DEFAULT and KEXEC_TYPE_CRASH.