Fix a regression in 6.13 kernel
cover Fix a regression in 6.13 kernel
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")
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(+)
Signature · 1 line
2.43.5
PATCH 1/1 nvme-pci: do not call nvme_write_sq_db() if the commands list is empty
nvme_submit_cmds() should check the rqlist
before calling nvme_write_sq_db();
if the list is empty, it must return immediately.
--- drivers/nvme/host/pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/pci.c +3 -0
@@ -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);
Signature · 1 line
2.43.5
Re: [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty
Quoted 3 lines · Maurizio Lombardi
nvme_submit_cmds()should check the rqlist
before callingnvme_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.
Re: [PATCH 1/1] nvme-pci: do not call nvme_write_sq_db() if the commands list is empty
In reply to Maurizio LombardiQuoted 3 lines · Maurizio Lombardi
nvme_submit_cmds()should check the rqlist
before callingnvme_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: