Subject: Re: [PATCH net-next v5] net: dlink: add support for reporting stats via `ethtool -S` and `ip -s -s link show`

From: Jakub Kicinski <[email-masked]>
Date: Mon, 31 Mar 2025 14:25:57 -0700

On Tue, 1 Apr 2025 01:40:19 +0900 Moon Yeounsu wrote:
> On Tue, Dec 10, 2024 at 07:15:19PM -0800, Jakub Kicinski wrote:
> > On Mon,  9 Dec 2024 18:28:27 +0900 Moon Yeounsu wrote:  
> > > +	unsigned long flags;
> > > +
> > > +	spin_lock_irqsave(&np->stats_lock, flags);  
> > 
> > I believe spin_lock_bh() is sufficient here, no need to save IRQ flags.
> >  
> 
> Anyway, base on what I have learned, I believe `spin_lock_irq()`
> should be used in this context instead of `spin_lock_bh()`.
> 
> The reason is that the `get_stats()` function can be called from
> an interrupt context (in the top-half).
> 
> If my understanding is correct, calling `spin_lock_bh()` in the
> top-half may lead to a deadlock.
> 
> The calling sequence is as follows:
> 	1. `rio_interrupt()` (registered via `request_irq()`)
> 	2. `rio_error()`
> 	3. `get_stats()`

Makes sense, please document this in the commit message for v6.