Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp362971lqj; Wed, 10 Apr 2024 12:44:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvUEt9SLPoOttN0LlkIH96utQ1/g3OdrNLAnP8cqc69cGCgS3rgERwaqw6g0qSJruFeM+ipakkvduvFdPQWhaWWLs/2Oh+1uYnIesvnw== X-Google-Smtp-Source: AGHT+IFnNeYe9YQdFgJEt5N3b7vqBdLVGY8JUY/iHCf9KPWTeDSR6nz6cmu4jS4UyEFWUxcfZ75U X-Received: by 2002:a37:e205:0:b0:78d:766a:d696 with SMTP id g5-20020a37e205000000b0078d766ad696mr3441193qki.26.1712778268121; Wed, 10 Apr 2024 12:44:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712778268; cv=pass; d=google.com; s=arc-20160816; b=XfRjixK+xqqF1pw1tZt6suqwlunxJvXaEBGD1UzP6iYv3YsUDslPh4RuamMy1hozk1 7FpzxZ16WmYD81F/i52hJFT7MsvfgpOuUb3hS0COf9w4es/X7uzB1nM09hFLLAJX/kVt 3RtCZ5Gq0hDCNZGdHC/ZyBrr4/t6rLGj/QpftE5EJ/nX2Q/FKcK8YGDfwLA/Sz+csb0D lwZL58YnubA6mxlNEDFVHjylfeZcbMhR0MFLtKCXwvg+IySN0NEF5SzjznoQ34qMpgOZ /nFRUcWaKZcmNYUiij3BP98XiaTJfwsR3Id5lRagamMmY8n7xBNfTNuSLvmNXPv8MCMA aZcQ== 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=9pWGJeQ/aH2LfyDq/5ABQwzi8v5Y/H1hiJWf4jIRljo=; fh=cEYmCmaCvWipNJoGc0Xaierves4a7pms8X4qixMnct0=; b=MIoLrbModz1n01sop2ZNUjUAmGDF6FNpW7oqiDN0PfsD1Niq3HtbBpV+ivY7FTrVil ncGlHQidI2gkHtQkzb5+WdmWvBeV6UiZDVhqUO78Z5aO7LKuEh8cnthPNurpWWOgwmZ6 P2cZyxBqwSuocNDAvBE0suphcUZKgTXCUV2XtmCSQBD/gApkQrUE6SyVFHpgfcXQJb6D TGs/W6vPn+LfuHQeQffy9c3wBsDxaYBNx1MwUq0TWkKWNhxgzdBDZzgMZTb9KDvQHf68 FxzzbnDHN2gk0gdot8NutetYRFF2CcEUN8P4kQ/rKZXwzGL1XfEjWbyA5Ltas+VY5o01 KJIg==; 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-139270-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139270-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e9-20020a37db09000000b0078ebde23011si718414qki.455.2024.04.10.12.44.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 12:44:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139270-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-139270-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139270-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D50351C2293F for ; Wed, 10 Apr 2024 19:44:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C83618133B; Wed, 10 Apr 2024 19:44:21 +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 73FA828FD; Wed, 10 Apr 2024 19:44:18 +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=1712778261; cv=none; b=E35909tQr3VDE50px4fSekRuI71TRX2GB+3TNHJmJcVnoOfuTcMdJoE6095/7DX5t5KocxMP1WrB6d9IpNaqLF/UF3CqGqphqjJZ+OLXzeko/JamXZwWBdZW8Aj3imgvIsZR5u/Ix+gKKjZCgUKPgLggLf3YFUT1aRkxAx+zNsg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712778261; c=relaxed/simple; bh=bvn3HeBV5B1H5EW3+9oYTS8376zM5l0GlHFhqMk/U4U=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ua1abeVAhShbzCV8S6lIlcnVij6ineXvC69VaN2h6ttItGRekMCaTup9YA/6LiQid4SNIeFBiPedCpRta7xu14i2Jjgz5BPhp10aHDvFuzjbrGxgkQD8xtt/KRUyxtN0bH2wFazqomHd2SziInp2ITaIcZEoUOdZADu6SMXnUTY= 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 4VFCnr464Qz6K9Pl; Thu, 11 Apr 2024 03:39:28 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 53E9C1402C7; Thu, 11 Apr 2024 03:44:16 +0800 (CST) Received: from localhost (10.48.150.216) 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; Wed, 10 Apr 2024 20:44:15 +0100 Date: Wed, 10 Apr 2024 20:44:15 +0100 From: Jonathan Cameron To: Miguel Luis CC: "Rafael J. Wysocki" , Len Brown , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "rmk+kernel@armlinux.org.uk" Subject: Re: [RFC PATCH 3/4] ACPI: processor: refactor acpi_processor_get_info: isolate acpi_{map|unmap}_cpu under CONFIG_ACPI_HOTPLUG_CPU Message-ID: <20240410204415.00005597@Huawei.com> In-Reply-To: References: <20240409150536.9933-1-miguel.luis@oracle.com> <20240409150536.9933-4-miguel.luis@oracle.com> <20240410142359.00003dea@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="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) On Wed, 10 Apr 2024 18:29:34 +0000 Miguel Luis wrote: > > On 10 Apr 2024, at 13:23, Jonathan Cameron wrote: > >=20 > > On Tue, 9 Apr 2024 15:05:32 +0000 > > Miguel Luis wrote: > > =20 > >> mapping and unmaping a cpu at the stage of extra cpu enumeration is > >> architecture specific which depends on CONFIG_ACPI_HOTPLUG_CPU so let's > >> isolate that functionality from architecture independent one. =20 > >=20 > > Should we consider renaming acpi_map_cpu() to arch_acpi_map_cpu() > > to make the arch specific nature of that call more obvious? =20 >=20 > Not sure about the pattern to use here but that seems fine to me. Current= usage > is architectures export acpi_map_cpu from the acpi interface and do their > thing. >=20 > Question is what to do when there=E2=80=99s a use-case which dismisses ac= pi_map_cpu and > it gets called on the code path? I'm not sure what you mean by dismisses? Is missing perhaps? If that is what you mean, I think it's a mistake to al= low that code to be called from a path that isn't dependent on CONFIG_ACPI_HOTPLUG_CPU. It makes no sense to do so and stubbing it out to = give the impression that the calling it does make sense (when looking at the cal= ler) is misleading. Jonathan >=20 > 1) export it and do nothing - it would be creating unnecessary dependency. >=20 > 2) evaluate whether calling it is exclusive to the CPU HP path and keep i= t wrapped > into CONFIG_ACPI_HOTPLUG_CPU. >=20 > Option (2) is the current approach on this RFC. IIUC acpi_map_cpu is sole= ly > used for CPU HP and the same applies to acpi_unmap_cpu. >=20 > > I think that has caused more confusion in the discussion than > > whether it is hotplug specific or not. =20 >=20 > Indeed. Within the CPU HP path there are these arch specific intricacies. >=20 > >=20 > > As mentioned in patch 2, fairly sure this needs to go before that > > patch. =20 >=20 > 2 and 3 depend on each to be self-contained as CPU HP wouldn=E2=80=99t wo= rk without late > CPU initialisation I think. >=20 > Miguel >=20 > >=20 > > Jonathan > > =20 > >>=20 > >> Signed-off-by: Miguel Luis > >> --- > >> drivers/acpi/acpi_processor.c | 17 +++++++++++++++-- > >> 1 file changed, 15 insertions(+), 2 deletions(-) > >>=20 > >> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_process= or.c > >> index 9ea58b61d741..c6e2f64a056b 100644 > >> --- a/drivers/acpi/acpi_processor.c > >> +++ b/drivers/acpi/acpi_processor.c > >> @@ -194,8 +194,21 @@ static void acpi_processor_hotplug_delay_init(str= uct acpi_processor *pr) > >> pr_info("CPU%d has been hot-added\n", pr->id); > >> pr->flags.need_hotplug_init =3D 1; > >> } > >> +static int acpi_processor_hotplug_map_cpu(struct acpi_processor *pr) > >> +{ > >> + return acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id); > >> +} > >> +static void acpi_processor_hotplug_unmap_cpu(struct acpi_processor *p= r) > >> +{ > >> + acpi_unmap_cpu(pr->id); > >> +} > >> #else > >> static void acpi_processor_hotplug_delay_init(struct acpi_processor *p= r) {} > >> +static int acpi_processor_hotplug_map_cpu(struct acpi_processor *pr) > >> +{ > >> + return 0; > >> +} > >> +static void acpi_processor_hotplug_unmap_cpu(struct acpi_processor *p= r) {} > >> #endif /* CONFIG_ACPI_HOTPLUG_CPU */ > >>=20 > >> /* Enumerate extra CPUs */ > >> @@ -215,13 +228,13 @@ static int acpi_processor_enumerate_extra(struct= acpi_processor *pr) > >> cpu_maps_update_begin(); > >> cpus_write_lock(); > >>=20 > >> - ret =3D acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id); > >> + ret =3D acpi_processor_hotplug_map_cpu(pr); > >> if (ret) > >> goto out; > >>=20 > >> ret =3D arch_register_cpu(pr->id); > >> if (ret) { > >> - acpi_unmap_cpu(pr->id); > >> + acpi_processor_hotplug_unmap_cpu(pr); > >> goto out; > >> } > >> =20 > > =20 >=20