[PATCH v2 7/7] nvme: add reserved ioq tags for cancel

Maurizio Lombardi m.lombardi85 at mail.ru
Thu Jun 27 01:12:13 PDT 2024


V Wed, Jun 26, 2024 at 03:20:08PM -0400, John Meneghini napsal(a):
> > >   	else if (ctrl->ops->flags & NVME_F_FABRICS)
> > >   		/* Reserved for fabric connect */
> > >   		set->reserved_tags = 1;
> > 
> > You mentioned an addtional tags is supposed to be reserved for fabrics.
> > Shouldn't this just be an "if", not an "else if", and then increment
> > reserved_tags?
> 
> Yes, good point. I was thinking we don't need more than 2 tags if it's a fabric.
> 
> So you want to reserve 3 tags when both cancel and fabrics are true?

You dropped the reserved tag for the connect command, this is from
the V2 patchset I am working on:

From: Maurizio Lombardi <mlombard at redhat.com>
Date: Tue, 25 Jun 2024 15:45:54 +0200
Subject: [PATCH 3/8] nvme-core: reserve tags for cancel commands

If the controller supports cancel commands, reserve two tags for them

Signed-off-by: Maurizio Lombardi <mlombard at redhat.com>
---
 drivers/nvme/host/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index fea5400ddf92..1b20f1a10321 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4532,9 +4532,14 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
         */
        if (ctrl->quirks & NVME_QUIRK_SHARED_TAGS)
                set->reserved_tags = NVME_AQ_DEPTH;
-       else if (ctrl->ops->flags & NVME_F_FABRICS)
+       else if (ctrl->ops->flags & NVME_F_FABRICS) {
                /* Reserved for fabric connect */
                set->reserved_tags = 1;
+               if (nvme_io_command_supported(ctrl, nvme_cmd_cancel)) {
+                       /* Reserved for cancel commands */
+                       set->reserved_tags += 2;
+               }
+       }
        set->numa_node = ctrl->numa_node;
        set->flags = BLK_MQ_F_SHOULD_MERGE;
        if (ctrl->ops->flags & NVME_F_BLOCKING)
-- 
2.43.0

Maurizio




More information about the Linux-nvme mailing list