From patchwork Mon Mar 20 18:03:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 9634873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8C59D60132 for ; Mon, 20 Mar 2017 18:05:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8443C26CF9 for ; Mon, 20 Mar 2017 18:05:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78F7126E73; Mon, 20 Mar 2017 18:05:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FA2B26CF9 for ; Mon, 20 Mar 2017 18:05:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cq1eH-0004pH-Lq; Mon, 20 Mar 2017 18:03:17 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cq1eG-0004ow-3L for xen-devel@lists.xen.org; Mon, 20 Mar 2017 18:03:16 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 07/78-27678-36910D85; Mon, 20 Mar 2017 18:03:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42K52LJdRjdJ8kK Ewel15hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bkPffYCi7xVRxbcIC5gfE0dxcjF4eQwGwm iZ45x9m6GDk4WATsJX48le1i5ORgFCiTuL1mPyuEnSvxbOtdMJtFwE7i0Y6dYLaQwGpGiQ/vR EBsNgEdie9PTzGD2CIC0hLXPl9mBLGZBbwlPhz5xw5iCwtYS5yf84IJYo6qxMO/X1lAbF4Bc4 k1z7awgdgSAtoSF9ofsYDcJiHQxyjx/vhDtgmMfAsYGVYxahSnFpWlFukaGeglFWWmZ5TkJmb m6BoamOnlphYXJ6an5iQmFesl5+duYgSGCQMQ7GD8tSzgEKMkB5OSKO/T2+cjhPiS8lMqMxKL M+KLSnNSiw8xynBwKEnwFkhciBASLEpNT61Iy8wBBixMWoKDR0mEVwIkzVtckJhbnJkOkTrFq MsxZ/buN0xCLHn5ealS4rz5IEUCIEUZpXlwI2DRc4lRVkqYlxHoKCGegtSi3MwSVPlXjOIcjE rCEJfwZOaVwG16BXQEE9ARy26cATmiJBEhJdXAKOh4qv5+kNiN26+mbF93rJ1jpnnL74C3L9r MYlLndfKUVqvFqkX4sn5RdVwQos7O0vPl0JrPeUVy1evSOO93lMxhFjts6ZZ0yiUhc+3Mryf5 euZb607i9ZrxydHvX/IBu4in/27xMTNc/rhpqvlHJt1sBTGd7WVyF8oezU1aJFo9vzC77vAzJ ZbijERDLeai4kQA958zEJkCAAA= X-Env-Sender: vkuznets@redhat.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1490032993!58780395!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5709 invoked from network); 20 Mar 2017 18:03:14 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-16.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Mar 2017 18:03:14 -0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27DB583F42; Mon, 20 Mar 2017 18:03:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 27DB583F42 DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 27DB583F42 Received: from vitty.brq.redhat.com (vitty.brq.redhat.com [10.34.26.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 254D978C2D; Mon, 20 Mar 2017 18:03:12 +0000 (UTC) From: Vitaly Kuznetsov To: xen-devel@lists.xen.org Date: Mon, 20 Mar 2017 19:03:09 +0100 Message-Id: <20170320180311.5091-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 20 Mar 2017 18:03:14 +0000 (UTC) Cc: Wei Liu , Ian Jackson Subject: [Xen-devel] [PATCH 0/2] libxl: fix soft reset for PVHv2 guests X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, I'm trying to make kexec/kdump work for PVHv2 guests too. PVHv2 guests are almost HVM guests so no major changes to the soft reset procedures are required. A few issues, however, arose during testing. Linux also requires some changes to boot after kexec. As PVH guests boot like normal HVM guests after kexec we need to detect their 'PVH-ness' somehow here's a hack which utilizes XEN_IOPORT_MAGIC: With the hack I was able to do kdump on a PVHv2 guest. I'll start a separate mail thread to discuss how we should do it right. Vitaly Kuznetsov (2): libxl: don't try to rename dm save file for PVH libxl: preserve console tty across soft reset tools/libxl/libxl_console.c | 5 ++++- tools/libxl/libxl_create.c | 24 +++++++++++++++++------- tools/libxl/libxl_internal.h | 1 + 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index ec1d5c4..b9f3fdf 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -1765,6 +1766,19 @@ void __init xen_prepare_pvh(void) x86_init.oem.arch_setup = xen_pvh_arch_setup; } + +static void xen_detect_pvh(void) { + short magic; + + if (xen_pvh) + return; + + magic = inw(XEN_IOPORT_MAGIC); + if (magic != XEN_IOPORT_MAGIC_VAL) { + xen_pvh = 1; + xen_pvh_arch_setup(); + } +} #endif void __ref xen_hvm_init_shared_info(void) @@ -1912,6 +1926,9 @@ static void __init xen_hvm_guest_init(void) init_hvm_pv_info(); + /* Detect PVH booting after kexec */ + xen_detect_pvh(); + xen_hvm_init_shared_info(); xen_panic_handler_init();