lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220218184157.176457-3-melanieplageman@gmail.com>
Date:   Fri, 18 Feb 2022 18:41:54 +0000
From:   "Melanie Plageman (Microsoft)" <melanieplageman@...il.com>
To:     mikelley@...rosoft.com, jejb@...ux.ibm.com, kys@...rosoft.com,
        martin.petersen@...cle.com, mst@...hat.com,
        benh@...nel.crashing.org, decui@...rosoft.com,
        don.brace@...rochip.com, R-QLogic-Storage-Upstream@...vell.com,
        haiyangz@...rosoft.com, jasowang@...hat.com, john.garry@...wei.com,
        kashyap.desai@...adcom.com, mpe@...erman.id.au,
        njavali@...vell.com, pbonzini@...hat.com, paulus@...ba.org,
        sathya.prakash@...adcom.com,
        shivasharan.srikanteshwara@...adcom.com,
        sreekanth.reddy@...adcom.com, stefanha@...hat.com,
        sthemmin@...rosoft.com, suganath-prabu.subramani@...adcom.com,
        sumit.saxena@...adcom.com, tyreld@...ux.ibm.com,
        wei.liu@...nel.org, linuxppc-dev@...ts.ozlabs.org,
        megaraidlinux.pdl@...adcom.com, mpi3mr-linuxdrv.pdl@...adcom.com,
        storagedev@...rochip.com,
        virtualization@...ts.linux-foundation.org,
        linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-scsi@...r.kernel.org, MPT-FusionLinux.pdl@...adcom.com
Cc:     andres@...razel.de
Subject: [PATCH RFC v1 2/5] scsi: map_queues() takes tag set instead of host

Change the scsi_host_template->map_queues() to accept a blk_mq_tag_set
instead of a Scsi_Host as a function parameter.

A future commit will introduce the concept of device tag sets. Thus
map_queues() cannot assume that the target blk_mq_tag_set is accessible
through Scsi_Host->tag_set.

Generalize map_queues() by changing its input to a blk_mq_tag_set.

This commit makes no functional change, as the Scsi_Host->tag_set is
passed as the argument to the LLD map_queues function.

Signed-off-by: Melanie Plageman <melanieplageman@...il.com>
---
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c    | 5 +++--
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c    | 5 +++--
 drivers/scsi/megaraid/megaraid_sas_base.c | 4 +++-
 drivers/scsi/mpi3mr/mpi3mr_os.c           | 4 ++--
 drivers/scsi/mpt3sas/mpt3sas_scsih.c      | 3 ++-
 drivers/scsi/qla2xxx/qla_os.c             | 7 ++++---
 drivers/scsi/scsi_debug.c                 | 5 +++--
 drivers/scsi/scsi_lib.c                   | 4 ++--
 drivers/scsi/smartpqi/smartpqi_init.c     | 5 +++--
 drivers/scsi/virtio_scsi.c                | 5 +++--
 include/scsi/scsi_host.h                  | 2 +-
 11 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index a3cf413f6990..e850797e4c18 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -3538,10 +3538,11 @@ static struct attribute *host_v2_hw_attrs[] = {
 
 ATTRIBUTE_GROUPS(host_v2_hw);
 
-static int map_queues_v2_hw(struct Scsi_Host *shost)
+static int map_queues_v2_hw(struct blk_mq_tag_set *set)
 {
+	struct Scsi_Host *shost = set->driver_data;
 	struct hisi_hba *hisi_hba = shost_priv(shost);
-	struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
+	struct blk_mq_queue_map *qmap = &set->map[HCTX_TYPE_DEFAULT];
 	const struct cpumask *mask;
 	unsigned int queue, cpu;
 
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index 169eb5fbecfc..75a2b4ccbd95 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -3135,10 +3135,11 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)
 	return 0;
 }
 
-static int hisi_sas_map_queues(struct Scsi_Host *shost)
+static int hisi_sas_map_queues(struct blk_mq_tag_set *set)
 {
+	struct Scsi_Host *shost = set->driver_data;
 	struct hisi_hba *hisi_hba = shost_priv(shost);
-	struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
+	struct blk_mq_queue_map *qmap = &set->map[HCTX_TYPE_DEFAULT];
 
 	return blk_mq_pci_map_queues(qmap, hisi_hba->pci_dev,
 				     BASE_VECTORS_V3_HW);
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 05db8f0b1e7e..d579cb41355e 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3168,12 +3168,14 @@ megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev,
 	return 0;
 }
 
-static int megasas_map_queues(struct Scsi_Host *shost)
+static int megasas_map_queues(struct blk_mq_tag_set *set)
 {
+	struct Scsi_Host *shost;
 	struct megasas_instance *instance;
 	int qoff = 0, offset;
 	struct blk_mq_queue_map *map;
 
+	shost = set->driver_data;
 	instance = (struct megasas_instance *)shost->hostdata;
 
 	if (shost->nr_hw_queues == 1)
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 284117da9086..38e27e3b392e 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -3167,8 +3167,9 @@ static int mpi3mr_bios_param(struct scsi_device *sdev,
  *
  * Return: return zero.
  */
-static int mpi3mr_map_queues(struct Scsi_Host *shost)
+static int mpi3mr_map_queues(struct blk_mq_tag_set *set)
 {
+	struct Scsi_Host *shost = set->driver_data;
 	struct mpi3mr_ioc *mrioc = shost_priv(shost);
 	int i, qoff, offset;
 	struct blk_mq_queue_map *map = NULL;
@@ -3205,7 +3206,6 @@ static int mpi3mr_map_queues(struct Scsi_Host *shost)
 	}
 
 	return 0;
-
 }
 
 /**
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 74cdf72ef837..4e3a9fff023e 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -11868,8 +11868,9 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time)
  * scsih_map_queues - map reply queues with request queues
  * @shost: SCSI host pointer
  */
-static int scsih_map_queues(struct Scsi_Host *shost)
+static int scsih_map_queues(struct blk_mq_tag_set *set)
 {
+	struct Scsi_Host *shost = set->driver_data;
 	struct MPT3SAS_ADAPTER *ioc =
 	    (struct MPT3SAS_ADAPTER *)shost->hostdata;
 	struct blk_mq_queue_map *map;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index abcd30917263..915fee7f9d08 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -335,7 +335,7 @@ MODULE_PARM_DESC(ql2xabts_wait_nvme,
 
 static void qla2x00_clear_drv_active(struct qla_hw_data *);
 static void qla2x00_free_device(scsi_qla_host_t *);
-static int qla2xxx_map_queues(struct Scsi_Host *shost);
+static int qla2xxx_map_queues(struct blk_mq_tag_set *tag_set);
 static void qla2x00_destroy_deferred_work(struct qla_hw_data *);
 
 
@@ -7881,11 +7881,12 @@ qla_pci_reset_done(struct pci_dev *pdev)
 	clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
 }
 
-static int qla2xxx_map_queues(struct Scsi_Host *shost)
+static int qla2xxx_map_queues(struct blk_mq_tag_set *set)
 {
 	int rc;
+	struct Scsi_Host *shost = set->driver_data;
 	scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata;
-	struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
+	struct blk_mq_queue_map *qmap = &set->map[HCTX_TYPE_DEFAULT];
 
 	if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase)
 		rc = blk_mq_map_queues(qmap);
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index af7ad912fabc..a0327ef6ef83 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -7272,15 +7272,16 @@ static int resp_not_ready(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
 	return check_condition_result;
 }
 
-static int sdebug_map_queues(struct Scsi_Host *shost)
+static int sdebug_map_queues(struct blk_mq_tag_set *set)
 {
 	int i, qoff;
+	struct Scsi_Host *shost = set->driver_data;
 
 	if (shost->nr_hw_queues == 1)
 		return 0;
 
 	for (i = 0, qoff = 0; i < HCTX_MAX_TYPES; i++) {
-		struct blk_mq_queue_map *map = &shost->tag_set.map[i];
+		struct blk_mq_queue_map *map = &set->map[i];
 
 		map->nr_queues  = 0;
 
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 61795bab83f7..bba66e29d38c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1864,10 +1864,10 @@ static int scsi_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
 
 static int scsi_map_queues(struct blk_mq_tag_set *set)
 {
-	struct Scsi_Host *shost = container_of(set, struct Scsi_Host, tag_set);
+	struct Scsi_Host *shost = set->driver_data;
 
 	if (shost->hostt->map_queues)
-		return shost->hostt->map_queues(shost);
+		return shost->hostt->map_queues(set);
 	return blk_mq_map_queues(&set->map[HCTX_TYPE_DEFAULT]);
 }
 
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 31c0c2054d6a..d81ead36d9f1 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -6332,11 +6332,12 @@ static int pqi_slave_alloc(struct scsi_device *sdev)
 	return 0;
 }
 
-static int pqi_map_queues(struct Scsi_Host *shost)
+static int pqi_map_queues(struct blk_mq_tag_set *set)
 {
+	struct Scsi_Host *shost = set->driver_data;
 	struct pqi_ctrl_info *ctrl_info = shost_to_hba(shost);
 
-	return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
+	return blk_mq_pci_map_queues(&set->map[HCTX_TYPE_DEFAULT],
 					ctrl_info->pci_dev, 0);
 }
 
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 0e6110da69e7..6595e142e2e4 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -711,10 +711,11 @@ static int virtscsi_abort(struct scsi_cmnd *sc)
 	return virtscsi_tmf(vscsi, cmd);
 }
 
-static int virtscsi_map_queues(struct Scsi_Host *shost)
+static int virtscsi_map_queues(struct blk_mq_tag_set *set)
 {
+	struct Scsi_Host *shost = set->driver_data;
 	struct virtio_scsi *vscsi = shost_priv(shost);
-	struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
+	struct blk_mq_queue_map *qmap = &set->map[HCTX_TYPE_DEFAULT];
 
 	return blk_mq_virtio_map_queues(qmap, vscsi->vdev, 2);
 }
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index f7f330f9255b..1255e8c164f6 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -277,7 +277,7 @@ struct scsi_host_template {
 	 *
 	 * Status: OPTIONAL
 	 */
-	int (* map_queues)(struct Scsi_Host *shost);
+	int (* map_queues)(struct blk_mq_tag_set *set);
 
 	/*
 	 * SCSI interface of blk_poll - poll for IO completions.
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ