Skip to contentSkip to conversation

qla2xxx - add nvme map_queues support

PATCH In review Nilesh Javali 6 participants 14 messages Aug 23, 2021 – Oct 13, 2021

Subsystems (4)
lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

cover qla2xxx - add nvme map_queues support

Currently nvme fc doesn't support map queue functionality. This patch set adds map_queue functionality to nvme_fc_mq_ops and nvme_fc_port_template, providing an option to LLDs to map queues similar to SCSI. For qla2xxx, minimum 10% improvement is noticed with this change as it helps in reducing cpu thrashing.

Saurav Kashyap (2):
nvme-fc: Add support for map_queues.
qla2xxx: Add map_queues support to nvme.

 drivers/nvme/host/fc.c          | 25 +++++++++++++++++++++++++
 drivers/scsi/qla2xxx/qla_nvme.c | 14 ++++++++++++++
 include/linux/nvme-fc-driver.h  |  7 +++++++
 3 files changed, 46 insertions(+)

base-commit: 92cc94adfce4683d0b421cbf59013703368aaeb9

Signature · 1 line
2.23.1
author maintainer
#1 lore raw

PATCH 1/2 nvme-fc: Add support for map_queues.

From: Saurav Kashyap <[email protected]>

NVMe FC don't have support for map queues as compared to pci, rdma and tcp. It doesn't provide a provision to LLDs to change the queue mapping like scsi layer. This patch adds an option for LLDs to change the queue mapping.

---
 drivers/nvme/host/fc.c         | 25 +++++++++++++++++++++++++
 include/linux/nvme-fc-driver.h |  7 +++++++
 2 files changed, 32 insertions(+)
drivers/nvme/host/fc.c +25 -0
index b08a61ca283f..078895809098 100644
@@ -16,6 +16,7 @@
 #include <linux/nvme-fc.h>
 #include "fc.h"
 #include <scsi/scsi_transport_fc.h>
+#include <linux/blk-mq-pci.h>
 
 /* *************************** Data Structures/Defines ****************** */
 
@@ -2839,6 +2840,29 @@ nvme_fc_complete_rq(struct request *rq)
 	nvme_fc_ctrl_put(ctrl);
 }
 
+static int nvme_fc_map_queues(struct blk_mq_tag_set *set)
+{
+	int i;
+	struct nvme_fc_ctrl *ctrl;
+	struct blk_mq_queue_map *map = NULL;
+
+	ctrl = set->driver_data;
+	for (i = 0; i < set->nr_maps; i++) {
+		map = &set->map[i];
+
+		if (!map->nr_queues) {
+			WARN_ON(i == HCTX_TYPE_DEFAULT);
+			continue;
+		}
+
+		/* Call LLDD map queue functionality if defined */
+		if (ctrl->lport->ops->map_queues)
+			ctrl->lport->ops->map_queues(&ctrl->lport->localport, map);
+		else
+			blk_mq_map_queues(map);
+	}
+	return 0;
+}
 
 static const struct blk_mq_ops nvme_fc_mq_ops = {
 	.queue_rq	= nvme_fc_queue_rq,
@@ -2847,6 +2871,7 @@ static const struct blk_mq_ops nvme_fc_mq_ops = {
 	.exit_request	= nvme_fc_exit_request,
 	.init_hctx	= nvme_fc_init_hctx,
 	.timeout	= nvme_fc_timeout,
+	.map_queues	= nvme_fc_map_queues,
 };
 
 static int
include/linux/nvme-fc-driver.h +7 -0
index 2a38f2b477a5..cb909edb76c4 100644
@@ -7,6 +7,7 @@
 #define _NVME_FC_DRIVER_H 1
 
 #include <linux/scatterlist.h>
+#include <linux/blk-mq.h>
 
 
 /*
@@ -497,6 +498,8 @@ struct nvme_fc_port_template {
 	int	(*xmt_ls_rsp)(struct nvme_fc_local_port *localport,
 				struct nvme_fc_remote_port *rport,
 				struct nvmefc_ls_rsp *ls_rsp);
+	void	(*map_queues)(struct nvme_fc_local_port *localport,
+			      struct blk_mq_queue_map *map);
 
 	u32	max_hw_queues;
 	u16	max_sgl_segments;
@@ -779,6 +782,10 @@ struct nvmet_fc_target_port {
  *       LS received.
  *       Entrypoint is Mandatory.
  *
+ * @map_queues: This functions lets the driver expose the queue mapping
+ *	 to the block layer.
+ *       Entrypoint is Optional.
+ *
  * @fcp_op:  Called to perform a data transfer or transmit a response.
  *       The nvmefc_tgt_fcp_req structure is the same LLDD-supplied
  *       exchange structure specified in the nvmet_fc_rcv_fcp_req() call
Signature · 1 line
2.23.1
author maintainer
#2 lore raw

PATCH 2/2 qla2xxx: Add map_queues support to nvme.

In reply to Nilesh Javali

From: Saurav Kashyap <[email protected]>

Add callback for map queues and use block layer blk_mq_pci_map_queues for mapping. With this mapping minimum 10% increase in performance is noticed.

---
 drivers/scsi/qla2xxx/qla_nvme.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +14 -0
index 05cad06ff165..7f9a7abc615b 100644
@@ -8,6 +8,8 @@
 #include <linux/delay.h>
 #include <linux/nvme.h>
 #include <linux/nvme-fc.h>
+#include <linux/blk-mq-pci.h>
+#include <linux/blk-mq.h>
 
 static struct nvme_fc_port_template qla_nvme_fc_transport;
 
@@ -634,6 +636,17 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	return rval;
 }
 
+static void qla_nvme_map_queues(struct nvme_fc_local_port *lport, struct blk_mq_queue_map *map)
+{
+	int rc;
+	struct scsi_qla_host *vha = lport->private;
+
+	rc = blk_mq_pci_map_queues(map, vha->hw->pdev, vha->irq_offset);
+	if (rc)
+		ql_log(ql_log_warn, vha, 0x21de,
+		       "pci map queue failed 0x%x", rc);
+}
+
 static void qla_nvme_localport_delete(struct nvme_fc_local_port *lport)
 {
 	struct scsi_qla_host *vha = lport->private;
@@ -668,6 +681,7 @@ static struct nvme_fc_port_template qla_nvme_fc_transport = {
 	.ls_abort	= qla_nvme_ls_abort,
 	.fcp_io		= qla_nvme_post_cmd,
 	.fcp_abort	= qla_nvme_fcp_abort,
+	.map_queues	= qla_nvme_map_queues,
 	.max_hw_queues  = 8,
 	.max_sgl_segments = 1024,
 	.max_dif_sgl_segments = 64,
Signature · 1 line
2.23.1
maintainer
#3 lore raw
In reply to Nilesh Javali
Quoted 5 lines · Nilesh Javali

Currently nvme fc doesn't support map queue functionality. This patch set adds map_queue functionality to nvme_fc_mq_ops and nvme_fc_port_template, providing an option to LLDs to map queues similar to SCSI. For qla2xxx, minimum 10% improvement is noticed with this change as it helps in reducing cpu thrashing.

Does this make nvme-fc use managed irq?

CCing Ming to see if this affects his patchset.

#4 lore raw

Hi Sagi,
Comments inline

Quoted 10 lines

-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Monday, August 23, 2021 10:51 PM
To: Nilesh Javali <[email protected]>; [email protected]; linux- [email protected]; Ming Lei <[email protected]>
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Quoted 8 lines
Quoted 5 lines · Nilesh Javali

Currently nvme fc doesn't support map queue functionality. This patch set adds map_queue functionality to nvme_fc_mq_ops and nvme_fc_port_template, providing an option to LLDs to map queues similar to SCSI. For qla2xxx, minimum 10% improvement is noticed with this change as it helps in reducing cpu thrashing.

Does this make nvme-fc use managed irq?

qla2xxx driver uses pci_alloc_irq_vectors_affinity to have affinity with each MSI-X vector. Currently nvme queue are not mapped based on affinity and irq offset. The change is to use blk_mq_pci_map_queues for mapping, this function consider irq affinity as well as irq offset.

Thanks,
~Saurav

Quoted 2 lines

CCing Ming to see if this affects his patchset.

#5 lore raw
Quoted 20 lines · Saurav Kashyap

Hi Sagi,
Comments inline

Quoted 17 lines

-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Monday, August 23, 2021 10:51 PM
To: Nilesh Javali <[email protected]>; [email protected]; linux- [email protected]; Ming Lei <[email protected]>
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Quoted 5 lines · Nilesh Javali

Currently nvme fc doesn't support map queue functionality. This patch set adds map_queue functionality to nvme_fc_mq_ops and nvme_fc_port_template, providing an option to LLDs to map queues similar to SCSI. For qla2xxx, minimum 10% improvement is noticed with this change as it helps in reducing cpu thrashing.

Quoted 4 lines
Quoted 1 line

Does this make nvme-fc use managed irq?

qla2xxx driver uses pci_alloc_irq_vectors_affinity to have affinity with each MSI-X vector. Currently nvme queue are not mapped based on affinity and irq offset. The change is to use blk_mq_pci_map_queues for mapping, this function consider irq affinity as well as irq offset.

OK, got it. Even though without this patchset, nvme-fc actually relies on managed irq since qla2xxx driver uses pci_alloc_irq_vectors_affinity.

Now the patchset[1] isn't good for addressing the issue in blk_mq_alloc_request_hctx().

[1] https://lore.kernel.org/linux-block/YR7demOSG6MKFVAF@T590/T/#t

Thanks,
Ming

#6 lore raw

Hi Ming,
Comments inline

Quoted 43 lines

-----Original Message-----
From: Ming Lei <[email protected]>
Sent: Tuesday, August 24, 2021 9:17 AM
To: Saurav Kashyap <[email protected]>
Cc: Sagi Grimberg <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; [email protected]; linux- [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>
Subject: [EXT] Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

External Email

----------------------------------------------------------------------

Quoted 7 lines · Saurav Kashyap

Hi Sagi,
Comments inline

Quoted 4 lines

-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Monday, August 23, 2021 10:51 PM
To: Nilesh Javali <[email protected]>; [email protected];

linux-

Quoted 13 lines
Quoted 13 lines

[email protected]; Ming Lei <[email protected]>
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Quoted 5 lines · Nilesh Javali

Currently nvme fc doesn't support map queue functionality. This patch set adds map_queue functionality to nvme_fc_mq_ops and nvme_fc_port_template, providing an option to LLDs to map queues similar to SCSI. For qla2xxx, minimum 10% improvement is noticed with this change as it helps in reducing cpu thrashing.

Quoted 3 lines
Quoted 1 line

Does this make nvme-fc use managed irq?

qla2xxx driver uses pci_alloc_irq_vectors_affinity to have affinity with each

MSI-X vector. Currently nvme queue are not mapped based on affinity and irq offset. The change is to use blk_mq_pci_map_queues for mapping, this function consider irq affinity as well as irq offset.

Quoted 1 line
Quoted 5 lines

OK, got it. Even though without this patchset, nvme-fc actually relies on managed irq since qla2xxx driver uses pci_alloc_irq_vectors_affinity.

Now the patchset[1] isn't good for addressing the issue in blk_mq_alloc_request_hctx().

Can you please elaborate on this? Is there something needs to be done from my side?

Thanks,
~Saurav

Quoted 11 lines

[1] https://urldefense.proofpoint.com/v2/url?u=https-
3A__lore.kernel.org_linux-2Dblock_YR7demOSG6MKFVAF-40T590_T_- 23t&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=ZHZbmY_LbM3DUZK_BDO1 OITP3ot_Vkb_5w- gas5TBMQ&m=CqFDnfAsZphubKXkUx5gsRF6RZ2Qe6sxWkYq4pBfFD0&s=2Nba EUI5eB6_R6PxW8ld1Xn2OU3_UdD6D30uvFAWhow&e=

Thanks,
Ming

#7 lore raw

Hi,

Can I get a review for this patch set?

Thanks,
~Saurav

Quoted 81 lines

-----Original Message-----
From: Saurav Kashyap <[email protected]>
Sent: Wednesday, August 25, 2021 10:29 AM
To: Ming Lei <[email protected]>
Cc: Sagi Grimberg <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; [email protected]; linux- [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>
Subject: RE: [EXT] Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Hi Ming,
Comments inline

Quoted 35 lines

-----Original Message-----
From: Ming Lei <[email protected]>
Sent: Tuesday, August 24, 2021 9:17 AM
To: Saurav Kashyap <[email protected]>
Cc: Sagi Grimberg <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; [email protected]; linux- [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>
Subject: [EXT] Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

External Email

----------------------------------------------------------------------

Quoted 7 lines · Saurav Kashyap

Hi Sagi,
Comments inline

Quoted 4 lines

-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Monday, August 23, 2021 10:51 PM
To: Nilesh Javali <[email protected]>; [email protected];

linux-

Quoted 13 lines
Quoted 13 lines

[email protected]; Ming Lei <[email protected]>
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Quoted 5 lines · Nilesh Javali

Currently nvme fc doesn't support map queue functionality. This patch set adds map_queue functionality to nvme_fc_mq_ops and nvme_fc_port_template, providing an option to LLDs to map queues similar to SCSI. For qla2xxx, minimum 10% improvement is noticed with this change as it helps in reducing cpu thrashing.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Does this make nvme-fc use managed irq?

qla2xxx driver uses pci_alloc_irq_vectors_affinity to have affinity with each

MSI-X vector. Currently nvme queue are not mapped based on affinity and irq offset. The change is to use blk_mq_pci_map_queues for mapping, this

function

Quoted 8 lines

consider irq affinity as well as irq offset.

Quoted 1 line

OK, got it. Even though without this patchset, nvme-fc actually relies on managed irq since qla2xxx driver uses pci_alloc_irq_vectors_affinity.

Now the patchset[1] isn't good for addressing the issue in blk_mq_alloc_request_hctx().

Can you please elaborate on this? Is there something needs to be done from my side?

Thanks,
~Saurav

Quoted 4 lines

[1] https://urldefense.proofpoint.com/v2/url?u=https-
3A__lore.kernel.org_linux-2Dblock_YR7demOSG6MKFVAF-40T590_T_-

23t&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=ZHZbmY_LbM3DUZK_BDO1

Quoted 2 lines

OITP3ot_Vkb_5w-

gas5TBMQ&m=CqFDnfAsZphubKXkUx5gsRF6RZ2Qe6sxWkYq4pBfFD0&s=2Nba

Quoted 5 lines

EUI5eB6_R6PxW8ld1Xn2OU3_UdD6D30uvFAWhow&e=

Thanks,
Ming

#8 lore raw

Hi Sagi/Christoph,

I haven't heard anything on this and there are no review comments on this patch set, kindly include this in nvme tree.

Thanks,
~Saurav

Quoted 95 lines

-----Original Message-----
From: Saurav Kashyap
Sent: Tuesday, September 7, 2021 2:48 PM
To: Ming Lei <[email protected]>; Sagi Grimberg <[email protected]>; [email protected]
Cc: Nilesh Javali <[email protected]>; [email protected]; linux- [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>
Subject: RE: [EXT] Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Hi,

Can I get a review for this patch set?

Thanks,
~Saurav

Quoted 10 lines

-----Original Message-----
From: Saurav Kashyap <[email protected]>
Sent: Wednesday, August 25, 2021 10:29 AM
To: Ming Lei <[email protected]>
Cc: Sagi Grimberg <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; [email protected]; linux- [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>
Subject: RE: [EXT] Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Quoted 8 lines

Hi Ming,
Comments inline

Quoted 5 lines

-----Original Message-----
From: Ming Lei <[email protected]>
Sent: Tuesday, August 24, 2021 9:17 AM
To: Saurav Kashyap <[email protected]>
Cc: Sagi Grimberg <[email protected]>; Nilesh Javali

<[email protected]>;

Quoted 12 lines
Quoted 12 lines

[email protected]; [email protected]; linux- [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>
Subject: [EXT] Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

External Email

----------------------------------------------------------------------

Quoted 3 lines · Saurav Kashyap

Hi Sagi,
Comments inline

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Monday, August 23, 2021 10:51 PM
To: Nilesh Javali <[email protected]>; [email protected];

linux-

Quoted 2 lines
Quoted 2 lines

[email protected]; Ming Lei <[email protected]>
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-

QLogic-

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

[email protected]>
Subject: Re: [PATCH 0/2] qla2xxx - add nvme map_queues support

Quoted 5 lines · Nilesh Javali

Currently nvme fc doesn't support map queue functionality. This patch set adds map_queue functionality to nvme_fc_mq_ops and nvme_fc_port_template, providing an option to LLDs to map queues similar to SCSI. For qla2xxx, minimum 10% improvement is noticed with this change as it helps in reducing cpu thrashing.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Does this make nvme-fc use managed irq?

qla2xxx driver uses pci_alloc_irq_vectors_affinity to have affinity with

each

Quoted 1 line
Quoted 1 line

MSI-X vector. Currently nvme queue are not mapped based on affinity and

irq

Quoted 5 lines
Quoted 1 line

offset. The change is to use blk_mq_pci_map_queues for mapping, this

function

Quoted 3 lines

consider irq affinity as well as irq offset.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

OK, got it. Even though without this patchset, nvme-fc actually relies on managed irq since qla2xxx driver uses pci_alloc_irq_vectors_affinity.

Now the patchset[1] isn't good for addressing the issue in blk_mq_alloc_request_hctx().

Can you please elaborate on this? Is there something needs to be done from

my

Quoted 9 lines

side?

Thanks,
~Saurav

Quoted 4 lines

[1] https://urldefense.proofpoint.com/v2/url?u=https-
3A__lore.kernel.org_linux-2Dblock_YR7demOSG6MKFVAF-40T590_T_-

Quoted 10 lines

23t&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=ZHZbmY_LbM3DUZK_BDO1

Quoted 3 lines
Quoted 2 lines

OITP3ot_Vkb_5w-

gas5TBMQ&m=CqFDnfAsZphubKXkUx5gsRF6RZ2Qe6sxWkYq4pBfFD0&s=2Nba

Quoted 5 lines
Quoted 5 lines

EUI5eB6_R6PxW8ld1Xn2OU3_UdD6D30uvFAWhow&e=

Thanks,
Ming

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#9 lore raw
Quoted 4 lines · Saurav Kashyap

Hi Sagi/Christoph,

I haven't heard anything on this and there are no review comments on this patch set, kindly include this in nvme tree.

I'll queue this up once the 5.16 tree opens unless James voices any objections.

#10 lore raw
Quoted 9 lines · Saurav Kashyap
Quoted 3 lines

Hi Sagi/Christoph,

I haven't heard anything on this and there are no review comments on this

patch set, kindly include this in nvme tree.

Quoted 1 line

I'll queue this up once the 5.16 tree opens unless James voices any objections.

Sounds good.

Thanks,
~Saurav

#11 lore raw
In reply to [email protected]

Hi Christoph,

Quoted 8 lines
Quoted 3 lines

Hi Sagi/Christoph,

I haven't heard anything on this and there are no review comments on this

patch set, kindly include this in nvme tree.

Quoted 1 line

I'll queue this up once the 5.16 tree opens unless James voices any objections.

Any updates on this one?

Thanks,
~Saurav

#12 lore raw
Quoted 4 lines · Saurav Kashyap

Hi Christoph,

Quoted 2 lines
Quoted 2 lines

Hi Sagi/Christoph,

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I haven't heard anything on this and there are no review comments on this

patch set, kindly include this in nvme tree.

Quoted 1 line

I'll queue this up once the 5.16 tree opens unless James voices any objections.

Any updates on this one?

http://git.infradead.org/nvme.git/commitdiff/062b5291ef352d6198c6c8414c71ae2debd06cf7