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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c57558a4-9f3a-48fa-acb7-e3eb2349c666@gmail.com>
Date: Fri, 1 Dec 2023 23:32:27 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>,
 Christian Marangi <ansuelsmth@...il.com>, Jakub Kicinski <kuba@...nel.org>,
 "linux-leds@...r.kernel.org" <linux-leds@...r.kernel.org>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] leds: trigger: netdev: skip setting baseline state in
 activate if hw-controlled

On 29.11.2023 23:02, Andrew Lunn wrote:
>> RTL8168 LED control allows to switch between different hw triggers. I
>> was under the
>> assumption that this is not uncommon.
> 
> I did take a look around various datasheets, and i did find a couple
> like this, but the majority have the ability to do software control.
> 
>> In order to deal with the non-atomic issue we have to set
>> trigger_data->mode to the
>> resulting new mode, based on what the user set. Question is what we show to the
>> user. If we show nothing, then he will expect the new mode to be active.
>> If we show an error, then he may assume that his input had no effect.
>> So we may have to show technically an OK, plus a message that his input has been
>> stored, but is not supported by hw.
> 
> It is hard to show anything to the user. We are just doing
> 
> echo 1 > file.
> 
> There is no channel to the user other than an error code.
> 
> There is also the question about what the LED should show. Ideally it
> should indicate some sort of state to indicate there is an
> error. Either constantly blink, turn off, etc. Maybe that is the
> solution. You implement a set_brightness function which just indicates
> an error on the LED, but otherwise return O.K?
> 
Let's take a very simple use case: We have a one bit configuration to
switch a LED between link_100 and link_1000 hw trigger mode.

Then we have the atomicity issue you described: We can't go directly
from one hw-controlled mode to the other, we have to go via both
modes active or no mode active.

And unfortunately we don't have the option to indicate this by some
optical LED activity like blinking, especially if the link is down
at the moment.

Would be a pity if our nice framework can't support such a simple
use case. So, what I could imagine, we react based on the return code
from hw_control_is_supported():

- 0: use hw control
- -EOPNOTSUPP: fall back to LED software control, no error returned to use
- -ENOTSUPP (another idea: ENOEXEC): store new mode in trigger_data->mode and return error to the user
- other errors: don't store new mode and return error to user

Not fully intuitive and the subtle difference between EOPNOTSUPP and
ENOTSUPP may confuse driver authors adding device LED support.
However for the user it should be ok, he always has the option to read
back the attribute in order to check whether new mode has been stored.
That's the best I can see so far.

>    Andrew

Heiner

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ