Re: [PATCH 2/3] nvme-core: don't check non-mdts for disc ctrl

Keith Busch
2022-04-11T23:52:13Z

On Mon, Apr 11, 2022 at 08:44:59PM +0000, Chaitanya Kulkarni wrote:
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 3554c20e78c3..ce4060c3d62e 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2525,6 +2525,13 @@ static void nvme_dev_add(struct nvme_dev *dev)
> int ret;
>
> if (!dev->ctrl.tagset) {
> + ret = nvme_init_non_mdts_limits(&dev->ctrl);
> + if (ret < 0) {
> + dev_warn(dev->ctrl.device,
> + "reading non mdts limit error: %d\n", ret);
> + return;
> + }
> +
> dev->tagset.ops = &nvme_mq_ops;
> dev->tagset.nr_hw_queues = dev->online_queues - 1;
> dev->tagset.nr_maps = 2; /* default + read */

This isn't right either. A controller can change it's limits after a reset.
It's unlikely outside some odd firmware upgrades, but it could happen, so
the limits need to be checked on each reset, not just the first one.