Skip to content

Commit 18828d7

Browse files
committed
xpadneo, rumble: Properly save and restore IRQ state during locking
A previous refactor to scoped guards accidentally changed locking semantics from `spinlock_irqsave/irqrestore` to `spinlock_irq`. With `spinlock_irq`, IRQs are unconditionally enabled on unlock. In this path that can re-enable IRQs too early while outer input/FF locking still expects them disabled, allowing ff-memless timer re-entry and resulting in a hard lockup. Switch rumble locking to `spinlock_irqsave` so the previous IRQ state is restored correctly. Reported hard lockup trace (excerpt): watchdog: CPU6: Watchdog detected hard LOCKUP on cpu 6 _raw_spin_lock_irqsave+0x3d/0x50 input_event+0x41/0x90 xpadneo_events_event+0x225/0x350 [hid_xpadneo] Fixes: ee5c0d4 ("xpadneo, rumble: Migrate to more modern scoped locks") Fixes: #596 Signed-off-by: Kai Krakow <kai@kaishome.de>
1 parent c36ef91 commit 18828d7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

hid-xpadneo/src/xpadneo/rumble.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void rumble_worker(struct work_struct *work)
8383
r->data.loop_count = 0xEB;
8484
}
8585

86-
scoped_guard(spinlock_irq, &xdata->rumble.lock) {
86+
scoped_guard(spinlock_irqsave, &xdata->rumble.lock) {
8787

8888
/* let our scheduler know we've been called */
8989
xdata->rumble.scheduled = false;
@@ -143,7 +143,7 @@ static void rumble_worker(struct work_struct *work)
143143
* throttle next command submission, the firmware doesn't like us to
144144
* send rumble data any faster
145145
*/
146-
scoped_guard(spinlock_irq, &xdata->rumble.lock) {
146+
scoped_guard(spinlock_irqsave, &xdata->rumble.lock) {
147147
xdata->rumble.throttle_until = RUMBLE_THROTTLE_JIFFIES;
148148
if (xdata->rumble.scheduled) {
149149
unsigned long delay_work = calculate_throttling_delay(xdata);
@@ -205,7 +205,7 @@ static int rumble_play(struct input_dev *dev, void *data, struct ff_effect *effe
205205
*/
206206
max_main = max(weak, strong);
207207

208-
scoped_guard(spinlock_irq, &xdata->rumble.lock) {
208+
scoped_guard(spinlock_irqsave, &xdata->rumble.lock) {
209209
unsigned long delay_work;
210210

211211
/* calculate the physical magnitudes, scale from 16 bit to 0..100 */

0 commit comments

Comments
 (0)