lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <27e19ac9-4bc0-2945-3985-6cd6bb5407df@gmail.com>
Date:   Sun, 20 Sep 2020 16:15:09 +0200
From:   Jacek Anaszewski <jacek.anaszewski@...il.com>
To:     Pavel Machek <pavel@....cz>, linux-leds@...r.kernel.org,
        dmurphy@...com,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: ledtrig-cpu: Limit to 4 CPUs

Hi Pavel,

On 9/19/20 11:38 AM, Pavel Machek wrote:
> commit 318681d3e019e39354cc6c2155a7fd1bb8e8084d
> Author: Pavel Machek <pavel@....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@....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@...aro.org>
>    * Copyright 2011 - 2012 Bryan Wu <bryan.wu@...onical.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.

> +			continue;
> +
>   		snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
>   
>   		led_trigger_register_simple(trig->name, &trig->_trig);
> 

-- 
Best regards,
Jacek Anaszewski

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ