Message ID | E1qtqkk-00AJHA-1u@rmk-PC.armlinux.org.uk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp1107132vqb; Fri, 20 Oct 2023 07:45:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9vgFnoSUNaGkixRhrQ75SUBGoJ36YGZwwFNIQLT0lRYKmN7BXlZ18FBJpi9uRuN5GU5HM X-Received: by 2002:a05:6870:3e08:b0:1e9:892b:eaa0 with SMTP id lk8-20020a0568703e0800b001e9892beaa0mr2338589oab.9.1697813158206; Fri, 20 Oct 2023 07:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697813158; cv=none; d=google.com; s=arc-20160816; b=iNMs8rdfanthCyQbFK2Lar4JE/oNTh4M6Ra8q3MKageoAIIdUrFx6PPD0kJLF9oPf2 H/GzS3CsLIXV0HS6AP4YG/EqVgwFbSBF5AyOT5zo86gKE9nrclroO28IpMRk/4I5OWzV CLHBEuXWphKR7HKQq49h5VH+KhW9Jr7uHO7jhGFkd0QL9w6yeNYpmBxSwX3TnjNsZz0C DBm8a9kK6KOt37HozgA4m2Jm/7r49AJXJsCT2iP41YvLFw3hS37CO2MwK26hbZ4GacM/ mQkF0wj+/Pih2gE4/k0LwUK2yv3UTn/LqXaKxUXtIdJTKN54uJfi4CLnieTS4jfMlPyH jpoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:dkim-signature; bh=cDxywtFxZEUNp05zPiJtAEtgwzGlfWET0wpc3onEv/c=; fh=ClSjnYXQ/e0krynDil6gRDPxHOCMAuogadoXv1VoMZc=; b=O8A+ZeBi3ww1T0TMUA9oIFWyGWadpPtcB3djv+hwhXQlzxDOLswL+qTB6H65ZLvnxg DZbfz9ExWAYyfXuBrWdEiX1oiWtqqlSOZRVUOkINILZY8FTB8lYjoDmNISS9+fUJOrxo USyY9jvXOhN6j2ExUX9YB+DMD5fW0ICadGQbZF5a8G4pHj9fWCdqv8i6rsdrs1SXP3aA gdghLfHflNVDGHP0CK7wafrSLKkMQzrB5LU1PJw2V8AAhwB86p7GSD5sG9uXhVxMBPJP onII07fEAIu20BmWHAE2sWhpLTnKeN1NJ1dkAPai+sfY7AO/HyRzPTgjJeiRWol61UQ7 ertw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=GPLeDlz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id t9-20020a63dd09000000b005ae598c71d8si1983505pgg.900.2023.10.20.07.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=GPLeDlz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 241658347B7D; Fri, 20 Oct 2023 07:45:56 -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 S1377583AbjJTOpk (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Fri, 20 Oct 2023 10:45:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377429AbjJTOpj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Oct 2023 10:45:39 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26441106; Fri, 20 Oct 2023 07:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cDxywtFxZEUNp05zPiJtAEtgwzGlfWET0wpc3onEv/c=; b=GPLeDlz8NZPdqaalFptDuwkfgg He7H0OvnM01HQb/90N87NEqkU6/7q6cu4gz6Xs7vXcSbfp7Bp70zUtr/Ke9If3SzmZPlqAQ7rmWhL EHe8spTakoPB9vD4Pr41hd9IigIcOMiTRmrYY7FKvL717JjxKBfMVKRFAtG+6J6YQ3ltQ9mAod82n X3aVWQz4pNHflalnnwPbSN/wDU17gRc5FIejYsy2ev6TdzJYXtnWKpcShgQK+GlOyV7ixTK/oxQbl KzPVN4VkGq4BgegruPDZ7XKXnaj8wQURiijPn8xIZU5+2H/+TglV61dD4JDkxs1/a+kgCxCJ8A2FF THo5uZdQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:49724 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <rmk@armlinux.org.uk>) id 1qtqki-0000WW-22; Fri, 20 Oct 2023 15:45:28 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from <rmk@rmk-PC.armlinux.org.uk>) id 1qtqkk-00AJHA-1u; Fri, 20 Oct 2023 15:45:30 +0100 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> To: Helge Deller <deller@gmx.de>, "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>, Jonathan Cameron <Jonathan.Cameron@Huawei.com>, Salil Mehta <salil.mehta@huawei.com>, linux-parisc@vger.kernel.org Subject: [PATCH] parisc: simplify smp_prepare_boot_cpu() MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: <E1qtqkk-00AJHA-1u@rmk-PC.armlinux.org.uk> Sender: Russell King <rmk@armlinux.org.uk> Date: Fri, 20 Oct 2023 15:45:30 +0100 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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: <linux-kernel.vger.kernel.org> 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 07:45:56 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780286130329008101 X-GMAIL-MSGID: 1780286130329008101 |
Series |
parisc: simplify smp_prepare_boot_cpu()
|
|
Commit Message
Russell King (Oracle)
Oct. 20, 2023, 2:45 p.m. UTC
smp_prepare_boot_cpu() reads the cpuid of the first CPU, printing a
message to state which processor booted, and setting it online and
present.
This cpuid is retrieved from per_cpu(cpu_data, 0).cpuid, which is
initialised in arch/parisc/kernel/processor.c:processor_probe() thusly:
p = &per_cpu(cpu_data, cpuid);
...
p->cpuid = cpuid; /* save CPU id */
Consequently, the cpuid retrieved seems to be guaranteed to also be
zero, meaning that the message printed in this boils down to:
pr_info("SMP: bootstrap CPU ID is 0\n");
Moreover, since kernel/cpu.c::boot_cpu_init() already sets CPU 0 to
be present and online, there is no need to do this again in
smp_prepare_boot_cpu().
Remove this code, and simplify the printk().
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
arch/parisc/kernel/smp.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
Comments
On Fri, 20 Oct 2023 15:45:30 +0100 "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote: > smp_prepare_boot_cpu() reads the cpuid of the first CPU, printing a > message to state which processor booted, and setting it online and > present. > > This cpuid is retrieved from per_cpu(cpu_data, 0).cpuid, which is > initialised in arch/parisc/kernel/processor.c:processor_probe() thusly: > > p = &per_cpu(cpu_data, cpuid); > ... > p->cpuid = cpuid; /* save CPU id */ > > Consequently, the cpuid retrieved seems to be guaranteed to also be > zero, meaning that the message printed in this boils down to: > > pr_info("SMP: bootstrap CPU ID is 0\n"); > > Moreover, since kernel/cpu.c::boot_cpu_init() already sets CPU 0 to > be present and online, there is no need to do this again in > smp_prepare_boot_cpu(). > > Remove this code, and simplify the printk(). > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> LGTM, but trivial comment inline. > --- > arch/parisc/kernel/smp.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c > index 2019c1f04bd0..989efc8c67a5 100644 > --- a/arch/parisc/kernel/smp.c > +++ b/arch/parisc/kernel/smp.c > @@ -404,13 +404,8 @@ static int smp_boot_one_cpu(int cpuid, struct task_struct *idle) > > void __init smp_prepare_boot_cpu(void) > { > - int bootstrap_processor = per_cpu(cpu_data, 0).cpuid; > - > /* Setup BSP mappings */ Given it's not doing any such thing, I think you should also drop the comment. > - printk(KERN_INFO "SMP: bootstrap CPU ID is %d\n", bootstrap_processor); > - > - set_cpu_online(bootstrap_processor, true); > - set_cpu_present(bootstrap_processor, true); > + pr_info("SMP: bootstrap CPU ID is 0\n"); > } > >
On 10/20/23 16:45, Russell King (Oracle) wrote: > smp_prepare_boot_cpu() reads the cpuid of the first CPU, printing a > message to state which processor booted, and setting it online and > present. > > This cpuid is retrieved from per_cpu(cpu_data, 0).cpuid, which is > initialised in arch/parisc/kernel/processor.c:processor_probe() thusly: > > p = &per_cpu(cpu_data, cpuid); > ... > p->cpuid = cpuid; /* save CPU id */ > > Consequently, the cpuid retrieved seems to be guaranteed to also be > zero, meaning that the message printed in this boils down to: > > pr_info("SMP: bootstrap CPU ID is 0\n"); > > Moreover, since kernel/cpu.c::boot_cpu_init() already sets CPU 0 to > be present and online, there is no need to do this again in > smp_prepare_boot_cpu(). > > Remove this code, and simplify the printk(). > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> applied. Removed the "Setup BSP mappings" comment too, as Jonathan Cameron suggested. Thank you! Helge > --- > arch/parisc/kernel/smp.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c > index 2019c1f04bd0..989efc8c67a5 100644 > --- a/arch/parisc/kernel/smp.c > +++ b/arch/parisc/kernel/smp.c > @@ -404,13 +404,8 @@ static int smp_boot_one_cpu(int cpuid, struct task_struct *idle) > > void __init smp_prepare_boot_cpu(void) > { > - int bootstrap_processor = per_cpu(cpu_data, 0).cpuid; > - > /* Setup BSP mappings */ > - printk(KERN_INFO "SMP: bootstrap CPU ID is %d\n", bootstrap_processor); > - > - set_cpu_online(bootstrap_processor, true); > - set_cpu_present(bootstrap_processor, true); > + pr_info("SMP: bootstrap CPU ID is 0\n"); > } > >
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index 2019c1f04bd0..989efc8c67a5 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -404,13 +404,8 @@ static int smp_boot_one_cpu(int cpuid, struct task_struct *idle) void __init smp_prepare_boot_cpu(void) { - int bootstrap_processor = per_cpu(cpu_data, 0).cpuid; - /* Setup BSP mappings */ - printk(KERN_INFO "SMP: bootstrap CPU ID is %d\n", bootstrap_processor); - - set_cpu_online(bootstrap_processor, true); - set_cpu_present(bootstrap_processor, true); + pr_info("SMP: bootstrap CPU ID is 0\n"); }