Bug 207197 - acpi_video0 appears and disappears on Lenovo ThinkPad E585 - Lenovo ThinkPad E585
Summary: acpi_video0 appears and disappears on Lenovo ThinkPad E585 - Lenovo ThinkPad ...
Status: ASSIGNED
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Video (show other bugs)
Hardware: x86-64 Linux
: P1 low
Assignee: Zhang Rui
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-11 15:08 UTC by Dāvis
Modified: 2021-03-25 03:27 UTC (History)
3 users (show)

See Also:
Kernel Version: 5.6.3
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Dāvis 2020-04-11 15:08:55 UTC
Basically on Lenovo ThinkPad E585 in systemd's journal can see that `systemd-backlight@backlight:acpi_video0` is failing.

```
apr 11 15:31:33 localhost systemd[1]: Starting Load/Save Screen Backlight Brightness of backlight:acpi_video0...
apr 11 15:31:33 localhost systemd[819]: systemd-backlight@backlight:acpi_video0.service: Executing: /usr/lib/systemd/systemd-backlight load backlight:acpi_video0                                                                                                        
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:amdgpu_bl0.service: About to execute: /usr/lib/systemd/systemd-backlight load backlight:amdgpu_bl0                                                                                                     
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:amdgpu_bl0.service: Forked /usr/lib/systemd/systemd-backlight as 820                                                                                                                                   
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:amdgpu_bl0.service: Changed dead -> start
apr 11 15:31:33 localhost systemd[1]: Starting Load/Save Screen Backlight Brightness of backlight:amdgpu_bl0...
apr 11 15:31:33 localhost systemd[820]: systemd-backlight@backlight:amdgpu_bl0.service: Executing: /usr/lib/systemd/systemd-backlight load backlight:amdgpu_bl0                                                                                                          
apr 11 15:31:33 localhost systemd-backlight[819]: Failed to get backlight or LED device 'backlight:acpi_video0': No such device
apr 11 15:31:33 localhost systemd[1]: systemd-journald.service: Received EPOLLHUP on stored fd 64 (stored), closing.
apr 11 15:31:33 localhost systemd[1]: Received SIGCHLD from PID 819 (systemd-backlig).
apr 11 15:31:33 localhost systemd[1]: Child 819 (systemd-backlig) died (code=exited, status=1/FAILURE)
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Failed to read oom_kill field of memory.events cgroup attribute: No such file or directory                                                                                        
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Child 819 belongs to systemd-backlight@backlight:acpi_video0.service.                                                                                                             
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Main process exited, code=exited, status=1/FAILURE
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Failed with result 'exit-code'.
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Service will not restart (restart setting)
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Changed start -> failed
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Job 274 systemd-backlight@backlight:acpi_video0.service/start finished, result=failed                                                                                             
apr 11 15:31:33 localhost systemd[1]: Failed to start Load/Save Screen Backlight Brightness of backlight:acpi_video0.
apr 11 15:31:33 localhost systemd[1]: systemd-backlight@backlight:acpi_video0.service: Unit entered failed state.
```

It appears to be because acpi_video0 shows up and later disappears as there is only amdgpu_bl0

```
$ ls -l /sys/class/backlight/
total 0
lrwxrwxrwx 1 root root 0 apr 11 15:31 amdgpu_bl0 -> ../../devices/pci0000:00/0000:00:08.1/0000:05:00.0/backlight/amdgpu_bl0/


$ dmesg -T | grep -i acpi
[S  apr 11 15:30:48 2020] acpi PNP0C14:01: duplicate WMI GUID 05901221-D566-11D1-B2F0-00A0C9062910 (first instance was on PNP0C14:00)
[S  apr 11 15:30:48 2020] acpi PNP0C14:02: duplicate WMI GUID 05901221-D566-11D1-B2F0-00A0C9062910 (first instance was on PNP0C14:00)
[S  apr 11 15:30:48 2020] battery: ACPI: Battery Slot [BAT0] (battery present)
[S  apr 11 15:31:30 2020] acpi_cpufreq: overriding BIOS provided _PSD data
[S  apr 11 15:31:30 2020] ACPI: AC Adapter [AC] (off-line)
[S  apr 11 15:31:30 2020] thinkpad_acpi: ThinkPad ACPI Extras v0.26
[S  apr 11 15:31:30 2020] thinkpad_acpi: http://ibm-acpi.sf.net/
[S  apr 11 15:31:30 2020] thinkpad_acpi: ThinkPad BIOS R0UET76W (1.56 ), EC R0UHT76W
[S  apr 11 15:31:30 2020] thinkpad_acpi: Lenovo ThinkPad E585, model 20KV000YUS
[S  apr 11 15:31:30 2020] thinkpad_acpi: radio switch found; radios are enabled
[S  apr 11 15:31:30 2020] thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness control, supported by the ACPI video driver
[S  apr 11 15:31:30 2020] thinkpad_acpi: Disabling thinkpad-acpi brightness events by default...
[S  apr 11 15:31:30 2020] thinkpad_acpi: Standard ACPI backlight interface available, not loading native one
[S  apr 11 15:31:30 2020] thinkpad_acpi: battery 1 registered (start 95, stop 101)
[S  apr 11 15:31:30 2020] input: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input24
```
Comment 1 Zhang Rui 2020-06-30 06:25:17 UTC
ACPI video driver has the API to unregister itself, and this API will be invoked by other drivers like graphics driver, when it knows that there is a better backlight control interface available.

The decision of if and when to disable the ACPI video driver is not made by the ACPI video driver.
Comment 2 Paul Menzel 2021-03-24 07:09:10 UTC
Reading https://github.com/systemd/systemd/issues/15329, what is the status here? Should some mailing list be used to contact the maintainers about the issue?
Comment 3 Zhang Rui 2021-03-25 02:59:27 UTC
acpi_video backlight interface is registered and then replaced by the amdgpu_bl0.

It is another problem that amdgpu_bl0 interface does not work, and I'm not sure which driver registers the amdgpu backlight interface after a quick search.
But to me, the problem is why systemd-backlight still pokes the unregistered acpi_video0 interface when there is already an replacement.

I think we need to get contact with the systemd-backlight owner.
Comment 4 Zhang Rui 2021-03-25 03:07:46 UTC
https://wiki.archlinux.org/index.php/Backlight#Save_and_restore_functionality

"The systemd package includes the service systemd-backlight@.service, which is enabled by default and "static". It saves the backlight brightness level at shutdown and restores it at boot. The service uses the ACPI method described in #ACPI, generating services for each folder found in /sys/class/backlight/. For example, if there is a folder named acpi_video0, it generates a service called systemd-backlight@backlight:acpi_video0.service. When using other methods of setting the backlight at boot, it is recommended to stop systemd-backlight from restoring the backlight by setting the kernel parameters parameter systemd.restore_state=0. See systemd-backlight@.service(8) for details.
Note: Some laptops have multiple video cards (e.g. Optimus) and the backlight restoration fails. Try masking an instance of the service (e.g. systemd-backlight@backlight:acpi_video1 for acpi_video1)."

To me, "stop systemd-backlight from restoring the backlight by setting the kernel parameters parameter systemd.restore_state=0" is not a perfect solution.

If user is okay when running with amdgpu_bl0, it means the cur_brightness in amdgpu_bl0 interface is the one user uses, thus we can quit systemd-backlight@backlight:acpi_video0.service smoothly and do save and restore in systemd-backlight@backlight:amdgpu_bl0.service as well.
right?
Comment 5 Zhang Rui 2021-03-25 03:27:15 UTC
I was just thinking why we don't have this problem for Intel graphics, so an alternative solution is to do early check in acpi_video_init().
In acpi_video_init(), if we know the amd graphics driver is built and we know it has backlight control, we should stop registering the acpi_video backlight interface.

is amdgpu_bl0 registered by kernel amd graphics driver?
or are you using out of tree amd graphics driver?


Do you know what is the proper place to raise this, Paul?

Note You need to log in before you can comment on or make changes to this bug.