]> git.itanic.dy.fi Git - linux-stable/commit
r8169: Use a raw_spinlock_t for the register locks.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 22 May 2023 13:41:21 +0000 (15:41 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 24 May 2023 03:38:12 +0000 (20:38 -0700)
commitd6c36cbc5e533f48bd89a7b5f339bd82b8b4378a
treeb8937bd5c6eda3399d294779d443ca571c573f4c
parent368d3cb406cdd074d1df2ad9ec06d1bfcb664882
r8169: Use a raw_spinlock_t for the register locks.

The driver's interrupt service routine is requested with the
IRQF_NO_THREAD if MSI is available. This means that the routine is
invoked in hardirq context even on PREEMPT_RT. The routine itself is
relatively short and schedules a worker, performs register access and
schedules NAPI. On PREEMPT_RT, scheduling NAPI from hardirq results in
waking ksoftirqd for further processing so using NAPI threads with this
driver is highly recommended since it NULL routes the threaded-IRQ
efforts.

Adding rtl_hw_aspm_clkreq_enable() to the ISR is problematic on
PREEMPT_RT because the function uses spinlock_t locks which become
sleeping locks on PREEMPT_RT. The locks are only used to protect
register access and don't nest into other functions or locks. They are
also not used for unbounded period of time. Therefore it looks okay to
convert them to raw_spinlock_t.

Convert the three locks which are used from the interrupt service
routine to raw_spinlock_t.

Fixes: e1ed3e4d9111 ("r8169: disable ASPM during NAPI poll")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/20230522134121.uxjax0F5@linutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/realtek/r8169_main.c