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:
--- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -971,10 +971,17 @@ static __poll_t port_fops_poll(struct file *filp, poll_table *wait) return EPOLLHUP; } ret = 0;
if (!will_read_block(port))
spin_lock(&port->inbuf_lock);if (port->inbuf)As far as I can tell, you got the interrupt flag handling wrong in both places: port_fops_poll() is called with interrupts enabled, so you have to use spin_lock_irq() to block the interrupt from hanging.
Ack.
@@ -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?