From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-scsi@vger.kernel.org
Cc: Sagi Grimberg <sagi@grimberg.me>, Daniel Wagner <dwagner@suse.de>,
Wen Xiong <wenxiong@us.ibm.com>,
John Garry <john.garry@huawei.com>,
Hannes Reinecke <hare@suse.de>, Keith Busch <kbusch@kernel.org>,
Damien Le Moal <damien.lemoal@wdc.com>,
Ming Lei <ming.lei@redhat.com>,
Adaptec OEM Raid Solutions <aacraid@microsemi.com>,
Subbu Seetharaman <subbu.seetharaman@broadcom.com>,
Don Brace <don.brace@microchip.com>,
James Smart <james.smart@broadcom.com>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Sathya Prakash <sathya.prakash@broadcom.com>,
Nilesh Javali <njavali@marvell.com>
Subject: [PATCH V2 4/6] scsi: set shost->use_managed_irq if driver uses managed irq
Date: Fri, 2 Jul 2021 23:05:53 +0800 [thread overview]
Message-ID: <20210702150555.2401722-5-ming.lei@redhat.com> (raw)
In-Reply-To: <20210702150555.2401722-1-ming.lei@redhat.com>
Set shost->use_managed_irq if irq vectors are allocated via
pci_alloc_irq_vectors_affinity(PCI_IRQ_AFFINITY) or
pci_alloc_irq_vectors(PCI_IRQ_AFFINITY).
The rule is that driver has to tell scsi core if managed irq is used.
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Cc: Subbu Seetharaman <subbu.seetharaman@broadcom.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Don Brace <don.brace@microchip.com>
Cc: James Smart <james.smart@broadcom.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
drivers/scsi/aacraid/linit.c | 3 +++
drivers/scsi/be2iscsi/be_main.c | 3 +++
drivers/scsi/csiostor/csio_init.c | 3 +++
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 +
drivers/scsi/hpsa.c | 3 +++
drivers/scsi/lpfc/lpfc.h | 1 +
drivers/scsi/lpfc/lpfc_init.c | 4 ++++
drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 3 +++
drivers/scsi/qla2xxx/qla_isr.c | 5 ++++-
drivers/scsi/smartpqi/smartpqi_init.c | 3 +++
11 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 3168915adaa7..6d0abad77ef8 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1761,6 +1761,9 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
else
shost->this_id = shost->max_id;
+ if (aac->msi_enabled)
+ shost->use_managed_irq = 1;
+
if (!aac->sa_firmware && aac_drivers[index].quirks & AAC_QUIRK_SRC)
aac_intr_normal(aac, 0, 2, 0, NULL);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 22cf7f4b8d8c..2de2a3f78170 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5684,6 +5684,9 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
}
hwi_enable_intr(phba);
+ if (phba->num_cpus > 1)
+ phba->shost->use_managed_irq = 1;
+
ret = iscsi_host_add(phba->shost, &phba->pcidev->dev);
if (ret)
goto free_irqs;
diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
index 390b07bf92b9..3bc713f3237d 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -633,6 +633,9 @@ csio_shost_init(struct csio_hw *hw, struct device *dev,
else
shost->transportt = csio_fcoe_transport_vport;
+ if (hw->num_pports <= IRQ_AFFINITY_MAX_SETS)
+ shost->use_managed_irq = 1;
+
/* root lnode */
if (!hw->rln)
hw->rln = ln;
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index e95408314078..a8bf567b8cfe 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -4760,6 +4760,7 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (rc)
goto err_out_debugfs;
dev_err(dev, "%d hw queues\n", shost->nr_hw_queues);
+ shost->use_managed_irq = 1;
rc = scsi_add_host(shost, dev);
if (rc)
goto err_out_free_irq_vectors;
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index f135a10f582b..a84c80746001 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5877,6 +5877,9 @@ static int hpsa_scsi_add_host(struct ctlr_info *h)
{
int rv;
+ if (h->msix_vectors > 0)
+ h->scsi_host->use_managed_irq = 1;
+
rv = scsi_add_host(h->scsi_host, &h->pdev->dev);
if (rv) {
dev_err(&h->pdev->dev, "scsi_add_host failed\n");
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index f8de0d10620b..f0595c670fe8 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -783,6 +783,7 @@ struct lpfc_hba {
#define HBA_HBEAT_INP 0x4000000 /* mbox HBEAT is in progress */
#define HBA_HBEAT_TMO 0x8000000 /* HBEAT initiated after timeout */
#define HBA_FLOGI_OUTSTANDING 0x10000000 /* FLOGI is outstanding */
+#define HBA_USE_MANAGED_IRQ 0x20000000 /* Use managed irq */
uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/
struct lpfc_dmabuf slim2p;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 5f018d02bf56..df5ec095d813 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4460,6 +4460,9 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
vport->port_type = LPFC_PHYSICAL_PORT;
}
+ if (phba->hba_flag & HBA_USE_MANAGED_IRQ)
+ shost->use_managed_irq = 1;
+
lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP,
"9081 CreatePort TMPLATE type %x TBLsize %d "
"SEGcnt %d/%d\n",
@@ -11563,6 +11566,7 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
goto vec_fail_out;
}
vectors = rc;
+ phba->hba_flag |= HBA_USE_MANAGED_IRQ;
/* Assign MSI-X vectors to interrupt handlers */
for (index = 0; index < vectors; index++) {
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 4d4e9dbe5193..20747f8e7bc8 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -6909,6 +6909,9 @@ static int megasas_io_attach(struct megasas_instance *instance)
instance->iopoll_q_count = 0;
}
+ if (instance->smp_affinity_enable)
+ host->use_managed_irq = 1;
+
dev_info(&instance->pdev->dev,
"Max firmware commands: %d shared with default "
"hw_queues = %d poll_queues %d\n", instance->max_fw_cmds,
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index d00aca3c77ce..de9de343e819 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -12089,6 +12089,9 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
shost->can_queue, shost->nr_hw_queues);
}
+ if (ioc->smp_affinity_enable)
+ shost->use_managed_irq = 1;
+
rv = scsi_add_host(shost, &pdev->dev);
if (rv) {
ioc_err(ioc, "failure at %s:%d/%s()!\n",
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 6e8f737a4af3..036b5f178a7f 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -4000,11 +4000,14 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
ret = pci_alloc_irq_vectors(ha->pdev, min_vecs,
min((u16)ha->msix_count, (u16)(num_online_cpus() + min_vecs)),
PCI_IRQ_MSIX);
- } else
+ } else {
ret = pci_alloc_irq_vectors_affinity(ha->pdev, min_vecs,
min((u16)ha->msix_count, (u16)(num_online_cpus() + min_vecs)),
PCI_IRQ_MSIX | PCI_IRQ_AFFINITY,
&desc);
+ if (ret > 0)
+ vha->host->use_managed_irq = 1;
+ }
if (ret < 0) {
ql_log(ql_log_fatal, vha, 0x00c7,
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 5db16509b6e1..b2f28ed7e568 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -6972,6 +6972,9 @@ static int pqi_register_scsi(struct pqi_ctrl_info *ctrl_info)
shost->host_tagset = 1;
shost->hostdata[0] = (unsigned long)ctrl_info;
+ if (ctrl_info->num_msix_vectors_enabled)
+ shost->use_managed_irq = 1;
+
rc = scsi_add_host(shost, &ctrl_info->pci_dev->dev);
if (rc) {
dev_err(&ctrl_info->pci_dev->dev, "scsi_add_host failed\n");
--
2.31.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-07-02 15:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 15:05 [PATCH V2 0/6] blk-mq: fix blk_mq_alloc_request_hctx Ming Lei
2021-07-02 15:05 ` [PATCH V2 1/6] blk-mq: prepare for not deactivating hctx if managed irq isn't used Ming Lei
2021-07-02 15:05 ` [PATCH V2 2/6] nvme: pci: pass BLK_MQ_F_MANAGED_IRQ to blk-mq Ming Lei
2021-07-02 15:05 ` [PATCH V2 3/6] scsi: add flag of .use_managed_irq to 'struct Scsi_Host' Ming Lei
2021-07-05 9:25 ` John Garry
2021-07-05 9:55 ` Ming Lei
2021-07-06 5:37 ` Christoph Hellwig
2021-07-06 7:41 ` Ming Lei
2021-07-06 10:32 ` Hannes Reinecke
2021-07-07 10:53 ` Ming Lei
2021-07-02 15:05 ` Ming Lei [this message]
2021-07-05 7:35 ` [PATCH V2 4/6] scsi: set shost->use_managed_irq if driver uses managed irq John Garry
2021-07-06 5:38 ` Christoph Hellwig
2021-07-02 15:05 ` [PATCH V2 5/6] virtio: add one field into virtio_device for recording if device " Ming Lei
2021-07-02 15:55 ` Michael S. Tsirkin
2021-07-05 2:48 ` Ming Lei
2021-07-05 3:59 ` Jason Wang
2021-07-06 5:42 ` Christoph Hellwig
2021-07-06 7:53 ` Ming Lei
2021-07-07 9:06 ` Thomas Gleixner
2021-07-07 9:42 ` Ming Lei
2021-07-07 14:05 ` Christoph Hellwig
2021-07-08 6:34 ` Ming Lei
2021-07-02 15:05 ` [PATCH V2 6/6] blk-mq: don't deactivate hctx if managed irq isn't used 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=20210702150555.2401722-5-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=aacraid@microsemi.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=don.brace@microchip.com \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=john.garry@huawei.com \
--cc=kashyap.desai@broadcom.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=njavali@marvell.com \
--cc=sagi@grimberg.me \
--cc=sathya.prakash@broadcom.com \
--cc=subbu.seetharaman@broadcom.com \
--cc=wenxiong@us.ibm.com \
/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