mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Lee Jones" <lee@kernel.org>, "Arnd Bergmann" <arnd@kernel.org>
Cc: "Pavel Machek" <pavel@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: trigger: ledtrig-cpu:: enforce NR_CPUS limit in Kconfig
Date: Wed, 25 Jun 2025 12:24:51 +0200	[thread overview]
Message-ID: <59044fff-6531-4425-8ccb-e21e17664f26@app.fastmail.com> (raw)
In-Reply-To: <20250625092450.GT795775@google.com>

On Wed, Jun 25, 2025, at 11:24, Lee Jones wrote:
> On Fri, 20 Jun 2025, Arnd Bergmann wrote:
>> 
>> Enforce this limit in Kconfig instead to avoid the build failure.
>
> I have so many questions!
>
> - This number seems arbitrary - what is the limiting factor?
>   - Character size for printing?

That is my best guess, yes. The original commit 8f88731d052d
("led-triggers: create a trigger for CPU activity") already
had this, plus

#define MAX_NAME_LEN 8
snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);

which comes out to 10000 cpus (0 through 9999) in a NUL-terminated
string. Obviously we could have a higher limit here but would
technically still need to check that.

> - What platform did you test this on to blow through that number?

I was only compile-testing with a crazy number of CPUs, to see
what would break, in particular when there are per-cpu structures
or cpumask_t variables on the stack. I sent fixes for the ones
that broke the build, but don't expect anything to actually
need this at runtime. Some of the fixes I sent also address
possible stack overflows that happen with a more realistic
number of CPUs.

> - What if we really do want 10000+ CPUs?
>   - And what will that LED array look like to support them all?

abcc131292aa ("ledtrig-cpu: Limit to 8 CPUs") actually added a
runtime limit to eight CPUS, which is probably more reasonable.

> - If we're enforcing here, is the BUILD_BUG_ON() now superfluous?

Yes, but it documents the requirement better than just the
Kconfig dependency. Since there is a runtime limit, we could
probably just drop the compile-time check and not add the
Kconfig check.

      Arnd

  reply	other threads:[~2025-06-25 10:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 11:08 Arnd Bergmann
2025-06-25  9:24 ` Lee Jones
2025-06-25 10:24   ` Arnd Bergmann [this message]
2025-06-25 10:36     ` Lee Jones

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=59044fff-6531-4425-8ccb-e21e17664f26@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=hansg@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®