You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Setting LED trigger to 'cpu' doesn't work with 64-bit kernel #4425
Describe the bug
Setting cpu or cpuX as the LED trigger in /sys/class/leds/ledX/trigger doesn't work with 64-bit kernel (using arm_64bit=1 in config.txt), but does work with 32-bit kernel. cat /sys/class/leds/ledX/trigger shows cpu and cpuX as available options.
To reproduce echo cpu | sudo tee /sys/class/leds/led0/trigger
Expected behaviour
LED should flicker with CPU usage
Actual behaviour
LED stays off and no errors
System
Pi Model:
Raspberry Pi 4 and CM4
cat /etc/rpi-issue
Raspberry Pi reference 2021-05-07
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, dcfd74d7d1fa293065ac6d565711e9ff891fe2b8, stage2
vcgencmd version
May 27 2021 14:02:31
Copyright (c) 2012 Broadcom
version 7d9a298cda813f747b51fe17e1e417e7bf5ca94d (clean) (release) (start_cd)
uname -a
Linux router.localnet 5.10.17-v8+ #1421 SMP PREEMPT Thu May 27 14:01:37 BST 2021 aarch64 GNU/Linux
The cpu trigger exports the ledtrig_cpu API, calls to which mark the times the CPU is busy and idle. A quick search through the kernel source show that it is only called from one place - arch/arm/kernel/process.c, in functions arch_cpu_idle_enter and arch_cpu_idle_exit.
Adding support on the arm64/aarch64 platform is trivial:
However, it will have a small overhead every time each CPU enters and leaves the idle state - some very simple logic, an atomic counter update, and walking a (likely empty) list under a spinlock. If there is an LED with a cpu trigger then the list won't be empty.
We're always wary of enabling configuration options that ending up costing all users memory, cpu or disk storage for the benefit of a few. This has the added disincentive of being a downstream patch (unless you decided to take it to the upstream maintainers of arm64), so I'm even less tempted.
I'll leave this here to see if there are any other opinions, but I'll need some persuasion (e.g. some performance measurements) before considering applying the patch.
Activity
pelwell commentedon Jul 1, 2021
The cpu trigger exports the
ledtrig_cpuAPI, calls to which mark the times the CPU is busy and idle. A quick search through the kernel source show that it is only called from one place - arch/arm/kernel/process.c, in functionsarch_cpu_idle_enterandarch_cpu_idle_exit.Adding support on the arm64/aarch64 platform is trivial:
However, it will have a small overhead every time each CPU enters and leaves the idle state - some very simple logic, an atomic counter update, and walking a (likely empty) list under a spinlock. If there is an LED with a
cputrigger then the list won't be empty.We're always wary of enabling configuration options that ending up costing all users memory, cpu or disk storage for the benefit of a few. This has the added disincentive of being a downstream patch (unless you decided to take it to the upstream maintainers of arm64), so I'm even less tempted.
I'll leave this here to see if there are any other opinions, but I'll need some persuasion (e.g. some performance measurements) before considering applying the patch.