From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-block@vger.kernel.org,
James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Hannes Reinecke <hare@suse.com>,
John Garry <john.garry@huawei.com>,
Keith Busch <keith.busch@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Don Brace <don.brace@microsemi.com>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Sathya Prakash <sathya.prakash@broadcom.com>,
Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V2 4/5] scsi: implement .complete_queue_affinity
Date: Mon, 27 May 2019 23:02:06 +0800 [thread overview]
Message-ID: <20190527150207.11372-5-ming.lei@redhat.com> (raw)
In-Reply-To: <20190527150207.11372-1-ming.lei@redhat.com>
Implement .complete_queue_affinity callback for all in-tree drivers
which support private completion queues.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 11 +++++++++++
drivers/scsi/hpsa.c | 12 ++++++++++++
drivers/scsi/megaraid/megaraid_sas_base.c | 10 ++++++++++
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 11 +++++++++++
4 files changed, 44 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index 49620c2411df..799ee15c8786 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2896,6 +2896,16 @@ static void debugfs_snapshot_restore_v3_hw(struct hisi_hba *hisi_hba)
clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
}
+static const struct cpumask *
+hisi_sas_complete_queue_affinity(struct Scsi_Host *sh, int cpu)
+{
+ struct hisi_hba *hisi_hba = shost_priv(sh);
+ unsigned reply_queue = hisi_hba->reply_map[cpu];
+
+ return pci_irq_get_affinity(hisi_hba->pci_dev,
+ reply_queue + BASE_VECTORS_V3_HW);
+}
+
static struct scsi_host_template sht_v3_hw = {
.name = DRV_NAME,
.module = THIS_MODULE,
@@ -2917,6 +2927,7 @@ static struct scsi_host_template sht_v3_hw = {
.shost_attrs = host_attrs_v3_hw,
.tag_alloc_policy = BLK_TAG_ALLOC_RR,
.host_reset = hisi_sas_host_reset,
+ .complete_queue_affinity = hisi_sas_complete_queue_affinity,
};
static const struct hisi_sas_hw hisi_sas_v3_hw = {
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 72f9edb86752..87d37f945c76 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -271,6 +271,8 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h);
#define VPD_PAGE (1 << 8)
#define HPSA_SIMPLE_ERROR_BITS 0x03
+static const struct cpumask *hpsa_complete_queue_affinity(
+ struct Scsi_Host *, int);
static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
static void hpsa_scan_start(struct Scsi_Host *);
static int hpsa_scan_finished(struct Scsi_Host *sh,
@@ -962,6 +964,7 @@ static struct scsi_host_template hpsa_driver_template = {
.name = HPSA,
.proc_name = HPSA,
.queuecommand = hpsa_scsi_queue_command,
+ .complete_queue_affinity = hpsa_complete_queue_affinity,
.scan_start = hpsa_scan_start,
.scan_finished = hpsa_scan_finished,
.change_queue_depth = hpsa_change_queue_depth,
@@ -4824,6 +4827,15 @@ static int hpsa_scsi_ioaccel_direct_map(struct ctlr_info *h,
cmd->cmnd, cmd->cmd_len, dev->scsi3addr, dev);
}
+static const struct cpumask *
+hpsa_complete_queue_affinity(struct Scsi_Host *sh, int cpu)
+{
+ struct ctlr_info *h = shost_to_hba(sh);
+ unsigned reply_queue = h->reply_map[cpu];
+
+ return pci_irq_get_affinity(h->pdev, reply_queue);
+}
+
/*
* Set encryption parameters for the ioaccel2 request
*/
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 3dd1df472dc6..59b71e8f98a8 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3165,6 +3165,15 @@ megasas_fw_cmds_outstanding_show(struct device *cdev,
return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&instance->fw_outstanding));
}
+static const struct cpumask *
+megasas_complete_queue_affinity(struct Scsi_Host *sh, int cpu)
+{
+ struct megasas_instance *instance = (struct megasas_instance *)sh->hostdata;
+ unsigned reply_queue = instance->reply_map[cpu];
+
+ return pci_irq_get_affinity(instance->pdev, reply_queue);
+}
+
static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR,
megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store);
static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO,
@@ -3208,6 +3217,7 @@ static struct scsi_host_template megasas_template = {
.bios_param = megasas_bios_param,
.change_queue_depth = scsi_change_queue_depth,
.no_write_same = 1,
+ .complete_queue_affinity = megasas_complete_queue_affinity,
};
/**
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 1ccfbc7eebe0..2db1d6fc4bda 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -10161,6 +10161,15 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time)
return 1;
}
+static const struct cpumask *
+mpt3sas_complete_queue_affinity(struct Scsi_Host *sh, int cpu)
+{
+ struct MPT3SAS_ADAPTER *ioc = shost_priv(sh);
+ unsigned reply_queue = ioc->cpu_msix_table[cpu];
+
+ return pci_irq_get_affinity(ioc->pdev, reply_queue);
+}
+
/* shost template for SAS 2.0 HBA devices */
static struct scsi_host_template mpt2sas_driver_template = {
.module = THIS_MODULE,
@@ -10189,6 +10198,7 @@ static struct scsi_host_template mpt2sas_driver_template = {
.sdev_attrs = mpt3sas_dev_attrs,
.track_queue_depth = 1,
.cmd_size = sizeof(struct scsiio_tracker),
+ .complete_queue_affinity = mpt3sas_complete_queue_affinity,
};
/* raid transport support for SAS 2.0 HBA devices */
@@ -10227,6 +10237,7 @@ static struct scsi_host_template mpt3sas_driver_template = {
.sdev_attrs = mpt3sas_dev_attrs,
.track_queue_depth = 1,
.cmd_size = sizeof(struct scsiio_tracker),
+ .complete_queue_affinity = mpt3sas_complete_queue_affinity,
};
/* raid transport support for SAS 3.0 HBA devices */
--
2.20.1
next prev parent reply other threads:[~2019-05-27 15:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 15:02 [PATCH V2 0/5] blk-mq: Wait for for hctx inflight requests on CPU unplug Ming Lei
2019-05-27 15:02 ` [PATCH V2 1/5] scsi: select reply queue from request's CPU Ming Lei
2019-05-28 5:43 ` Hannes Reinecke
2019-05-28 10:33 ` John Garry
2019-05-29 2:36 ` Ming Lei
2019-05-27 15:02 ` [PATCH V2 2/5] blk-mq: introduce .complete_queue_affinity Ming Lei
2019-05-27 15:02 ` [PATCH V2 3/5] scsi: core: implement callback of .complete_queue_affinity Ming Lei
2019-05-27 15:02 ` Ming Lei [this message]
2019-05-27 15:02 ` [PATCH V2 5/5] blk-mq: Wait for for hctx inflight requests on CPU unplug Ming Lei
2019-05-28 16:50 ` John Garry
2019-05-29 2:28 ` Ming Lei
2019-05-29 2:42 ` Ming Lei
2019-05-29 9:42 ` John Garry
2019-05-29 10:10 ` Ming Lei
2019-05-29 15:33 ` Ming Lei
2019-05-29 16:10 ` John Garry
2019-05-30 2:28 ` Ming Lei
2019-05-30 4:11 ` Ming Lei
2019-05-30 9:31 ` John Garry
2019-05-30 9:45 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190527150207.11372-5-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=don.brace@microsemi.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=john.garry@huawei.com \
--cc=kashyap.desai@broadcom.com \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sathya.prakash@broadcom.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).