Re: virtio_console: lost wakeup due to race between port_fops_poll() and vring_interrupt()

From: Lorenz Bauer

Date: Mon Dec 15 2025 - 04:51:53 EST


On Wed, Dec 10, 2025 at 3:58 PM Amit Shah <amit@xxxxxxxxxx> wrote:
>
> Both port_fops_write() and port_fops_poll() call will_write_block() for
> checking the block condition -- which is whether port->outvq_full is
> set. Even if buffers were consumed via poll, outvq_full should just
> return false, right?

Yes, it would. However, the problem is that port_fops_write never gets
to that part. It is stuck in wait_event_freezable(port->waitqueue).

> Hm, does adding wake_up(port->waitqueue) in case 'ret' is false in
> will_write_block() help?

It would, but I think it only addresses half of the problem. The read path
also calls reclaim_consumed_buffers. I've thrown together a patch which
issues a wakeup from reclaim_consumed_buffers instead, which seems
to work.

Best
Lorenz