From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Marek Behun <marek.behun@nic.cz>
Cc: Pavel Machek <pavel@ucw.cz>,
linux-leds@vger.kernel.org, dmurphy@ti.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: ledtrig-cpu: Limit to 4 CPUs
Date: Sun, 20 Sep 2020 18:55:28 +0200 [thread overview]
Message-ID: <91f1caa7-8005-6c8f-ce7c-84e5c8cee5f8@gmail.com> (raw)
In-Reply-To: <20200920173905.237c314e@nic.cz>
On 9/20/20 5:39 PM, Marek Behun wrote:
> On Sun, 20 Sep 2020 16:15:09 +0200
> Jacek Anaszewski <jacek.anaszewski@gmail.com> wrote:
>
>> Hi Pavel,
>>
>> On 9/19/20 11:38 AM, Pavel Machek wrote:
>>> commit 318681d3e019e39354cc6c2155a7fd1bb8e8084d
>>> Author: Pavel Machek <pavel@ucw.cz>
>>> Date: Sat Sep 19 11:34:58 2020 +0200
>>>
>>> ledtrig-cpu: Limit to 4 CPUs
>>>
>>> Some machines have thousands of CPUs... and trigger mechanisms was not
>>> really meant for thousands of triggers. I doubt anyone uses this
>>> trigger on many-CPU machine; but if they do, they'll need to do it
>>> properly.
>>>
>>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>>
>>> diff --git a/drivers/leds/trigger/ledtrig-cpu.c b/drivers/leds/trigger/ledtrig-cpu.c
>>> index 869976d1b734..b7e00b09b137 100644
>>> --- a/drivers/leds/trigger/ledtrig-cpu.c
>>> +++ b/drivers/leds/trigger/ledtrig-cpu.c
>>> @@ -2,14 +2,18 @@
>>> /*
>>> * ledtrig-cpu.c - LED trigger based on CPU activity
>>> *
>>> - * This LED trigger will be registered for each possible CPU and named as
>>> - * cpu0, cpu1, cpu2, cpu3, etc.
>>> + * This LED trigger will be registered for first four CPUs and named
>>> + * as cpu0, cpu1, cpu2, cpu3. There's additional trigger called cpu that
>>> + * is on when any CPU is active.
>>> + *
>>> + * If you want support for arbitrary number of CPUs, make it one trigger,
>>> + * with additional sysfs file selecting which CPU to watch.
>>> *
>>> * It can be bound to any LED just like other triggers using either a
>>> * board file or via sysfs interface.
>>> *
>>> * An API named ledtrig_cpu is exported for any user, who want to add CPU
>>> - * activity indication in their code
>>> + * activity indication in their code.
>>> *
>>> * Copyright 2011 Linus Walleij <linus.walleij@linaro.org>
>>> * Copyright 2011 - 2012 Bryan Wu <bryan.wu@canonical.com>
>>> @@ -145,6 +149,9 @@ static int __init ledtrig_cpu_init(void)
>>> for_each_possible_cpu(cpu) {
>>> struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
>>>
>>> + if (cpu > 4)
>>
>> NACK. The workaround for this trigger was implemented for a reason -
>> to make it working on platforms with arbitrary number of logical cpus.
>> I've got 8, so I am discriminated now. Not saying, that it precludes
>> trigger registration with no single line of warning.
>> Regardless of that - you have no guarantee that you're not breaking
>> anyone - "I doubt" is not a sufficient argument.
>>
>
> If that is the case Jacek, I would try 16 and then see if people
> complain. Do you really think that someone sets a specific LED to
> trigger on activity on CPU id > 16?
I have an access to the machine with 80 cpus, so I could once
get surprised not being able to find cpuN triggers not being
listed among available triggers.
And say that I have a solution where I install 80 userspace LEDs
(drivers/leds/uleds.c) and register them on each cpuN triggers to get
notifications on how cpus work.
> If you do not agree, then I think we should implement a "cpu" trigger
> where the cpu ID (or maybe mask of multiple CPUs) is configurable via
> another sysfs file. And then declare current cpu trigger (with names
> "cpu%d") as legacy.
Yes, we can do that, and even mark the cpu trigger as legacy but we
cannot prevent people from using it if that was present in kernel
for many years.
--
Best regards,
Jacek Anaszewski
next prev parent reply other threads:[~2020-09-20 16:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-19 9:38 ledtrig-cpu: Limit to 4 CPUs Pavel Machek
2020-09-20 14:15 ` Jacek Anaszewski
2020-09-20 15:39 ` Marek Behun
2020-09-20 16:55 ` Jacek Anaszewski [this message]
2020-09-20 17:33 ` Marek Behun
2020-09-20 17:49 ` Jacek Anaszewski
2020-09-20 18:34 ` Pavel Machek
2020-09-21 22:14 ` Jacek Anaszewski
2020-09-21 22:42 ` Pavel Machek
2020-09-22 20:41 ` Jacek Anaszewski
2020-09-25 8:51 ` Jacek Anaszewski
2020-09-25 9:40 ` Pavel Machek
2020-09-26 13:59 ` Jacek Anaszewski
2020-10-08 10:10 ` Pavel Machek
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=91f1caa7-8005-6c8f-ce7c-84e5c8cee5f8@gmail.com \
--to=jacek.anaszewski@gmail.com \
--cc=dmurphy@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=marek.behun@nic.cz \
--cc=pavel@ucw.cz \
/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;
as well as URLs for NNTP newsgroup(s).