mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Leah Neukirchen <leah@vuxu.org>
To: Vincent Donnefort <vincent.donnefort@arm.com>
Cc: Rich Felker <dalias@libc.org>,
	 musl@lists.openwall.com,  Samuel Holland <samuel@sholland.org>,
	 jason <jason@insomnia247.nl>
Subject: Re: [musl] [PATCH v3] sysconf: add _SC_NPROCESSORS_CONF support
Date: Sat, 07 Aug 2021 18:29:56 +0200	[thread overview]
Message-ID: <874kc19q0r.fsf@vuxu.org> (raw)
In-Reply-To: <20210712163246.GA115682@e124901.cambridge.arm.com> (Vincent Donnefort's message of "Mon, 12 Jul 2021 17:32:46 +0100")

Vincent Donnefort <vincent.donnefort@arm.com> writes:

>> > Moreover, in the case of a non-available sysfs, the fallback to sched_getaffinity
>> > would help and at least align _CONF with _ONL (which is the current behavior).
>> > 
>> > Reading /proc/stat and /proc/softirq looks like a hack. They just happen to
>> > align on the _ONL/_CONF and doesn't produce a machine-readable output. While
>> > the CPU sysfs subsys is really meant to describe CPUs.
>> 
>> If they're mandated stable interfaces that "happen" to have the exact
>> data we need, I don't see what the objection to using them is. A
>> better question would be whether access to them is restricted in any
>> hardening profiles. At least they don't seem to be hidden by the
>> hidepid mount option.
>> 
> Indeed the function hasn't changed for 10y, which is I guess somewhat stable
> and it is currently walking through all the possible CPUs (which is what we want
> to count). Also, this file is currently always present whenever procfs is
> mounted.
>
> Nonetheless, as this is human-readable, nothing mandates the format. And as an
> example, on my desktop machine, with 448 allocated CPUS, the first line of
> /proc/softirqs (the line that contains all the CPUs) is 4949 long. The
> "possible" mask describes same information with only 6 characters.

For the record, on my single-cpu mainboard with a "AMD Ryzen 7 3700X
8-Core Processor", there are 16 processor entries in /proc/cpuinfo,
but /proc/softirq goes to CPU31.  /sys/devices/system/cpu has entries
up to cpu15, and glibc getconf _NPROCESSORS_CONF also says 16.

-- 
Leah Neukirchen  <leah@vuxu.org>  https://leahneukirchen.org/

  parent reply	other threads:[~2021-08-07 16:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10  5:31 jason
2021-07-10 17:11 ` Rich Felker
2021-07-10 17:29 ` Samuel Holland
2021-07-10 19:44   ` Rich Felker
2021-07-12 13:08     ` Vincent Donnefort
2021-07-12 15:41       ` Rich Felker
2021-07-12 16:32         ` Vincent Donnefort
2021-07-12 17:14           ` Rich Felker
2021-07-12 18:12             ` Vincent Donnefort
2021-08-07 14:52             ` James Y Knight
2021-08-07 16:29           ` Leah Neukirchen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-07-06  9:55 Vincent Donnefort

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kc19q0r.fsf@vuxu.org \
    --to=leah@vuxu.org \
    --cc=dalias@libc.org \
    --cc=jason@insomnia247.nl \
    --cc=musl@lists.openwall.com \
    --cc=samuel@sholland.org \
    --cc=vincent.donnefort@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).