Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@meta.com>,
	linux-nvme@lists.infradead.org,
	Bjorn Helgaas <helgaas@kernel.org>
Subject: Re: [PATCH] nvme-pci: serialize polling interrupt queue with shutdown
Date: Fri, 15 May 2026 07:29:31 -0600	[thread overview]
Message-ID: <agcfu6hzCWpM68Fa@kbusch-mbp> (raw)
In-Reply-To: <20260515042941.GB3433@lst.de>

On Fri, May 15, 2026 at 06:29:41AM +0200, Christoph Hellwig wrote:
> On Thu, May 14, 2026 at 07:45:44AM -0700, Keith Busch wrote:
> > From: Keith Busch <kbusch@kernel.org>
> > 
> > Polling an interrupt driven completion queue temporarilly disables the
> > irq. If this occurs concurrently with another thread disabling the
> > device, the irq vector may have been freed, which makes it available for
> > reuse. Reenabling the irq after polling the queue may be referencing a
> > stale irq at that point.
> > 
> > Fix this race by ensuring nvme_poll_irqdisable() can not run
> > concurrently with nvme_dev_disable(), and skip polling the completion
> > queue if the queue has already been disabled.
> 
> Do we need the same change in nvme_suspend_queue?  I.e., should the check
> and locking be moved into nvme_poll_irqdisable?

nvme_suspend_queue is called from only one place that already holds the
same lock, so not necessary. And we can't do the locking within
nvme_poll_irqdisable since nvme_dev_disable calls it with the lock
already held too. I can add lockdep asserts to make the expectations
clear, though. 


      reply	other threads:[~2026-05-15 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 14:45 [PATCH] nvme-pci: serialize polling interrupt queue with shutdown Keith Busch
2026-05-15  4:29 ` Christoph Hellwig
2026-05-15 13:29   ` Keith Busch [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=agcfu6hzCWpM68Fa@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=hch@lst.de \
    --cc=helgaas@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-nvme@lists.infradead.org \
    /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