From nobody Sun May 24 22:42:18 2026 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azon11010065.outbound.protection.outlook.com [52.101.46.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 456E03A4526 for ; Wed, 20 May 2026 17:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.46.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779296562; cv=fail; b=DERCpqa81ETW5mISHB8aeaLhmk3Lg5hKVFVLsU0pGd4ZgU/hW1Z2ofu4itu5yG3i/WEzJKoL7MYdvsTPl3dsN0jCXzezN9s+FUYzFeI7Xx2JLcfNnmAEar6yeetJMWEszhZaSfNG18pVVNiLEFYet3Bi0is98iK23pRLjwy+L2Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779296562; c=relaxed/simple; bh=ZLQOAPS0oRuKwKM94Me7SSFO9rEwKkEFJsWxIMQRoWY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=uGeomER75gTlrpRUmhtJH7OSl30xrryMiATmimke0SHINsHxx1gRAyw7nA0Ezz4d0f2OBgkk/scB9lC7KsnUr7KiWwWBhPNNCxWtyV6wrOiBNJqZWWmxli/B1MVeKbm16QbloksE50uTQq6ylc6v24QGzDBX4chGAeSrMdxOacQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=SkpTclD/; arc=fail smtp.client-ip=52.101.46.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="SkpTclD/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KqXBaAmxZvNYPqJWB0IWhCkZ5jDEjEJsmYiux1mr3J5WuPibOuM36LPozl3KPYbkpBouDpR+Q1zHjTDj7vAnbepL0dEQo0iRvdBv7wCgzfQbTcfuD3v+TZ9K6nOi7kb3SlCC0kNIeuIQcDyLjh5YJSXpsE+ZyJZErElAaRSjeH4+Uf8HdW8qMi/ProUC1p0QD04KfIz2k5w2AxIyHiT0qOVfeTePcSB/JjZP2sEl5xMcEqAp+ZYpmrdfIWv2/9B1HCa1Opp/xDHEDLgOScz07L+T0juQBtph0T3wo7KF7n3beYSozVifdy0sWOeK5Oswa1BLvh1swBm7qp9+4o40Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=BtVCNIX+DueTQOdz5mGFjL2gPgRANfs2TQnBRSrB2q8=; b=KE6B4DpQNUF+RpMPslvXByLunDPfuqJcKKyGgc9qutd1nhISM5OG/sjwSJOkWZaSlR4Cw1ewFYPLm09vHknFOrHRBUTmEyq3LOhyFN82asblWrVoQ2gvg4n/x7oGHJYxAMHTNwtST1CZqo7ACmrXWyiFUeLNS1bdcvghQJOjoLeGXetBk4Ekyh8cjHmCqp0lcHE/Ag6BwjWB6G7+4H0fUm1xIcxT7IGu76esY1wsCk7ZHp4pCjhTsjeANADkssMs34PlpDaVcui/ToOcmGnYTSecXUVjSZWPwcqWsN/WtwpmSn7Iq46qHLuLt32+DHikOmLEMOpjcR1Lv+W1NuXksw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BtVCNIX+DueTQOdz5mGFjL2gPgRANfs2TQnBRSrB2q8=; b=SkpTclD/i5Vq2XhX7VNVep4i7Zc7a2+HGGmtLk/VQL19x7fJWinrvAhXavgVFX1m2Uj7zhr0EdUNej9wMmYLKDqILiQ3iJpIaq9Ztu6NDzB0OtrEjY1n4I2UozjXC0kYPc4rc3ThTXyA9adzNsUZ5tufnHJn4x5HDGL2UzRWp4M= Received: from SA1PR05CA0018.namprd05.prod.outlook.com (2603:10b6:806:2d2::18) by CH3PR12MB8660.namprd12.prod.outlook.com (2603:10b6:610:177::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.24; Wed, 20 May 2026 17:02:32 +0000 Received: from SN1PEPF000252A2.namprd05.prod.outlook.com (2603:10b6:806:2d2:cafe::4a) by SA1PR05CA0018.outlook.office365.com (2603:10b6:806:2d2::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.48.16 via Frontend Transport; Wed, 20 May 2026 17:02:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SN1PEPF000252A2.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.48.11 via Frontend Transport; Wed, 20 May 2026 17:02:32 +0000 Received: from tlendack-t1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Wed, 20 May 2026 12:01:10 -0500 From: Tom Lendacky To: , CC: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Nadav Amit , Rik van Riel , Dave Hansen Subject: [PATCH v3] x86/mm: Disable broadcast TLB flush when PCID is disabled Date: Wed, 20 May 2026 12:00:50 -0500 Message-ID: X-Mailer: git-send-email 2.51.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A2:EE_|CH3PR12MB8660:EE_ X-MS-Office365-Filtering-Correlation-Id: f46b6f23-610d-47a7-05c1-08deb691953e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|36860700016|82310400026|56012099003|18002099003|11063799006; X-Microsoft-Antispam-Message-Info: 45shoYtG+eSv42PKC871KMDDnyBaoaNOXlo6xPG8/jJBWOOKfg0bS+sWEVclPyBjM/vBxXcN1fTCj9GNpQwe3XU5M1UhyD8Hm8VO3aA9dLbh9hMl7IGMSQZujoWzuMmMNjS7POEe5jt2qz/XVqHftFIIHJ3BE29iTg/0XHwLgmE/8q9s4eJhh1XsJnrWHySKhzZPabwH2epWLOgjPMv6z54DtctELWiN6EJYifbt4uMbMNeIZLqDoKdLHIPpNH02zT/qyzpq27ybYxpuLzN+2EH5QEC3WpkWF8sB+ltEl18n/OTo7W2dsE5huDoBmSsoLHJGo9F85GYiEeiOWHyE+dmlgYF8r/A//payl12TQNFJosYoUWpg403es9ZSUT/aMX+Id2apZ7OgsbMx1MtaODv8Wsxz1SsckmVx7p7G/92KSGdwRUKaQIHgwPR8YA1Dp54guZLDFmCFrBEED8ez6UQo+kaZLm6gfc+SXIVmK/eG2aw8W1RIKYnIgqQKR/jo6rqp6HjLGcoQG2CF10sIuZ2B2KNG/FkFDEmpDdOpSqGC6Q8A1iEcW3fiuSun1CofiOUxDoNTdDIe5M5b5eTUujMfADOETM6sRXbeswFeg5aAVeK7a5aaEhCQMqj8op4c8nn4OdNooP2q/Dfjf7U+aP02jHj1KTzDF79s+vnrh6zkVHeqO4eA2xhup8tAlUqBqGvmDQDJOsEz884gCA00W6iY0pre47Z9MoQMIrgBn1M= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(36860700016)(82310400026)(56012099003)(18002099003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jHBFuza6r87ksAo2XW2ieXnv+C61TyBwc+rHaX3BsUAqOioKwxI0NmAboubED3OXiIiykK898ludpPI1F9jdqTNYo6qIIRYmPR4EO/9VvCLBY2NqLZ13eA0VV3RHOBra2HjjOFUlDKEUWkk17D4MSR5js/1RbTZgltmfMnaF9vQDTT9y/RGy04jShFJ6ggDikiiHJgofOHBUNju1o1a4vzwAfzL1rJfVVXrese9Cg0HLp7xjKw9y/gUilASDwZinl2XPg8J9fpUKlcNBFYoGxshpljBgFjYP2VoLnwDpGsnfQrixTy/8cuBNVT137qYBc5sTgXIwB37XekHuy71yBKZED7+lzRydrWnudw8B6541BIxPJpwv9wTFu9C5SoLKuMqgGuHmEI6MU2AuA10pq4qPmrgvvktgHFEKhLkV44n14e5xct/JagrgorIwYiwY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2026 17:02:32.3041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f46b6f23-610d-47a7-05c1-08deb691953e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8660 Content-Type: text/plain; charset="utf-8" Booting with "nopcid" clears X86_FEATURE_PCID and keeps CR4.PCIDE from being set to one. On AMD CPUs that support INVLPGB, broadcast TLB flushing remains enabled. There are two checks that decide whether the global ASID code runs, mm_global_asid() and consider_global_asid(), that key off of the X86_FEATURE_INVLPGB feature. Once an mm becomes active on more than three CPUs, consider_global_asid() assigns it a global ASID, after which flush_tlb_mm_range() takes the broadcast_tlb_flush() path using a non-zero PCID. Issuing an INVLPGB with a non-zero PCID while CR4.PCIDE is not set results in a #GP: Oops: general protection fault, kernel NULL pointer dereference 0x1: 0000 = [#1] SMP NOPTI CPU: 158 UID: 0 PID: 3119 Comm: snap Not tainted 7.1.0-rc3 #1 PREEMPT(full) Hardware name: ... RIP: 0010:broadcast_tlb_flush+0x9d/0x210 Code: ... 89 da 48 83 c8 07 <0f> 01 fe eb 08 cc cc cc ... RSP: 0000:ffa0000031217cb0 EFLAGS: 00010202 RAX: 00007f8ee8540007 RBX: 0000000008070000 RCX: 0000000000000000 RDX: 0000000000070000 RSI: 0000000000000001 RDI: 00007f8ee8540000 RBP: ff110001189a0700 R08: 00007f8ee8541000 R09: 000000000000000c R10: 000000000000000c R11: 0000000000070000 R12: ff1100c0433aec80 R13: 0000000000000000 R14: 0000000000000008 R15: 0000000000000007 FS: 00007f8ed3fff6c0(0000) GS:ff1100c0b7b8a000(0000) knlGS:00000000000000= 00 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f8ee8540058 CR3: 00080001433af000 CR4: 0000000000751ef0 PKRU: 55555554 Call Trace: flush_tlb_mm_range+0xd8/0x220 ptep_clear_flush+0x56/0x60 wp_page_copy+0x293/0x6c0 ? _raw_spin_unlock+0x15/0x30 __handle_mm_fault+0x512/0x6d0 handle_mm_fault+0x145/0x2a0 do_user_addr_fault+0x187/0x6f0 exc_page_fault+0x6a/0x180 asm_exc_page_fault+0x22/0x30 RIP: 0033:0x55c553ebc639 Code: ... RSP: 002b:00007f8ed3ffeaa8 EFLAGS: 00010246 RAX: 00007f8ee8540058 RBX: 000055c554ff77b8 RCX: 00007f8ee853c1c8 RDX: 0000000000000000 RSI: 000000c000062b20 RDI: 00007f8ee8540040 RBP: 00007f8ed3ffeb00 R08: 0000000000006040 R09: 0000000000000005 R10: 0000000000000004 R11: 00000000000001c0 R12: 0000000000000001 R13: 0000005990100204 R14: 000000c000624fc0 R15: 3fffffffffffffff Modules linked in: ... ---[ end trace 0000000000000000 ]--- All processors that support broadcast TLB invalidation also have PCID support, so it is only the "nopcid" scenario that is of concern. In this situation just disable the broadcast TLB support using the CPUID dependency support by making X86_FEATURE_INVLPGB dependent on X86_FEATURE_PCID. Fixes: 4afeb0ed1753 ("x86/mm: Enable broadcast TLB invalidation for multi-t= hreaded processes") Assisted-by: Claude:claude-opus-4.7 Suggested-by: Dave Hansen Signed-off-by: Tom Lendacky --- Changes from v2: - Update commit message. (Dave) Changes from v1: - Disable broadcast TLB support when PCID support is not available instead of adding PCID support checks to mm_global_asid() and consider_global_asid(). (Dave) --- arch/x86/kernel/cpu/cpuid-deps.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-d= eps.c index 146f6f8b0650..99801e844b30 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -92,6 +92,7 @@ static const struct cpuid_dep cpuid_deps[] =3D { { X86_FEATURE_FRED, X86_FEATURE_LKGS }, { X86_FEATURE_SPEC_CTRL_SSBD, X86_FEATURE_SPEC_CTRL }, { X86_FEATURE_LASS, X86_FEATURE_SMAP }, + { X86_FEATURE_INVLPGB, X86_FEATURE_PCID }, {} }; =20 base-commit: 2fb123664e61027830a6752a8e9235e7f7712504 --=20 2.51.1