Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp153547lqj; Wed, 10 Apr 2024 06:57:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqTeA+3772pGQzKkF31DtvCGmDOSLIChkSdQzimhAW7926A+eiBSgORHzlvz/QvgGIfFCAJFwmAwt9vHyjI362ufrC/FtJuhHt3KTuww== X-Google-Smtp-Source: AGHT+IF38bwSxHW8GtEf/pVXSFJtMfNDOq0PqquoJnAxiuzhcrvs9B6WXJ2vjTYeJJLQo8BwEmD5 X-Received: by 2002:a17:906:eecc:b0:a51:b0e1:863a with SMTP id wu12-20020a170906eecc00b00a51b0e1863amr2480240ejb.4.1712757438449; Wed, 10 Apr 2024 06:57:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712757438; cv=pass; d=google.com; s=arc-20160816; b=Szs2qzn2kp4sw91O0H08tFvtn9Hi1Gl8CupNxa8gpegszXZMH2b7RbyUuxudRIrkB6 dpVHAh7rXOqn3WnQ7HKqXT/lCJHdTmf7bBubnLzP+fYilcbIRyIaMvXnY2IZCvISYfXT 2G4YHUv92qfLSUeR2hZP1TUvlNedB5cnFDz272EmTBF23PYia+IWxYrb5h5gV+9I46YU zqm+JqKbCPI3fcEeyqlR6uWTIzFQIND5be4iwJYsQp3cpupjA7oXd4zPqW6FrabQVGSN 02FAITiDyM1wn0+ynLWfU96tWHeP+bpzU5hhSCOXI2kJo86usJJY+ay7jC22oZrMIydL SDGw== 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=vwjXPQBg71Tw4HpCNbCiOsm1CFlhvl3fb6B+VC8UytM=; fh=Bjs3PnFfMvs+BFTyJ9y6tLyJi212q6uorkDK9SVVmsE=; b=t0I1JwVcPh/7EeNdoPkqG+3Mhcoh/LW1oG9e9ZLEtPIPX9UfqNAW1jUIWXuuf+q1yq 2ase68IMPlF9q/IOZzgjOGDHRFiqatcC/g4S+eBQZ9it0A2Wuch6nonjZlp7ftkwPtbW daJZugr41woE2BEz34i8VwVtk69TpFizvCCxNDTbf9QGpW4/+wGGCo7HnNElZ6yxOTEA ty6r/15nTSMd3XxdX97rJEiu6hOZVJoYTqwXuXhkGb6WdmgQVmi+15HAHUajAPpkq2yL 52UIL8mh1ed9OzaG5PFSAbV0IR9USlaUPrjeeLgbk4Oz1maCli5y1Kd/QJWPROnQfJxa +5tg==; 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-138680-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138680-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l10-20020a170906078a00b00a4e7817756bsi5677784ejc.347.2024.04.10.06.57.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:57:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138680-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-138680-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138680-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 190E31F32E8C for ; Wed, 10 Apr 2024 13:57:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D631616DECD; Wed, 10 Apr 2024 13:50:12 +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 F010116D9C7; Wed, 10 Apr 2024 13:50:08 +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=1712757012; cv=none; b=Yqjo+u/NhNZ7czDrtUbUBnTiYMsnt3xqKo+Y/g4qe9DIsfa0NVO8S+7e7lGgYxGlxl8KU5PAl3Gi9BfoIM4Asz9bJWspHvD22k4sHprduvQ26cD+PrMEU2ahXgGo9SEeXScJ1Z8vEJds86jS+o/7xhW1tJ+AR53EzA+eSYupn54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712757012; c=relaxed/simple; bh=9zjC72oMJYYHMUAUwT5oG2XaeuDan+dzKqCHcr5RWWs=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SuFNw84ei2T2SgqjUOQvTBMJcUA4pLXaz10ODwTnCkhFmn9cs7rrOgHha8ujJBRJy/mI3oZ6vrmWgYbtOm4OlWwp1tc+GBk6Ezmiu8Yd0nbn2s1tAeB/PJg77risgo7Weq/bsAKsm/+2uKIYYi3ydNEPBQmWA8OJYji1MGxJdao= 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.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VF3xC2BRXz6K6f2; Wed, 10 Apr 2024 21:45:19 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id B565C1400CA; Wed, 10 Apr 2024 21:50:06 +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; Wed, 10 Apr 2024 14:50:06 +0100 Date: Wed, 10 Apr 2024 14:50:05 +0100 From: Jonathan Cameron To: "Rafael J. Wysocki" CC: Russell King , , , , , , , , , , , , , , , Salil Mehta , Jean-Philippe Brucker , , , James Morse Subject: Re: [PATCH RFC v4 02/15] ACPI: processor: Register all CPUs from acpi_processor_get_info() Message-ID: <20240410145005.00003050@Huawei.com> In-Reply-To: References: <20240322185327.00002416@Huawei.com> <20240410134318.0000193c@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: lhrpeml500002.china.huawei.com (7.191.160.78) To lhrpeml500005.china.huawei.com (7.191.163.240) On Wed, 10 Apr 2024 15:28:18 +0200 "Rafael J. Wysocki" wrote: > On Wed, Apr 10, 2024 at 2:43=E2=80=AFPM Jonathan Cameron > wrote: > > =20 > > > > =20 > > > > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > > > > > index 47de0f140ba6..13d052bf13f4 100644 > > > > > --- a/drivers/base/cpu.c > > > > > +++ b/drivers/base/cpu.c > > > > > @@ -553,7 +553,11 @@ static void __init cpu_dev_register_generic(= void) > > > > > { > > > > > int i, ret; > > > > > > > > > > - if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES)) > > > > > + /* > > > > > + * When ACPI is enabled, CPUs are registered via > > > > > + * acpi_processor_get_info(). > > > > > + */ > > > > > + if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES) || !acpi_disa= bled) > > > > > return; =20 > > > > > > > > Honestly, this looks like a quick hack to me and it absolutely > > > > requires an ACK from the x86 maintainers to go anywhere. =20 > > > Will address this separately. > > > =20 > > > > So do people prefer this hack, or something along lines of the followin= g? > > > > static int __init cpu_dev_register_generic(void) > > { > > int i, ret =3D 0; > > > > for_each_online_cpu(i) { > > if (!get_cpu_device(i)) { > > ret =3D arch_register_cpu(i); > > if (ret) > > pr_warn("register_cpu %d failed (%d)\n"= , i, ret); > > } > > } > > //Probably just eat the error. > > return 0; > > } > > subsys_initcall_sync(cpu_dev_register_generic); =20 >=20 > I would prefer something like the above. >=20 > I actually thought that arch_register_cpu() might return something > like -EPROBE_DEFER when it cannot determine whether or not the CPU is > really available. Ok. That would end up looking much more like the original code I think. So we wouldn't have this late registration at all, or keep it for DT on arm64? I'm not sure that's a clean solution though leaves the x86 path alone. If we get rid of this catch all, solution would be to move the !acpi_disabled check into the arm64 version of arch_cpu_register() because we would only want the delayed registration path to be used on ACPI cases where the question of CPU availability can't yet be resolved. >=20 > Then, the ACPI processor enumeration path may take care of registering > CPU that have not been registered so far and in the more-or-less the > same way regardless of the architecture (modulo some arch-specific > stuff). If I understand correctly, in acpi_processor_get_info() we'd end up with a similar check on whether it was already registered (the x86 path) or had be deferred (arm64 / acpi). =20 >=20 > In the end, it should be possible to avoid changing the behavior of > x86 and loongarch in this series. Possible, yes, but result if I understand correctly is we end up with very different flows and replication of functionality between the early registration and the late one. I'm fine with that if you prefer it! >=20 > > Which may look familiar at it's effectively patch 3 from v3 which was d= ealing > > with CPUs missing from DSDT (something we think doesn't happen). > > > > It might be possible to elide the arch_register_cpu() in > > make_present() but that will mean we use different flows in this patch = set > > for the hotplug and initially present cases which is a bit messy. > > > > I've tested this lightly on arm64 and x86 ACPI + DT booting and it "see= ms" fine. =20 >=20 > Sounds promising. Possibly not that relevant though if proposal is to drop this approach. :( At least I now have test setups! Jonathan >=20 > Thanks!