Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp149395lqg; Fri, 26 Apr 2024 11:09:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1UoNGJvM2HQ5DlrXESfm9dNY3/C8JXWGFEAmdC6/vPhsG/XRvW2YEPwRKneqgn1y5NBgT5MdfVnmVkI4z2r6eQqoRbrLbY1mvbV401Q== X-Google-Smtp-Source: AGHT+IETocf+MNPrigFShmVJlRQ7cjlDGMtvqCapuNzA9o+Xp0o/ZefLAT6/HJbly2+IergOeoTB X-Received: by 2002:a17:906:3e4e:b0:a58:a2f7:85e9 with SMTP id t14-20020a1709063e4e00b00a58a2f785e9mr2702432eji.34.1714154970450; Fri, 26 Apr 2024 11:09:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714154970; cv=pass; d=google.com; s=arc-20160816; b=pJu4yIexxDs1AGx1A1j8sNrVl780XMcUo4Fy+Qfg5SuQnXdHoLmn/pW9UycYppnqvY E87+swhVWmNGBKkw8crtlzk6KpXZRIiZ9HKusmRF5uJbqprmMrSzOlmYJD0k98vsR/XO 4Q3k7hohz+wYW/9bhffR1A1dJMFEGWeC81mi83cJX37gKIDRiMVybpRixp66yyLsG96s G5mkHV1QuGjSZOtxNAEZvScXlcIwAH2qu+WsdSepiPHTzkDqz18VwD/yWc7at7xppqYh iw92jlezzutfpC1sz5ficxH6lbFaQwfHFkhxD4C4O/Q39G20w2yYwijrussSALIoxWGo 15Ow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=3jP326zRorcut3vAjLu+MqlrL+LxgBf8fTsSIwEoBvU=; fh=zKteNxjX8kORKv3dpqwp/TaJY/e3eb9grl/AdX8vmLQ=; b=zdVHTH+RdZf/r/d6OHfwzzMBMXVwxrL5ZWRNDI1pRT2TvSMgiBbXWREICLUdbEG6Jk EDo/XDCyGyCEwIzFDBU6V0KMI5gk2T0GtS2eSz3AAz0AvkollpASqb5+5omXGzWZjhKP Q6q7bb5J1g4i0Q8m9kU8o+wa020l4aBiaTR5av/b8j7ZIYVwiBQDO5FBaj1AIy57TNv5 dV5FWG5jehHq5EPQI5GyZYAfmD8E5mv/LkheZ2xsONno0VrVI6rj2ibz0Pc8zio+SS9h 9rgwvFYIu9b9Kxy+dHDWptRLBOwFhdHJPPORLmaH0jIYWXh7iuSv7ftkK3O2onDhB6NS N8RA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-160535-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id mj25-20020a170906af9900b00a51a1d1a3dcsi11194093ejb.319.2024.04.26.11.09.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 11:09:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160535-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-160535-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DC6D71F2330C for ; Fri, 26 Apr 2024 18:09:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5038616DED4; Fri, 26 Apr 2024 18:09:19 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97F661EB5E; Fri, 26 Apr 2024 18:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714154958; cv=none; b=Mxlb0/584UJX9lsH79B90Yphjc+pQDlezKnjRO1W9roWJoKfV95IlpN2MI6oKBG8YelsdejkjAqYoeu+GsHuPZlieZWDAlYFC+hmhgfn8M/HzpEiWRn/1oKyifGE/1+YjJKmR2JrGQRC3IpfmlxnrPyHiwshkt1OxwVfrgO7xJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714154958; c=relaxed/simple; bh=vylh6oaMyHYbUe0eNlx6uprvORS7R1/lEC/zt0QqiOQ=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qBiHMao8iv6i7i86FJkZTMRDLbiGb/PWkmHw4//JymUrLhJXa6/mb8iUwC50ZexxAZFMuuImxUR15GAY112eDjZ4hKPE7A2niWWVL+tMnWdbcFUBYODAEYuSG/noDO//LwSF2FKkrQIeOZodP/SUDsM0UtunGdv09fA+uqzurzc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VR0zV4n0sz6JBCB; Sat, 27 Apr 2024 02:06:46 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 70BD61408F9; Sat, 27 Apr 2024 02:09:12 +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_256_GCM_SHA384) id 15.1.2507.35; Fri, 26 Apr 2024 19:09:11 +0100 Date: Fri, 26 Apr 2024 19:09:10 +0100 From: Jonathan Cameron To: Miguel Luis CC: Thomas Gleixner , Peter Zijlstra , "linux-pm@vger.kernel.org" , "loongarch@lists.linux.dev" , "linux-acpi@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "x86@kernel.org" , Russell King , "Rafael J . Wysocki" , "James Morse" , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon , Marc Zyngier , Hanjun Guo , Ingo Molnar , Borislav Petkov , Dave Hansen , "linuxarm@huawei.com" , "justin.he@arm.com" , "jianyong.wu@arm.com" , Lorenzo Pieralisi , "Sudeep Holla" Subject: Re: [PATCH v8 01/16] ACPI: processor: Simplify initial onlining to use same path for cold and hotplug Message-ID: <20240426190910.00001dcd@Huawei.com> In-Reply-To: <20240426184949.0000506d@Huawei.com> References: <20240426135126.12802-1-Jonathan.Cameron@huawei.com> <20240426135126.12802-2-Jonathan.Cameron@huawei.com> <6347020E-CB49-44ED-87B2-3BB2AA2F59E0@oracle.com> <2E688E98-F57F-444F-B326-5206FB6F5C1E@oracle.com> <20240426184949.0000506d@Huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500005.china.huawei.com (7.191.163.240) On Fri, 26 Apr 2024 18:49:49 +0100 Jonathan Cameron wrote: > On Fri, 26 Apr 2024 17:21:41 +0000 > Miguel Luis wrote: > > > Hi Jonathan, > > > > > On 26 Apr 2024, at 16:05, Miguel Luis wrote: > > > > > > > > > > > >> On 26 Apr 2024, at 13:51, Jonathan Cameron wrote: > > >> > > >> Separate code paths, combined with a flag set in acpi_processor.c to > > >> indicate a struct acpi_processor was for a hotplugged CPU ensured that > > >> per CPU data was only set up the first time that a CPU was initialized. > > >> This appears to be unnecessary as the paths can be combined by letting > > >> the online logic also handle any CPUs online at the time of driver load. > > >> > > >> Motivation for this change, beyond simplification, is that ARM64 > > >> virtual CPU HP uses the same code paths for hotplug and cold path in > > >> acpi_processor.c so had no easy way to set the flag for hotplug only. > > >> Removing this necessity will enable ARM64 vCPU HP to reuse the existing > > >> code paths. > > >> > > >> Leave noisy pr_info() in place but update it to not state the CPU > > >> was hotplugged. > > > > On a second thought, do we want to keep it? Can't we just assume that no > > news is good news while keeping the warn right after __acpi_processor_start ? > > Good question - my inclination was to keep this in place for now as removing > it would remove a source of information people may expect on x86 hotplug. > > Then maybe propose dropping it as overly noisy kernel as a follow up > patch after this series is merged. Felt like a potential rat hole I didn't > want to go down if I could avoid it. > > If any x86 experts want to shout that no one cares then I'll happily drop > the print. We've carefully made it so that on arm64 we have no way to tell > if this is hotplug or normal cpu bring up so we can't just print it on > hotplug. I'm being silly. This is just one of the messages shouting out hotplug happened and for that matter only occurs at online anyway which is trivially detected. There is a much more informative ACPI: CPU3: has been hot-added message for example on the actual hotplug event. Let's drop it for v9. There is also a stale comment about a flag being set that is no longer the case that I'll drop. > > Jonathan > > > > > > Miguel > > > > >> > > >> Acked-by: Rafael J. Wysocki > > >> Reviewed-by: Hanjun Guo > > >> Tested-by: Miguel Luis > > >> Reviewed-by: Gavin Shan > > >> Signed-off-by: Jonathan Cameron > > >> > > >> --- > > >> v8: No change > > >> --- > > >> drivers/acpi/acpi_processor.c | 1 - > > >> drivers/acpi/processor_driver.c | 44 ++++++++++----------------------- > > >> include/acpi/processor.h | 2 +- > > >> 3 files changed, 14 insertions(+), 33 deletions(-) > > >> > > >> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c > > >> index 7a0dd35d62c9..7fc924aeeed0 100644 > > >> --- a/drivers/acpi/acpi_processor.c > > >> +++ b/drivers/acpi/acpi_processor.c > > >> @@ -216,7 +216,6 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) > > >> * gets online for the first time. > > >> */ > > >> pr_info("CPU%d has been hot-added\n", pr->id); > > >> - pr->flags.need_hotplug_init = 1; > > >> > > >> out: > > >> cpus_write_unlock(); > > >> diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c > > >> index 67db60eda370..55782eac3ff1 100644 > > >> --- a/drivers/acpi/processor_driver.c > > >> +++ b/drivers/acpi/processor_driver.c > > >> @@ -33,7 +33,6 @@ MODULE_AUTHOR("Paul Diefenbaugh"); > > >> MODULE_DESCRIPTION("ACPI Processor Driver"); > > >> MODULE_LICENSE("GPL"); > > >> > > >> -static int acpi_processor_start(struct device *dev); > > >> static int acpi_processor_stop(struct device *dev); > > >> > > >> static const struct acpi_device_id processor_device_ids[] = { > > >> @@ -47,7 +46,6 @@ static struct device_driver acpi_processor_driver = { > > >> .name = "processor", > > >> .bus = &cpu_subsys, > > >> .acpi_match_table = processor_device_ids, > > >> - .probe = acpi_processor_start, > > >> .remove = acpi_processor_stop, > > >> }; > > >> > > >> @@ -115,12 +113,10 @@ static int acpi_soft_cpu_online(unsigned int cpu) > > >> * CPU got physically hotplugged and onlined for the first time: > > >> * Initialize missing things. > > >> */ > > >> - if (pr->flags.need_hotplug_init) { > > >> + if (!pr->flags.previously_online) { > > >> int ret; > > >> > > >> - pr_info("Will online and init hotplugged CPU: %d\n", > > >> - pr->id); > > >> - pr->flags.need_hotplug_init = 0; > > >> + pr_info("Will online and init CPU: %d\n", pr->id); > > >> ret = __acpi_processor_start(device); > > >> WARN(ret, "Failed to start CPU: %d\n", pr->id); > > >> } else { > > >> @@ -167,9 +163,6 @@ static int __acpi_processor_start(struct acpi_device *device) > > >> if (!pr) > > >> return -ENODEV; > > >> > > >> - if (pr->flags.need_hotplug_init) > > >> - return 0; > > >> - > > >> result = acpi_cppc_processor_probe(pr); > > >> if (result && !IS_ENABLED(CONFIG_ACPI_CPU_FREQ_PSS)) > > >> dev_dbg(&device->dev, "CPPC data invalid or not present\n"); > > >> @@ -185,32 +178,21 @@ static int __acpi_processor_start(struct acpi_device *device) > > >> > > >> status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, > > >> acpi_processor_notify, device); > > >> - if (ACPI_SUCCESS(status)) > > >> - return 0; > > >> + if (!ACPI_SUCCESS(status)) { > > >> + result = -ENODEV; > > >> + goto err_thermal_exit; > > >> + } > > >> + pr->flags.previously_online = 1; > > >> > > >> - result = -ENODEV; > > >> - acpi_processor_thermal_exit(pr, device); > > >> + return 0; > > >> > > >> +err_thermal_exit: > > >> + acpi_processor_thermal_exit(pr, device); > > >> err_power_exit: > > >> acpi_processor_power_exit(pr); > > >> return result; > > >> } > > >> > > >> -static int acpi_processor_start(struct device *dev) > > >> -{ > > >> - struct acpi_device *device = ACPI_COMPANION(dev); > > >> - int ret; > > >> - > > >> - if (!device) > > >> - return -ENODEV; > > >> - > > >> - /* Protect against concurrent CPU hotplug operations */ > > >> - cpu_hotplug_disable(); > > >> - ret = __acpi_processor_start(device); > > >> - cpu_hotplug_enable(); > > >> - return ret; > > >> -} > > >> - > > >> static int acpi_processor_stop(struct device *dev) > > >> { > > >> struct acpi_device *device = ACPI_COMPANION(dev); > > >> @@ -279,9 +261,9 @@ static int __init acpi_processor_driver_init(void) > > >> if (result < 0) > > >> return result; > > >> > > >> - result = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, > > >> - "acpi/cpu-drv:online", > > >> - acpi_soft_cpu_online, NULL); > > >> + result = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, > > >> + "acpi/cpu-drv:online", > > >> + acpi_soft_cpu_online, NULL); > > >> if (result < 0) > > >> goto err; > > >> hp_online = result; > > >> diff --git a/include/acpi/processor.h b/include/acpi/processor.h > > >> index 3f34ebb27525..e6f6074eadbf 100644 > > >> --- a/include/acpi/processor.h > > >> +++ b/include/acpi/processor.h > > >> @@ -217,7 +217,7 @@ struct acpi_processor_flags { > > >> u8 has_lpi:1; > > >> u8 power_setup_done:1; > > >> u8 bm_rld_set:1; > > >> - u8 need_hotplug_init:1; > > >> + u8 previously_online:1; > > > > > > Reviewed-by: Miguel Luis > > > > > > Miguel > > > > > >> }; > > >> > > >> struct acpi_processor { > > >> -- > > >> 2.39.2 > > >> > > > > > >