Bug 218155

Summary: Logitech G510s keyboard - sysfs: cannot create duplicate filename .../leds/g15::kbd_backlight/color
Product: Drivers Reporter: Arthur Borsboom (arthurborsboom)
Component: Input DevicesAssignee: drivers_input-devices
Status: RESOLVED CODE_FIX    
Severity: normal CC: jwrdegoede, lee.jones, tiwai
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: 6.6.1 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Kernel log 6.6.1
Kernel log 6.6.3

Description Arthur Borsboom 2023-11-17 13:20:08 UTC
Created attachment 305415 [details]
Kernel log 6.6.1

The Logitech G510s keyboard stopped working on kernel 6.6.1; kernel 6.5.9 works fine. The same seems to have happened to the System76 keyboard backlight, and possibly more keyboards with leds.

There seems to be a discussion going on on LKML with a possible solution.

https://lkml.org/lkml/2023/11/6/476

A solution seems to prevent exposing the 'color' attribute to sysfs, since it is not needed.

Kernel log 6.6.1 snippet; full log is attached.

[    7.990759] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:08.0/0000:07:00.0/0000:08:0c.0/0000:0c:00.0/usb1/1-3/1-3:1.1/0003:046D:C22D.000B/leds/g15::kbd_backlight/color'
[    7.990762] CPU: 4 PID: 451 Comm: (udev-worker) Tainted: G           OE      6.6.1-arch1-1 #1 be166a630cd909acf8820643140e9106c6ea80e6
[    7.990766] Hardware name: ASUS System Product Name/TUF GAMING X670E-PLUS WIFI, BIOS 1813 10/13/2023
[    7.990767] Call Trace:
[    7.990769]  <TASK>
[    7.990771]  dump_stack_lvl+0x47/0x60
[    7.990778]  sysfs_warn_dup+0x5a/0x70
[    7.990783]  sysfs_add_file_mode_ns+0x11a/0x130
[    7.990786]  internal_create_group+0x125/0x3b0
[    7.990789]  internal_create_groups+0x42/0xa0
[    7.990791]  device_add+0x5ad/0x8a0
[    7.990794]  ? srso_alias_return_thunk+0x5/0x7f
[    7.990798]  ? kstrdup+0x4c/0x70
[    7.990802]  device_create_groups_vargs+0xce/0xf0
[    7.990805]  device_create_with_groups+0x4b/0x70
[    7.990808]  led_classdev_register_ext+0x1d2/0x470
[    7.990812]  ? devm_led_classdev_register_ext+0x3a/0x90
[    7.990817]  devm_led_classdev_register_ext+0x50/0x90
[    7.990820]  lg_g15_probe+0x667/0x770 [hid_lg_g15 4a43fb61ec72c8e966287bea16924535918cb678]
[    7.990826]  hid_device_probe+0x10e/0x1a0
[    7.990829]  really_probe+0x19b/0x3e0
[    7.990833]  ? __pfx___device_attach_driver+0x10/0x10
[    7.990835]  __driver_probe_device+0x78/0x160
[    7.990838]  driver_probe_device+0x1f/0x90
[    7.990841]  __device_attach_driver+0x89/0x110
[    7.990844]  bus_for_each_drv+0x92/0xf0
[    7.990847]  __device_attach+0xb2/0x1b0
[    7.990850]  ? __pfx___hid_bus_reprobe_drivers+0x10/0x10
[    7.990853]  device_reprobe+0x4e/0x90
[    7.990855]  ? __hid_bus_reprobe_drivers+0x39/0x60
[    7.990857]  bus_for_each_dev+0x85/0xd0
[    7.990860]  ? __pfx___hid_bus_driver_added+0x10/0x10
[    7.990862]  __hid_bus_driver_added+0x2c/0x40
[    7.990865]  bus_for_each_drv+0x92/0xf0
[    7.990868]  __hid_register_driver+0x74/0x80
[    7.990871]  ? __pfx_ms_driver_init+0x10/0x10 [hid_microsoft a9a7eb35e2e5d1c3f68fd046c8c3a94730fe7fdb]
[    7.990876]  do_one_initcall+0x5a/0x320
[    7.990883]  do_init_module+0x60/0x240
[    7.990888]  init_module_from_file+0x89/0xe0
[    7.990894]  idempotent_init_module+0x120/0x2b0
[    7.990898]  __x64_sys_finit_module+0x5e/0xb0
[    7.990901]  do_syscall_64+0x5d/0x90
[    7.990904]  ? do_syscall_64+0x6c/0x90
[    7.990906]  ? srso_alias_return_thunk+0x5/0x7f
[    7.990908]  ? exit_to_user_mode_prepare+0x132/0x1f0
[    7.990911]  ? srso_alias_return_thunk+0x5/0x7f
[    7.990914]  ? syscall_exit_to_user_mode+0x2b/0x40
[    7.990916]  ? srso_alias_return_thunk+0x5/0x7f
[    7.990918]  ? do_syscall_64+0x6c/0x90
[    7.990920]  ? syscall_exit_to_user_mode+0x2b/0x40
[    7.990922]  ? srso_alias_return_thunk+0x5/0x7f
[    7.990924]  ? do_syscall_64+0x6c/0x90
[    7.990927]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[    7.990930] RIP: 0033:0x7f4ef790773d
[    7.990947] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c3 95 0c 00 f7 d8 64 89 01 48
[    7.990948] RSP: 002b:00007ffe65533e38 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[    7.990951] RAX: ffffffffffffffda RBX: 000056078c53f520 RCX: 00007f4ef790773d
[    7.990952] RDX: 0000000000000004 RSI: 00007f4ef7e05376 RDI: 000000000000000e
[    7.990953] RBP: 00007f4ef7e05376 R08: 00005602ec2c7357 R09: fffffffffffffe90
[    7.990954] R10: 0000000000000050 R11: 0000000000000246 R12: 0000000000020000
[    7.990956] R13: 000056078c52e2f0 R14: 0000000000000000 R15: 000056078c527640
[    7.990960]  </TASK>
Comment 1 Takashi Iwai 2023-11-17 13:35:27 UTC
We received a similar report for openSUSE Tumbleweed
  https://bugzilla.suse.com/show_bug.cgi?id=1217172

A workaround patch to rename the conflicting "color" sysfs entry of hid-lg-g15 driver was confirmed to work there.
  https://bugzilla.suse.com/attachment.cgi?id=870817

But I guess a better alternative would be to rather either removing or renaming the led class one instead, as the hid-lg-g15 driver has used its sysfs entry already for ages.
Comment 2 Takashi Iwai 2023-11-17 13:38:52 UTC
FWIW, the culprit of the regression on 6.6 is the commit
c7d80059b086c4986cd994a1973ec7a5d75f8eea
    leds: class: Store the color index in struct led_classdev

It introduced "class" sysfs entry while the HID driver had already the same sysfs entry, and now it conflicts and resulted in the driver probe error.

Adding Lee to Cc.
Comment 3 Takashi Iwai 2023-11-17 13:42:14 UTC
(In reply to Takashi Iwai from comment #2)
> It introduced "class" sysfs entry while the HID driver had already the same
> sysfs entry, and now it conflicts and resulted in the driver probe error.

s/"class"/"color"/
Comment 4 Hans de Goede 2023-11-22 15:21:52 UTC
This is fixed by this patch:

https://lore.kernel.org/linux-leds/20231121162359.9332-1-tiwai@suse.de/

This patch is on its way to Linus and should then also get added to the 6.6.y stable series.
Comment 5 Arthur Borsboom 2023-11-22 15:27:27 UTC
Nice, good to hear.

I will report back when the patch should have landed in Arch Linux and fix the regression.
Comment 6 Arthur Borsboom 2023-11-30 14:30:05 UTC
The Logitech G510s keyboard regression is still present in 6.6.3.
Comment 7 Arthur Borsboom 2023-11-30 14:30:27 UTC
Created attachment 305520 [details]
Kernel log 6.6.3
Comment 8 Arthur Borsboom 2023-11-30 15:02:40 UTC
I just noticed the fix pull request for kernel 6.7

https://lkml.org/lkml/2023/11/30/601

Shouldn't this contain a Fixes: tag and CC stable@... ?
Comment 9 Arthur Borsboom 2023-12-10 11:40:51 UTC
I confirm that the Logitech G510s keyboard regression is fixed in Arch kernel 6.6.5.