From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30373 invoked from network); 5 May 2021 17:13:15 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 5 May 2021 17:13:15 -0000 Received: (qmail 11811 invoked by uid 550); 5 May 2021 17:11:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 6112 invoked from network); 5 May 2021 17:05:25 -0000 Date: Wed, 5 May 2021 18:05:06 +0100 From: Vincent Donnefort To: Alexander Monakov Cc: musl@lists.openwall.com Message-ID: <20210505170506.GA260789@e120877-lin.cambridge.arm.com> References: <20210505130615.6222-1-vincent.donnefort@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [musl] [PATCH] sysconf: add _SC_NPROCESSORS_CONF support On Wed, May 05, 2021 at 05:04:53PM +0300, Alexander Monakov wrote: > > > On Wed, 5 May 2021, Vincent Donnefort wrote: > > > Currently, _SC_NPROCESSORS_CONF is always equal to _SC_NPROCESSORS_ONLN. > > However, it is expected from the first one to give the total number of CPUs > > in the system, while the later must return only the number of CPUs which > > are currently online. This distinction is important for a software such as > > trace-cmd. Trace-cmd is a front-end for the kernel tracing tool ftrace. > > When recording traces, trace-cmd needs to get the total number of CPUs > > available in the system (_SC_NPROCESSORS_CONF) and not only the online ones > > otherwise if a CPU goes offline some data might be missing. > > > > Hence, add a specific method to get _SC_NPROCESSORS_CONF, based on the > > sysfs CPU entries /sys/devices/system/cpu/cpu[0-9] > > Why do the opendir instead of reading from /sys/devices/system/cpu/possible? > The online/offline/possible CPU masks are documented in > linux/Documentation/ABI/testing/sysfs-devices-system-cpu and > linux/Documentation/cputopology.txt > > Alexander Could indeed use one of the CPU mask. "present" is probably better suited for this usage. "possible" seems to have a different behavior on different architectures e.g it is CONFIG_HOTPLUG dependent on x86. Will do a V2 based on the present mask. -- Vincent