Received: by 10.223.185.116 with SMTP id b49csp6392321wrg; Wed, 28 Feb 2018 08:39:47 -0800 (PST) X-Google-Smtp-Source: AH8x224ZqLRAQEt9OnvXpueutP7z2vYf32wAzQE10PJNgjboNLR1MKkBvvlrpK7SBOY6GKgc40y5 X-Received: by 10.98.93.193 with SMTP id n62mr18355211pfj.83.1519835987661; Wed, 28 Feb 2018 08:39:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835987; cv=none; d=google.com; s=arc-20160816; b=Gl3/TvykxNWr0a/JR1y0qD/4xtGHsJUHyCBxnl/njfijsSJxisHQhfUifmjvo3GYhl StThfMv7UhSfcPG18kjmg0bbrS+7Cvi7iU2trs/sSOTPMEOUpVLlQm+/+fVWvSp19EDD nakh6HSaMT++hMgHxhL+AL8M7jVTSuZTt8GNQTeExBORoPCvBWt+s3MDQ468v5HeM2IV bAQNNmCLqprf1V3dUoT5lIgKfca2MlMlyIIYbm0iWBdaZNDVGMrZor5TwHp85GyPCOkL WEws1o9P5iCkSdUFgI7VrYS/kUt5s5vE4v1rSCQJ7BvZSmJrZwd2oVdH1U9cQJd8sGmc 6L/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=1tyrCkoGMic6yhMCiNT0NmijusZMLSPHkR5WAsqbZXU=; b=oiovGx57E19Bs3wcXNgH+XKpDu1DtRQ2+BzgjkoHse31YM8NeayOVTPMOjpmYSsL55 JMMAI8m9APg8F54kGuMMdSons1GMNnM6hdA3WNZ/fsnbUQQkuVfbs24EFXdO3SfN5y1C z19ATW24QM7SRVdTkelgNE9oN+vYZyHZ/kTS436Meny9xXJ2DiyHHP/JxwSWGg78ZP1a LKJ4k0JcHCBtpE4lSqsY0QiwbixH/EoKZGHxb4xtufGcd2ySOjFbUX1q6vJP3sDTjGB9 UvYbv0n+thMRwa44lHjBvw4IdhbNgmwj5H7QFyDV21k1p8WVELK1zL71RIn1JiOYg6Dc fhwQ== 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 x63si1481914pfi.173.2018.02.28.08.39.33; Wed, 28 Feb 2018 08:39:47 -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 S1752743AbeB1QEL (ORCPT + 99 others); Wed, 28 Feb 2018 11:04:11 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34803 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516AbeB1QEI (ORCPT ); Wed, 28 Feb 2018 11:04:08 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yn-0006Xd-W9; Wed, 28 Feb 2018 15:22:26 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yk-0000IH-Hh; Wed, 28 Feb 2018 15:22:22 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jia Zhang" , "Borislav Petkov" , "Tony Luck" , "Thomas Gleixner" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 228/254] x86/microcode/intel: Extend BDW late-loading further with LLC size check In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jia Zhang commit 7e702d17ed138cf4ae7c00e8c00681ed464587c7 upstream. 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 Link: https://lkml.kernel.org/r/1516321542-31161-1-git-send-email-zhang.jia@linux.alibaba.com [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- arch/x86/kernel/cpu/microcode/intel.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -87,6 +87,9 @@ MODULE_DESCRIPTION("Microcode Update Dri MODULE_AUTHOR("Tigran Aivazian "); MODULE_LICENSE("GPL"); +/* last level cache size per core */ +static int llc_size_per_core; + static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) { struct cpuinfo_x86 *c = &cpu_data(cpu_num); @@ -273,12 +276,14 @@ static bool is_blacklisted(unsigned int /* * 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 == 0x4F && 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"); @@ -345,6 +350,15 @@ static struct microcode_ops microcode_in .microcode_fini_cpu = microcode_fini_cpu, }; +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 = &cpu_data(0); @@ -355,6 +369,8 @@ struct microcode_ops * __init init_intel return NULL; } + llc_size_per_core = calc_llc_size_per_core(c); + return µcode_intel_ops; }