Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp326866lqp; Fri, 12 Apr 2024 21:42:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWFx5iDHmiSt/zW1/Zgt8o1mjzEviEhvoLWnBoSXvIi0Wmc0nrRwrAdSswcH9ibMdTw6L2akzO3dmhAaY9JOIyHf3zZaa7LiWiGH6/Zig== X-Google-Smtp-Source: AGHT+IFAdIpBL2ab3fvRSKdmTo+Hd/2wZ22OLEXf/oRF/dVG5cPWwni6JhQnVwmy8mv0a7QbJw1R X-Received: by 2002:ad4:5969:0:b0:699:2fe6:b596 with SMTP id eq9-20020ad45969000000b006992fe6b596mr6339244qvb.21.1712983322920; Fri, 12 Apr 2024 21:42:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712983322; cv=pass; d=google.com; s=arc-20160816; b=CxGqE4PpkR1mTWGqMOcLLD2DdFsTb5a/0M4nGZxzZHCnT5pIRHvMvEM5r9zWE9PSzL 0tEj8RDdQcYATnot7V35tnPtAVtnguatk7rFGHALOEvTojWJl5krzogafIXP2W8H9+iy j2OdCKyJkM35R7bwOfrH4NuD5ZkpEnAHJF+NiuM7dL7IkKzLOO/JmtMDPkgF3y2O2pnc quoIRSU2RIChK0UDdap3gjiMLeOzmNv+bhtwPoptNfuWYfOVQUWL/fr4UgqlGMCA0lSX QMflkdvrDD7FrU9ioi8qjWrofUaYVHVADvnNiHFhyJMIq3dQmXc6Nio8bTWC388B9x7Y fYEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=WlIVDozCVY/JGZQYSCf78/za9Pzo0Vj4c3aiYXZpVpw=; fh=fTsvBGRCJ30wcbM+qukBwV1mBYwq/gxe2+STlSGXKvg=; b=lbw6BEkjZIXaDre2KLtXPGvDqZQWYYxUdEm7L0JJ/pNfnbwbPuUUOrXv05ADVfqj3t m/ZK/Aoguy2HjalSHq+JGkPABo9naWOX7xILMkMUrqi+CqovOyhCbGQRbSNzuiCA+JtX anAd7uwkrp6HK1WR1UUu2MQl/tGjYB0W50gFTmeCKvVD4k3F4yIH+tZKzhvmnrARM1oO DP+Ff3tPYwYQYr4eUXJ7JXe6cbmZAN2mwhM9+In5KTgBvlfc56S7GI6iEf4Em+Ew6IA1 2MINowKfyQArc0naGCKnbydJpgr0b15Azp9PIsX8WedjwWzM7F1IWCGUmlRbGm43W9+b SYxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=jmAjncTn; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-143577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143577-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ea18-20020ad458b2000000b0069b2f09d6afsi5079888qvb.139.2024.04.12.21.42.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 21:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=jmAjncTn; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-143577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143577-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 624F31C21703 for ; Sat, 13 Apr 2024 04:42:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEA171C6B7; Sat, 13 Apr 2024 04:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="jmAjncTn" Received: from xry111.site (xry111.site [89.208.246.23]) (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 A9C4C1C2A5 for ; Sat, 13 Apr 2024 04:41:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712983314; cv=none; b=BjotznlEqieaf0h8cXcdV7RZHaXuAr9z+9+APBBitHpOro0jVRTfFUb5yLVFnkl4GQx+21c9wDopnglKs85oUaVNMnTnESjTLa7D1Q/x+zxCsAGMQDA97c2wyoPSqd/wAJEtKagnT13dlupUP5vkcHLkSol7uqTQMhzrsp2/8Bo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712983314; c=relaxed/simple; bh=UXijQCiAnsNtHaRSQd/EDzkWLeezaosMUAopyhq0jDc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GD1jCHGYI5A06p7BB97QEzVjX+804WGK3c1YCFLmnlab8hCIqtEdHWxre7DL2Dii6t+C/Ug17dQ1bwVAuHhwZlNp0fe2bcftkyn+euy59JZCTd3o+NTD6tVm952THlGSbdNFeG/ufimEHRKtJY1WT4U6e/64kqca8jwxau/A9aQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=jmAjncTn; arc=none smtp.client-ip=89.208.246.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1712983303; bh=UXijQCiAnsNtHaRSQd/EDzkWLeezaosMUAopyhq0jDc=; h=From:To:Cc:Subject:Date:From; b=jmAjncTnSbsPrBqNB3gNkgO512vLGecVommB2xKy4Bige2aSHsA3TVRpElIlMpqLi aRkQDKul+p1OLbjo8AEfiJCpvW3VDFLU7mTqc5HxRzu0j6MHJExYkrjmVdZbEJU8r4 bYmqAb7cYsZsVFplD9IJTqWlCS+9GYoa2NdUvU8Y= Received: from stargazer.. (unknown [IPv6:240e:358:11d1:f200:dc73:854d:832e:8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id A14F966D46; Sat, 13 Apr 2024 00:41:36 -0400 (EDT) From: Xi Ruoyao To: Dave Hansen , Michael Kelley , Pawan Gupta Cc: Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Xi Ruoyao , Sean Christopherson , Andrew Cooper Subject: [PATCH v8 1/2] x86/mm: Don't disable PCID if "incomplete Global INVLPG flushes" is fixed by microcode Date: Sat, 13 Apr 2024 12:41:28 +0800 Message-ID: <20240413044129.52812-1-xry111@xry111.site> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Per the "Processor Specification Update" documentations referred by the intel-microcode-20240312 release note, this microcode release has fixed the issue for all affected models. So don't disable PCID if the microcode is new enough. The precise minimum microcode revision fixing the issue is provided by engineer from Intel. Cc: Dave Hansen Cc: Michael Kelley Cc: Pawan Gupta Cc: Sean Christopherson Cc: Andrew Cooper Link: https://lore.kernel.org/all/168436059559.404.13934972543631851306.tip-bot2@tip-bot2/ Link: https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/tag/microcode-20240312 Link: https://cdrdv2.intel.com/v1/dl/getContent/740518 # RPL042, rev. 13 Link: https://cdrdv2.intel.com/v1/dl/getContent/682436 # ADL063, rev. 24 Link: https://lore.kernel.org/all/20240325231300.qrltbzf6twm43ftb@desk/ Signed-off-by: Xi Ruoyao --- arch/x86/mm/init.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 679893ea5e68..c318cdc35467 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -261,33 +261,43 @@ static void __init probe_page_size_mask(void) } } -#define INTEL_MATCH(_model) { .vendor = X86_VENDOR_INTEL, \ - .family = 6, \ - .model = _model, \ - } +#define INTEL_MATCH(_model, _fixed_microcode) \ + { \ + .vendor = X86_VENDOR_INTEL, \ + .family = 6, \ + .model = _model, \ + .driver_data = _fixed_microcode, \ + } + /* * INVLPG may not properly flush Global entries - * on these CPUs when PCIDs are enabled. + * on these CPUs when PCIDs are enabled and the + * microcode is not updated to fix the issue. */ static const struct x86_cpu_id invlpg_miss_ids[] = { - INTEL_MATCH(INTEL_FAM6_ALDERLAKE ), - INTEL_MATCH(INTEL_FAM6_ALDERLAKE_L ), - INTEL_MATCH(INTEL_FAM6_ATOM_GRACEMONT ), - INTEL_MATCH(INTEL_FAM6_RAPTORLAKE ), - INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_P), - INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_S), + INTEL_MATCH(INTEL_FAM6_ALDERLAKE, 0x2e), + INTEL_MATCH(INTEL_FAM6_ALDERLAKE_L, 0x42c), + INTEL_MATCH(INTEL_FAM6_ATOM_GRACEMONT, 0x11), + INTEL_MATCH(INTEL_FAM6_RAPTORLAKE, 0x118), + INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_P, 0x4117), + INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_S, 0x2e), {} }; static void setup_pcid(void) { + const struct x86_cpu_id *invlpg_miss_match; + if (!IS_ENABLED(CONFIG_X86_64)) return; if (!boot_cpu_has(X86_FEATURE_PCID)) return; - if (x86_match_cpu(invlpg_miss_ids)) { + invlpg_miss_match = x86_match_cpu(invlpg_miss_ids); + + if (invlpg_miss_match && + boot_cpu_data.microcode < invlpg_miss_match->driver_data) { pr_info("Incomplete global flushes, disabling PCID"); setup_clear_cpu_cap(X86_FEATURE_PCID); return; -- 2.44.0