From patchwork Wed May 25 08:13:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12860762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 42C94C43217 for ; Wed, 25 May 2022 08:13:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.336975.561428 (Exim 4.92) (envelope-from ) id 1ntm96-0006Xl-UH; Wed, 25 May 2022 08:13:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 336975.561428; Wed, 25 May 2022 08:13:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ntm96-0006Xe-RC; Wed, 25 May 2022 08:13:32 +0000 Received: by outflank-mailman (input) for mailman id 336975; Wed, 25 May 2022 08:13:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ntm95-0006XS-Er for xen-devel@lists.xenproject.org; Wed, 25 May 2022 08:13:31 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8e054db6-dc02-11ec-bd2c-47488cf2e6aa; Wed, 25 May 2022 10:13:30 +0200 (CEST) Received: from mail-bn8nam11lp2175.outbound.protection.outlook.com (HELO NAM11-BN8-obe.outbound.protection.outlook.com) ([104.47.58.175]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 May 2022 04:13:26 -0400 Received: from DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) by SN2PR03MB2384.namprd03.prod.outlook.com (2603:10b6:804:c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Wed, 25 May 2022 08:13:24 +0000 Received: from DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e]) by DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e%5]) with mapi id 15.20.5273.023; Wed, 25 May 2022 08:13:24 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8e054db6-dc02-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1653466410; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=POv1bx7iLdSJsiqqXLREhhkckNI2R8ta4CoCgLlMJAo=; b=GxtGRH/71K4d9ap1vUH76g5Y+NJWjnQ86HnIUS94HhKmP73R3lZfnaL2 JkKbFsRpA0pQM2lzHKruQRcxF9QjpR92e5cb2STbhvHkeF8N8cQAZJNhv /VARbbcGyS0xXYwrGFG1/zbsahZ0lDBaKiYoPJoX30bf9Js+3+5nYHGdQ o=; X-IronPort-RemoteIP: 104.47.58.175 X-IronPort-MID: 72524842 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:gWf8N6z476+KTl2bQiZ6t+dDxyrEfRIJ4+MujC+fZmUNrF6WrkVVm jEcUWCEO/fcNmb3KNt1a9vl9B8Ovp+HzdAxTlNt+yAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX5JZS5LwbZj2NY124XhWmthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ NplmKGcTC55Joj1k99HA0BgDwNbL/F/9+qSSZS/mZT7I0zuVVLJmqwrJmdmeIoS96BwHH1E8 uEeJHYVdBefiumqwbW9DO5xmsAkK8qtN4Qa0p1i5WiBUbB6HtaeE+OTuoIwMDQY36iiGd7EY MUUc3x3ZQnoaBxTIFYHTpk5mY9Eg1GgKWAC9ALJ/8Lb5UD/kB4o++PHHOCJe+LaT8VImB2en 0TvqjGR7hYycYb3JSC+2mKhgKrDkD32XKoWFaak7bh6jVuL3GsRBRYKE1yhrpGRiESzRtZeI Ew84Tc1oO4580nDZsb5dw21pjiDpBF0ZjZLO+gz6QXIwKyE5Q+cXzEAVmQYN4Fgs9IqTzs30 FPPh8nuGTFkrLySTzSa66uQqjSxfyMSKAfueBM5cOfM2PG7yKlbs/4FZo8L/HKd5jEtJQzN/ g== IronPort-HdrOrdr: A9a23:p3yZ9Kyiar+6fFHZ+uFMKrPwFb1zdoMgy1knxilNoH1uA7Wlfq WV9sjzuiWE7Qr5NEtQ++xofZPwIk80lqQV3WByB8bHYOCOggLBR72Kr7GD/9SKIVyYygcy79 YHT0G8MrHN5JpB4PoSLDPWLz/o+re6zJw= X-IronPort-AV: E=Sophos;i="5.91,250,1647316800"; d="scan'208";a="72524842" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZxDXUsvm66e47gMMiMemaWD2VJdj8k6lXhMIRMp5okaFYwmx8GRljMvlCwnCV+m2+sjoLe7QbFuK208Yte0AxP/Xr3/tQxjLX+WvmO6F+sqrpncFz7po6SUfAZo1JQCd1owWTomYg7wveAslVX5ha8ZvposqSX0T53kdhwy1/bT3VRUCCCXu/CIzt4rMuw5mJO6jMqH3KN6Ym8kFf5Jw2CSRE5KXbjHabQez6nI8IIHCaS/uZSjgU2s08WpZIjGCSUssiTw90lBn/3S7sUSP7oCyS5y4JJBKBGwyNLoqvMA1loVSmNhR+3K4O172bG+CxGLxNZgIVqO4Boh+ZIBZ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Pv4o2EB645bspSYKdAOEJYy3+IXNe5d0keMtqwzqBBs=; b=XoHVZyFQaAslN+Vsq6/7vDKjzzFytUhFRGxEYwz2l7yqOjKuW11F186AIv2Gy0FM+9Y6+lAf34XkIzD6jCAjZji055Ug/QNhoD6Ew+O8vZbpNyFBtD0ArH7TOcHNxbtZ/9LaLPdkTotrF2FvhFsAuZkw9LMVIKBaMTkv0CuYF03nJqril8mmhiHIHQXBoGDamHMHqxIblW3wfVAXvX9/izJO4eagq0qp7MfCVjkTbcgHzTB2C+PsKf+CRjI9NYv54492t+mk4w0n3FH0kyanr0V6PY9dlGQtP9tdtAfCUNWm351XE9KT8e3bDlPs4gHxcmBOb+/ZSQVk36JDcfFZ2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pv4o2EB645bspSYKdAOEJYy3+IXNe5d0keMtqwzqBBs=; b=xJ6Dd3ldkjn6gMC7uRru43S411gHiYa9N/mLSt8Trbb+UGqL6NnPLsctVGyTKWX8kXQIY3bL/7b/vADaj5wqI8rzwtpSpjvEYYZ4Igau80YClqwhoPCnubY/yMlEu6LUDnnT0rSRFSQzJQaM6dZZ6YuZmpJxPEGKTUoLzqaDatw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH v3 1/2] x86/mm: rename FLUSH_FORCE_IPI to FLUSH_NO_ASSIST Date: Wed, 25 May 2022 10:13:10 +0200 Message-Id: <20220525081311.13416-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220525081311.13416-1-roger.pau@citrix.com> References: <20220525081311.13416-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0379.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18f::6) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c25b9bf1-0dc4-40e3-c153-08da3e26702b X-MS-TrafficTypeDiagnostic: SN2PR03MB2384:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oGdZVQgL8YveeSzbuWPpZ8ulCvnDyHMFcb4Ijx7W37impbPc2/SdUBxdGVGGahULzopoGR4sLGzaYTJxs9MKIpG73MieFOwS0Z1jG+6Rvb2V90kw7Mm55tDF63BRHNn/iTmMEq0htHAm+m3GIwMplPkxZ6CkVa4PAjmh51OjR8kOiA1BFD9QcCaZYiGONkK3bzURumBLjtMiQn2OqipRSLKwttMwZxqG3cSalFxYgoHAiv8bnBhQ44CGHGCkIuqySYcx6LQ6uytxSfcgzSygG7hXniP5y2+/8B/mHv8FH8QPyMqJqZ/fsaf5w28bp4MT1z8U2S6UJSmAA+Pn7N35XaORvn4/MF9PC1DrEZcwlsUyBu2yetalxevHz4cgEKtK53OUUfI+5FwiOpBXzuckIO3azk92L6ijQAJd5GjxJEA9LUH3O67WUTxCeHhnZTvdgqC26+FqBwXVtvpb219iYisYENwdgN7EN8sSSp3uj6S44ZTVpFpyg24VK5TOSh8RVnsTEhyXZl2K676ugMNJqIuNMKLAfjtUUy8HVBANqfFlHfYufR+JrnjjfBhL5/ZamNYPvIB/D1cWyXJ8zlvxCl66h0vfs8T5ON/smKBxETVWbpWt9JTNqo0pvgrc8YIHJXghJxpCpQsvW38Vc7Vrbg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66556008)(66946007)(66476007)(6506007)(4326008)(26005)(6512007)(8676002)(82960400001)(86362001)(5660300002)(508600001)(83380400001)(8936002)(6486002)(1076003)(2906002)(38100700002)(316002)(2616005)(6666004)(36756003)(186003)(6916009)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?E+Vlb3mA2HJBdewj4daQ/9upQqh8?= =?utf-8?q?MSZraN+aV2b6og0UtNSTgnVGWmyTJXL3Hj6BnzVmzsNZ4zX28zZAILiRBbbmD1wND?= =?utf-8?q?qX5LDRT2nySnpk/dRIr/VVpaJOjMzbmDAYhKwKJIIeuHtHrEiXsCqIHmlo5PqgSEu?= =?utf-8?q?V5z6fYqniXAFr8nuWEuWOW5h3VKemNprWNlSRIRmSMR/KAMCuNpqATNi9f0+8l2nk?= =?utf-8?q?MaC1dPyHlfOLy6NF5Ply2+VHkBE4hq/p7ck52WYu9xZTpeC1lgvx7NpZPQUpN2WZS?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YFLD29Id/IOB5hb7KJq6NaKt6Fi+N+vvTG4jEAk6ZCy8CP6yk?= =?utf-8?q?aC5P1BqpLDZOa4KRYTdBOQvUb6pjdzASZLcyAcARc6vEnCbkchpwyiTbSoQ8XcJbD?= =?utf-8?q?QLZHA3e47qcwVYndfI4fI24A5S7WyUJPz/epq/w71snp5zMW/Yiw6xOSBA1xCFN+M?= =?utf-8?q?rMqWFfkSfCjj8ZLnEp1ZdIqizJN2pXmb/y77F6TOrppyyELv2oLWOqh7JW04aiJXP?= =?utf-8?q?GMPN/LQpZgMfQP6D0DEpvGNvhFIeOhlQDwEQD0PUUHzvQoMvQzQj0BhTd5bitrE1c?= =?utf-8?q?H1r70Xj1NsFjemivcJx1u5PpSQmdseerGaSNc9pC4ZauEubwBNBLeQHsA8XBEKqyt?= =?utf-8?q?9wdXDPzTuFOC9ow8hzqqaswLv31rHIKWmZWsX1eWpTj01Fr6o1kVIL/nYeiLC8tn9?= =?utf-8?q?ApqJ3Y3NVq1g1NZLoCSpEJS4EBJYkucuxASdL/SPbZc8B8WDqMknP8Bx+9+WOaZDh?= =?utf-8?q?Z22YV4OBxGYjVms1y4k7hxgmWXsweXvYFSSqXaTd7evUBfiYChJZ8=3D?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: c25b9bf1-0dc4-40e3-c153-08da3e26702b X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2022 08:13:23.9203 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Bv2HdBE6MOvPW7xXsW9XTBZu9RVBEaokQYVBW0TZsjnUj/5naqfF9saYFoy1mSRHnitxEWSGJ7LaYZ3oF56zJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2384 Rename the flag to better note that it's not actually forcing any IPIs to be issued if none is required, but merely avoiding the usage of TLB flush assistance (which itself can avoid the sending of IPIs to remote processors). No functional change expected. Requested-by: Jan Beulich Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- Changes since v2: - New in this version. --- xen/arch/x86/include/asm/flushtlb.h | 16 ++++++++-------- xen/arch/x86/mm.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/include/asm/flushtlb.h b/xen/arch/x86/include/asm/flushtlb.h index 18777f1d4c..a461ee36ff 100644 --- a/xen/arch/x86/include/asm/flushtlb.h +++ b/xen/arch/x86/include/asm/flushtlb.h @@ -128,13 +128,12 @@ void switch_cr3_cr4(unsigned long cr3, unsigned long cr4); #endif #if defined(CONFIG_PV) || defined(CONFIG_SHADOW_PAGING) /* - * Force an IPI to be sent. Note that adding this to the flags passed to - * flush_area_mask will prevent using the assisted flush without having any - * other side effect. + * Adding this to the flags passed to flush_area_mask will prevent using the + * assisted flush without having any other side effect. */ -# define FLUSH_FORCE_IPI 0x8000 +# define FLUSH_NO_ASSIST 0x8000 #else -# define FLUSH_FORCE_IPI 0 +# define FLUSH_NO_ASSIST 0 #endif /* Flush local TLBs/caches. */ @@ -162,11 +161,12 @@ void flush_area_mask(const cpumask_t *, const void *va, unsigned int flags); flush_area_mask(mask, (const void *)(v), FLUSH_TLB|FLUSH_ORDER(0)) /* - * Make the common code TLB flush helper force use of an IPI in order to be - * on the safe side. Note that not all calls from common code strictly require + * Make the common code TLB flush helper disallow the usage of any flush + * assistance in order to be on the safe side and interrupt remote processors + * requiring a flush. Note that not all calls from common code strictly require * this. */ -#define arch_flush_tlb_mask(mask) flush_mask(mask, FLUSH_TLB | FLUSH_FORCE_IPI) +#define arch_flush_tlb_mask(mask) flush_mask(mask, FLUSH_TLB | FLUSH_NO_ASSIST) /* Flush all CPUs' TLBs */ #define flush_tlb_all() \ diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 72dbce43b1..bbb834c3fb 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2988,7 +2988,7 @@ static int _get_page_type(struct page_info *page, unsigned long type, flush_mask(mask, (x & PGT_type_mask) && (x & PGT_type_mask) <= PGT_root_page_table - ? FLUSH_TLB | FLUSH_FORCE_IPI + ? FLUSH_TLB | FLUSH_NO_ASSIST : FLUSH_TLB); } From patchwork Wed May 25 08:13:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12860761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3CCF1C4332F for ; Wed, 25 May 2022 08:13:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.336977.561450 (Exim 4.92) (envelope-from ) id 1ntm98-00072w-Jw; Wed, 25 May 2022 08:13:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 336977.561450; Wed, 25 May 2022 08:13:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ntm98-00072Z-Ee; Wed, 25 May 2022 08:13:34 +0000 Received: by outflank-mailman (input) for mailman id 336977; Wed, 25 May 2022 08:13:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ntm96-0006XS-Mv for xen-devel@lists.xenproject.org; Wed, 25 May 2022 08:13:32 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9041dd70-dc02-11ec-bd2c-47488cf2e6aa; Wed, 25 May 2022 10:13:31 +0200 (CEST) Received: from mail-bn8nam11lp2173.outbound.protection.outlook.com (HELO NAM11-BN8-obe.outbound.protection.outlook.com) ([104.47.58.173]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 May 2022 04:13:30 -0400 Received: from DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) by SN2PR03MB2384.namprd03.prod.outlook.com (2603:10b6:804:c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Wed, 25 May 2022 08:13:28 +0000 Received: from DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e]) by DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e%5]) with mapi id 15.20.5273.023; Wed, 25 May 2022 08:13:28 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9041dd70-dc02-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1653466411; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=8F7EfaoMWpTNFHcKmBPjZ/vxeH0S1RpTiRruL/e6XuI=; b=I3VcSb9weGC1vaMZDePovtTOQ6ZtVi6d5VDYgFVKooqsq26Q5aj6VWjl zAuoUHM4w/t1QeEOl/sDfYGEX9kigfiyGfiiyXsGta680gai9Y/ty8tuq Nd++r3vicsxEEqF4LCywpnTBSYlIdnKP2VAJMzPeD1AF3x3T+ucZVwEmn A=; X-IronPort-RemoteIP: 104.47.58.173 X-IronPort-MID: 72524846 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:8Ay8EqvDwx6n5ip6Qzbj3d43Z+fnVCJfMUV32f8akzHdYApBsoF/q tZmKTuEOf2CYzP1f95xPou39k4P7MXdx4dgTQo6pX81EStG+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQywobVvqYy2YLjW17X5 IuryyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi92GqrJw7o3fSUGTSZ7B5MYp+7iIyKW5Jn7I03uKxMAwt1IJWRvZMgy3LYyBmtDs /sFNDoKcxaPwfqsx662QfVtgcJlK9T3OIQYuTdryjSx4fQOGMifBfmVo4IImm5v3aiiHt6HD yYdQSBoYxnaJQVGJ38cCY4knffujX76G9FdgA3P+PBrszSNpOB3+LrmF+rrYv26fOt2t2udj 0DI70inByhPYbRzzhLAqBpAnNTnjS79HY4fCrC83vprm0GIgHweDgUMUlm2quX/jVSxM/pdI UEJ/islrYAp6VemCNL6WnWQv3qsrhMaHd1KHIUHBBqlz6PV50OTADgCRzsYMdg+7pZpHnoty 0ODmM7vCXp3qrqJRHmB97CS6zSvJSwSKmxEbigBJecY3+TeTEgIpkqnZr5e/GSd1bUZxRmYL +i2kRUD IronPort-HdrOrdr: A9a23:PYK6yKsqmZF4n5WVfE4BMqud7skC5IMji2hC6mlwRA09TyXGra 2TdaUgvyMc1gx7ZJhBo7+90We7MBHhHPlOkPMs1NaZLXLbUQ6TQL2KgrGSpwEIdxefygcZ79 YYT0EcMqyOMbEFt7ec3ODQKb9Jrri6GeKT9J/jJh9WPH1XgspbnmJE42igYy5LrF4sP+tFKH PQ3LsPmxOQPVAsKuirDHgMWObO4/XNiZLdeBYDQzoq8hOHgz+E4KPzV0Hw5GZUbxp/hZMZtU TVmQ3w4auu99m91x/nzmfWq7BbgsHoxNdvDNGFzuIVNjLvoAC1Y5kJYczLgBkF5MWUrHo6mt jFpBkte+x19nPqZ2mw5SDg3gHxuQxen0PK+Bu9uz/OsMb5TDU1B45qnoRCaCbU7EImoZVVzL 9L93jxjesZMTrw2ADGo/TYXRBjkUS55VA4l/QIsnBZWYwCLJdMsI0k+l9PGptoJlO31GkeKp guMCjg3ocXTbvDBEqp/VWHgebcE0jbJy32DHTr4aeuonprdHMQ9Tps+CVQpAZEyHsHceg02w 31CNUXqFhwdL5nUUsEPpZmfSKWMB27ffueChPlHbzYfJt3SE7lmtrQ3Igfwt2MVdgh8KYS8a 6xIm+w81RCMX7TNQ== X-IronPort-AV: E=Sophos;i="5.91,250,1647316800"; d="scan'208";a="72524846" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FdCTcHnhrys4QppJRE05fjAi4Vb3Hr4iSZ21awdJoz60fzthZrnoJz8nTsbmsyu2m/veezDGm0Um0mx/ctgSo6pyfcxbicHybxn4NxnxRPvpz82r4j+vT+RXCFHxkgCF+1DCim3ViYxisgmFW6Yz/0H8ct2wxGjyLjaRAD3NuK8MmF4srvFKVjo0rX4mw1Yd2C11IijtGSDyqlNOLsALO1o/e87M9s+M1TJf3xhLFDQ6A4uHjTFBBd3s+hwAGWzEcDisVRGy04i5tKSeqUMnuTqh0BXNvHFHZWL31ezGD86OY6EtySlT25ZkbTJ4akwmwKI+AFt3x5cfIOrU4L2IuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QuFt592UrrbYEvjJPFgpDXuLgHLJ3o7mGGCCs3x5yqg=; b=AaGuv3qoijmUAvXzxRFD8MJi1ekeGChpTXQdxiPd33iPRh8ddhO/dWp2A1zgIUim1vkny+lUOBvtYVan05CXT0BBQz4t9q7WVGkYVJQ7owvw2yE0sDWHkRzojI74baysYhkfWCreuF/TDlojinPOu7Hh0Q8j7chpbGRAwQIkKAJpEg283fIl4xMeZO11Gymt1ZN1RJwtuBPf7Lp0IMBcr7sAdWNQa6M1yicYwwRYxhLC9p2XUpiPESK/XFLIadDHLHzMI657ZOOvT70hbDHM0jOfQtDLFGAeurPioSlGYQ1HUIhnRhCVtB7kdXXwT86pnlSR5jUw2i2/ImgzRfusjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QuFt592UrrbYEvjJPFgpDXuLgHLJ3o7mGGCCs3x5yqg=; b=a9PFeflKCZUswGNDiwe2mS2MXBY976k6ayVUhIO82DAq/vJPD/rR/DOvNTPqXeRsocMcNT4RPTRlLBLW5GBQv9pMOwKIYjqvCH/YzGIJqV2BHxkHA/a6fWbg/7KITfZAEhECYkyQGnXj8JVdtK5UNSpfhxuzedeDxak7mGVJbOQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH v3 2/2] x86/flushtlb: remove flush_area check on system state Date: Wed, 25 May 2022 10:13:11 +0200 Message-Id: <20220525081311.13416-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220525081311.13416-1-roger.pau@citrix.com> References: <20220525081311.13416-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::7) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c5b8d78e-8596-4c36-6a85-08da3e2672a1 X-MS-TrafficTypeDiagnostic: SN2PR03MB2384:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5z9g20HgFkjv5Ki2FLNo+Cjodi08bd77CofPYM9HRIursp6yichgLPAdTVF6awbNSWZ/0McWl6Q2iex59c9CdF2szeEAJXlDVtSXDWEgquaNtkfGQZYX663dS/znvGEt0gA6jAiktLLUwzYWouC2FIdqV7YbGxbBcZ8Xckf8cuLaPif6lJSOtbb4rjgptKfFfAZBLwS3wqnj9ogjkxiUXZj7OvRENu/VbYXFdrbKOwDPs1rwxV4Ti2qGaTSz/cn0SmDkQF0nhHiFlC+MA2z9wQTdf38Y0nb0dc2VCutOs2Y/GcKnyozKtKlOG+IP6IcTW9ezMXB/Zu+B9tYfPcm9OMby6I5mOPhlxiuysbfYCLQembR28EMv6eblxam4lZTfJu9UKolg5ZmNDyLBQmfNl24vmCCJfzL0z75QmT4ziGiiSh1yRZkLSohYdFJBUgREHhDY9GMv9NcdxOguRLwKZ0sr0535JidQoiuAnlkHVpgZvUBW9zXOlHYi4oKWgl6LWwngH/D8mwkgbH5YKVhcUxh7C4Wl/ydryA/163WZwJyZrS25gfq/8AKrxHqMeX5SR1TyNn6ld0Kxhc1tvky/Or6ejPehVHMm4zMWbjZh5aDe6LcQamuahgBtz5BJO0rgjx2nrR2axCQNVB/NTAeY8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66556008)(66946007)(66476007)(6506007)(4326008)(26005)(6512007)(8676002)(82960400001)(86362001)(5660300002)(508600001)(83380400001)(8936002)(6486002)(1076003)(2906002)(38100700002)(316002)(2616005)(6666004)(36756003)(186003)(6916009)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+YgfbgZ/wS2xn6rbZPWwJJZD1h/H?= =?utf-8?q?7O8HSOBTloFXaPZuUOKABUdq5/Hlr3CxzcDKn4TMWiWQBl+Z/VHfZqhO1u86AekY8?= =?utf-8?q?RA3RoCFjUMfjq7k3dwNT4ZChBHgsRvT/qaLmeaJqdjC7TstnqsNG019jvgIhytbbu?= =?utf-8?q?oSkyKnWOkoD92QsBXhqU/STVUn/G0whcYWriMtRFdBoiBEZKTqivqBm2YV29dX6Iu?= =?utf-8?q?t0H56f9n97k0eOz8JCzlFv8rLyirSo3jyd1ft6zHQbtrSbkScJmuCgH6U0wGpCMA6?= =?utf-8?q?UwHEgF2QmZn5FdDaZT4tg+md1aAaVwDpsGwofxqKmj7xgaBkwVJZ+flLVylc00Z8D?= =?utf-8?q?vc4zw5Di3gi6EyYBrmQkmr0cO2XUxpLtHL/lRzVqLXElavPMi86zvGGFLFOt9f3O4?= =?utf-8?q?YgWfwrSbj8C0O5v/Mt12FGhR7sj3NCdVCs81oY/ykrElS/5+8gY8NeSJWNuLs8Uwj?= =?utf-8?q?7rnOF5c7S2ptyVf9dpXhU+CVTbgECzuIxfb2zI+9me6hB5GorZEONVfaJS7WrLklL?= =?utf-8?q?aZfVmkmWEz7V7NmL9V54w6+6MAblayWUr1xI8IvCzq5dkb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NmOe6?= =?utf-8?q?9oHLUGnVBgg+IS000pgMzMSr/UNkNK7zMGORojTaCC2NFaz7+T/0zVgcyqx6BcjBC?= =?utf-8?q?7/TcsriPvbrH3I7ELvgJKBl9eRwj1+XrcPAxHh/n49e/93WLd9xPxiW03LE8mz47u?= =?utf-8?q?ST9JLCTi0s9oyTjwYHFObuF6VX+zt4gEv9A4B/8J9tExMKLadoAcLRJ4tAHk8Rfzk?= =?utf-8?q?nf4m0cdE71mjTOyNDOwpIhsGJJbuSUeEwWioW1dogFr/1mQrwbgSY=3D?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5b8d78e-8596-4c36-6a85-08da3e2672a1 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2022 08:13:28.0925 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 61YIBSJK7dWjfKR3+7YDhdrKu9OgCa3HPi9L8HxLZKwWU0ELIA/h1EfsuBfNrkYlul2EgaEME86bWHdT8FxF6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2384 Booting with Shadow Stacks leads to the following assert on a debug hypervisor: Assertion 'local_irq_is_enabled()' failed at arch/x86/smp.c:265 ----[ Xen-4.17.0-10.24-d x86_64 debug=y Not tainted ]---- CPU: 0 RIP: e008:[] flush_area_mask+0x40/0x13e [...] Xen call trace: [] R flush_area_mask+0x40/0x13e [] F modify_xen_mappings+0xc5/0x958 [] F arch/x86/alternative.c#_alternative_instructions+0xb7/0xb9 [] F alternative_branches+0xf/0x12 [] F __start_xen+0x1ef4/0x2776 [] F __high_start+0x94/0xa0 This is due to SYS_STATE_smp_boot being set before calling alternative_branches(), and the flush in modify_xen_mappings() then using flush_area_all() with interrupts disabled. Note that alternative_branches() is called before APs are started, so the flush must be a local one (and indeed the cpumask passed to flush_area_mask() just contains one CPU). Take the opportunity to simplify a bit the logic and make flush_area() an alias of flush_area_all() in mm.c, taking into account that cpu_online_map just contains the BSP before APs are started. This requires widening the assert in flush_area_mask() to allow being called with interrupts disabled as long as it's strictly a local only flush. The overall result is that a conditional can be removed from flush_area(). While there also introduce an ASSERT to check that a vCPU state flush is not issued for the local CPU only. Fixes: (78e072bc37 'x86/mm: avoid inadvertently degrading a TLB flush to local only') Suggested-by: Andrew Cooper Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- Changes since v2: - Fix commit message. - Keep flush_area() in mm.c and reduce code churn. Changes since v1: - Add an extra assert. - Rename flush_area() to flush_area_all(). --- xen/arch/x86/mm.c | 9 ++------- xen/arch/x86/smp.c | 5 ++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index bbb834c3fb..038f71ecf4 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5070,13 +5070,8 @@ l1_pgentry_t *virt_to_xen_l1e(unsigned long v) #define l1f_to_lNf(f) (((f) & _PAGE_PRESENT) ? ((f) | _PAGE_PSE) : (f)) #define lNf_to_l1f(f) (((f) & _PAGE_PRESENT) ? ((f) & ~_PAGE_PSE) : (f)) -/* - * map_pages_to_xen() can be called early in boot before any other - * CPUs are online. Use flush_area_local() in this case. - */ -#define flush_area(v,f) (system_state < SYS_STATE_smp_boot ? \ - flush_area_local((const void *)v, f) : \ - flush_area_all((const void *)v, f)) +/* flush_area_all() can be used prior to any other CPU being online. */ +#define flush_area(v, f) flush_area_all((const void *)v, f) #define L3T_INIT(page) (page) = ZERO_BLOCK_PTR diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c index 0a02086966..b42603c351 100644 --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -262,7 +262,10 @@ void flush_area_mask(const cpumask_t *mask, const void *va, unsigned int flags) { unsigned int cpu = smp_processor_id(); - ASSERT(local_irq_is_enabled()); + /* Local flushes can be performed with interrupts disabled. */ + ASSERT(local_irq_is_enabled() || cpumask_subset(mask, cpumask_of(cpu))); + /* Exclude use of FLUSH_VCPU_STATE for the local CPU. */ + ASSERT(!cpumask_test_cpu(cpu, mask) || !(flags & FLUSH_VCPU_STATE)); if ( (flags & ~(FLUSH_VCPU_STATE | FLUSH_ORDER_MASK)) && cpumask_test_cpu(cpu, mask) )