Skip to content

Commit 45ca634

Browse files
LeviYeoReumNipaLocal
authored andcommitted
smc91x: fix broken irq-context in PREEMPT_RT
When smc91x.c is built with PREEMPT_RT, the following splat occurs in FVP_RevC: [ 13.055000] smc91x LNRO0003:00 eth0: link up, 10Mbps, half-duplex, lpa 0x0000 [ 13.062137] BUG: workqueue leaked atomic, lock or RCU: kworker/2:1[106] [ 13.062137] preempt=0x00000000 lock=0->0 RCU=0->1 workfn=mld_ifc_work [ 13.062266] C ** replaying previous printk message ** [ 13.062266] CPU: 2 UID: 0 PID: 106 Comm: kworker/2:1 Not tainted 6.18.0-dirty kernel-patches#179 PREEMPT_{RT,(full)} [ 13.062353] Hardware name: , BIOS [ 13.062382] Workqueue: mld mld_ifc_work [ 13.062469] Call trace: [ 13.062494] show_stack+0x24/0x40 (C) [ 13.062602] __dump_stack+0x28/0x48 [ 13.062710] dump_stack_lvl+0x7c/0xb0 [ 13.062818] dump_stack+0x18/0x34 [ 13.062926] process_scheduled_works+0x294/0x450 [ 13.063043] worker_thread+0x260/0x3d8 [ 13.063124] kthread+0x1c4/0x228 [ 13.063235] ret_from_fork+0x10/0x20 This happens because smc_special_trylock() disables IRQs even on PREEMPT_RT, but smc_special_unlock() does not restore IRQs on PREEMPT_RT. The reason is that smc_special_unlock() calls spin_unlock_irqrestore(), and rcu_read_unlock_bh() in __dev_queue_xmit() cannot invoke rcu_read_unlock() through __local_bh_enable_ip() when current->softirq_disable_cnt becomes zero. To address this issue, replace smc_special_trylock() with spin_trylock_irqsave(). Fixes: 342a932 ("locking/spinlock: Provide RT variant header: <linux/spinlock_rt.h>") Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: NipaLocal <nipa@local>
1 parent 36b8312 commit 45ca634

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

drivers/net/ethernet/smsc/smc91x.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,7 @@ static inline void smc_rcv(struct net_device *dev)
516516
* any other concurrent access and C would always interrupt B. But life
517517
* isn't that easy in a SMP world...
518518
*/
519-
#define smc_special_trylock(lock, flags) \
520-
({ \
521-
int __ret; \
522-
local_irq_save(flags); \
523-
__ret = spin_trylock(lock); \
524-
if (!__ret) \
525-
local_irq_restore(flags); \
526-
__ret; \
527-
})
519+
#define smc_special_trylock(lock, flags) spin_trylock_irqsave(lock, flags)
528520
#define smc_special_lock(lock, flags) spin_lock_irqsave(lock, flags)
529521
#define smc_special_unlock(lock, flags) spin_unlock_irqrestore(lock, flags)
530522
#else

0 commit comments

Comments
 (0)