Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1884441rda; Tue, 24 Oct 2023 06:24:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlRbfIca16lj2fIJoFHIr10hzSMIIOroMPsOd8AzT3Xiylnutm74g3A+IguK1NqDzZsdf1 X-Received: by 2002:a17:90b:3013:b0:27c:fd8c:7d28 with SMTP id hg19-20020a17090b301300b0027cfd8c7d28mr11084845pjb.39.1698153864322; Tue, 24 Oct 2023 06:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698153864; cv=none; d=google.com; s=arc-20160816; b=WVz5U26HFFRhHLsUSyK1J0A5U2cr+Wqt+Gb6XzysOP7TvIqvMKgGsPg23Y//Z2kPTT J6g/b4Oie26Dv++MjPISoa+r2rYIqoMisfK6sqewpI9mVX1zwLHc8ef4qCrzZhL8oleh h2chfBZNixEQn/g1TzgU2+bKek18iPIIvHAfhf3zIgNJKXDuicGWmOTMsadyqZaaFdI0 bmEj6AhSUN9a4gBiGDCsaptBUOtRS/wi/xJnqLBrLI6GaOteDPNnS+4yODWoR4Oxsvki 3BRyWEYeCex5qiJ6L/8AP8/IJxb921Cz38ATP4vhoT+N/pqBqfZ1irjGRmfcsnSh+L2l d2uw== 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=gdUwx0H61gTB8NR9dIpzgdjW5wYXel7BrvBQyLGBxd4=; fh=21oOLqZrsdqszPj8OgnjfQavEO8hJ4yT0sqEMQ3fADg=; b=SH/TxgAXPAqYctsUZEGmpagay9p+UtIgnA9mH+464wkqMUN/nOOM+IV9eY2FPSOgvH WVM83qyvp0NbHIwW4obDNE+YgAs1jaHyVg+Eo1Bqh62C47HXh1YLrQ5xi0qn+dXlJD4J wwOG1U2adoa36V/1AOG3sEspBzJrHwsz2/A7FJIl4+WhxbvUh2toBrOCa19n9itHep5H BLBjj1YypD+vIyEB4mOY4A4mf77XbFJZww54SnqT4Nkft7byngxWch5hnLfl9Zc6iitF SkL3i3wAhTnlBM4RHrwmWAHSjt8WdhsJUQduoZNM1Om6dG9qadYy0+KTjIsniAZIhmHi J1bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="tmlkb1/Z"; dkim=neutral (no key) header.i=@linutronix.de header.b=f1t9brjf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z1-20020a17090ab10100b0027ce6cd3144si10859809pjq.126.2023.10.24.06.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 06:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="tmlkb1/Z"; dkim=neutral (no key) header.i=@linutronix.de header.b=f1t9brjf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 87474809927D; Tue, 24 Oct 2023 06:24:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343566AbjJXNW4 (ORCPT + 99 others); Tue, 24 Oct 2023 09:22:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234487AbjJXNWD (ORCPT ); Tue, 24 Oct 2023 09:22:03 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55A3119A0; Tue, 24 Oct 2023 06:21:07 -0700 (PDT) Date: Tue, 24 Oct 2023 13:21:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698153665; 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=gdUwx0H61gTB8NR9dIpzgdjW5wYXel7BrvBQyLGBxd4=; b=tmlkb1/ZrYyd45t1+sB3LFpDtBQfWHfmX/il2lHuxDzYDske6/J0HbluW9QLLhJvSslfZ3 N1Z9Y1No1KDYOXFENt/5lO0Z6cqkx/iI3iSBf+Y4oV6gPONxXrxjK1/aCN+dK4eXyPZsB4 kmFlhz4oRoVbN6CPv6lahYq3QOHiM7u89HqU40Yy++hYsmd1p6bRp9Lx/dJqP0bIBLvW+o bJGuwASAI6Z/75B1QuMSzCXTC8OerywYx743N3I4+yOWFHD3w8jGUiOafZPjoh4I+FhkKr 223RMssjmkUSQf4Y3qicNfLhtxsHj2EARRE0Xxcw8WfQpbt+x6ppbVDWsNL5CA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698153665; 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=gdUwx0H61gTB8NR9dIpzgdjW5wYXel7BrvBQyLGBxd4=; b=f1t9brjflWwWyRmYruCWb4UU55AuuPhl0lnDyAxu6OhHP0toTpEqr9OlDOYBedJQJo+gZO M9ucSt5Icm2eOuBg== 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: <169815366429.3135.13131206121862202196.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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 24 Oct 2023 06:24:13 -0700 (PDT) The following commit has been merged into the x86/microcode branch of tip: Commit-ID: b48b26f992a3828b4ae274669f99ce68451d4904 Gitweb: https://git.kernel.org/tip/b48b26f992a3828b4ae274669f99ce68451d4904 Author: Thomas Gleixner AuthorDate: Tue, 17 Oct 2023 23:23:49 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 24 Oct 2023 15:05: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); }