Cannot set display brightness
Brief summary of the problem:
After getting the display replaced under warranty in a HP Pavilion Aero, setting the display brightness doesn't work anymore.
Hardware description:
- CPU: AMD Ryzen 7 5800U with Radeon Graphics
- GPU: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c1)
- System Memory: 16 Gb
- Display(s): Built-in 2560x1600 @ 60Hz
System information:
- Distro name and Version: Devuan GNU/Linux 5 (daedalus)
- Kernel version:
6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 GNU/Linux
(also tried it with the newest 6.3 kernel from the Debian unstable repo with the same result)
How to reproduce the issue:
I'm filing this as a bug because:
- it works under Windows
- it works when booting an Ubuntu 22.04 live CD (kernel 5.15)
It also worked with the old display, but now:
$ cat /sys/class/backlight/amdgpu_bl0/actual_brightness
Segmentation fault
In the kernel log:
divide error: 0000 [#1] PREEMPT SMP NOPTI
CPU: 8 PID: 5994 Comm: cat Tainted: P OE 6.1.0-10-amd64 #1 Debian 6.1.37-1
Hardware name: HP HP Pavilion Aero Laptop 13-be0xxx/8916, BIOS F.12 04/11/2023
RIP: 0010:convert_brightness_to_user+0x32/0x60 [amdgpu]
Code: 00 74 2e 69 57 08 e8 03 00 00 31 c0 69 4f 0c e8 03 00 00 39 d6 72 15 29 d6 29 d1 89 f0 89 ca c1 e0 08 d1 ea 29 f0 01 d0 31 d2 <f7> f1 c3 cc cc cc cc 8b 47 14 89 c1 c1 e1 08 01 c1 8b 47 10 89 c2
RSP: 0018:ffffb6e859637c90 EFLAGS: 00010246
RAX: 00000000e827fed6 RBX: ffff91a162af54f8 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 000000001b032b2a RDI: ffffb6e859637ca0
RBP: 0000000000000000 R08: 0000000000000008 R09: 0000000000000326
R10: 0000000000000002 R11: 0000000000000000 R12: ffff91a140d9d000
R13: ffff91a15b0f7800 R14: 0000000000000001 R15: 0000000000000001
FS: 00007fe821c74740(0000) GS:ffff91a44e800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe821696000 CR3: 00000003b0536000 CR4: 0000000000750ee0
PKRU: 55555554
Call Trace:
<TASK>
? __die_body.cold+0x1a/0x1f
? die+0x2a/0x50
? do_trap+0xc5/0x110
? convert_brightness_to_user+0x32/0x60 [amdgpu]
? do_error_trap+0x6a/0x90
? convert_brightness_to_user+0x32/0x60 [amdgpu]
? exc_divide_error+0x34/0x50
? convert_brightness_to_user+0x32/0x60 [amdgpu]
? asm_exc_divide_error+0x16/0x20
? convert_brightness_to_user+0x32/0x60 [amdgpu]
amdgpu_dm_backlight_get_brightness+0x10d/0x130 [amdgpu]
actual_brightness_show+0x3e/0x90
dev_attr_show+0x18/0x40
sysfs_kf_seq_show+0xa3/0xe0
seq_read_iter+0x122/0x450
vfs_read+0x23c/0x310
ksys_read+0x6b/0xf0
do_syscall_64+0x5b/0xc0
? handle_mm_fault+0xdb/0x2d0
? preempt_count_add+0x47/0xa0
? up_read+0x37/0x70
? do_user_addr_fault+0x1bb/0x570
? fpregs_assert_state_consistent+0x22/0x50
? exit_to_user_mode_prepare+0x40/0x1d0
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe821d6f03d
Code: 31 c0 e9 c6 fe ff ff 50 48 8d 3d a6 55 0a 00 e8 39 fe 01 00 66 0f 1f 84 00 00 00 00 00 80 3d a1 25 0e 00 00 74 17 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 5b c3 66 2e 0f 1f 84 00 00 00 00 00 48 83 ec
RSP: 002b:00007ffccf79d108 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007fe821d6f03d
RDX: 0000000000020000 RSI: 00007fe821697000 RDI: 0000000000000003
RBP: 0000000000020000 R08: 00000000ffffffff R09: 0000000000000000
R10: 00007fe821c86b40 R11: 0000000000000246 R12: 00007fe821697000
R13: 0000000000000003 R14: 0000000000020000 R15: 0000000000000000
</TASK>
Modules linked in: rfcomm fuse cmac algif_hash algif_skcipher af_alg bnep nf_conntrack_netlink xfrm_user xfrm_algo xt_addrtype br_netfilter xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp nft_compat x_tables nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables libcrc32c nfnetlink bridge binfmt_misc 8021q garp stp mrp llc nls_ascii nls_cp437 vfat fat ext4 mbcache jbd2 crc32c_generic rtw89_8852ae rtw89_8852a rtw89_pci rtw89_core btusb intel_rapl_msr intel_rapl_common btrtl btbcm edac_mce_amd btintel snd_ctl_led btmtk mac80211 kvm_amd snd_hda_codec_realtek bluetooth snd_hda_codec_generic libarc4 kvm uvcvideo ledtrig_audio jitterentropy_rng cfg80211 snd_soc_dmic videobuf2_vmalloc snd_acp3x_pdm_dma irqbypass snd_acp3x_rn videobuf2_memops snd_hda_codec_hdmi videobuf2_v4l2 drbg snd_soc_core videobuf2_common snd_hda_intel ansi_cprng ghash_clmulni_intel snd_intel_dspcfg sha512_ssse3 snd_intel_sdw_acpi sha512_generic ecdh_generic
sparse_keymap snd_compress videodev snd_hda_codec aesni_intel mc joydev snd_hda_core crypto_simd snd_pci_acp6x snd_hwdep cryptd snd_pcm rapl ecc crc16 serio_raw snd_timer snd_pci_acp5x pcspkr efi_pstore ucsi_acpi snd snd_rn_pci_acp3x typec_ucsi sp5100_tco rfkill ccp snd_acp_config hid_multitouch roles wmi_bmof watchdog snd_soc_acpi k10temp soundcore snd_pci_acp3x typec rng_core evdev ac acpi_cpufreq amd_pmc acpi_tad efivarfs zfs(POE) zunicode(POE) zzstd(OE) zlua(OE) zavl(POE) icp(POE) zcommon(POE) znvpair(POE) spl(OE) usbhid cdc_ether usbnet r8152 mii amdgpu gpu_sched drm_buddy i2c_algo_bit drm_display_helper xhci_pci xhci_hcd cec nvme rc_core drm_ttm_helper nvme_core ttm t10_pi usbcore drm_kms_helper crc64_rocksoft crc64 crc_t10dif crct10dif_generic hid_sensor_hub hid_generic drm crct10dif_pclmul crc32_pclmul crc32c_intel i2c_piix4 i2c_hid_acpi amd_sfh usb_common crct10dif_common fan i2c_hid button video battery hid wmi
---[ end trace 0000000000000000 ]---
RIP: 0010:convert_brightness_to_user+0x32/0x60 [amdgpu]
Code: 00 74 2e 69 57 08 e8 03 00 00 31 c0 69 4f 0c e8 03 00 00 39 d6 72 15 29 d6 29 d1 89 f0 89 ca c1 e0 08 d1 ea 29 f0 01 d0 31 d2 <f7> f1 c3 cc cc cc cc 8b 47 14 89 c1 c1 e1 08 01 c1 8b 47 10 89 c2
RSP: 0018:ffffb6e859637c90 EFLAGS: 00010246
RAX: 00000000e827fed6 RBX: ffff91a162af54f8 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 000000001b032b2a RDI: ffffb6e859637ca0
RBP: 0000000000000000 R08: 0000000000000008 R09: 0000000000000326
R10: 0000000000000002 R11: 0000000000000000 R12: ffff91a140d9d000
R13: ffff91a15b0f7800 R14: 0000000000000001 R15: 0000000000000001
FS: 00007fe821c74740(0000) GS:ffff91a44e800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe821696000 CR3: 00000003b0536000 CR4: 0000000000750ee0
PKRU: 55555554
And the display brightness stays at a dimmed level no matter what.
Other times the cat
doesn't segfault but gets stuck in I/O wait ("D" state) and cannot be killed even with SIGKILL (the kernel trace looks the same).
Now when I go to the Ubuntu live system by rebooting (no poweroff) from Devuan what I see is that the display stays dimmed, the brightness controls still don't work, but I can read from the sysfs files:
ubuntu@ubuntu:/sys/class/backlight/amdgpu_bl0$ cat actual_brightness
77899
ubuntu@ubuntu:/sys/class/backlight/amdgpu_bl0$ cat max_brightness
255
ubuntu@ubuntu:/sys/class/backlight/amdgpu_bl0$ cat brightness
255