Re: 6.2 nvme-pci: something wrong
From: Linus Torvalds
Date: Sat Dec 24 2022 - 11:57:26 EST
On Sat, Dec 24, 2022 at 2:19 AM Hugh Dickins <hughd@xxxxxxxxxx> wrote:
>
> Regarding the awful 0's based queue depth: yes, it just looked to me
> as if the way that got handled in pci.c before differed from the way
> it gets handled in pci.c and core.c now, one too many "+ 1"s or "- 1"s
> somewhere.
The commit in question seems to replace nvme_pci_alloc_tag_set() calls
with nvme_alloc_io_tag_set(), and that has a big difference in how
queue_depth is set.
It used to do (in nnvme_pci_alloc_tag_set()):
set->queue_depth = min_t(unsigned, dev->q_depth, BLK_MQ_MAX_DEPTH) - 1;
but now it does (in nvme_alloc_io_tag_set())
set->queue_depth = ctrl->sqsize + 1;
instead.
So that "set->queue_depth" _seems_ to have historically had that "-1"
(that "zero means one" that apparently sqsize also has), but the new
code basically undoes it.
I don't know the code at all, but this does all seem to be a change
(and *very* confusing).
The fact that Hugh gets it to work by doint that
set->queue_depth = ctrl->sqsize;
does seem to match the whole "it used to subtract one" behavior it
had. Which is why I assume Hugh tried that patch in the first place.
Linus