From patchwork Wed Jan 22 08:53:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 11345341 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 86D51139A for ; Wed, 22 Jan 2020 08:54:55 +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 636DF2253D for ; Wed, 22 Jan 2020 08:54:55 +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="B0/HP7/M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 636DF2253D 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 1iuBm1-0000m9-Tv; Wed, 22 Jan 2020 08:54:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuBm0-0000lq-TE for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 08:54:04 +0000 X-Inumbo-ID: baa823d4-3cf4-11ea-8e9a-bc764e2007e4 Received: from bombadil.infradead.org (unknown [2607:7c80:54:e::133]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id baa823d4-3cf4-11ea-8e9a-bc764e2007e4; Wed, 22 Jan 2020 08:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=B0/HP7/M7TR7D/wAqiepBoD0Qq qh8NKwlV/RsV55qEQbUXCzdVf4AdwD+SPLH0HKNF7309ZikoxJ1V6HNpnvtY3WAKqmC069mnGcxP6 2RrqpPm6pNCyXclEJw0Eym3iNFVMs+jK8N6Hp4u+6vTljMO3RD7Crehhw5lNrWGT4kshJunJ5OJ7p CI9FYfwHIiEvcdgc5DB2ifAx5LmVpC/vei0Ax4JYc8irP4ApZ+vCk5iGo792wpbsIFOHU1hnJT7+u Z+lDzZJxLKsQ4OfqGOY0QB+WmlU0RBLhTgFWYsQJWd1Kcz3GB06GbJo8paWVAqKGwawmN6l5hR8MV cEtn2voA==; Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iuBlu-0001yD-Fr; Wed, 22 Jan 2020 08:53:58 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1iuBlt-008mRT-9E; Wed, 22 Jan 2020 08:53:57 +0000 From: David Woodhouse To: Xen-devel Date: Wed, 22 Jan 2020 08:53:48 +0000 Message-Id: <20200122085357.2092778-5-dwmw2@infradead.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200122085357.2092778-1-dwmw2@infradead.org> References: <6cbe16ae42ab806df513d359220212d4f01ce43d.camel@infradead.org> <20200122085357.2092778-1-dwmw2@infradead.org> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [RFC PATCH v2 05/14] 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.