Re: [net,PATCH v3 1/2] net: ks8851: Reinstate disabling of BHs around IRQ handler

Sebastian Andrzej Siewior
2026-04-14T14:52:21Z

On 2026-04-14 16:20:46 [+0200], Marek Vasut wrote:
> > This is what happens since commit 0913ec336a6c0 ("net: ks8851: Fix
> > deadlock with the SPI chip variant"). Before that commit the softirq
> > execution will be picked up by netdev_alloc_skb_ip_align() and requires
> > PREEMPT_RT and a RX packet in #1 to trigger the deadlock.
>
> Do you want me to add this into the V4 commit message ?

The description does not match the code since the commit mentioned
above.

> > > Fix the problem by disabling BH around critical sections, including the
> > > IRQ handler, thus preventing the net_tx_action() softirq from triggering
> > > during these critical sections. The net_tx_action() softirq is triggered
> > > at the end of the IRQ handler, once all the other IRQ handler actions have
> > > been completed.
> > >
> > > __schedule from schedule_rtlock+0x1c/0x34
> > > schedule_rtlock from rtlock_slowlock_locked+0x548/0x904
> > > rtlock_slowlock_locked from rt_spin_lock+0x60/0x9c
> > > rt_spin_lock from ks8851_start_xmit_par+0x74/0x1a8
> > > ks8851_start_xmit_par from netdev_start_xmit+0x20/0x44
> > > netdev_start_xmit from dev_hard_start_xmit+0xd0/0x188
> > > dev_hard_start_xmit from sch_direct_xmit+0xb8/0x25c
> > > sch_direct_xmit from __qdisc_run+0x1f8/0x4ec
> > > __qdisc_run from qdisc_run+0x1c/0x28
> > > qdisc_run from net_tx_action+0x1f0/0x268
> > > net_tx_action from handle_softirqs+0x1a4/0x270
> > > handle_softirqs from __local_bh_enable_ip+0xcc/0xe0
> > > __local_bh_enable_ip from __alloc_skb+0xd8/0x128
> > > __alloc_skb from __netdev_alloc_skb+0x3c/0x19c
> > > __netdev_alloc_skb from ks8851_irq+0x388/0x4d4
> > > ks8851_irq from irq_thread_fn+0x24/0x64
> > > irq_thread_fn from irq_thread+0x178/0x28c
> > > irq_thread from kthread+0x12c/0x138
> > > kthread from ret_from_fork+0x14/0x28
> >
> > The backtrace here and the description is based on an older kernel.
> > However
> I actually did update the backtrace in V3 with the one from current next
> 20260413 .

That would be from yesterday and the change is merged since v6.10. But
why is the softirq starting from __netdev_alloc_skb() instead of
spin_unlock_bh(&ks->statelock)? After that unlock, the softirq must be
processed and __netdev_alloc_skb() _could_ observe pending softirqs but
not from ks8851.

Sebastian