From patchwork Tue Jul 30 13:18:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11065767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9D211823 for ; Tue, 30 Jul 2019 13:20:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9809A28801 for ; Tue, 30 Jul 2019 13:20:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C2C528806; Tue, 30 Jul 2019 13:20:33 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D7FC28831 for ; Tue, 30 Jul 2019 13:20:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hsS1x-0001yS-VM; Tue, 30 Jul 2019 13:19:05 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hsS1w-0001y5-HF for xen-devel@lists.xenproject.org; Tue, 30 Jul 2019 13:19:04 +0000 X-Inumbo-ID: 99c9078f-b2cc-11e9-8980-bc764e045a96 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 99c9078f-b2cc-11e9-8980-bc764e045a96; Tue, 30 Jul 2019 13:19:03 +0000 (UTC) Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: vePXMUuuy14z8RERPNkhAteB4PKBrlhFR5Cf44uiaxk4T8O5UJOewEMC74n0onk4h07/pbrqdi gAqh7z1dLCevHH8aid+0iisbgSUBTckpCwuU/lUHI1P1Zp8jn/4MzIpq/4a7h6VM3sID0SdVTm oRLXcBKYduSOD7ycwx8Nb0DEHc9TAlGWpRJCNYFzJVrgae+uDJLKbbS7FOvacrdmzd2cJQjg9U bBps6DnErQACrrFH/VA8Iz5n/oa8YF2poVLxBav/tR02oakriurtMclQvm8Vha2mbM2U0k/llc D+E= X-SBRS: 2.7 X-MesageID: 3652030 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,326,1559534400"; d="scan'208";a="3652030" From: Paul Durrant To: Date: Tue, 30 Jul 2019 14:18:50 +0100 Message-ID: <20190730131852.20543-4-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20190730131852.20543-1-paul.durrant@citrix.com> References: <20190730131852.20543-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v4 3/5] x86/domain: remove the 'oos_off' flag 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: Wei Liu , George Dunlap , Andrew Cooper , Tim Deegan , Paul Durrant , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The flag is not needed since the domain 'options' can now be tested directly. Signed-off-by: Paul Durrant Reviewed-by: Jan Beulich --- Cc: Tim Deegan Cc: George Dunlap Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monné" v3: - Force 'oos_off' to be set for PV guests (to avoid call to is_hvm_domain() except in ASSERT) - Dropped Tim's A-b because of the change v2: - Move some of the hunks from patch #3 - Also update the definition of shadow_domain_init() in none.c --- xen/arch/x86/mm/paging.c | 2 +- xen/arch/x86/mm/shadow/common.c | 7 ++++--- xen/arch/x86/mm/shadow/none.c | 2 +- xen/common/domain.c | 16 ++++++++++++---- xen/include/asm-x86/domain.h | 1 - xen/include/asm-x86/shadow.h | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 097a27f608..69aa228e46 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -653,7 +653,7 @@ int paging_domain_init(struct domain *d) if ( hap_enabled(d) ) hap_domain_init(d); else - rc = shadow_domain_init(d, d->options); + rc = shadow_domain_init(d); return rc; } diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index fa18de0bb6..1187176993 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -46,7 +46,7 @@ static void sh_clean_dirty_bitmap(struct domain *); /* Set up the shadow-specific parts of a domain struct at start of day. * Called for every domain from arch_domain_create() */ -int shadow_domain_init(struct domain *d, unsigned int domcr_flags) +int shadow_domain_init(struct domain *d) { static const struct log_dirty_ops sh_ops = { .enable = sh_enable_log_dirty, @@ -62,7 +62,6 @@ int shadow_domain_init(struct domain *d, unsigned int domcr_flags) #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) d->arch.paging.shadow.oos_active = 0; - d->arch.paging.shadow.oos_off = domcr_flags & XEN_DOMCTL_CDF_oos_off; #endif d->arch.paging.shadow.pagetable_dying_op = 0; @@ -2523,11 +2522,13 @@ static void sh_update_paging_modes(struct vcpu *v) #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) /* We need to check that all the vcpus have paging enabled to * unsync PTs. */ - if ( is_hvm_domain(d) && !d->arch.paging.shadow.oos_off ) + if ( !(d->options & XEN_DOMCTL_CDF_oos_off) ) { int pe = 1; struct vcpu *vptr; + ASSERT(is_hvm_domain(d)); + for_each_vcpu(d, vptr) { if ( !hvm_paging_enabled(vptr) ) diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c index a70888bd98..2fddf4274c 100644 --- a/xen/arch/x86/mm/shadow/none.c +++ b/xen/arch/x86/mm/shadow/none.c @@ -18,7 +18,7 @@ static void _clean_dirty_bitmap(struct domain *d) ASSERT(is_pv_domain(d)); } -int shadow_domain_init(struct domain *d, unsigned int domcr_flags) +int shadow_domain_init(struct domain *d) { static const struct log_dirty_ops sh_none_ops = { .enable = _enable_log_dirty, diff --git a/xen/common/domain.c b/xen/common/domain.c index 36b38e1b2e..2df908285b 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -313,11 +313,19 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config) return -EINVAL; } - if ( !(config->flags & XEN_DOMCTL_CDF_hvm_guest) && - (config->flags & XEN_DOMCTL_CDF_hap) ) + if ( !(config->flags & XEN_DOMCTL_CDF_hvm_guest) ) { - dprintk(XENLOG_INFO, "HAP enabled for non-HVM guest\n"); - return -EINVAL; + if ( config->flags & XEN_DOMCTL_CDF_hap ) + { + dprintk(XENLOG_INFO, "HAP enabled for non-HVM guest\n"); + return -EINVAL; + } + + /* + * It is only meaningful for XEN_DOMCTL_CDF_oos_off to be clear + * for HVM guests. + */ + config->flags |= XEN_DOMCTL_CDF_oos_off; } return arch_sanitise_domain_config(config); diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 933b85901f..5f9899469c 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -115,7 +115,6 @@ struct shadow_domain { /* OOS */ bool_t oos_active; - bool_t oos_off; /* Has this domain ever used HVMOP_pagetable_dying? */ bool_t pagetable_dying_op; diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index f29f0f652b..8ebb89c027 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -49,7 +49,7 @@ /* Set up the shadow-specific parts of a domain struct at start of day. * Called from paging_domain_init(). */ -int shadow_domain_init(struct domain *d, unsigned int domcr_flags); +int shadow_domain_init(struct domain *d); /* Setup the shadow-specific parts of a vcpu struct. It is called by * paging_vcpu_init() in paging.c */