From: "Arnd Bergmann" <arnd@arndb.de>
To: "Lorenz Bauer" <lmb@isovalent.com>
Cc: "Amit Shah" <amit@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
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 21:39:45 +0100 [thread overview]
Message-ID: <6ef2f777-dd96-4b07-bd4d-0567705bf837@app.fastmail.com> (raw)
In-Reply-To: <CAN+4W8hAqVxbr040b_+Q-zF0Dv0utoj_UfwH+4LVk=Vx2TTFZA@mail.gmail.com>
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
prev parent reply other threads:[~2025-12-22 20:40 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
2025-12-22 16:23 ` Lorenz Bauer
2025-12-22 20:39 ` Arnd Bergmann [this message]
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=6ef2f777-dd96-4b07-bd4d-0567705bf837@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®