From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CAA4C54FD0 for ; Mon, 20 Apr 2020 17:31:29 +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 6047F20782 for ; Mon, 20 Apr 2020 17:31:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="NDEQiIQm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6047F20782 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass 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 1jQaGL-00074V-DP; Mon, 20 Apr 2020 17:31:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jQaGJ-00074Q-Or for xen-devel@lists.xenproject.org; Mon, 20 Apr 2020 17:31:15 +0000 X-Inumbo-ID: bb60ae94-832c-11ea-b4f4-bc764e2007e4 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bb60ae94-832c-11ea-b4f4-bc764e2007e4; Mon, 20 Apr 2020 17:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1587403874; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=F05uyVxwp1JoOAOpYLy8FCYYOpsSUjvQDelW8C5ZJV0=; b=NDEQiIQmJjIt9W60KZRUgTLwgMu84/n9Ja8sJsKf7x4phHx50HjInwcD ULpuaueckblHzXey/E1/XtKn/ymy10VdkQmT1X8PUTLaZtfHc0sAhsV5+ ahNRLZD+iLfgG+b7YniwHuh8XN90OjfuWAk7+WXIR5uQRPbbWlSgZu8ya 4=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@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 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: oR7G4JNTMS4paASmxqOKN3Z+jn+ViELXowzJJjdiXAYukZRbjZU0mKlEynaE1eSyo34/alwK4I 592OgIzUi35Nk8nN+PP4SZM71P9wf3XWlBVUTEe9Gu4kAVDElUiZqttccPRvziv8fxYHATBDY1 Jn4vXVnPVeu3/m4jTTwqQ/q7TiMZFFO43VhAMqz1LUJCbuITLkpI1qMgqNXd4gHy0PANMoYckE BjX9M382mQUNfad33HHZeGwFt2tD5zaaWyaXnL8z0/TxtbqkJRYMQtPP/jFrhP4JMPPC3CbnAs dKk= X-SBRS: 2.7 X-MesageID: 15970648 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,407,1580792400"; d="scan'208";a="15970648" Subject: Re: [PATCH 1/3] x86/pv: Options to disable and/or compile out 32bit PV support To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <20200417155004.16806-1-andrew.cooper3@citrix.com> <20200417155004.16806-2-andrew.cooper3@citrix.com> <20200420134757.GS28601@Air-de-Roger> From: Andrew Cooper Message-ID: <71867ff0-6b4b-0355-d547-8ba7685a89e2@citrix.com> Date: Mon, 20 Apr 2020 18:31:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200420134757.GS28601@Air-de-Roger> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) 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: Xen-devel , Wei Liu , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 20/04/2020 14:47, Roger Pau Monné wrote: > On Fri, Apr 17, 2020 at 04:50:02PM +0100, Andrew Cooper wrote: >> This is the start of some performance and security-hardening improvements, >> based on the fact that 32bit PV guests are few and far between these days. >> >> Ring1 is full or architectural corner cases, such as counting as supervisor > ^ of Already fixed (I spotted it 30s after posting). >> from a paging point of view. This accounts for a substantial performance hit >> on processors from the last 8 years (adjusting SMEP/SMAP on every privilege >> transition), and the gap is only going to get bigger with new hardware >> features. >> >> Signed-off-by: Andrew Cooper >> --- >> CC: Jan Beulich >> CC: Wei Liu >> CC: Roger Pau Monné >> >> There is a series I can't quite post yet which wants to conditionally turn >> opt_pv32 off, which is why I've put it straight in in an int8_t form rather > s/in in/in/ "in in" is legitimate in some cases, despite it looking awkard.   In this case, the structure is "straight in", separate from "in an int8_t form". If this sentence were for inclusion in the commit message, I'd have probably spent more effort trying to phrase it differently. > >> than a straight boolean form. >> --- >> docs/misc/xen-command-line.pandoc | 12 +++++++++++- >> xen/arch/x86/Kconfig | 16 ++++++++++++++++ >> xen/arch/x86/pv/domain.c | 35 +++++++++++++++++++++++++++++++++++ >> xen/arch/x86/setup.c | 9 +++++++-- >> xen/include/asm-x86/pv/domain.h | 6 ++++++ >> 5 files changed, 75 insertions(+), 3 deletions(-) >> >> diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc >> index acd0b3d994..ee12b0f53f 100644 >> --- a/docs/misc/xen-command-line.pandoc >> +++ b/docs/misc/xen-command-line.pandoc >> @@ -1694,7 +1694,17 @@ The following resources are available: >> CDP, one COS will corespond two CBMs other than one with CAT, due to the >> sum of CBMs is fixed, that means actual `cos_max` in use will automatically >> reduce to half when CDP is enabled. >> - >> + >> +### pv >> + = List of [ 32= ] >> + >> + Applicability: x86 >> + >> +Controls for aspects of PV guest support. >> + >> +* The `32` boolean controls whether 32bit PV guests can be created. It >> + defaults to `true`, and is ignored when `CONFIG_PV32` is compiled out. >> + >> ### pv-linear-pt (x86) >> > `= ` >> >> diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig >> index 8149362bde..4c52197de3 100644 >> --- a/xen/arch/x86/Kconfig >> +++ b/xen/arch/x86/Kconfig >> @@ -49,6 +49,22 @@ config PV >> >> If unsure, say Y. >> >> +config PV32 >> + bool "Support for 32bit PV guests" >> + depends on PV >> + default y >> + ---help--- >> + The 32bit PV ABI uses Ring1, an area of the x86 architecture which >> + was deprecated and mostly removed in the AMD64 spec. As a result, >> + it occasionally conflicts with newer x86 hardware features, causing >> + overheads for Xen to maintain backwards compatibility. >> + >> + People may wish to disable 32bit PV guests for attack surface >> + reduction, or performance reasons. Backwards compatibility can be >> + provided via the PV Shim mechanism. >> + >> + If unsure, say Y. >> + >> config PV_LINEAR_PT >> bool "Support for PV linear pagetables" >> depends on PV >> diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c >> index 70fae43965..47a0db082f 100644 >> --- a/xen/arch/x86/pv/domain.c >> +++ b/xen/arch/x86/pv/domain.c >> @@ -16,6 +16,39 @@ >> #include >> #include >> >> +#ifdef CONFIG_PV32 >> +int8_t __read_mostly opt_pv32 = -1; >> +#endif >> + >> +static int parse_pv(const char *s) > __init > > With that: > > Reviewed-by: Roger Pau Monné Thanks, ~Andrew