Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp138448lqj; Wed, 10 Apr 2024 06:31:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIOhyMAAQ5/1w5NROYF2PqQ/dWhzeJWoV1bIr3TiomlzhzoEjAE37JwV70kcOybBxWtXBZy1VxHQ2YPX/11en8J/uDyIU5Jntot7bU2w== X-Google-Smtp-Source: AGHT+IGeMHKhiYgpunlwWMeuLzwgrHi8DLEctzEJ2Q0UCOrBlj7Z/KVooerhKeBoFWJIeXcUQodO X-Received: by 2002:a05:6a20:734f:b0:1a8:1ecb:25b0 with SMTP id v15-20020a056a20734f00b001a81ecb25b0mr3282066pzc.2.1712755904086; Wed, 10 Apr 2024 06:31:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712755904; cv=pass; d=google.com; s=arc-20160816; b=xLLeYIdoA9PRghqxvhVViP4/d/lpWHdDbnTca/DNgLVw1Xs8aWRtqtLySB52GiAnAr z15tY94EoGrAaLoyC3qdy99s1dh29R9oqlXnCCV2wN6ftwLF4sGFKZJx9rZTLeGuLirQ Xn4/jX4AnY3x2pJh3fqpihPQsWvPtaKvNWO90MmPIqRAZuxzXlC+hn6YfvIELIkeU6W8 hyCnsYaPnZBRv1wN+Q7lzUJLKJjVhKXSHv3xhtXQK0EvYThH0U0NqoRtQvPcD3YVyAYU A1HXhEvgcX1Uy54zA3K/e0HqRH4+g6rGLzxvzVA5B7ksxYEDmiTR9IFzVzXVcCiUckR8 VvrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=6UIxMJ8/mu5NYR7lVXnquqTttjCL49xNgR1XXIPjXj4=; fh=oJzQylOc6CKU1yplppYrYsA+2D/6IGEo4VvMYzFGZ0I=; b=BohpZU56KgY7MSZGs2JAuvMiZ7z2k/aRQloU+ZxBcKs2wEZj0QDqcs67qrslF4bV1o QzFm2AZoNUiaBrLQCHEHd/cjOnAezF76j0kXr25GOtV+pOAb85M27ai6iZPhaxgeKC54 DZKz3Aex6/DiOgZ2mGifFdmUhgYw1Y1fK/zsCOPTf4A2QBPsQyBQ/ca+XGhHSujd3Z2o tC1qMkkLXH/KhuvruEdWeuapc+htjtiagpVe2zIAiYDtZRSmlaI+xj+dSDHBgLX7B7eF 9bxaDYQxcio1be5cRH3r56ZB36XdleYVyvyoOVFGoC4/iIBHPgD7PVjbAJARbrYphdzB OygQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iubVYXfK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y30-20020aa793de000000b006ece3da5268si7368391pff.391.2024.04.10.06.31.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:31:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iubVYXfK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1992E28C8AD for ; Wed, 10 Apr 2024 13:28:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFAF215EFA9; Wed, 10 Apr 2024 13:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iubVYXfK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9744315ADA2; Wed, 10 Apr 2024 13:28:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712755711; cv=none; b=O/M9uf7vji4Ave9amjru6NyNlQA3EDkla8qZGZQMb5iUwoYIS3kUat4RrLUZEijh9HdvxrA/LdSZgn2tH7vqus6dGqpPXt4P02Eyehr3pADBkNVuDeUszF9ijQAWDIco1g6FE4DMuhXZbTvqTB7wBzfykeUFwjGGbrIJoOn0f5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712755711; c=relaxed/simple; bh=vG/etX9uFWDRMQyM96dxgcCHcoWyYgwQIb4SGb4iHUc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Milf5EHTOqdLYwAyKHZTQlTSuq938u+2iRPrWIp907ZhHSVBK8dudVj1Ln19aZDvvyYa7+i72OuVNnl2wLWHHZL+tiYq1XRNemPygq2JXgu1G8ozB9f3Rx3KDIjB5uUiQEr8zuA7y8qvqkrPk63fp5tWLo3F6n6w7d5ORUSu9g4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iubVYXfK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 420B6C43390; Wed, 10 Apr 2024 13:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712755711; bh=vG/etX9uFWDRMQyM96dxgcCHcoWyYgwQIb4SGb4iHUc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iubVYXfK6JPDhhN9TmRS0x6QzxNaToPZCeVJnHP93bzsfQkb7YaWzUGU5fvosdVlK 1iYtCJ+3WmeWgXErCaKKoO8GwwKCAVsPQSeaDEZwvjhLCuOC89oo5gQpo6M/afAEAy 4yeMyJV1phaU5H/syWUh2fS6hJ6AmMPbK9BuOo+0TU6FA/S11ekIIS3LR1gsLiMZaG mJvEUbFS4EnjHWHw0mmkVeePQ3ozflixNW+Mf7PgkbFPaNxs5zDRXrhRsUvsJ6qIwh nvaEhh/w7672EUsnJyENttVNo1/Exy/MsDqmdMXp6iyLxGelAPVwHWr0EhfXbeuCBH DtboMbnFmvheg== Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-22f0429c1ebso185206fac.0; Wed, 10 Apr 2024 06:28:31 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUUcst/lEX0TrGqaZcggeqiPU+99cGmB4KLjRYNj6ZHx6CvmX/0iux/PHrv9BkgPQhexl4/cAYo0E0X+DFH2SO8qCqp2crdxsi365sCWaHER2kck0+6g38wJ68p4wvsVU4wZT2We0W5OpCOLe1es/4Y0h+vrO6jFdicgDUpj+xm3oC4hjBUAvc8D3wJav6dc5iwuiE/ycdF7RYhFpQjNAnJYiIh0S3CkHKextzPzsYbdHoQT1k7ZVZ9F50NXJiTN65baYuCYKMgUrhNTHSCxxLDlmL7vtAhwlgXEi7p0zvSAxOgh7W85X18LeMstJ2xREHVhvyR5CjdsUHC9hNm/xV5hPn9JnO0Bu5osE2rLGHH X-Gm-Message-State: AOJu0YzEIW7zi+uQ3p6nnF2pVZwTJrnvJ+NcJT5qcWoP830PtPnIukE+ MFAibq2RZZXmrqB0AcDGutcTJsd2vyDnkNo9oEkBzx7IKMfLSyj18pTebcrb5MZhaaedunYN+o3 kUeOk+d8GCg4/+1GbCQBzvGyTeUs= X-Received: by 2002:a05:6871:a00a:b0:22d:fb4b:9d11 with SMTP id vp10-20020a056871a00a00b0022dfb4b9d11mr2534660oab.4.1712755710509; Wed, 10 Apr 2024 06:28:30 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240322185327.00002416@Huawei.com> <20240410134318.0000193c@huawei.com> In-Reply-To: <20240410134318.0000193c@huawei.com> From: "Rafael J. Wysocki" Date: Wed, 10 Apr 2024 15:28:18 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC v4 02/15] ACPI: processor: Register all CPUs from acpi_processor_get_info() To: Jonathan Cameron Cc: "Rafael J. Wysocki" , Russell King , 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, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, acpica-devel@lists.linuxfoundation.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 10, 2024 at 2:43=E2=80=AFPM Jonathan Cameron wrote: > > > > > > > > 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(vo= id) > > > > { > > > > 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_disabl= ed) > > > > return; > > > > > > Honestly, this looks like a quick hack to me and it absolutely > > > requires an ACK from the x86 maintainers to go anywhere. > > Will address this separately. > > > > So do people prefer this hack, or something along lines of the following? > > 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); I would prefer something like the above. 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. 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). In the end, it should be possible to avoid changing the behavior of x86 and loongarch in this series. > Which may look familiar at it's effectively patch 3 from v3 which was dea= ling > 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 se= t > 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 "seems= " fine. Sounds promising. Thanks!