From nobody Fri May 3 21:46:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576505008; cv=none; d=zohomail.com; s=zohoarc; b=a0rMaLwCt9zlV/+fc139Hj7vc+Zc8vmCRgwkgsI+xBl1EGSFMUHmHUdL12yX+jpWz6+j77VIF8hCNu5wMknWjGH7OHquFEqqu4ooQBh0V7lcd9QZb4UkymkZ6pyzRFsHV2413cY9w9Kj+dtWuLXtiw1l9KrGe/KqvgADcbM20Hk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576505008; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=lziXsIcNX1eiIt+QdnZ+4farfeV7K6TkygEkO6Rv2Dg=; b=CY1avdYA8ggBLgEOLhjR5nlQ/K8m9w5QhP5UijserQBJRgzUxiZ+lfKBXhw5WjlS9kBMKuP2U84trQzxdUR7qd75P6ZrYyl2zvIjDL03d3gmn0UTSUHMB5xQw/Pw0wjRuA7ANfTx9SDScFdSpHBwjLHbBFDhy/o6+gv0zsAJ3Rc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576505008105327.23809000589085; Mon, 16 Dec 2019 06:03:28 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1igqxN-00053X-6C; Mon, 16 Dec 2019 14:02:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1igqxM-00053P-11 for xen-devel@lists.xenproject.org; Mon, 16 Dec 2019 14:02:40 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b34ef482-200c-11ea-b6f1-bc764e2007e4; Mon, 16 Dec 2019 14:02:31 +0000 (UTC) X-Inumbo-ID: b34ef482-200c-11ea-b6f1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576504951; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=d+5CN1bbsgCynDpdONeTI6M48SZ2l36mbPg1F1H06kE=; b=h9eO1Pis+MgdlZihIj4DOLF6W6v1WHuEl5CC/gqbdLWhjdGgrjuS0DqY M9+s2K0YFTnDFeECmwahyPbyMuMdVDGMxSJ4/Cgmf0kjLtd2HqLIFjs+7 HkOQHgIuhoOVuVdlsIkGDDtUHJwIISRilZhHac2UthAGwYjiyr7GPYsKh 8=; Authentication-Results: esa6.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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.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=esa6.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 (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: YTYB84jY1Yyf96GAq/RIRvQZKX9TNrljwV8mDXFfB+Z4thOIFDGPiqvF/HK0B3JbaR/3BcIN2q fZcpfyLbQ75p8UeVXjIBePpzVFWqTIOm7/4Tb/v/LcqM74GtIAdVaQGxoDewyJ5oZy+82RGLkf cqYckZkcpVwHIsjF//ACmdpx5yEUr2T/NiVCMIvnm4c+WCkcnKTlt9wdwzXacN9JFqj96cOtIY Lupdv+KQla/AN6x9mn0prJ8krg8ZKlnJPBz7ef81hvnKunee7cWcE5cDNERO6A1Ug5XdlSqGlF Vng= X-SBRS: 2.7 X-MesageID: 10140307 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,321,1571716800"; d="scan'208";a="10140307" From: Andrew Cooper To: Xen-devel Date: Mon, 16 Dec 2019 14:02:27 +0000 Message-ID: <20191216140227.19234-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/pv: Fix `global-pages` to match the documentation 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) c/s 5de961d9c09 "x86: do not enable global pages when virtualized on AMD or Hygon hardware" in fact does. Fix the calculation in pge_init(). While fixing this, adjust the command line documenation, first to use the newer style, and to expand the description to discuss cases where the option might be useful to use, but Xen can't account for by default. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- docs/misc/xen-command-line.pandoc | 24 +++++++++++++++--------- xen/arch/x86/pv/domain.c | 4 ++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 7a1be84ca9..cb54a000fc 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1087,18 +1087,24 @@ value settable via Xen tools. =20 Dom0 is using this value for sizing its maptrack table. =20 -### global-pages (x86) -> `=3D ` +### global-pages + =3D + + Applicability: x86 + Default: true unless running virtualized on AMD or Hygon hardware =20 -> Default: `true` unless running virtualized on AMD or Hygon hardware +Control whether to use global pages for PV guests, and thus the need to +perform TLB flushes by writing to CR4. This is a performance trade-off. =20 -Set whether the PGE bit in CR4 will be enabled for PV guests. This control= s the -usage of global pages, and thus the need to perform tlb flushes by writing= to -CR4. +AMD SVM does not support selective trapping of CR4 writes, which means tha= t a +global TLB flush (two CR4 writes) takes two VMExits, and massively outweigh +the benefit of using global pages to begin with. This case is easy for Xe= n to +spot, and is accounted for in the default setting. =20 -Note it's disabled by default when running virtualized on AMD or Hygon har= dware -since AMD SVM doesn't support selective trapping of CR4, so global pages a= re -not enabled in order to reduce the overhead of TLB flushes. +Other cases where this option might be a benefit is on VT-x hardware when +selective CR4 writes are not supported/enabled by the hypervisor, or in any +virtualised case using shadow paging. These are not easy for Xen to spot,= so +are not accounted for in the default setting. =20 ### guest_loglvl > `=3D [/]` where level is `none | error | warn= ing | info | debug | all` diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c index e6e1c51548..ed5111fc47 100644 --- a/xen/arch/x86/pv/domain.c +++ b/xen/arch/x86/pv/domain.c @@ -125,8 +125,8 @@ static int __init pge_init(void) { if ( opt_global_pages =3D=3D -1 ) opt_global_pages =3D !cpu_has_hypervisor || - (boot_cpu_data.x86_vendor & - (X86_VENDOR_AMD | X86_VENDOR_HYGON)); + !(boot_cpu_data.x86_vendor & + (X86_VENDOR_AMD | X86_VENDOR_HYGON)); =20 return 0; } --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel