mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Lorenz Bauer" <lmb@isovalent.com>, "Amit Shah" <amit@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] virtio: console: fix lost wakeup when device is written and polled
Date: Mon, 22 Dec 2025 17:12:55 +0100	[thread overview]
Message-ID: <abdeaef1-e6d4-43c3-b8c4-d5f0c645a169@app.fastmail.com> (raw)
In-Reply-To: <20251222-virtio-console-lost-wakeup-v2-1-5de93cb3f1c1@isovalent.com>

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

  reply	other threads:[~2025-12-22 16:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22 16:04 Lorenz Bauer
2025-12-22 16:12 ` Arnd Bergmann [this message]
2025-12-22 16:23   ` Lorenz Bauer
2025-12-22 20:39     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abdeaef1-e6d4-43c3-b8c4-d5f0c645a169@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=amit@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lmb@isovalent.com \
    --cc=stable@vger.kernel.org \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®