Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp958661rdb; Fri, 20 Oct 2023 04:48:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoKNtlvHdLWY5yasgN+ypK/8BWC6nR7b3ZV+b0vzRWsagjA9k3wDw4ZskixrKIevy1I9kw X-Received: by 2002:a05:6a00:998:b0:6bd:2c0a:e7d with SMTP id u24-20020a056a00099800b006bd2c0a0e7dmr1639036pfg.19.1697802534018; Fri, 20 Oct 2023 04:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697802534; cv=none; d=google.com; s=arc-20160816; b=FedKskki0TzpdCZ1CMnub8rkmoxPjQ7lWnVR7UvcViwHLkMJdyq8GTlwKQSlFZN1ZD VwQl6i8YG1tRWAux4WOW9g1YYsBOT4L0gwqRfmN3fqOBOd1wnFDKANnsep1e1cfzV6jO E1xIs+PWsfI21+dApXgPEhARUSTx102HKS2bPkkw8FTZazFd9SCxwy25Ah+9SdeqWvxn hzZ4n6G9OPVJ8KUuEip4lH73GXoNPW912iDlvfHY+gA+uio+0YHNgon5H8I1IXOZx0Ha KSusOubRGsT8TL8bM8M5OtB4GITolTL/4M50d3kc+6MkqWk86xnazA0MY65ZRS50Wu3W IgHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=nc4d6Zj4XHgr1Xjl54x/oqf+uff/SWLYOAPpNjI0yAs=; fh=21oOLqZrsdqszPj8OgnjfQavEO8hJ4yT0sqEMQ3fADg=; b=h7eIkUl0SXGI/iHWUIQ0bKsOnoibkQmLBV6P7fRBgSCu+EMlkAHs6D7wCS/LQdZ+Q+ UPCAZY6tDc8IUNb2s6A6spbbO32yfx9xb3OXLBtDP9VVwQcnSVQoodogPBmVObIehZsc GHtc99e21IwqQ02ncVZD+cW8B1OiHpBjbthMu515BZBS+BFJnd9CciwbwD3r+oGh3jUR 6yUUW8CMnVaAJCchjS1QdI8aXB8EaainQmxYyaTUmX3YG8qhC3J7/ksUfq162LlJHCWO YNl6BjQAAEsQ1cLDeVdtDrWOSDK8hoQ8XIXW/NwJ0JdJ1iV38juPXBdOfHgEBxqXbchT Roiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jAxdUzEC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=kFEB+FY9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id m22-20020a056a00081600b00690c92a8defsi1794197pfk.206.2023.10.20.04.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 04:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jAxdUzEC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=kFEB+FY9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 815AC83C4D96; Fri, 20 Oct 2023 04:48:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377299AbjJTLs3 (ORCPT + 99 others); Fri, 20 Oct 2023 07:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377377AbjJTLsO (ORCPT ); Fri, 20 Oct 2023 07:48:14 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE1310EA; Fri, 20 Oct 2023 04:38:27 -0700 (PDT) Date: Fri, 20 Oct 2023 11:37:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697801876; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nc4d6Zj4XHgr1Xjl54x/oqf+uff/SWLYOAPpNjI0yAs=; b=jAxdUzEC0OfC3B3QAmbYAFT9oTiCy/iiImRK/iVd+vEZEs5OGOlEp7Ux29iEjN255ODHBa WPXMvCJLEsv7xLeqGt/xxNn0YOaVbWOHwhHKVaGm4FbcAOV9+P6rs+hCJEPAOFBB6aMUcG sTBLIgpblBYoQ4dH0Dn5VVfsxSh0uD5AKL/sWksFH9xnobYuKAZiKK5bXNnB6x7BsVTSbA WgaMzHk6aUuUOW1HfZa/0pr3h237PSgTQ4Ta+ezOtGhIuaMH5GlShyCf+EKlzSoAQGWptx jq1RzUj4N6Q5Q1+BiWlNRR/Hnp3ZkDf2q+/oTLkJGzDim7XDlQNwANocdCg1Lg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697801876; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nc4d6Zj4XHgr1Xjl54x/oqf+uff/SWLYOAPpNjI0yAs=; b=kFEB+FY9A9hGQkC8BI+FM0Tdxe5Qj3CQiEfDgftKLSsy755usF3rHBvkVCHfM4QcN6U0I+ iXHbDO5Bqt+pRfCg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/microcode] x86/microcode: Remove pointless apply() invocation Cc: "Borislav Petkov (AMD)" , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231017211723.018821624@linutronix.de> References: <20231017211723.018821624@linutronix.de> MIME-Version: 1.0 Message-ID: <169780187623.3135.2371077022889402294.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 20 Oct 2023 04:48:51 -0700 (PDT) The following commit has been merged into the x86/microcode branch of tip: Commit-ID: e7aeaa830bb161b700dfd295ce972d1035b46864 Gitweb: https://git.kernel.org/tip/e7aeaa830bb161b700dfd295ce972d1035b46864 Author: Thomas Gleixner AuthorDate: Tue, 17 Oct 2023 23:23:49 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Thu, 19 Oct 2023 15:37:54 +02:00 x86/microcode: Remove pointless apply() invocation Microcode is applied on the APs during early bringup. There is no point in trying to apply the microcode again during the hotplug operations and neither at the point where the microcode device is initialized. Collect CPU info and microcode revision in setup_online_cpu() for now. This will move to the CPU hotplug callback later. [ bp: Leave the starting notifier for the following scenario: - boot, late load, suspend to disk, resume without the starting notifier, only the last core manages to update the microcode upon resume: # rdmsr -a 0x8b 10000bf 10000bf 10000bf 10000bf 10000bf 10000dc <---- This is on an AMD F10h machine. For the future, one should check whether potential unification of the CPU init path could cover the resume path too so that this can be simplified even more. tglx: This is caused by the odd handling of APs which try to find the microcode blob in builtin or initrd instead of caching the microcode blob during early init before the APs are brought up. Will be cleaned up in a later step. ] Signed-off-by: Borislav Petkov (AMD) Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20231017211723.018821624@linutronix.de --- arch/x86/kernel/cpu/microcode/core.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 2b742fe..cfc1f7a 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -487,17 +487,6 @@ static void microcode_fini_cpu(int cpu) microcode_ops->microcode_fini_cpu(cpu); } -static enum ucode_state microcode_init_cpu(int cpu) -{ - struct ucode_cpu_info *uci = ucode_cpu_info + cpu; - - memset(uci, 0, sizeof(*uci)); - - microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig); - - return microcode_ops->apply_microcode(cpu); -} - /** * microcode_bsp_resume - Update boot CPU microcode during resume. */ @@ -552,14 +541,14 @@ static int mc_cpu_down_prep(unsigned int cpu) static void setup_online_cpu(struct work_struct *work) { int cpu = smp_processor_id(); - enum ucode_state err; + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; - err = microcode_init_cpu(cpu); - if (err == UCODE_ERROR) { - pr_err("Error applying microcode on CPU%d\n", cpu); - return; - } + memset(uci, 0, sizeof(*uci)); + microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig); + cpu_data(cpu).microcode = uci->cpu_sig.rev; + if (!cpu) + boot_cpu_data.microcode = uci->cpu_sig.rev; mc_cpu_online(cpu); }