Received: by 10.192.165.156 with SMTP id m28csp29186imm; Tue, 10 Apr 2018 15:43:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx48YTHNqoaM52W8VxK1JPZ5WZm7rqM31yRKD1zE0Wq09qDQXUXP3hDjr6jMhh4EJ260NYYN3 X-Received: by 10.99.163.111 with SMTP id v47mr308011pgn.298.1523400214807; Tue, 10 Apr 2018 15:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400214; cv=none; d=google.com; s=arc-20160816; b=AFPyHh0Eey+4MBMxNGEv3XTJNYNpC+5Gb6s2Nn9qrmVYJuRT46q1zelSbSHgnTqjq8 fOAvPAmLwiL+SUc36rqE4cY+BTm/nFA+F2A3GURDMDZPt9MUShM8t0c8+xG9lHuLwx7F 6+FoMkX/v4UWkzcEQp/pynl9TmImANAn3pA4A2U6KIAHRmPPM8/TsyesYzwRWujXRnYH RQos3OpcP1yo/gDHTCca46zBcB44Bj93W/+j3JPyLfkWcr9MXKDalAHI+dbHClSwPnaJ ZeHL2UWUJWsIR/wOLFLnvQ6Ewk2UBPuzAoMLGVZIfUI4JF37PKXxsmIg0LcdygRn2Mwu lxIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dlvwjSrEjcX8RAx5WMGVnXm1JAK6FVfyAfZhBzcT4sY=; b=IINeeFH3ohmoEdjs0fJbf+KSa0/YHN63GqSOc3rLO9d3sxBomgNmqsk2+vsqgpK0BU Ci+wLC8NS13jGX9wRHq7QYx+t3ENw6F+aSLdKaP84qCcbKELPLb/TgADZaF1/2u7j4qO y0apx1xHLa8WLe30dxIE+Fp00sHYu6/pyuPf84F4XoAo15PdosWsk4MONhqrKWe7Djzb BNK/OzXySZDSbBsACa6hZpquHaagJ+1w+hqPDkgWLTZb9fHufgqCa7WSQxutQVhaXwDy 2im9MjH5OyPoyu24BpMe5NJkfKtUDAFDDUnzYDTEE9L0o8C8w78yWcNCgNbkccvxIaBE DDyA== 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 65-v6si3448925plb.573.2018.04.10.15.42.58; Tue, 10 Apr 2018 15:43:34 -0700 (PDT) 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 S1755341AbeDJWin (ORCPT + 99 others); Tue, 10 Apr 2018 18:38:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44882 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756009AbeDJWih (ORCPT ); Tue, 10 Apr 2018 18:38:37 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 99054CC4; Tue, 10 Apr 2018 22:38:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Thomas Gleixner , Tom Lendacky , Ashok Raj , Arjan Van De Ven Subject: [PATCH 4.14 092/138] x86/microcode/intel: Look into the patch cache first Date: Wed, 11 Apr 2018 00:24:42 +0200 Message-Id: <20180410212912.864356848@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Borislav Petkov commit d8c3b52c00a05036e0a6b315b4b17921a7b67997 upstream. The cache might contain a newer patch - look in there first. A follow-on change will make sure newest patches are loaded into the cache of microcode patches. Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Tested-by: Tom Lendacky Tested-by: Ashok Raj Cc: Arjan Van De Ven Link: https://lkml.kernel.org/r/20180228102846.13447-6-bp@alien8.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/intel.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -791,9 +791,9 @@ static int collect_cpu_info(int cpu_num, static enum ucode_state apply_microcode_intel(int cpu) { - struct microcode_intel *mc; - struct ucode_cpu_info *uci; + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; struct cpuinfo_x86 *c = &cpu_data(cpu); + struct microcode_intel *mc; static int prev_rev; u32 rev; @@ -801,11 +801,10 @@ static enum ucode_state apply_microcode_ if (WARN_ON(raw_smp_processor_id() != cpu)) return UCODE_ERROR; - uci = ucode_cpu_info + cpu; - mc = uci->mc; + /* Look for a newer patch in our cache: */ + mc = find_patch(uci); if (!mc) { - /* Look for a newer patch in our cache: */ - mc = find_patch(uci); + mc = uci->mc; if (!mc) return UCODE_NFOUND; }