linux-yocto/drivers/input
Fabrice Gasnier a7b79db258 Input: gpio-keys - fix a sleep while atomic with PREEMPT_RT
commit f4a8f561d0 upstream.

When enabling PREEMPT_RT, the gpio_keys_irq_timer() callback runs in
hard irq context, but the input_event() takes a spin_lock, which isn't
allowed there as it is converted to a rt_spin_lock().

[ 4054.289999] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
[ 4054.290028] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/0
...
[ 4054.290195]  __might_resched+0x13c/0x1f4
[ 4054.290209]  rt_spin_lock+0x54/0x11c
[ 4054.290219]  input_event+0x48/0x80
[ 4054.290230]  gpio_keys_irq_timer+0x4c/0x78
[ 4054.290243]  __hrtimer_run_queues+0x1a4/0x438
[ 4054.290257]  hrtimer_interrupt+0xe4/0x240
[ 4054.290269]  arch_timer_handler_phys+0x2c/0x44
[ 4054.290283]  handle_percpu_devid_irq+0x8c/0x14c
[ 4054.290297]  handle_irq_desc+0x40/0x58
[ 4054.290307]  generic_handle_domain_irq+0x1c/0x28
[ 4054.290316]  gic_handle_irq+0x44/0xcc

Considering the gpio_keys_irq_isr() can run in any context, e.g. it can
be threaded, it seems there's no point in requesting the timer isr to
run in hard irq context.

Relax the hrtimer not to use the hard context.

Fixes: 019002f20c ("Input: gpio-keys - use hrtimer for release timer")
Suggested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Link: https://lore.kernel.org/r/20250528-gpio_keys_preempt_rt-v2-1-3fc55a9c3619@foss.st.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ adjusted context ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-01 09:48:39 +01:00
..
gameport Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
joystick Input: xpad - set correct controller type for Acer NGR200 2025-07-24 08:56:21 +02:00
keyboard Input: gpio-keys - fix a sleep while atomic with PREEMPT_RT 2025-08-01 09:48:39 +01:00
misc Input: iqs7222 - explicitly define number of external channels 2025-07-10 16:05:10 +02:00
mouse Input: synaptics - enable InterTouch on TUXEDO InfinityBook Pro 14 v5 2025-05-18 08:24:51 +02:00
rmi4 Input: synaptics-rmi - fix crash with unsupported versions of F34 2025-06-19 15:32:22 +02:00
serio Input: i8042 - swap old quirk combination with new quirk for more devices 2025-03-22 12:54:22 -07:00
tablet move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
tests Input updates for v6.11-rc0 2024-07-19 16:51:39 -07:00
touchscreen Input: cyttsp5 - fix power control issue on wakeup 2025-05-18 08:24:50 +02:00
apm-power.c
evbug.c
evdev.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
ff-core.c Input: ff-core - prefer struct_size over open coded arithmetic 2024-04-30 14:04:31 -07:00
ff-memless.c
input-compat.c
input-compat.h
input-core-private.h
input-leds.c Input: leds - change config symbol dependency for audio mute trigger 2024-03-03 14:46:06 -08:00
input-mt.c Input: MT - limit max slots 2024-07-29 10:44:48 -07:00
input-poller.c
input-poller.h
input.c Input updates for v6.12-rc5 2024-11-03 08:35:29 -10:00
joydev.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
Kconfig
Makefile
matrix-keymap.c Input: matrix-keymap - switch to using __free() cleanup facility 2024-08-29 10:59:30 -07:00
mousedev.c
sparse-keymap.c
touchscreen.c
vivaldi-fmap.c Input: add missing MODULE_DESCRIPTION() macros 2024-06-09 14:38:48 -07:00