On Monday 07 December 2020 16:37:04 Paul Menzel wrote: > Dear Linux folks, > > > On a Dell Precision 3540/0M14W7 with Debian sid/unstable restoring the > keyboard backlight takes over 100 ms according to `systemd-analyze > critical-chain` [1]. > > ``` > $ systemd-analyze critical-chain > […] > └─sysinit.target @887ms > └─systemd-backlight@leds:dell::kbd_backlight.service @1.295s > +114ms > └─system-systemd\x2dbacklight.slice @1.294s > └─system.slice @291ms > └─-.slice @291ms > ``` > > I have to run the program [2] under strace to know for sure, that the delay > is caused by accessing the backlight device. Hello! If it is really truth that the 100 ms delay is in the kernel then you can use e.g. perf tool to trace where in the kernel happens that delay. Kernel driver for keyboard backlight just calls Dell's SMBIOS API which issues SMM call. After that processor enters into privileged x86 SMM mode into Dell's SMM hook installed by the Dell firmware during machine boot and do appropriate keyboard backlight change call. During this procedure is normal execution of x86 processor stopped and even kernel does not have control over it. I already saw that people reported similar issues to Dell's SMM API for temperature and fan control and measured that processor stays in Dell's SMM code for a long time. So I can imagine that there could be a similar issue also with keyboard. But I can be completely wrong. I'm not sure if that keyboard backlight is related to SMM or not (this needs to be debugged) but basically kernel cannot do anything with Dell's SMM code. If problem is really in Dell SMM you can just report issue to Dell. If problem is somewhere else in kernel we need to know more details (e.g. in which function kernel spends lot of time) and then we can look how to optimize it. > Unfortunately, the device is > already in use by somebody else, so debugging is not easy. Maybe you have > some hint, how to approach analysis from the Linux kernel side. I understand that in this case it is harder to debug this issue. I know only perf tool for doing these analysis but maybe somebody else can help how it can be debugged in other way? > > Kind regards, > > Paul > > > [1]: https://github.com/systemd/systemd/issues/17885 > [2]: https://github.com/systemd/systemd/blob/5acd143259068c8959d7823b178ffbca3269db30/src/backlight/backlight.c