Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6157763rdb; Thu, 14 Dec 2023 09:43:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkV8Dy2NerlaQtXmwRpg0dUfOgLi3v2SjEFqGqaVW6LtKoZuqmeNoAWAOESyT6lvtFL7Pe X-Received: by 2002:a05:6a00:2d07:b0:6ce:b7cb:5770 with SMTP id fa7-20020a056a002d0700b006ceb7cb5770mr6361113pfb.49.1702575836778; Thu, 14 Dec 2023 09:43:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702575836; cv=none; d=google.com; s=arc-20160816; b=svEO813IJgAyA8UTAT/MLpFBqQjdJqz6dM3rx7l+LEysNqtQOAG38TYzhcDPwJ+rqA vhxcjW6WDWEPPBrnr3Uvev+jkNfTuNZuxymsaXdaqMbRIFT8x81P4MVxJjhZ1kbu4Xrt ixrHKcv4nq6l3OJpR17GjXAfjUAI7B/Tc8SsZmmFfFBZ1eLzSC/Ng7wLwnLMng8Ob7s+ 58KjCpskCJo7NH1y/wea8DBWMQM0WFcUO+orcyWocU4v0pX+l9m8IVfk71J39fLaQr34 qogA8lMpOwzKL5Q7I5r/RbcMRWDfp2yNmLnhTlhWYIvFYWOUZG/r4eUAk/AFgZhUMj4K r2BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=kznCyrSQcHK6cPgtCQvjDOi0z1H1jSEvzizNy2mZH6o=; fh=4iHbZ733mqZc4Bx83AV0konbWC9aXbRvmPAEmCiuGYk=; b=CXNTYq4RUrMx3YXN4y65pHyGYs36zV9iD+HsFpR4X0SDgWFenQvLnJTtF00qFvGzIq z/Dbx7O3rGERyneJtybOWQNH5+jm3favJjFVe0hSR+INQVSfyBKeUCkHxREMS1a+Q79q UYcheunXlSbldm1nQUmZpnN6g3UxV8ZGBvSA8uz3xjrnqUPZyepYjHLNairMNMSJGyyd 9zZNVBsBkTeOqEyrs1CrQJhinAQJs47aKaZm9v5JME0X3xYMJf7Db6lqUk8/ygDSeOV6 10vGo1hUDyleu6uagoYpONcgeCuHWmv1kd3MMUhuYERMyoBtmcuZ3teKvTSuycbkq6J9 ZYSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id c32-20020a630d20000000b0059b79bf220csi11575037pgl.662.2023.12.14.09.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 09:43:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E2240826A044; Thu, 14 Dec 2023 09:43:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229708AbjLNRnh (ORCPT + 99 others); Thu, 14 Dec 2023 12:43:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjLNRng (ORCPT ); Thu, 14 Dec 2023 12:43:36 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3DEFCF; Thu, 14 Dec 2023 09:43:41 -0800 (PST) Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SrfmQ0L9Sz6K7F2; Fri, 15 Dec 2023 01:41:42 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 83E611400DB; Fri, 15 Dec 2023 01:43:39 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 14 Dec 2023 17:43:38 +0000 Date: Thu, 14 Dec 2023 17:43:37 +0000 From: Jonathan Cameron To: "Russell King (Oracle)" CC: , , , , , , , , , , , , , , Salil Mehta , Jean-Philippe Brucker , , , James Morse Subject: Re: [PATCH RFC v3 07/21] ACPI: Rename acpi_processor_hotadd_init and remove pre-processor guards Message-ID: <20231214174337.000042a4@Huawei.com> In-Reply-To: References: Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 14 Dec 2023 09:43:54 -0800 (PST) On Wed, 13 Dec 2023 12:49:47 +0000 Russell King (Oracle) wrote: > From: James Morse > > acpi_processor_hotadd_init() will make a CPU present by mapping it > based on its hardware id. > > 'hotadd_init' is ambiguous once there are two different behaviours > for cpu hotplug. This is for toggling the _STA present bit. Subsequent > patches will add support for toggling the _STA enabled bit, named > acpi_processor_make_enabled(). > > Rename it acpi_processor_make_present() to make it clear this is > for CPUs that were not previously present. > > Expose the function prototypes it uses to allow the preprocessor > guards to be removed. The IS_ENABLED() check will let the compiler > dead-code elimination pass remove this if it isn't going to be > used. > > Signed-off-by: James Morse > Tested-by: Miguel Luis > Tested-by: Vishnu Pajjuri > Tested-by: Jianyong Wu > --- > Outstanding comments: > https://lore.kernel.org/r/20230914151720.00007105@Huawei.com If it's not caused a build warning yet, chances are high this is fine. Reviewed-by: Jonathan Cameron > https://lore.kernel.org/r/b8f430c1-c30f-191f-18c6-f750fa6ba476@redhat.com > For this comment, we use IS_ENABLED() in multiple places in the kernel in > this way, and it isn't a problem. > --- > drivers/acpi/acpi_processor.c | 14 +++++--------- > include/linux/acpi.h | 2 -- > 2 files changed, 5 insertions(+), 11 deletions(-) > > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c > index c8e960ff0aca..26e3efb74614 100644 > --- a/drivers/acpi/acpi_processor.c > +++ b/drivers/acpi/acpi_processor.c > @@ -183,13 +183,15 @@ static void __init acpi_pcc_cpufreq_init(void) {} > #endif /* CONFIG_X86 */ > > /* Initialization */ > -#ifdef CONFIG_ACPI_HOTPLUG_PRESENT_CPU > -static int acpi_processor_hotadd_init(struct acpi_processor *pr) > +static int acpi_processor_make_present(struct acpi_processor *pr) > { > unsigned long long sta; > acpi_status status; > int ret; > > + if (!IS_ENABLED(CONFIG_ACPI_HOTPLUG_PRESENT_CPU)) > + return -ENODEV; > + > if (invalid_phys_cpuid(pr->phys_id)) > return -ENODEV; > > @@ -223,12 +225,6 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) > cpu_maps_update_done(); > return ret; > } > -#else > -static inline int acpi_processor_hotadd_init(struct acpi_processor *pr) > -{ > - return -ENODEV; > -} > -#endif /* CONFIG_ACPI_HOTPLUG_PRESENT_CPU */ > > static int acpi_processor_get_info(struct acpi_device *device) > { > @@ -335,7 +331,7 @@ static int acpi_processor_get_info(struct acpi_device *device) > * because cpuid <-> apicid mapping is persistent now. > */ > if (invalid_logical_cpuid(pr->id) || !cpu_present(pr->id)) { > - int ret = acpi_processor_hotadd_init(pr); > + int ret = acpi_processor_make_present(pr); > > if (ret) > return ret; > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 36071bc11acd..19d009ca9e7a 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -301,12 +301,10 @@ static inline int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, > } > #endif > > -#ifdef CONFIG_ACPI_HOTPLUG_PRESENT_CPU > /* Arch dependent functions for cpu hotplug support */ > int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, > int *pcpu); > int acpi_unmap_cpu(int cpu); > -#endif /* CONFIG_ACPI_HOTPLUG_PRESENT_CPU */ > > #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC > int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr);