[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <abdeaef1-e6d4-43c3-b8c4-d5f0c645a169@app.fastmail.com>
Date: Mon, 22 Dec 2025 17:12:55 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Lorenz Bauer" <lmb@...valent.com>, "Amit Shah" <amit@...nel.org>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Cc: virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH v2] virtio: console: fix lost wakeup when device is written and
polled
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.
> @@ -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().
Arnd
Powered by blists - more mailing lists