From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6BDAC4332F for ; Thu, 9 Nov 2023 10:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yzeVMVjhTfftoXvKKl0GWY19O1U3WsA+TrsbcReDkQE=; b=AcEYKZYim6s/eQ M9jpZMNaAjuzZ/IxTr9SoRVlkSSypgsmhzWdtWkHt8CNpKTsg1Py4RxfysSRqf2ss6lFUqqkZe1/2 xVjyFN3c68x+c+aL4F5vlVO6Y8kjUahWwUoFMoHcgoNc99qSqZJnJBsdy3w7Yej/JI21pg4PCuWjR 6mcoTed+RiIWCuLxsW4W+OqTz6cYbUgjWcn1H9vRk7D6/57Vl+J6d9vstW3xl8/A+bVNh1EhnWNsd 5RxctIVohdzRbSM6r2vyji++5gFgWY+hIh/QPwuu+PVosAUjG7Mo8KYP9hprWzqkbeLq7YbCJrE1Q IZEHXeJFr4NwRjiDkCNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r11yq-005snl-2c; Thu, 09 Nov 2023 10:09:44 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r11yn-005smL-28 for linux-arm-kernel@lists.infradead.org; Thu, 09 Nov 2023 10:09:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699524580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f66C/Uco7Rn4beNRod/QtpM+fKeOVkNE1m9/M9ZsY14=; b=XY0jEFNIKPzoHUHhMSwhB8sXqU6m5Y49AnlMsK6EU6Xjrk6b75F5a11XVZE2gmxf6nMx9x Dm4FzxhvV1rFYpaU6N/0oE0bk9KIwK7XF5vgm9Lp43cVChuRaqrWeekC/QDJQx8zotC3RL 0BIM2WE2wFeuOuM2C6gMvl7LJpK4ylg= Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-557-eCKdnIndO7Kpz6XWcxgZAw-1; Thu, 09 Nov 2023 05:09:39 -0500 X-MC-Unique: eCKdnIndO7Kpz6XWcxgZAw-1 Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-3b2e755889aso175635b6e.0 for ; Thu, 09 Nov 2023 02:09:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699524579; x=1700129379; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f66C/Uco7Rn4beNRod/QtpM+fKeOVkNE1m9/M9ZsY14=; b=P60LaafysRHGpdL5TlhKObNRHBKM8zPP7S8ypXiNWmsFv/2r3A5z8e2jXgFDXqMsp0 EwXA2wuvoLJ/0IF3LeMxoRWlwvpvziyrZEpbSJbf1KWyBEGzNp21/wy6Diuh0aIuYTm8 tb/PdPm03O+iDg2jdXc6egWEywd+6iybFMfjrC26z620OSG/6pjXbjppjJL4SDNZk8mr lk+ZT+7NwoqwC/5aPe8FiQbOpfb0a5po34rzOVrAg3PMrEgPKXrr00hfcrUSx9LrBc0l HYiSgRpObWL3z7zMiNQknY8FozchNxTjAwO8L8BeO2l0KOY3NyYJ05mQsTvNCIPeGt82 /UzQ== X-Gm-Message-State: AOJu0YzPREL+XpTDdghy97j+pjzRCDhYumujiRDJZYmMHfxcVMK/6qFh +t+KF/jL7ZSW9ZAJBFGB0PlyhKU426DEOQ+E7yN16EXr7gxoCXz17X8sLACGtw9Aqv4bgTgASMd geEOTiMMwCdMTpd1k/u6dmWkyp4Rlocq2GHk= X-Received: by 2002:a05:6871:a113:b0:1e9:e8fd:bb77 with SMTP id vs19-20020a056871a11300b001e9e8fdbb77mr5119497oab.0.1699524578741; Thu, 09 Nov 2023 02:09:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuc2Fsk1aOG+26g+R1TKcXCB5LvcN3abO9ejRxfqdYaGILXhVW+FjXlWbJavq6vyZSTQA5Iw== X-Received: by 2002:a05:6871:a113:b0:1e9:e8fd:bb77 with SMTP id vs19-20020a056871a11300b001e9e8fdbb77mr5119472oab.0.1699524578430; Thu, 09 Nov 2023 02:09:38 -0800 (PST) Received: from [10.66.61.39] ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id q18-20020a62ae12000000b006bae6eea9d0sm10335148pff.49.2023.11.09.02.09.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Nov 2023 02:09:38 -0800 (PST) Message-ID: Date: Thu, 9 Nov 2023 18:09:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES To: "Russell King (Oracle)" , 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, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse , Greg Kroah-Hartman , "Rafael J. Wysocki" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren References: From: Shaoqin Huang In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_020941_768013_3BD8A091 X-CRM114-Status: GOOD ( 31.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Russell, On 11/7/23 18:29, Russell King (Oracle) wrote: > From: James Morse > > Three of the five ACPI architectures create sysfs entries using > register_cpu() for present CPUs, whereas arm64, riscv and all > GENERIC_CPU_DEVICES do this for possible CPUs. > > Registering a CPU is what causes them to show up in sysfs. > > It makes very little sense to register all possible CPUs. Registering > a CPU is what triggers the udev notifications allowing user-space to > react to newly added CPUs. > > To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change > it to use for_each_present_cpu(). Making the ACPI architectures use > GENERIC_CPU_DEVICES is a pre-requisite step to centralise their > cpu_register() logic, before moving it into the ACPI processor driver. > When ACPI is disabled this work would be done by > cpu_dev_register_generic(). What do you actually mean about when ACPI is disabled this work would be done by cpu_dev_register_generic()? Is the work means register the cpu? I'm not quite understand that, and how about when ACPI is enabled, which function do this work? > > Of the ACPI architectures that register possible CPUs, arm64 and riscv > do not support making possible CPUs present as they use the weak 'always > fails' version of arch_register_cpu(). > > Only two of the eight architectures that use GENERIC_CPU_DEVICES have a > distinction between present and possible CPUs. > > The following architectures use GENERIC_CPU_DEVICES but are not SMP, > so possible == present: > * m68k > * microblaze > * nios2 > > The following architectures use GENERIC_CPU_DEVICES and consider > possible == present: > * csky: setup_smp() > * processor_probe() sets possible for all CPUs and present for all CPUs > except the boot cpu, which will have been done by > init/main.c::start_kernel(). > > um appears to be a subarchitecture of x86. > > The remaining architecture using GENERIC_CPU_DEVICES are: > * openrisc and hexagon: > where smp_init_cpus() makes all CPUs < NR_CPUS possible, > whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present. > > After this change, openrisc and hexagon systems that use the max_cpus > command line argument would not see the other CPUs present in sysfs. > This should not be a problem as these CPUs can't bre brought online as ^ nit: can't be > _cpu_up() checks cpu_present(). > > After this change, only CPUs which are present appear in sysfs. > > Signed-off-by: James Morse > Reviewed-by: Jonathan Cameron > Signed-off-by: Russell King (Oracle) Thanks, Shaoqin > --- > drivers/base/cpu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 9ea22e165acd..34b48f660b6b 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -533,7 +533,7 @@ static void __init cpu_dev_register_generic(void) > #ifdef CONFIG_GENERIC_CPU_DEVICES > int i; > > - for_each_possible_cpu(i) { > + for_each_present_cpu(i) { > if (register_cpu(&per_cpu(cpu_devices, i), i)) > panic("Failed to register CPU device"); > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel