Received: by 10.223.176.46 with SMTP id f43csp223598wra; Thu, 18 Jan 2018 16:28:46 -0800 (PST) X-Google-Smtp-Source: ACJfBotWtlZVT4AcBjj+Fp+MQ3/ZQ7mHl9z9ADl/xgGfwc0ffzlBzCJFwk99xOKgVg/VYi0QSlNZ X-Received: by 10.99.94.193 with SMTP id s184mr39937172pgb.325.1516321726239; Thu, 18 Jan 2018 16:28:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516321726; cv=none; d=google.com; s=arc-20160816; b=GlL9tf6xThHjUZkh6oh+xhfuetESZvpEkmRCn0vqOce7G9wfkQiHeZAN0m6GIL6mbq UWDTKp58qTsLPvK7HJWaucX6IHKCuYiuN8CNU6ETg08KzShtxVZ25ryZpoeocqF6li+h uMxE2y2yoMLiWDktj7P2JDPxDo+oJhkZGU/TLPcNpD2IUJmJ4/kuTq/rhcvzNCec3zdk FTFUwGxQlmKKE4VSXpH6QzypmxLz0HZrvipiRAmmvFrXCRzFN/2sAYI3YIZtIB8Qg5Zn PM0ml/MFlbC/q+Cc0konKI6bgJzpTIUorVKTbso/DKsnf1hCas6D/pu+vZBZkH5vMt70 LASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=mWOhfMNSKTskpqq9jbVPNFk6o1xImRneQt6GXgssiHU=; b=v1Z5bikOz1plF95lQ54uqAIMQ5xn698tZZSGug5yjT07Cj5ftWqTCl3MWChSj+f6Zf F6gfH8N3V7TzEZc/51hmBjs74LRgeFnJ/YJJc0TUKxtjdihwlxxSPOhsIyzMO/De7K1C 1pjnT9fUATDiu/Adb7bhu7ZGAs1k2BYiD8ZtdtCmjK+3yX4/ErXwW5gpNRd/DsZt1Bgo unBHPFsykF9jr//um8uKdFTFI/5anL8bOG0OU5QujTvCaMpH3E1VSgk6rBpib5j6GqZp WZOkcqJ0HLVtj6D0uxX47a9yRSvZiVy0rxxnzLFJskFSRrXeWiRNXHbPXVWX91MglS19 HUeg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s77si8222341pfa.172.2018.01.18.16.28.32; Thu, 18 Jan 2018 16:28:46 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755155AbeASA0P (ORCPT + 99 others); Thu, 18 Jan 2018 19:26:15 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:47053 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754860AbeASAZ6 (ORCPT ); Thu, 18 Jan 2018 19:25:58 -0500 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.06358043|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e01e04421;MF=zhang.jia@linux.alibaba.com;NM=1;PH=DS;RN=9;RT=9;SR=0;TI=SMTPD_---0Swp71JS_1516321551; Received: from localhost(mailfrom:zhang.jia@linux.alibaba.com fp:106.11.232.254) by smtp.aliyun-inc.com(127.0.0.1); Fri, 19 Jan 2018 08:25:51 +0800 From: Jia Zhang To: tony.luck@intel.com, bp@alien8.de Cc: hmh@hmh.eng.br, mingo@redhat.com, hpa@zytor.com, tglx@linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org, Jia Zhang Subject: [PATCH v3] x86/microcode/intel: Extend BDW late-loading with LLC size check Date: Fri, 19 Jan 2018 08:25:42 +0800 Message-Id: <1516321542-31161-1-git-send-email-zhang.jia@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The commit b94b73733171 ("x86/microcode/intel: Extend BDW late-loading with a revision check") reduces the impact of erratum BDF90 for Broadwell process model. Actually, the impact can be reduced further through adding the checks for the size of LLC per core. For more details, see erratum BDF90 in document #334165 (Intel Xeon Processor E7-8800/4800 v4 Product Family Specification Update) from September 2017. Signed-off-by: Jia Zhang --- arch/x86/kernel/cpu/microcode/intel.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index d9e460f..55534c0 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -44,6 +44,8 @@ /* Current microcode patch used in early patching on the APs. */ static struct microcode_intel *intel_ucode_patch; +/* LLC size per core used in is_blacklisted() */ +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 +914,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 +979,15 @@ static int get_ucode_user(void *to, const void *from, size_t n) .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 +998,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; } -- 1.8.3.1