On Mon, Dec 22, 2025, at 17:23, Lorenz Bauer wrote:
On Mon, Dec 22, 2025 at 5:13 PM Arnd Bergmann arnd@arndb.de wrote:
On Mon, Dec 22, 2025, at 17:04, Lorenz Bauer wrote:
@@ -1705,6 +1713,10 @@ static void out_intr(struct virtqueue *vq) return; }
spin_lock_irqsave(&port->outvq_lock, flags);reclaim_consumed_buffers(port);spin_unlock_irqrestore(&port->outvq_lock, flags);wake_up_interruptible(&port->waitqueue);The callback seems to always be called with interrupts disabled(), so here it's safe to use spin_lock() instead of spin_lock_irqsave().
This is pretty much just copied from in_intr which also uses _irqsave. I think it makes sense to stick to that for consistency's sake. What do you think?
The usual rule is that you must use spin_lock_irqsave() if the function can be called from either interrupt or non-interrupt context. It's also safe to be used if you are not sure.
However, in interrupt handlers you usually want to use the plain spin_lock() both for efficiency reasons and to document the calling conventions.
Arnd