Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1989243rda; Tue, 24 Oct 2023 09:02:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETVAWRzIHZAUjhXa+rVtLdKiaGYNIe17WgbICpNUa1sJ5n+JOWw5yI2tJeAA+MJa93JNFH X-Received: by 2002:a05:6359:1a8d:b0:168:e8e6:b91f with SMTP id rv13-20020a0563591a8d00b00168e8e6b91fmr3611418rwb.18.1698163369019; Tue, 24 Oct 2023 09:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698163368; cv=none; d=google.com; s=arc-20160816; b=blOGWf2ewVBQgUczbpbBeU0OKk19tGkx4+Q4PRQF/z2iEcMG4fMOXmdGIHZWBtx6sq 8igyYqeYDfH0hbuwkJSKXdhDhRCi1DadO4EjMTkp+NOazkK0eQFlNh97A6CahMh665kY 2xGjAEFP6pfAO1lHW3iXfHtMDn8nnzL8FrX3ZfkGfk3jG2kEd+c7poc6EZSn9TTkQuy6 HJNBM5ltMNbC12N6g/dBaPQCShRgDmy01P7nRK9/ecH+gmwME6V0nskFrKREKCHq0mvE q7YRiLt5cczITCkLtukK6UkjOgxE4rZaC/xcUrveHaewlfY0kBokSto+bBMEwOz/lau8 6JUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zOAFn0ALcbNrLMv9uEW4C/kgTFgxl3Imsop1ZZ69QUs=; fh=BZVm1XDZWHyTREQFMx6KckjDIaXONk+V11S3x0Sk1ww=; b=JxobvrK/KSTx6xEAKwrP4zBTOcQCoj7mkr5lW4UIsC/01KKayLuoSxtpf50v+J5xIM 1niAHhs8C5XWVSI10qlNsTaELbfITk4P0w4DhdH8NddmPp7E+9sLwJzPSOh7dThtlxle nL5ueARd5FjUAmwXj5VzWPCb55Nyd9HwNX4SsbkH0IT2RNiGmlnLuiHncbIqkQtD7377 mwa0MJIDAmYqK1cT14NMp8eVYquCibMbyyb0h7skevAHR6nr+8yrbVDaQilrlv8DljsA 0Y4vdLXYutwdm9eKpJ9bsR0+vdBm37loDnLA3/syfSogfHxj6JVEtIJUDxaYaP7buw2A ajPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G0VPiT0N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b11-20020a655ccb000000b00565701e9a36si8429809pgt.752.2023.10.24.09.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 09:02:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G0VPiT0N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B3FBA80BB3ED; Tue, 24 Oct 2023 09:02:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234605AbjJXQCg (ORCPT + 99 others); Tue, 24 Oct 2023 12:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234306AbjJXQCf (ORCPT ); Tue, 24 Oct 2023 12:02:35 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7916F1B3; Tue, 24 Oct 2023 09:02:33 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C019C433C7; Tue, 24 Oct 2023 16:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698163353; bh=F7gFThJKXxRz67KtPOHXZ1MPyn546aHaKsuQ7HB3hqg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G0VPiT0NaPFcpVExXTrkeNQPAO04ohPxAd37DPcoJLpOtXMCCjTbSvuBTvMKm6fKL 7+97TChy1Rw9XyE2D4xj290syTx4P7Q0qI+cUomEuI1s01Fdc+0+On0HONlKTWh43O JYqW/Fa9n5BmP1kwOrdU1rcoFgbCPjndXNvWvCiA= Date: Tue, 24 Oct 2023 18:02:30 +0200 From: Greg Kroah-Hartman To: Russell King Cc: 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, Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse , "Rafael J. Wysocki" , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH 38/39] cpumask: Add enabled cpumask for present CPUs that can be brought online Message-ID: <2023102411-ascent-plot-04fd@gregkh> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 09:02:45 -0700 (PDT) On Tue, Oct 24, 2023 at 04:19:24PM +0100, Russell King wrote: > From: James Morse > > The 'offline' file in sysfs shows all offline CPUs, including those > that aren't present. User-space is expected to remove not-present CPUs > from this list to learn which CPUs could be brought online. > > CPUs can be present but not-enabled. These CPUs can't be brought online > until the firmware policy changes, which comes with an ACPI notification > that will register the CPUs. > > With only the offline and present files, user-space is unable to > determine which CPUs it can try to bring online. Add a new CPU mask > that shows this based on all the registered CPUs. > > Signed-off-by: James Morse > --- > drivers/base/cpu.c | 10 ++++++++++ > include/linux/cpumask.h | 25 +++++++++++++++++++++++++ > kernel/cpu.c | 3 +++ > 3 files changed, 38 insertions(+) > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 2b9cb2667654..f8bf1d4c7d71 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -95,6 +95,7 @@ void unregister_cpu(struct cpu *cpu) > { > int logical_cpu = cpu->dev.id; > > + set_cpu_enabled(logical_cpu, false); > unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); > > device_unregister(&cpu->dev); > @@ -273,6 +274,13 @@ static ssize_t print_cpus_offline(struct device *dev, > } > static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL); > > +static ssize_t print_cpus_enabled(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpu_enabled_mask)); > +} > +static DEVICE_ATTR(enabled, 0444, print_cpus_enabled, NULL); This needs to be documented somewhere in Documentation/ABI/ did I miss that patch? thanks, greg k-h