Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp72651lqp; Tue, 21 May 2024 19:09:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQv3H4UlnZJ7+pIEq0tDFj8P949zf6YFHG2FBfFUT4Kpj32XT+ETd3oGykZcEvqXM2inmbCrfKsxfVJkRjofNZEYA6ni0HQOAkQ11gyw== X-Google-Smtp-Source: AGHT+IGydfenjKs5RnKQD3pFjlBEIZJJpsIHSO+qYUlk+ydLJ3R/c0d9Popq2OM0eNdHmmmmh1zM X-Received: by 2002:a17:902:7846:b0:1f2:f115:4d87 with SMTP id d9443c01a7336-1f31c9e7b85mr6275645ad.48.1716343751983; Tue, 21 May 2024 19:09:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716343751; cv=pass; d=google.com; s=arc-20160816; b=J7VuUllHn2MXgNCNI+KFrBVFT4igPiIGWAaFrIPIY7Qt5naQJdAkYKmiAML66sXg6B 45QTgblEa1V8WHeX6oAp9SvQV2va2xfAPkcPbnEGakLwdtZSJeuHdnG2926UOHvq/pD0 1GohMxS5lUfD0IlWJ3Mn8lKvoE7uFrgGo7DAZDW31qdJdz5YBXWXN8uTN9Ddq5IZ4vLc jOzdaNyH8pPpbl73k0khEcJ2c3osawJ8I7FUIO8HdkUl1TcocCkHIcV1uPooC9kU4X7l JVv+DnlOKFzPM3zeBu2MInK9/GuThibuZunVovhfJdY2IeCn9p3ggAphrqKaP2AA3x7z v5Wg== 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=YQEtqqdy6/aO/2ZBxzuTTK4pepShheBJ9EHoL9joO54=; fh=fTsvBGRCJ30wcbM+qukBwV1mBYwq/gxe2+STlSGXKvg=; b=SDjOa7sCtQUN/F4+65fydG1nNxkc70y5MDhk1LRUhixp0A4lI6Q9TTbyxlH8yX2LMZ 1+xCp9ack5BU6uJyRMBoJ5lOdu1LjWPvj3yYt6PIyg/mHsRGthCWS18loc8/pVmOgaLV UPgBCxGGNYRsZb4Pyo/U5htVci+Aj1Jy88Ex/oYJ/LktEFplWoaN6EBMUyJgD9RPZasI rMDfjg3AdJjxIccB7o0AWfMwH2Dx37Ir2VdMPysbJu7CIIkSSPyRPEGbcdlZPv1k5LUD wSAXuOsfeunxtzfhAam5/ir2UR/uCIbwKzDlwjDcCfbCAUBiML5znGpjnFyrVmCQUsyk pZkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=JZKYFQOu; 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-185679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185679-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c0372dcsi16621835ad.332.2024.05.21.19.09.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 19:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=JZKYFQOu; 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-185679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185679-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5926BB21668 for ; Wed, 22 May 2024 02:07:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75D1ABA4D; Wed, 22 May 2024 02:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="JZKYFQOu" 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 0DC0E1C680 for ; Wed, 22 May 2024 02:07:32 +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=1716343654; cv=none; b=sa6zOJpoeqdktx5isdapk0Du/7g1xWO9fEybqEMJAdkJIOxakZg5QY68rRJtQO3QpYBdaiHn9Kcj1XLFi8aDWdbA6wJPrpNolXfYr9Cs4lLc5+ZDNQDPKbwVjjfYSrY68j+X5Xv8oB3dtaEWq4XcIqOkFlAgQQHtdLj3gTYgnLc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716343654; c=relaxed/simple; bh=bxl/lOFPSiCd4ykMkwouK0nVOpCXnivt9yMjnzRYgpQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Hx9ui7lIpTTjwPlbr3oRP3Ivh5cF/MOrGdr21nZjyfkp62hMbTpZADO7GjW+jm21Ralga5ogNnCOq6cbdjNLi9ouH4FnPnXVfbeCwvhTzefdcssvI76vnN+2oKhLdg97fT/puvXNEpuNNN/N6IZW0Bgpf5Chw0/ONW7+Zj8DWqs= 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=JZKYFQOu; 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=1716343651; bh=bxl/lOFPSiCd4ykMkwouK0nVOpCXnivt9yMjnzRYgpQ=; h=From:To:Cc:Subject:Date:From; b=JZKYFQOuOUifgcqNuHj/S5NZuQ/q7Jb5H/GQCVgabpXFzmaXhIWWGs1zmgGIEZ9Mm DX6fghyJHgTSFNHeVzl4nEIU3+oBNfOZvc4mLwRx1yvjko4APY4vqS4hZY3+oM+JyX PHIl1Ct4T/GHlKG3Q5390Y5L1EX7xEzs1do4Y3OM= Received: from stargazer.. (unknown [IPv6:240e:358:11a2:a00:dc73:854d:832e:3]) (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 5A7851A3F25; Tue, 21 May 2024 22:07:25 -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 v10 1/2] x86/mm: Don't disable PCID if "incomplete Global INVLPG flushes" is fixed by microcode Date: Wed, 22 May 2024 10:06:24 +0800 Message-ID: <20240522020625.69418-1-xry111@xry111.site> X-Mailer: git-send-email 2.45.1 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 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index eb503f53c319..e960196e8058 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -264,27 +264,33 @@ static void __init probe_page_size_mask(void) /* * 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[] = { - X86_MATCH_VFM(INTEL_ALDERLAKE, 0), - X86_MATCH_VFM(INTEL_ALDERLAKE_L, 0), - X86_MATCH_VFM(INTEL_ATOM_GRACEMONT, 0), - X86_MATCH_VFM(INTEL_RAPTORLAKE, 0), - X86_MATCH_VFM(INTEL_RAPTORLAKE_P, 0), - X86_MATCH_VFM(INTEL_RAPTORLAKE_S, 0), + X86_MATCH_VFM(INTEL_ALDERLAKE, 0x2e), + X86_MATCH_VFM(INTEL_ALDERLAKE_L, 0x42c), + X86_MATCH_VFM(INTEL_ATOM_GRACEMONT, 0x11), + X86_MATCH_VFM(INTEL_RAPTORLAKE, 0x118), + X86_MATCH_VFM(INTEL_RAPTORLAKE_P, 0x4117), + X86_MATCH_VFM(INTEL_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.45.1