Received: by 10.223.176.46 with SMTP id f43csp660028wra; Wed, 24 Jan 2018 04:06:56 -0800 (PST) X-Google-Smtp-Source: AH8x2274GKRNLr9rCjc5fMl45scmapZMFoZ5FDtgvmGvryWlIpAUlMvuVkt7EhOUI1iQLj71nyUO X-Received: by 2002:a17:902:12f:: with SMTP id 44-v6mr6310036plb.403.1516795616791; Wed, 24 Jan 2018 04:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516795616; cv=none; d=google.com; s=arc-20160816; b=z5B9WZjMxhxO7FykeiNJKZFJHFXNmKyyhuPFEKJq5X6NWPSnYCbuYdN4lzvNgaVcGd tjDUqftn6lfG9NP20bi+OJaLa6Fbb1WnnszJWLeDPNwsqpHxsiKpSRyx7EnIhaLE5b6g kUZzN7bs78fJbmL8KPQ9t0VrFwlDlfwb8xQL61nsK53/xpFU6RItZHvGL2g7dqq3H7ap YPXKo4qVuzmq8eNU7LyFVrKdRhJl2pIbLzhLm0N9wQrJxpU2E4bxUi+KV+AIcmpaCT9h WkiUtYaxmeb6G7WZzRvHZVhfBFfwVQsUTY5jH457oAMHmxXgpejk4qtX+wMCjo+mCgf1 Ft/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=RFYwawbGZuQcJooCHErI3qXFX6WAjYGRVFtk9mSABJE=; b=Tk9nVZzeAz9Evu546B44j1BXroQ9HOWN+hzs7ufdW0DlAPjeqVaIao0nqRaYQI2fOn VAyZBSapHc/pGTczrSt5iwJM54Vv98KEmO8zy0swzXJsakyda/88XuVcdSBmwYG/4kiW 3RvWeW/bi329rpfgxZERY1SbguVHeCkyjFwsnLsR0U+/WhwDZIt6TovHw/xwyP1ueMYC cixiI3G0oLiIsCiCYrE1wLK2CLQVtzF5uXeIIHzARpIQadrv57txsklmh1aiYQW6Qu+n E/bpDpy+IQAXBDX0JUjvZja5FK7r3isJvBIVvXjVLPQDt5NH653L7mMBGOsrZVLHCt7w YVwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6-v6si120350plt.143.2018.01.24.04.06.42; Wed, 24 Jan 2018 04:06:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933410AbeAXMFy (ORCPT + 99 others); Wed, 24 Jan 2018 07:05:54 -0500 Received: from terminus.zytor.com ([65.50.211.136]:44751 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932953AbeAXMFw (ORCPT ); Wed, 24 Jan 2018 07:05:52 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w0OC4bxC009750; Wed, 24 Jan 2018 04:04:37 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w0OC4akb009747; Wed, 24 Jan 2018 04:04:36 -0800 Date: Wed, 24 Jan 2018 04:04:36 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jia Zhang Message-ID: Cc: tglx@linutronix.de, zhang.jia@linux.alibaba.com, bp@suse.de, tony.luck@intel.com, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: bp@suse.de, tony.luck@intel.com, zhang.jia@linux.alibaba.com, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org In-Reply-To: <1516321542-31161-1-git-send-email-zhang.jia@linux.alibaba.com> References: <1516321542-31161-1-git-send-email-zhang.jia@linux.alibaba.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/microcode/intel: Extend BDW late-loading further with LLC size check Git-Commit-ID: 7e702d17ed138cf4ae7c00e8c00681ed464587c7 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 7e702d17ed138cf4ae7c00e8c00681ed464587c7 Gitweb: https://git.kernel.org/tip/7e702d17ed138cf4ae7c00e8c00681ed464587c7 Author: Jia Zhang AuthorDate: Tue, 23 Jan 2018 11:41:32 +0100 Committer: Thomas Gleixner CommitDate: Wed, 24 Jan 2018 13:00:35 +0100 x86/microcode/intel: Extend BDW late-loading further with LLC size check Commit b94b73733171 ("x86/microcode/intel: Extend BDW late-loading with a revision check") reduced the impact of erratum BDF90 for Broadwell model 79. The impact can be reduced further by checking the size of the last level cache portion per core. Tony: "The erratum says the problem only occurs on the large-cache SKUs. So we only need to avoid the update if we are on a big cache SKU that is also running old microcode." For more details, see erratum BDF90 in document #334165 (Intel Xeon Processor E7-8800/4800 v4 Product Family Specification Update) from September 2017. Fixes: b94b73733171 ("x86/microcode/intel: Extend BDW late-loading with a revision check") Signed-off-by: Jia Zhang Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Acked-by: Tony Luck Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/1516321542-31161-1-git-send-email-zhang.jia@linux.alibaba.com --- arch/x86/kernel/cpu/microcode/intel.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index d9e460f..f7c55b0 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -45,6 +45,9 @@ static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin"; /* Current microcode patch used in early patching on the APs. */ static struct microcode_intel *intel_ucode_patch; +/* last level cache size per core */ +static int llc_size_per_core; + static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1, unsigned int s2, unsigned int p2) { @@ -912,12 +915,14 @@ static bool is_blacklisted(unsigned int cpu) /* * Late loading on model 79 with microcode revision less than 0x0b000021 - * may result in a system hang. This behavior is documented in item - * BDF90, #334165 (Intel Xeon Processor E7-8800/4800 v4 Product Family). + * and LLC size per core bigger than 2.5MB may result in a system hang. + * This behavior is documented in item BDF90, #334165 (Intel Xeon + * Processor E7-8800/4800 v4 Product Family). */ if (c->x86 == 6 && c->x86_model == INTEL_FAM6_BROADWELL_X && c->x86_mask == 0x01 && + llc_size_per_core > 2621440 && c->microcode < 0x0b000021) { pr_err_once("Erratum BDF90: late loading with revision < 0x0b000021 (0x%x) disabled.\n", c->microcode); pr_err_once("Please consider either early loading through initrd/built-in or a potential BIOS update.\n"); @@ -975,6 +980,15 @@ static struct microcode_ops microcode_intel_ops = { .apply_microcode = apply_microcode_intel, }; +static int __init calc_llc_size_per_core(struct cpuinfo_x86 *c) +{ + u64 llc_size = c->x86_cache_size * 1024; + + do_div(llc_size, c->x86_max_cores); + + return (int)llc_size; +} + struct microcode_ops * __init init_intel_microcode(void) { struct cpuinfo_x86 *c = &boot_cpu_data; @@ -985,5 +999,7 @@ struct microcode_ops * __init init_intel_microcode(void) return NULL; } + llc_size_per_core = calc_llc_size_per_core(c); + return µcode_intel_ops; }