* [PATCH 0/1] Fix a regression in 6.13 kernel
@ 2025-03-31 16:28 Maurizio Lombardi
2025-03-31 16:28 ` [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty Maurizio Lombardi
0 siblings, 1 reply; 4+ messages in thread
From: Maurizio Lombardi @ 2025-03-31 16:28 UTC (permalink / raw)
To: kbusch; +Cc: axboe, mikhail.v.gavrilov, hch, linux-nvme, mlombard
Some time ago Mikhail Gavrilov reported a regression against kernel 6.13
introduced by commit beadf0088501d9dcf2 ("nvme-pci: reverse request order in nvme_queue_rqs")
https://lore.kernel.org/linux-nvme/CABXGCsMcxu3pCF8jYPeqF_jN34saBwc8Fci+c-Dg2Lh7rqvuFQ@mail.gmail.com/
I was not able to reproduce the bug, but Mikhail reported that this patch
fixed it for him:
https://lore.kernel.org/linux-nvme/CABXGCsMd_xv8jPDF_sFYhwd8GtANZ23nbaSJuCxQRO7cjPtgWg@mail.gmail.com/
I think the problem here is that nvme_write_sq_db() ends up
being called even when the rqlist is empty and this couldn't happen before
the changes introduced by beadf0088501d9dcf2
Maurizio Lombardi (1):
nvme-pci: do not call nvme_write_sq_db() if the commands list is empty
drivers/nvme/host/pci.c | 3 +++
1 file changed, 3 insertions(+)
--
2.43.5
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty
2025-03-31 16:28 [PATCH 0/1] Fix a regression in 6.13 kernel Maurizio Lombardi
@ 2025-03-31 16:28 ` Maurizio Lombardi
2025-03-31 16:45 ` Keith Busch
2025-04-03 4:37 ` Christoph Hellwig
0 siblings, 2 replies; 4+ messages in thread
From: Maurizio Lombardi @ 2025-03-31 16:28 UTC (permalink / raw)
To: kbusch; +Cc: axboe, mikhail.v.gavrilov, hch, linux-nvme, mlombard
nvme_submit_cmds() should check the rqlist
before calling nvme_write_sq_db();
if the list is empty, it must return immediately.
Fixes: beadf0088501 ("nvme-pci: reverse request order in nvme_queue_rqs")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
drivers/nvme/host/pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 2883d17ee1eb..b178d52eac1b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -986,6 +986,9 @@ static void nvme_submit_cmds(struct nvme_queue *nvmeq, struct rq_list *rqlist)
{
struct request *req;
+ if (rq_list_empty(rqlist))
+ return;
+
spin_lock(&nvmeq->sq_lock);
while ((req = rq_list_pop(rqlist))) {
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
--
2.43.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty
2025-03-31 16:28 ` [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty Maurizio Lombardi
@ 2025-03-31 16:45 ` Keith Busch
2025-04-03 4:37 ` Christoph Hellwig
1 sibling, 0 replies; 4+ messages in thread
From: Keith Busch @ 2025-03-31 16:45 UTC (permalink / raw)
To: Maurizio Lombardi; +Cc: axboe, mikhail.v.gavrilov, hch, linux-nvme, mlombard
On Mon, Mar 31, 2025 at 06:28:59PM +0200, Maurizio Lombardi wrote:
> nvme_submit_cmds() should check the rqlist
> before calling nvme_write_sq_db();
> if the list is empty, it must return immediately.
I believe that could cause the driver to write the same value into a sq
doorbell twice, which is a spec violation.
Thanks, applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty
2025-03-31 16:28 ` [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty Maurizio Lombardi
2025-03-31 16:45 ` Keith Busch
@ 2025-04-03 4:37 ` Christoph Hellwig
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2025-04-03 4:37 UTC (permalink / raw)
To: Maurizio Lombardi
Cc: kbusch, axboe, mikhail.v.gavrilov, hch, linux-nvme, mlombard
On Mon, Mar 31, 2025 at 06:28:59PM +0200, Maurizio Lombardi wrote:
> nvme_submit_cmds() should check the rqlist
> before calling nvme_write_sq_db();
> if the list is empty, it must return immediately.
It would be useful for future readers to state why it is important.
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-03 4:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31 16:28 [PATCH 0/1] Fix a regression in 6.13 kernel Maurizio Lombardi
2025-03-31 16:28 ` [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty Maurizio Lombardi
2025-03-31 16:45 ` Keith Busch
2025-04-03 4:37 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.