• Sebastian Andrzej Siewior's avatar
    r8169: Use a raw_spinlock_t for the register locks. · d6c36cbc
    Sebastian Andrzej Siewior authored
    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: e1ed3e4d ("r8169: disable ASPM during NAPI poll")
    Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
    Link: https://lore.kernel.org/r/20230522134121.uxjax0F5@linutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    d6c36cbc
r8169_main.c 138 KB