linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ledtrig netdev: what is the purpose of spinlock usage?
@ 2020-10-29  6:00 Marek Behún
  2020-10-29 17:45 ` Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Marek Behún @ 2020-10-29  6:00 UTC (permalink / raw)
  To: Ben Whitten; +Cc: linux-leds

Hi Ben (or Pavel or whomever can explain this),

since you are the original author of netdev LED trigger, I guess this
question should go to you. Why are spinlocks used as locks in the
netdev trigger code? Is this for performance? Would it be a drastic
performance hit to use mutexes?

The reason why I am asking is that I am designing an API for transparent
HW offload of LED triggers. (Some LEDs, eg. LEDs on ethernet PHYs, can
blink on rx/tx activity themselves).

You can find this at
https://git.kernel.org/pub/scm/linux/kernel/git/kabel/linux.git/log/?h=leds-trigger-hw-offload

The current approach for the netdev trigger is that the
set_baseline_state function calls trigger_offload() method of the LED
classdev. But the whole set_baseline_state function is called from
within spinlock, and so when the trigger_offload method calls something
that can sleep (MDIO bus communication, for example), kernel complains:
  BUG: scheduling while atomic

Thanks.

Marek

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-29 23:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-29  6:00 ledtrig netdev: what is the purpose of spinlock usage? Marek Behún
2020-10-29 17:45 ` Pavel Machek
2020-10-29 18:13   ` Marek Behún
2020-10-29 21:32     ` Ben Whitten
2020-10-29 22:49     ` Jacek Anaszewski
2020-10-29 23:14       ` Marek Behún

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).