From patchwork Fri Oct 20 11:37:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 156053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp992160vqb; Fri, 20 Oct 2023 04:41:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7in3EumMzWgSzkFOmMaZneXpA37nrARZV40asXzukHSY0YRM6Yh/VTwf/nfRaiLPOx9oO X-Received: by 2002:a05:6a20:7f91:b0:163:a041:336c with SMTP id d17-20020a056a207f9100b00163a041336cmr1799373pzj.48.1697802107219; Fri, 20 Oct 2023 04:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697802107; cv=none; d=google.com; s=arc-20160816; b=qLBFFwg7Mv4mdcQMTti7DEV+jnM5jGW5BTXsbt5BJ6rVbzIAV9LtYSs9bn6K+FHv7j EoNpotUQA6OEb5pWHq3nneikMUWngXwwikN+a3WU4gytLzLqq3Gy1nMIKdzPY78kQB4H o7kNnfWJrJ3tSJ6HgCSRimc85GXCEiYQGiT8JY52KuG+UOCJ+o5y340QWAvsWHnqINCa VB8FYMjAldZPEdxEog9pdZfGkGQiN4G+nBI/C83emu21NctUX10cnh7cTsKtmZtgwgN6 SyQe+3/yF7278tCssCmoHmrT25GKjPbskYMFONhTjWwEdVVdkMVNI+ALw9qj+cpR4wiO K85w== 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=vdYHOrN3XM+EccrGn81iU/XtmJFMCAQc9uJD23D4LzI=; fh=LWlv3U+xZ3+vQt4tlJRIlKl5VzN7iFjjE/bzRmlxKDA=; b=l2HJi8tOG3haHQbygvxh2VEESa+0X2D1ByBVs8BcSq4giuP6f4ynjDIMRt1IUdCYQo 3vILW703MH84Uk/rryoe/0p67eGPku3pkUl1boYhh1J0RAWuP+L5ayccXUfOm6UFJVA4 /bS1QGdpCE9wDQnqf0ReqplDnqhb2l2PqB3Vgk2ebStGH7J+1/Byn9Nrc+/AH0+seClZ aoqhliYYy0pvea0JARoPNbQ7WcX06+lSON59yT+VVT2EJL1FLRNxnKL6USNaQz99tg7L nR+jNj7McApXXos1Xq+Az3rauGmFvPlGTxoLZzUdUy3rSlE3alkQTLF2nR4xA1KTEyr8 oUKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=giOQkZAI; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id t4-20020a63f344000000b005b7dd1e334csi1587849pgj.601.2023.10.20.04.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 04:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=giOQkZAI; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 83496832B72A; Fri, 20 Oct 2023 04:40:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377448AbjJTLjl (ORCPT + 25 others); Fri, 20 Oct 2023 07:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377149AbjJTLiv (ORCPT ); Fri, 20 Oct 2023 07:38:51 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D43A1FEA; Fri, 20 Oct 2023 04:38:07 -0700 (PDT) Date: Fri, 20 Oct 2023 11:37:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697801873; 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=vdYHOrN3XM+EccrGn81iU/XtmJFMCAQc9uJD23D4LzI=; b=giOQkZAIg9RgOPasC279ekFJq3dufkROdN6p8o6Xd+Tk/18XNsV8f58CAfSofr43l0MkzD gBp6w34FowEjZYjgCf2ucMcnSu2IyaWAB9afIufxufl3Hdfjv2Um+7i6KOu/adwgk5nNcd EVxNQWLDnEokVQkUnsbx6ZHKUVAGVgLhW9UKSKagEiAXbl+4S7CoLiWVUqSALfTRKoleJk vqwE1GS7QvYX5a5YHMDMUo8W9jNcbaN4Su5Va9S182m8OsiNkLamLjfh+WV5/DWK/R7R+2 YL5TfrDp0JT7qYbEVPqrBLwexyHFg4pAbMMYov/MklN40aGS3hp1AxVIgUxJmQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697801873; 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=vdYHOrN3XM+EccrGn81iU/XtmJFMCAQc9uJD23D4LzI=; b=qqdktpSU/ncHeQHWiD2jP9aQtHt12dZ5opNx2g/hZLLJgClWXNIJw29JaBprGbh5C8wE8O AQ2Hju85LEBIEZAg== 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: Get rid of the schedule work indirection Cc: Thomas Gleixner , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231017211723.354748138@linutronix.de> References: <20231017211723.354748138@linutronix.de> MIME-Version: 1.0 Message-ID: <169780187303.3135.6617404814622767836.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 20 Oct 2023 04:40:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780039523467661165 X-GMAIL-MSGID: 1780274542025656546 The following commit has been merged into the x86/microcode branch of tip: Commit-ID: dda4cedc27cfb76dc07230c501c81c59b62b1db0 Gitweb: https://git.kernel.org/tip/dda4cedc27cfb76dc07230c501c81c59b62b1db0 Author: Thomas Gleixner AuthorDate: Tue, 17 Oct 2023 23:23:58 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Thu, 19 Oct 2023 15:53:00 +02:00 x86/microcode: Get rid of the schedule work indirection Scheduling work on all CPUs to collect the microcode information is just another extra step for no value. Let the CPU hotplug callback registration do it. Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20231017211723.354748138@linutronix.de --- arch/x86/kernel/cpu/microcode/core.c | 29 +++++++++------------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 37145cf..0ed96d2 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -481,8 +481,16 @@ static struct syscore_ops mc_syscore_ops = { static int mc_cpu_online(unsigned int cpu) { + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; struct device *dev = get_cpu_device(cpu); + 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; + if (sysfs_create_group(&dev->kobj, &mc_attr_group)) pr_err("Failed to create group for CPU%d\n", cpu); return 0; @@ -503,20 +511,6 @@ static int mc_cpu_down_prep(unsigned int cpu) return 0; } -static void setup_online_cpu(struct work_struct *work) -{ - int cpu = smp_processor_id(); - struct ucode_cpu_info *uci = ucode_cpu_info + cpu; - - 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); -} - static struct attribute *cpu_root_microcode_attrs[] = { #ifdef CONFIG_MICROCODE_LATE_LOADING &dev_attr_reload.attr, @@ -562,12 +556,9 @@ static int __init microcode_init(void) } } - /* Do per-CPU setup */ - schedule_on_each_cpu(setup_online_cpu); - register_syscore_ops(&mc_syscore_ops); - cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "x86/microcode:online", - mc_cpu_online, mc_cpu_down_prep); + cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/microcode:online", + mc_cpu_online, mc_cpu_down_prep); pr_info("Microcode Update Driver: v%s.", DRIVER_VERSION);