[PATCH] SCSI: don't get target/host busy_count in scsi_mq_get_budget()
It is very expensive to atomic_inc/atomic_dec the host wide counter of host->busy_count, and it should have been avoided via blk-mq's mechanism of getting driver tag, which uses the more efficient way of sbitmap queue. Also we don't check atomic_read(>device_busy) in scsi_mq_get_budget() and don't run queue if the counter becomes zero, so IO hang may be caused if all requests are completed just before the current SCSI device is added to shost->starved_list. Fixes: 0df21c86bdbf(scsi: implement .get_budget and .put_budget for blk-mq) Reported-by: Bart Van AsscheSigned-off-by: Ming Lei --- drivers/scsi/scsi_lib.c | 29 + 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a098af3070a1..7f218ef61900 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1944,11 +1944,7 @@ static void scsi_mq_put_budget(struct blk_mq_hw_ctx *hctx) { struct request_queue *q = hctx->queue; struct scsi_device *sdev = q->queuedata; - struct Scsi_Host *shost = sdev->host; - atomic_dec(>host_busy); - if (scsi_target(sdev)->can_queue > 0) - atomic_dec(_target(sdev)->target_busy); atomic_dec(>device_busy); put_device(>sdev_gendev); } @@ -1957,7 +1953,6 @@ static blk_status_t scsi_mq_get_budget(struct blk_mq_hw_ctx *hctx) { struct request_queue *q = hctx->queue; struct scsi_device *sdev = q->queuedata; - struct Scsi_Host *shost = sdev->host; blk_status_t ret; ret = prep_to_mq(scsi_prep_state_check(sdev, NULL)); @@ -1968,18 +1963,9 @@ static blk_status_t scsi_mq_get_budget(struct blk_mq_hw_ctx *hctx) goto out; if (!scsi_dev_queue_ready(q, sdev)) goto out_put_device; - if (!scsi_target_queue_ready(shost, sdev)) - goto out_dec_device_busy; - if (!scsi_host_queue_ready(q, shost, sdev)) - goto out_dec_target_busy; return BLK_STS_OK; -out_dec_target_busy: - if (scsi_target(sdev)->can_queue > 0) - atomic_dec(_target(sdev)->target_busy); -out_dec_device_busy: - atomic_dec(>device_busy); out_put_device: put_device(>sdev_gendev); out: @@ -1992,6 +1978,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req = bd->rq; struct request_queue *q = req->q; struct scsi_device *sdev = q->queuedata; + struct Scsi_Host *shost = sdev->host; struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); blk_status_t ret; int reason; @@ -2001,10 +1988,15 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, goto out_put_budget; ret = BLK_STS_RESOURCE; + if (!scsi_target_queue_ready(shost, sdev)) + goto out_put_budget; + if (!scsi_host_queue_ready(q, shost, sdev)) + goto out_dec_target_busy; + if (!(req->rq_flags & RQF_DONTPREP)) { ret = prep_to_mq(scsi_mq_prep_fn(req)); if (ret != BLK_STS_OK) - goto out_put_budget; + goto out_dec_host_busy; req->rq_flags |= RQF_DONTPREP; } else { blk_mq_start_request(req); @@ -2022,11 +2014,16 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, if (reason) { scsi_set_blocked(cmd, reason); ret = BLK_STS_RESOURCE; - goto out_put_budget; + goto out_dec_host_busy; } return BLK_STS_OK; +out_dec_host_busy: + atomic_dec(>host_busy); +out_dec_target_busy: + if (scsi_target(sdev)->can_queue > 0) + atomic_dec(_target(sdev)->target_busy); out_put_budget: scsi_mq_put_budget(hctx); switch (ret) { -- 2.9.5
Tercüme edilecek metinleriniz hakkında
Sayın ilgili, Biz 20 yılı aşkın bir süredir internet üzerinden profesyonel olarak TERCÜME HİZMETLERİ veren bir kuruluşuz. 2017 başında firmalara özel, sayfası 20 TL+KDV'lik bir kampanya hazırladık. Sadece İNGİLİZCE - TÜRKÇE ve TÜRKÇE - İNGİLİZCE çevirilerde geçerli olan ve kısa bir süre devam edecek bu cazip fiyat avantajından yararlanmak için lütfen bizi hemen şimdi arayınız veya bir e-posta gönderiniz. Diğer diller icin lütfen fiyat sorunuz. Not: 1 sayfa = 1000 karakter veya 160 kelimelik dünya standardı esas alınmıştır. Teknik metinlerde %25 fark alınacaktır. Diğer diller için lütfen fiyat alınız. Saygılarımızla, Levent Türer, Genel Koordinatör Türer Çeviri Hizmetleri e-posta: i...@turerceviri.com web: www.turerceviri.com Tel: 0232 364 24 62 Cep: 0536 359 81 13 Bu e-mail size sadece bir defaya mahsus gönderilmiştir. Tekrar gönderilmeyecektir. Size rahatsızlık verdiysek özürlerimizi sunarız...
[PATCH] scsi_transport_fc: add 64GBIT and 128GBIT port speed definitions
Add 64GBIT and 128GBIT port speed definitions. Upcoming hardware will reference these speeds. Signed-off-by: James Smart--- drivers/scsi/scsi_transport_fc.c | 2 ++ include/scsi/scsi_transport_fc.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 3c6bc0081fcb..49058295d9bc 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -267,6 +267,8 @@ static const struct { { FC_PORTSPEED_50GBIT, "50 Gbit" }, { FC_PORTSPEED_100GBIT, "100 Gbit" }, { FC_PORTSPEED_25GBIT, "25 Gbit" }, + { FC_PORTSPEED_64BIT, "64 Gbit" }, + { FC_PORTSPEED_128BIT, "128 Gbit" }, { FC_PORTSPEED_NOT_NEGOTIATED, "Not Negotiated" }, }; fc_bitfield_name_search(port_speed, fc_port_speed_names) diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index e8644eea9fe5..8cf30215c177 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -139,6 +139,8 @@ enum fc_vport_state { #define FC_PORTSPEED_50GBIT0x200 #define FC_PORTSPEED_100GBIT 0x400 #define FC_PORTSPEED_25GBIT0x800 +#define FC_PORTSPEED_64BIT 0x1000 +#define FC_PORTSPEED_128BIT0x2000 #define FC_PORTSPEED_NOT_NEGOTIATED(1 << 15) /* Speed not established */ /* -- 2.13.1
[PATCH 12/17] lpfc: correct port registrations with nvme_fc
The driver currently registers any remote port that has NVME support. It should only be registering target ports. Register only target ports. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hbadisc.c | 20 drivers/scsi/lpfc/lpfc_nvme.c| 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 4577330313c0..ffceebf420f4 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -4176,12 +4176,14 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, if (ndlp->nlp_fc4_type & NLP_FC4_NVME) { vport->phba->nport_event_cnt++; - if (vport->phba->nvmet_support == 0) - /* Start devloss */ - lpfc_nvme_unregister_port(vport, ndlp); - else + if (vport->phba->nvmet_support == 0) { + /* Start devloss if target. */ + if (ndlp->nlp_type & NLP_NVME_TARGET) + lpfc_nvme_unregister_port(vport, ndlp); + } else { /* NVMET has no upcall. */ lpfc_nlp_put(ndlp); + } } } @@ -4205,11 +4207,13 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ndlp->nlp_fc4_type & NLP_FC4_NVME) { if (vport->phba->nvmet_support == 0) { /* Register this rport with the transport. -* Initiators take the NDLP ref count in -* the register. +* Only NVME Target Rports are registered with +* the transport. */ - vport->phba->nport_event_cnt++; - lpfc_nvme_register_port(vport, ndlp); + if (ndlp->nlp_type & NLP_NVME_TARGET) { + vport->phba->nport_event_cnt++; + lpfc_nvme_register_port(vport, ndlp); + } } else { /* Just take an NDLP ref count since the * target does not register rports. diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index db1ed426f7e6..d3ada630b427 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -2473,7 +2473,8 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) /* Sanity check ndlp type. Only call for NVME ports. Don't * clear any rport state until the transport calls back. */ - if (ndlp->nlp_type & (NLP_NVME_TARGET | NLP_NVME_INITIATOR)) { + + if (ndlp->nlp_type & NLP_NVME_TARGET) { init_completion(>rport_unreg_done); /* No concern about the role change on the nvme remoteport. -- 2.13.1
[PATCH 13/17] lpfc: Correct driver deregistrations with host nvme transport
The driver's interaction with the host nvme transport has been incorrect for a while. The driver did not wait for the unregister callbacks (waited only 5 jiffies). Thus the driver may remove objects that may be referenced by subsequent abort commands from the transport, and the actual unregister callback was effectively a noop. This was especially problematic if the driver was unloaded. The driver now waits for the unregister callbacks, as it should, before continuing with teardown. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_disc.h | 2 + drivers/scsi/lpfc/lpfc_nvme.c | 113 -- drivers/scsi/lpfc/lpfc_nvme.h | 2 + 3 files changed, 113 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index f9a566eaef04..5a7547f9d8d8 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h @@ -134,6 +134,8 @@ struct lpfc_nodelist { struct lpfc_scsicmd_bkt *lat_data; /* Latency data */ uint32_t fc4_prli_sent; uint32_t upcall_flags; +#define NLP_WAIT_FOR_UNREG0x1 + uint32_t nvme_fb_size; /* NVME target's supported byte cnt */ #define NVME_FB_BIT_SHIFT 9/* PRLI Rsp first burst in 512B units. */ }; diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index d3ada630b427..12d09a6a4563 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -154,6 +154,10 @@ lpfc_nvme_localport_delete(struct nvme_fc_local_port *localport) { struct lpfc_nvme_lport *lport = localport->private; + lpfc_printf_vlog(lport->vport, KERN_INFO, LOG_NVME, +"6173 localport %p delete complete\n", +lport); + /* release any threads waiting for the unreg to complete */ complete(>lport_unreg_done); } @@ -946,10 +950,19 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, freqpriv->nvme_buf = NULL; /* NVME targets need completion held off until the abort exchange -* completes. +* completes unless the NVME Rport is getting unregistered. */ - if (!(lpfc_ncmd->flags & LPFC_SBUF_XBUSY)) + if (!(lpfc_ncmd->flags & LPFC_SBUF_XBUSY) || + ndlp->upcall_flags & NLP_WAIT_FOR_UNREG) { + /* Clear the XBUSY flag to prevent double completions. +* The nvme rport is getting unregistered and there is +* no need to defer the IO. +*/ + if (lpfc_ncmd->flags & LPFC_SBUF_XBUSY) + lpfc_ncmd->flags &= ~LPFC_SBUF_XBUSY; + nCmd->done(nCmd); + } spin_lock_irqsave(>hbalock, flags); lpfc_ncmd->nrport = NULL; @@ -2234,6 +2247,47 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) return ret; } +/* lpfc_nvme_lport_unreg_wait - Wait for the host to complete an lport unreg. + * + * The driver has to wait for the host nvme transport to callback + * indicating the localport has successfully unregistered all + * resources. Since this is an uninterruptible wait, loop every ten + * seconds and print a message indicating no progress. + * + * An uninterruptible wait is used because of the risk of transport-to- + * driver state mismatch. + */ +void +lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, + struct lpfc_nvme_lport *lport) +{ +#if (IS_ENABLED(CONFIG_NVME_FC)) + u32 wait_tmo; + int ret; + + /* Host transport has to clean up and confirm requiring an indefinite +* wait. Print a message if a 10 second wait expires and renew the +* wait. This is unexpected. +*/ + wait_tmo = msecs_to_jiffies(LPFC_NVME_WAIT_TMO * 1000); + while (true) { + ret = wait_for_completion_timeout(>lport_unreg_done, + wait_tmo); + if (unlikely(!ret)) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR, +"6176 Lport %p Localport %p wait " +"timed out. Renewing.\n", +lport, vport->localport); + continue; + } + break; + } + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR, +"6177 Lport %p Localport %p Complete Success\n", +lport, vport->localport); +#endif +} + /** * lpfc_nvme_destroy_localport - Destroy lpfc_nvme bound to nvme transport. * @pnvme: pointer to lpfc nvme data structure. @@ -2268,7 +2322,11 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) */ init_completion(>lport_unreg_done); ret = nvme_fc_unregister_localport(localport); -
[PATCH 17/17] lpfc: update driver version to 11.4.0.5
Update the driver version to 11.4.0.5 Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index e0181371af09..cc2f5cec98c5 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h @@ -20,7 +20,7 @@ * included with this package. * ***/ -#define LPFC_DRIVER_VERSION "11.4.0.4" +#define LPFC_DRIVER_VERSION "11.4.0.5" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */ -- 2.13.1
[PATCH 09/17] lpfc: Adjust default value of lpfc_nvmet_mrq
The current default for async hw receive queues is 1, which presents issues under heavy load as number of queues influence the available async receive buffer limits. Raise the default to the either the current hw limit (16) or the number of hw qs configured (io channel value). Revise the attribute definition for mrq to better reflect what we do for hw queues. E.g. 0 means default to optimal (# of cpus), non-zero specifies a specific limit. Before this change, mrq=0 meant target mode was disabled. As 0 now has a different meaning, rework the if tests to use the better nvmet_support check. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_attr.c| 11 -- drivers/scsi/lpfc/lpfc_debugfs.c | 2 +- drivers/scsi/lpfc/lpfc_init.c| 47 drivers/scsi/lpfc/lpfc_nvmet.h | 4 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 4dcd129ca901..598e07f43912 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3361,12 +3361,13 @@ LPFC_ATTR_R(suppress_rsp, 1, 0, 1, /* * lpfc_nvmet_mrq: Specify number of RQ pairs for processing NVMET cmds + * lpfc_nvmet_mrq = 0 driver will calcualte optimal number of RQ pairs * lpfc_nvmet_mrq = 1 use a single RQ pair * lpfc_nvmet_mrq >= 2 use specified RQ pairs for MRQ * */ LPFC_ATTR_R(nvmet_mrq, - 1, 1, 16, + LPFC_NVMET_MRQ_AUTO, LPFC_NVMET_MRQ_AUTO, LPFC_NVMET_MRQ_MAX, "Specify number of RQ pairs for processing NVMET cmds"); /* @@ -6357,6 +6358,9 @@ lpfc_nvme_mod_param_dep(struct lpfc_hba *phba) phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; } + if (!phba->cfg_nvmet_mrq) + phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; + /* Adjust lpfc_nvmet_mrq to avoid running out of WQE slots */ if (phba->cfg_nvmet_mrq > phba->cfg_nvme_io_channel) { phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; @@ -6364,10 +6368,13 @@ lpfc_nvme_mod_param_dep(struct lpfc_hba *phba) "6018 Adjust lpfc_nvmet_mrq to %d\n", phba->cfg_nvmet_mrq); } + if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) + phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; + } else { /* Not NVME Target mode. Turn off Target parameters. */ phba->nvmet_support = 0; - phba->cfg_nvmet_mrq = 0; + phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_OFF; phba->cfg_nvmet_fb_size = 0; } diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index e8c5a0927dd7..e0df6bbfd1c8 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -3215,7 +3215,7 @@ lpfc_idiag_cqs_for_eq(struct lpfc_hba *phba, char *pbuffer, return 1; } - if (eqidx < phba->cfg_nvmet_mrq) { + if ((eqidx < phba->cfg_nvmet_mrq) && phba->nvmet_support) { /* NVMET CQset */ qp = phba->sli4_hba.nvmet_cqset[eqidx]; *len = __lpfc_idiag_print_cq(qp, "NVMET CQset", pbuffer, *len); diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index fc9f91327724..7a06f23a3baf 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -7939,8 +7939,12 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba) phba->cfg_fcp_io_channel = io_channel; if (phba->cfg_nvme_io_channel > io_channel) phba->cfg_nvme_io_channel = io_channel; - if (phba->cfg_nvme_io_channel < phba->cfg_nvmet_mrq) - phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; + if (phba->nvmet_support) { + if (phba->cfg_nvme_io_channel < phba->cfg_nvmet_mrq) + phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; + } + if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) + phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2574 IO channels: irqs %d fcp %d nvme %d MRQ: %d\n", @@ -8454,13 +8458,15 @@ lpfc_sli4_queue_destroy(struct lpfc_hba *phba) /* Release NVME CQ mapping array */ lpfc_sli4_release_queue_map(>sli4_hba.nvme_cq_map); - lpfc_sli4_release_queues(>sli4_hba.nvmet_cqset, - phba->cfg_nvmet_mrq); + if (phba->nvmet_support) { + lpfc_sli4_release_queues(>sli4_hba.nvmet_cqset, +phba->cfg_nvmet_mrq); - lpfc_sli4_release_queues(>sli4_hba.nvmet_mrq_hdr, -
[PATCH 16/17] lpfc: small sg cnt cleanup
The logic for sg_seg_cnt is a bit convoluted. This patch tries to clean up a couple of areas, especially around the +2 and +1 logic. This patch: - cleans up the lpfc_sg_seg_cnt attribute to specify a real minimum rather than making the minimum be whatever the default is. - Remove the hardcoding of +2 (for the number of elements we use in a sgl for cmd iu and rsp iu) and +1 (an additional entry to compensate for nvme's reduction of io size based on a possible partial page) logic in sg list initialization. In the case where the +1 logic is referenced in host and target io checks, use the values set in the transport template as that value was properly set. There can certainly be more done in this area and it will be addressed in combined host/target driver effort. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 19 ++- drivers/scsi/lpfc/lpfc_nvme.c | 3 ++- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 46a89bdff8e4..dd2191c83052 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -55,6 +55,7 @@ struct lpfc_sli2_slim; #define LPFC_MAX_SG_SLI4_SEG_CNT_DIF 128 /* sg element count per scsi cmnd */ #define LPFC_MAX_SG_SEG_CNT_DIF 512/* sg element count per scsi cmnd */ #define LPFC_MAX_SG_SEG_CNT4096/* sg element count per scsi cmnd */ +#define LPFC_MIN_SG_SEG_CNT32 /* sg element count per scsi cmnd */ #define LPFC_MAX_SGL_SEG_CNT 512 /* SGL element count per scsi cmnd */ #define LPFC_MAX_BPL_SEG_CNT 4096/* BPL element count per scsi cmnd */ #define LPFC_MAX_NVME_SEG_CNT 256 /* max SGL element cnt per NVME cmnd */ diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 598e07f43912..74d6fe984df4 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -5135,7 +5135,7 @@ LPFC_ATTR(delay_discovery, 0, 0, 1, * this parameter will be limited to 128 if BlockGuard is enabled under SLI4 * and will be limited to 512 if BlockGuard is enabled under SLI3. */ -LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, +LPFC_ATTR_R(sg_seg_cnt, LPFC_MIN_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); /* diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index c466ceb43bc9..92dc865ca52c 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5812,6 +5812,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) struct lpfc_mqe *mqe; int longs; int fof_vectors = 0; + int extra; uint64_t wwn; phba->sli4_hba.num_online_cpu = num_online_cpus(); @@ -5867,13 +5868,21 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) */ /* +* 1 for cmd, 1 for rsp, NVME adds an extra one +* for boundary conditions in its max_sgl_segment template. +*/ + extra = 2; + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) + extra++; + + /* * It doesn't matter what family our adapter is in, we are * limited to 2 Pages, 512 SGEs, for our SGL. * There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp */ max_buf_size = (2 * SLI4_PAGE_SIZE); - if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - 2) - phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - 2; + if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - extra) + phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - extra; /* * Since lpfc_sg_seg_cnt is module param, the sg_dma_buf_size @@ -5906,14 +5915,14 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) */ phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp) + - ((phba->cfg_sg_seg_cnt + 2) * + ((phba->cfg_sg_seg_cnt + extra) * sizeof(struct sli4_sge)); /* Total SGEs for scsi_sg_list */ - phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; + phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; /* -* NOTE: if (phba->cfg_sg_seg_cnt + 2) <= 256 we only +* NOTE: if (phba->cfg_sg_seg_cnt + extra) <= 256 we only * need to post 1 page for the SGL. */ } diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 67bd0ff299d1..0a42956058e9 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -62,6 +62,7 @@
[PATCH 11/17] lpfc: Linux LPFC driver does not process all RSCNs
During RSCN storms, the driver does not rediscover some targets. The driver marks some RSCN as to be handled after the ones it's working on. The driver missed processing some deferred RSCN. Move where the driver checks for deferred RSCNs and initiate deferred RSCN handling if the flag was set. Also revise nport state within the RSCN confirm routine. Add some state data to a possible debug print to aid future debugging. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_ct.c | 19 +++ drivers/scsi/lpfc/lpfc_els.c | 4 +--- drivers/scsi/lpfc/lpfc_hbadisc.c | 9 +++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 33417681f5d4..0990f81524cd 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -685,6 +685,25 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, lpfc_els_flush_rscn(vport); goto out; } + + spin_lock_irq(shost->host_lock); + if (vport->fc_flag & FC_RSCN_DEFERRED) { + vport->fc_flag &= ~FC_RSCN_DEFERRED; + spin_unlock_irq(shost->host_lock); + + /* +* Skip processing the NS response +* Re-issue the NS cmd +*/ + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, +"0151 Process Deferred RSCN Data: x%x x%x\n", +vport->fc_flag, vport->fc_rscn_id_cnt); + lpfc_els_handle_rscn(vport); + + goto out; + } + spin_unlock_irq(shost->host_lock); + if (irsp->ulpStatus) { /* Check for retry */ if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index a708d80cb609..5cfa73e8fe40 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1681,6 +1681,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, /* Two ndlps cannot have the same did on the nodelist */ ndlp->nlp_DID = keepDID; + lpfc_nlp_set_state(vport, ndlp, keep_nlp_state); if (phba->sli_rev == LPFC_SLI_REV4 && active_rrqs_xri_bitmap) memcpy(ndlp->active_rrqs_xri_bitmap, @@ -6183,9 +6184,6 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); /* send RECOVERY event for ALL nodes that match RSCN payload */ lpfc_rscn_recovery_check(vport); - spin_lock_irq(shost->host_lock); - vport->fc_flag &= ~FC_RSCN_DEFERRED; - spin_unlock_irq(shost->host_lock); return 0; } lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 3468257bda02..4577330313c0 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -5832,14 +5832,19 @@ static struct lpfc_nodelist * __lpfc_find_node(struct lpfc_vport *vport, node_filter filter, void *param) { struct lpfc_nodelist *ndlp; + uint32_t data1; list_for_each_entry(ndlp, >fc_nodes, nlp_listp) { if (filter(ndlp, param)) { + data1 = (((uint32_t) ndlp->nlp_state << 24) | +((uint32_t) ndlp->nlp_xri << 16) | +((uint32_t) ndlp->nlp_type << 8) | +((uint32_t) ndlp->nlp_rpi & 0xff)); lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, "3185 FIND node filter %p DID " -"Data: x%p x%x x%x\n", +"Data: x%p x%x x%x x%x\n", filter, ndlp, ndlp->nlp_DID, -ndlp->nlp_flag); +ndlp->nlp_flag, data1); return ndlp; } } -- 2.13.1
[PATCH 10/17] lpfc: Fix ndlp ref count for pt2pt mode issue RSCN
pt2pt ndlp ref count prematurely goes to 0. There was reference removed that should only be removed if connected to a switch, not if in point-to-point mode. Add a mode check before the reference remove. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 95872a0329ad..a708d80cb609 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -2962,8 +2962,8 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry) /* This will cause the callback-function lpfc_cmpl_els_cmd to * trigger the release of node. */ - - lpfc_nlp_put(ndlp); + if (!(vport->fc_flag & FC_PT2PT)) + lpfc_nlp_put(ndlp); return 0; } -- 2.13.1
[PATCH 15/17] lpfc: Fix driver handling of nvme resources during unload
During driver unload, the driver may crash due to NULL pointers. The NULL pointers were due to the driver not protecting itself sufficiently during some of the teardown paths. Additionally, the driver was not waiting for and cleanup up nvme io resources. As such, the driver wasn't making the callbacks to the transport, stalling the transports association teardown. This patch waits for io clean up before tearding down and adds checks for possible NULL pointers. Cc:# 4.12+ Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_crtn.h | 2 + drivers/scsi/lpfc/lpfc_init.c | 18 drivers/scsi/lpfc/lpfc_nvme.c | 96 ++- 3 files changed, 105 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 7e300734b345..dac33900bf17 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -254,6 +254,8 @@ void lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctxp); int lpfc_nvmet_rcv_unsol_abort(struct lpfc_vport *vport, struct fc_frame_header *fc_hdr); +void lpfc_sli_flush_nvme_rings(struct lpfc_hba *phba); +void lpfc_nvme_wait_for_io_drain(struct lpfc_hba *phba); void lpfc_sli4_build_dflt_fcf_record(struct lpfc_hba *, struct fcf_record *, uint16_t); int lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq, diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 7a06f23a3baf..c466ceb43bc9 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -10136,6 +10136,16 @@ lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) int fcp_xri_cmpl = 1; int els_xri_cmpl = list_empty(>sli4_hba.lpfc_abts_els_sgl_list); + /* Driver just aborted IOs during the hba_unset process. Pause +* here to give the HBA time to complete the IO and get entries +* into the abts lists. +*/ + msleep(LPFC_XRI_EXCH_BUSY_WAIT_T1 * 5); + + /* Wait for NVME pending IO to flush back to transport. */ + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) + lpfc_nvme_wait_for_io_drain(phba); + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) fcp_xri_cmpl = list_empty(>sli4_hba.lpfc_abts_scsi_buf_list); @@ -11659,6 +11669,10 @@ lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) /* Flush all driver's outstanding SCSI I/Os as we are to reset */ lpfc_sli_flush_fcp_rings(phba); + /* Flush the outstanding NVME IOs if fc4 type enabled. */ + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) + lpfc_sli_flush_nvme_rings(phba); + /* stop all timers */ lpfc_stop_hba_timers(phba); @@ -11690,6 +11704,10 @@ lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) /* Clean up all driver's outstanding SCSI I/Os */ lpfc_sli_flush_fcp_rings(phba); + + /* Flush the outstanding NVME IOs if fc4 type enabled. */ + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) + lpfc_sli_flush_nvme_rings(phba); } /** diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index ea7a0e65bbfd..67bd0ff299d1 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -88,6 +88,9 @@ lpfc_nvme_create_queue(struct nvme_fc_local_port *pnvme_lport, struct lpfc_nvme_qhandle *qhandle; char *str; + if (!pnvme_lport->private) + return -ENOMEM; + lport = (struct lpfc_nvme_lport *)pnvme_lport->private; vport = lport->vport; qhandle = kzalloc(sizeof(struct lpfc_nvme_qhandle), GFP_KERNEL); @@ -140,6 +143,9 @@ lpfc_nvme_delete_queue(struct nvme_fc_local_port *pnvme_lport, struct lpfc_nvme_lport *lport; struct lpfc_vport *vport; + if (!pnvme_lport->private) + return; + lport = (struct lpfc_nvme_lport *)pnvme_lport->private; vport = lport->vport; @@ -1265,13 +1271,29 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, struct lpfc_nvme_buf *lpfc_ncmd; struct lpfc_nvme_rport *rport; struct lpfc_nvme_qhandle *lpfc_queue_info; - struct lpfc_nvme_fcpreq_priv *freqpriv = pnvme_fcreq->private; + struct lpfc_nvme_fcpreq_priv *freqpriv; #ifdef CONFIG_SCSI_LPFC_DEBUG_FS uint64_t start = 0; #endif + /* Validate pointers. LLDD fault handling with transport does +* have timing races. +*/ lport = (struct lpfc_nvme_lport *)pnvme_lport->private; + if (unlikely(!lport)) { + ret = -EINVAL; + goto out_fail; + } + vport = lport->vport; + + if (unlikely(!hw_queue_handle)) { +
[PATCH 05/17] lpfc: Fix NVME LS abort_xri
performing an LS abort results in the following message being seen: 0603 Invalid CQ subtype 6: 0300 2202 0016 d005 and the associated exchange is not properly freed. The code did not recognize the exchange type that was aborted, thus it was not properly handled. Correct by adding the NVME LS ELS type to the exchange types that are recognized. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_sli.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index ba6f0619433c..1229f58bdd09 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -12807,6 +12807,7 @@ lpfc_sli4_sp_handle_abort_xri_wcqe(struct lpfc_hba *phba, spin_unlock_irqrestore(>hbalock, iflags); workposted = true; break; + case LPFC_NVME_LS: /* NVME LS uses ELS resources */ case LPFC_ELS: cq_event = lpfc_cq_event_setup( phba, wcqe, sizeof(struct sli4_wcqe_xri_aborted)); -- 2.13.1
[PATCH 08/17] lpfc: Fix display for debugfs queInfo
Display for lpfc/fnX/iDiag/queInfo isn't formatted perfectly. Corrected the format strings for the queue info debug messages. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_debugfs.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index d50c481ec41c..e8c5a0927dd7 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -3248,7 +3248,7 @@ __lpfc_idiag_print_eq(struct lpfc_queue *qp, char *eqtype, len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n%s EQ info: EQ-STAT[max:x%x noE:x%x " - "bs:x%x proc:x%llx eqd %d]\n", + "cqe_proc:x%x eqe_proc:x%llx eqd %d]\n", eqtype, qp->q_cnt_1, qp->q_cnt_2, qp->q_cnt_3, (unsigned long long)qp->q_cnt_4, qp->q_mode); len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, @@ -3368,6 +3368,12 @@ lpfc_idiag_queinfo_read(struct file *file, char __user *buf, size_t nbytes, if (len >= max_cnt) goto too_big; + qp = phba->sli4_hba.hdr_rq; + len = __lpfc_idiag_print_rqpair(qp, phba->sli4_hba.dat_rq, + "ELS RQpair", pbuffer, len); + if (len >= max_cnt) + goto too_big; + /* Slow-path NVME LS response CQ */ qp = phba->sli4_hba.nvmels_cq; len = __lpfc_idiag_print_cq(qp, "NVME LS", @@ -3385,12 +3391,6 @@ lpfc_idiag_queinfo_read(struct file *file, char __user *buf, size_t nbytes, if (len >= max_cnt) goto too_big; - qp = phba->sli4_hba.hdr_rq; - len = __lpfc_idiag_print_rqpair(qp, phba->sli4_hba.dat_rq, - "RQpair", pbuffer, len); - if (len >= max_cnt) - goto too_big; - goto out; } -- 2.13.1
[PATCH 01/17] lpfc: FLOGI failures are reported when connected to a private loop.
When the HBA is connected to a private loop, the driver reports FLOGI loop-open failure as functional error. This is an expected condition. Mark loop-open failure as a warning instead of error. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 35 +-- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index b14f7c5653cd..7df791047f55 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1030,29 +1030,36 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, stop_rr_fcf_flogi: /* FLOGI failure */ - lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, - "2858 FLOGI failure Status:x%x/x%x TMO:x%x " - "Data x%x x%x\n", - irsp->ulpStatus, irsp->un.ulpWord[4], - irsp->ulpTimeout, phba->hba_flag, - phba->fcf.fcf_flag); + if (!(irsp->ulpStatus == IOSTAT_LOCAL_REJECT && + ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) == + IOERR_LOOP_OPEN_FAILURE))) + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, + "2858 FLOGI failure Status:x%x/x%x " + "TMO:x%x Data x%x x%x\n", + irsp->ulpStatus, irsp->un.ulpWord[4], + irsp->ulpTimeout, phba->hba_flag, + phba->fcf.fcf_flag); /* Check for retry */ if (lpfc_els_retry(phba, cmdiocb, rspiocb)) goto out; - /* FLOGI failure */ - lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, -"0100 FLOGI failure Status:x%x/x%x TMO:x%x\n", -irsp->ulpStatus, irsp->un.ulpWord[4], -irsp->ulpTimeout); - - /* If this is not a loop open failure, bail out */ if (!(irsp->ulpStatus == IOSTAT_LOCAL_REJECT && ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) == - IOERR_LOOP_OPEN_FAILURE))) + IOERR_LOOP_OPEN_FAILURE))) { + /* FLOGI failure */ + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, +"0100 FLOGI failure Status:x%x/x%x TMO:x%x\n", +irsp->ulpStatus, irsp->un.ulpWord[4], +irsp->ulpTimeout); goto flogifail; + } + + lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS, +"0150 FLOGI failure Status:x%x/x%x TMO:x%x\n", +irsp->ulpStatus, irsp->un.ulpWord[4], +irsp->ulpTimeout); /* FLOGI failed, so there is no fabric */ spin_lock_irq(shost->host_lock); -- 2.13.1
[PATCH 14/17] lpfc: Fix crash during driver unload with running nvme traffic
When the driver is unloading, the nvme transport could be in the process of submitting new requests, will send abort requests to terminate associations, or may make LS-related requests. The driver's abort and request entry points currently is ignorant of the unloading state and is starting the requests even though the infrastructure to complete them continues to teardown. Change the entry points for new requests to check whether unloading and if so, reject the requests. Abort routines check unloading, and if so, noop the request. An abort is noop'd as the teardown paths are already aborting/terminating the io outstanding at the time the teardown initiated. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_nvme.c | 14 ++ drivers/scsi/lpfc/lpfc_nvmet.c | 11 +++ 2 files changed, 25 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 12d09a6a4563..ea7a0e65bbfd 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -423,6 +423,9 @@ lpfc_nvme_ls_req(struct nvme_fc_local_port *pnvme_lport, if (vport->load_flag & FC_UNLOADING) return -ENODEV; + if (vport->load_flag & FC_UNLOADING) + return -ENODEV; + ndlp = lpfc_findnode_did(vport, pnvme_rport->port_id); if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) { lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE | LOG_NVME_IOERR, @@ -538,6 +541,9 @@ lpfc_nvme_ls_abort(struct nvme_fc_local_port *pnvme_lport, vport = lport->vport; phba = vport->phba; + if (vport->load_flag & FC_UNLOADING) + return; + ndlp = lpfc_findnode_did(vport, pnvme_rport->port_id); if (!ndlp) { lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_ABTS, @@ -1273,6 +1279,11 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, goto out_fail; } + if (vport->load_flag & FC_UNLOADING) { + ret = -ENODEV; + goto out_fail; + } + /* Validate pointers. */ if (!pnvme_lport || !pnvme_rport || !freqpriv) { lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR | LOG_NODE, @@ -1500,6 +1511,9 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport, vport = lport->vport; phba = vport->phba; + if (vport->load_flag & FC_UNLOADING) + return; + /* Announce entry to new IO submit field. */ lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_ABTS, "6002 Abort Request to rport DID x%06x " diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c index 84cf1b9079f7..2b50aecc2722 100644 --- a/drivers/scsi/lpfc/lpfc_nvmet.c +++ b/drivers/scsi/lpfc/lpfc_nvmet.c @@ -635,6 +635,9 @@ lpfc_nvmet_xmt_ls_rsp(struct nvmet_fc_target_port *tgtport, if (phba->pport->load_flag & FC_UNLOADING) return -ENODEV; + if (phba->pport->load_flag & FC_UNLOADING) + return -ENODEV; + lpfc_printf_log(phba, KERN_INFO, LOG_NVME_DISC, "6023 NVMET LS rsp oxid x%x\n", ctxp->oxid); @@ -721,6 +724,11 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport, goto aerr; } + if (phba->pport->load_flag & FC_UNLOADING) { + rc = -ENODEV; + goto aerr; + } + #ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (ctxp->ts_cmd_nvme) { if (rsp->op == NVMET_FCOP_RSP) @@ -823,6 +831,9 @@ lpfc_nvmet_xmt_fcp_abort(struct nvmet_fc_target_port *tgtport, if (phba->pport->load_flag & FC_UNLOADING) return; + if (phba->pport->load_flag & FC_UNLOADING) + return; + lpfc_printf_log(phba, KERN_INFO, LOG_NVME_ABTS, "6103 NVMET Abort op: oxri x%x flg x%x ste %d\n", ctxp->oxid, ctxp->flag, ctxp->state); -- 2.13.1
[PATCH 04/17] lpfc: Fix crash after bad bar setup on driver attachment
In test cases where an instance of the driver is detached and reattached, the driver will crash on reattachment. There is a compound if statement that will skip over the bar setup if the pci_resource_start call is not successful. The driver erroneously returns success to its bar setup in this scenario even though the bars aren't properly configured. Rework the offending code segment for proper initialization steps. If the pci_resource_start call fails, -ENOMEM is now returned. Sample stack: rport-5:0-10: blocked FC remote port time out: removing rport BUG: unable to handle kernel NULL pointer dereference at (null) ... lpfc_sli4_wait_bmbx_ready+0x32/0x70 [lpfc] ... ... RIP: 0010:... ... lpfc_sli4_wait_bmbx_ready+0x32/0x70 [lpfc] Call Trace: ... lpfc_sli4_post_sync_mbox+0x106/0x4d0 [lpfc] ... ? __alloc_pages_nodemask+0x176/0x420 ... ? __kmalloc+0x2e/0x230 ... lpfc_sli_issue_mbox_s4+0x533/0x720 [lpfc] ... ? mempool_alloc+0x69/0x170 ... ? dma_generic_alloc_coherent+0x8f/0x140 ... lpfc_sli_issue_mbox+0xf/0x20 [lpfc] ... lpfc_sli4_driver_resource_setup+0xa6f/0x1130 [lpfc] ... ? lpfc_pci_probe_one+0x23e/0x16f0 [lpfc] ... lpfc_pci_probe_one+0x445/0x16f0 [lpfc] ... local_pci_probe+0x45/0xa0 ... work_for_cpu_fn+0x14/0x20 ... process_one_work+0x17a/0x440 Cc:# 4.12+ Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_init.c | 84 ++- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 745aff753396..fc9f91327724 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -9437,44 +9437,62 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) lpfc_sli4_bar0_register_memmap(phba, if_type); } - if ((if_type == LPFC_SLI_INTF_IF_TYPE_0) && - (pci_resource_start(pdev, PCI_64BIT_BAR2))) { - /* -* Map SLI4 if type 0 HBA Control Register base to a kernel -* virtual address and setup the registers. -*/ - phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); - bar1map_len = pci_resource_len(pdev, PCI_64BIT_BAR2); - phba->sli4_hba.ctrl_regs_memmap_p = - ioremap(phba->pci_bar1_map, bar1map_len); - if (!phba->sli4_hba.ctrl_regs_memmap_p) { - dev_printk(KERN_ERR, >dev, - "ioremap failed for SLI4 HBA control registers.\n"); + if (if_type == LPFC_SLI_INTF_IF_TYPE_0) { + if (pci_resource_start(pdev, PCI_64BIT_BAR2)) { + /* +* Map SLI4 if type 0 HBA Control Register base to a +* kernel virtual address and setup the registers. +*/ + phba->pci_bar1_map = pci_resource_start(pdev, + PCI_64BIT_BAR2); + bar1map_len = pci_resource_len(pdev, PCI_64BIT_BAR2); + phba->sli4_hba.ctrl_regs_memmap_p = + ioremap(phba->pci_bar1_map, + bar1map_len); + if (!phba->sli4_hba.ctrl_regs_memmap_p) { + dev_err(>dev, + "ioremap failed for SLI4 HBA " + "control registers.\n"); + error = -ENOMEM; + goto out_iounmap_conf; + } + phba->pci_bar2_memmap_p = +phba->sli4_hba.ctrl_regs_memmap_p; + lpfc_sli4_bar1_register_memmap(phba); + } else { + error = -ENOMEM; goto out_iounmap_conf; } - phba->pci_bar2_memmap_p = phba->sli4_hba.ctrl_regs_memmap_p; - lpfc_sli4_bar1_register_memmap(phba); } - if ((if_type == LPFC_SLI_INTF_IF_TYPE_0) && - (pci_resource_start(pdev, PCI_64BIT_BAR4))) { - /* -* Map SLI4 if type 0 HBA Doorbell Register base to a kernel -* virtual address and setup the registers. -*/ - phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); - bar2map_len = pci_resource_len(pdev, PCI_64BIT_BAR4); - phba->sli4_hba.drbl_regs_memmap_p = - ioremap(phba->pci_bar2_map, bar2map_len); - if (!phba->sli4_hba.drbl_regs_memmap_p) { - dev_printk(KERN_ERR, >dev, - "ioremap failed for SLI4 HBA doorbell
[PATCH 03/17] lpfc: Handle XRI_ABORTED_CQE in soft IRQ
XRI_ABORTED_CQE completions were not being handled in the fast path. They were being queued and deferred to the lpfc worker thread for processing. This is an artifact of the driver design prior to moving queue processing out of the isr and into a workq element. Now that queue processing is already in a deferred context, remove this artifact and process them directly. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 - drivers/scsi/lpfc/lpfc_hbadisc.c | 2 - drivers/scsi/lpfc/lpfc_init.c| 8 drivers/scsi/lpfc/lpfc_sli.c | 97 +++- drivers/scsi/lpfc/lpfc_sli4.h| 2 - 5 files changed, 35 insertions(+), 75 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 231302273257..7219b6ce5dc7 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -705,7 +705,6 @@ struct lpfc_hba { * capability */ #define HBA_NVME_IOQ_FLUSH 0x8 /* NVME IO queues flushed. */ -#define NVME_XRI_ABORT_EVENT 0x10 uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ struct lpfc_dmabuf slim2p; diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index d9a03beb76a4..3468257bda02 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -640,8 +640,6 @@ lpfc_work_done(struct lpfc_hba *phba) lpfc_handle_rrq_active(phba); if (phba->hba_flag & FCP_XRI_ABORT_EVENT) lpfc_sli4_fcp_xri_abort_event_proc(phba); - if (phba->hba_flag & NVME_XRI_ABORT_EVENT) - lpfc_sli4_nvme_xri_abort_event_proc(phba); if (phba->hba_flag & ELS_XRI_ABORT_EVENT) lpfc_sli4_els_xri_abort_event_proc(phba); if (phba->hba_flag & ASYNC_EVENT) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 52c039e9f4a4..745aff753396 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5954,9 +5954,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) INIT_LIST_HEAD(>sli4_hba.lpfc_abts_nvme_buf_list); INIT_LIST_HEAD(>sli4_hba.lpfc_abts_nvmet_ctx_list); INIT_LIST_HEAD(>sli4_hba.lpfc_nvmet_io_wait_list); - - /* Fast-path XRI aborted CQ Event work queue list */ - INIT_LIST_HEAD(>sli4_hba.sp_nvme_xri_aborted_work_queue); } /* This abort list used by worker thread */ @@ -9199,11 +9196,6 @@ lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) /* Pending ELS XRI abort events */ list_splice_init(>sli4_hba.sp_els_xri_aborted_work_queue, ); - if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { - /* Pending NVME XRI abort events */ - list_splice_init(>sli4_hba.sp_nvme_xri_aborted_work_queue, -); - } /* Pending asynnc events */ list_splice_init(>sli4_hba.sp_asynce_work_queue, ); diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index ec6ff8c4e953..ba6f0619433c 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -12311,41 +12311,6 @@ void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *phba) } /** - * lpfc_sli4_nvme_xri_abort_event_proc - Process nvme xri abort event - * @phba: pointer to lpfc hba data structure. - * - * This routine is invoked by the worker thread to process all the pending - * SLI4 NVME abort XRI events. - **/ -void lpfc_sli4_nvme_xri_abort_event_proc(struct lpfc_hba *phba) -{ - struct lpfc_cq_event *cq_event; - - /* First, declare the fcp xri abort event has been handled */ - spin_lock_irq(>hbalock); - phba->hba_flag &= ~NVME_XRI_ABORT_EVENT; - spin_unlock_irq(>hbalock); - /* Now, handle all the fcp xri abort events */ - while (!list_empty(>sli4_hba.sp_nvme_xri_aborted_work_queue)) { - /* Get the first event from the head of the event queue */ - spin_lock_irq(>hbalock); - list_remove_head(>sli4_hba.sp_nvme_xri_aborted_work_queue, -cq_event, struct lpfc_cq_event, list); - spin_unlock_irq(>hbalock); - /* Notify aborted XRI for NVME work queue */ - if (phba->nvmet_support) { - lpfc_sli4_nvmet_xri_aborted(phba, - _event->cqe.wcqe_axri); - } else { - lpfc_sli4_nvme_xri_aborted(phba, - _event->cqe.wcqe_axri); - } - /* Free the event processed
[PATCH 00/17] lpfc updates for 11.4.0.5
This patch set provides a number of bug fixes and additions to the driver. The patches were cut against the Martin's 4.15/scsi-queue tree. There are no outside dependencies. James Smart (17): lpfc: FLOGI failures are reported when connected to a private loop. lpfc: Expand WQE capability of every NVME hardware queue lpfc: Handle XRI_ABORTED_CQE in soft IRQ lpfc: Fix crash after bad bar setup on driver attachment lpfc: Fix NVME LS abort_xri lpfc: Raise maximum NVME sg list size for 256 elements lpfc: Driver fails to detect direct attach storage array lpfc: Fix display for debugfs queInfo lpfc: Adjust default value of lpfc_nvmet_mrq lpfc: Fix ndlp ref count for pt2pt mode issue RSCN lpfc: Linux LPFC driver does not process all RSCNs lpfc: correct port registrations with nvme_fc lpfc: Correct driver deregistrations with host nvme transport lpfc: Fix crash during driver unload with running nvme traffic lpfc: Fix driver handling of nvme resources during unload lpfc: small sg cnt cleanup lpfc: update driver version to 11.4.0.5 drivers/scsi/lpfc/lpfc.h | 4 +- drivers/scsi/lpfc/lpfc_attr.c| 13 ++- drivers/scsi/lpfc/lpfc_crtn.h| 2 + drivers/scsi/lpfc/lpfc_ct.c | 19 +++ drivers/scsi/lpfc/lpfc_debugfs.c | 16 +-- drivers/scsi/lpfc/lpfc_disc.h| 2 + drivers/scsi/lpfc/lpfc_els.c | 79 +++-- drivers/scsi/lpfc/lpfc_hbadisc.c | 31 +++-- drivers/scsi/lpfc/lpfc_hw4.h | 6 +- drivers/scsi/lpfc/lpfc_init.c| 243 +-- drivers/scsi/lpfc/lpfc_nvme.c| 227 +--- drivers/scsi/lpfc/lpfc_nvme.h| 5 +- drivers/scsi/lpfc/lpfc_nvmet.c | 13 ++- drivers/scsi/lpfc/lpfc_nvmet.h | 4 + drivers/scsi/lpfc/lpfc_sli.c | 169 ++- drivers/scsi/lpfc/lpfc_sli4.h| 10 +- drivers/scsi/lpfc/lpfc_version.h | 2 +- 17 files changed, 595 insertions(+), 250 deletions(-) -- 2.13.1
[PATCH 07/17] lpfc: Driver fails to detect direct attach storage array
The driver does not respond to PLOGI from the direct attach target. The driver uses incorrect S_ID in CONFIG_LINK, after FLOGI completion Correct by issuing CONFIG_LINK with the correct S_ID after receiving the PLOGI from the target Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 36 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 7df791047f55..95872a0329ad 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -858,6 +858,9 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, vport->fc_flag |= FC_PT2PT; spin_unlock_irq(shost->host_lock); + /* If we are pt2pt with another NPort, force NPIV off! */ + phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED; + /* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */ if ((phba->sli_rev == LPFC_SLI_REV4) && phba->fc_topology_changed) { lpfc_unregister_fcf_prep(phba); @@ -916,28 +919,29 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, spin_lock_irq(shost->host_lock); ndlp->nlp_flag |= NLP_NPR_2B_DISC; spin_unlock_irq(shost->host_lock); - } else + + mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); + if (!mbox) + goto fail; + + lpfc_config_link(phba, mbox); + + mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; + mbox->vport = vport; + rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); + if (rc == MBX_NOT_FINISHED) { + mempool_free(mbox, phba->mbox_mem_pool); + goto fail; + } + } else { /* This side will wait for the PLOGI, decrement ndlp reference * count indicating that ndlp can be released when other * references to it are done. */ lpfc_nlp_put(ndlp); - /* If we are pt2pt with another NPort, force NPIV off! */ - phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED; - - mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); - if (!mbox) - goto fail; - - lpfc_config_link(phba, mbox); - - mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; - mbox->vport = vport; - rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); - if (rc == MBX_NOT_FINISHED) { - mempool_free(mbox, phba->mbox_mem_pool); - goto fail; + /* Start discovery - this should just do CLEAR_LA */ + lpfc_disc_start(vport); } return 0; -- 2.13.1
[PATCH 02/17] lpfc: Expand WQE capability of every NVME hardware queue
Hardware queues are a fast staging area to push commands into the adapter. The adapter should drain them extremely quickly. However, under heavy io load, the host cpu is pushing commands faster than the drain rate of the adapter causing the driver to resource busy commands. Enlarge the hardware queue (wq & cq) to support a larger number of queue entries (4x the prior size) before backpressure. Enlarging the queue requires larger contiguous buffers (16k) per logical page for the hardware. This changed calling sequences that were expecting 4K page sizes that now must pass a parameter with the page sizes. It also required use of a new version of an adapter command that can vary the page size values. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hw4.h | 6 +++- drivers/scsi/lpfc/lpfc_init.c | 67 ++-- drivers/scsi/lpfc/lpfc_nvme.h | 3 +- drivers/scsi/lpfc/lpfc_sli.c | 71 +-- drivers/scsi/lpfc/lpfc_sli4.h | 8 +++-- 5 files changed, 112 insertions(+), 43 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 2b145966c73f..73c2f6971d2b 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -1122,6 +1122,7 @@ struct cq_context { #define LPFC_CQ_CNT_2560x0 #define LPFC_CQ_CNT_5120x1 #define LPFC_CQ_CNT_1024 0x2 +#define LPFC_CQ_CNT_WORD7 0x3 uint32_t word1; #define lpfc_cq_eq_id_SHIFT22 /* Version 0 Only */ #define lpfc_cq_eq_id_MASK 0x00FF @@ -1129,7 +1130,7 @@ struct cq_context { #define lpfc_cq_eq_id_2_SHIFT 0 /* Version 2 Only */ #define lpfc_cq_eq_id_2_MASK 0x #define lpfc_cq_eq_id_2_WORD word1 - uint32_t reserved0; + uint32_t lpfc_cq_context_count; /* Version 2 Only */ uint32_t reserved1; }; @@ -1193,6 +1194,9 @@ struct lpfc_mbx_cq_create_set { #define lpfc_mbx_cq_create_set_arm_SHIFT 31 #define lpfc_mbx_cq_create_set_arm_MASK0x0001 #define lpfc_mbx_cq_create_set_arm_WORDword2 +#define lpfc_mbx_cq_create_set_cq_cnt_SHIFT16 +#define lpfc_mbx_cq_create_set_cq_cnt_MASK 0x7FFF +#define lpfc_mbx_cq_create_set_cq_cnt_WORD word2 #define lpfc_mbx_cq_create_set_num_cq_SHIFT0 #define lpfc_mbx_cq_create_set_num_cq_MASK 0x #define lpfc_mbx_cq_create_set_num_cq_WORD word2 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 4ffdde5808ee..52c039e9f4a4 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -7964,10 +7964,10 @@ static int lpfc_alloc_nvme_wq_cq(struct lpfc_hba *phba, int wqidx) { struct lpfc_queue *qdesc; - int cnt; - qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, - phba->sli4_hba.cq_ecount); + qdesc = lpfc_sli4_queue_alloc(phba, LPFC_NVME_PAGE_SIZE, + phba->sli4_hba.cq_esize, + LPFC_NVME_CQSIZE); if (!qdesc) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0508 Failed allocate fast-path NVME CQ (%d)\n", @@ -7976,8 +7976,8 @@ lpfc_alloc_nvme_wq_cq(struct lpfc_hba *phba, int wqidx) } phba->sli4_hba.nvme_cq[wqidx] = qdesc; - cnt = LPFC_NVME_WQSIZE; - qdesc = lpfc_sli4_queue_alloc(phba, LPFC_WQE128_SIZE, cnt); + qdesc = lpfc_sli4_queue_alloc(phba, LPFC_NVME_PAGE_SIZE, + LPFC_WQE128_SIZE, LPFC_NVME_WQSIZE); if (!qdesc) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0509 Failed allocate fast-path NVME WQ (%d)\n", @@ -7996,8 +7996,9 @@ lpfc_alloc_fcp_wq_cq(struct lpfc_hba *phba, int wqidx) uint32_t wqesize; /* Create Fast Path FCP CQs */ - qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, - phba->sli4_hba.cq_ecount); + qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, + phba->sli4_hba.cq_esize, + phba->sli4_hba.cq_ecount); if (!qdesc) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0499 Failed allocate fast-path FCP CQ (%d)\n", wqidx); @@ -8008,7 +8009,8 @@ lpfc_alloc_fcp_wq_cq(struct lpfc_hba *phba, int wqidx) /* Create Fast Path FCP WQs */ wqesize = (phba->fcp_embed_io) ? LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; - qdesc = lpfc_sli4_queue_alloc(phba, wqesize, phba->sli4_hba.wq_ecount); + qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, + wqesize,
[PATCH 06/17] lpfc: Raise maximum NVME sg list size for 256 elements
Raise the maximum NVME sg list size allowed to 256 elements. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 7219b6ce5dc7..46a89bdff8e4 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -57,7 +57,7 @@ struct lpfc_sli2_slim; #define LPFC_MAX_SG_SEG_CNT4096/* sg element count per scsi cmnd */ #define LPFC_MAX_SGL_SEG_CNT 512 /* SGL element count per scsi cmnd */ #define LPFC_MAX_BPL_SEG_CNT 4096/* BPL element count per scsi cmnd */ -#define LPFC_MAX_NVME_SEG_CNT 128 /* max SGL element cnt per NVME cmnd */ +#define LPFC_MAX_NVME_SEG_CNT 256 /* max SGL element cnt per NVME cmnd */ #define LPFC_MAX_SGE_SIZE 0x8000 /* Maximum data allowed in a SGE */ #define LPFC_IOCB_LIST_CNT 2250/* list of IOCBs for fast-path usage. */ -- 2.13.1
[PATCH v3 6/8] scsi/ipr: Use sgl_alloc_order() and sgl_free_order()
Use the sgl_alloc_order() and sgl_free_order() functions instead of open coding these functions. Signed-off-by: Bart Van AsscheAcked-by: Brian King Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Cc: Martin K. Petersen Cc: linux-scsi@vger.kernel.org --- drivers/scsi/Kconfig | 1 + drivers/scsi/ipr.c | 49 - drivers/scsi/ipr.h | 2 +- 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 766955318005..d918115afdca 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -1059,6 +1059,7 @@ config SCSI_IPR depends on PCI && SCSI && ATA select FW_LOADER select IRQ_POLL + select SGL_ALLOC ---help--- This driver supports the IBM Power Linux family RAID adapters. This includes IBM pSeries 5712, 5703, 5709, and 570A, as well diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index f838bd73befa..6fed5db6255e 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -3815,10 +3815,8 @@ static struct device_attribute ipr_iopoll_weight_attr = { **/ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len) { - int sg_size, order, bsize_elem, num_elem, i, j; + int sg_size, order; struct ipr_sglist *sglist; - struct scatterlist *scatterlist; - struct page *page; /* Get the minimum size per scatter/gather element */ sg_size = buf_len / (IPR_MAX_SGLIST - 1); @@ -3826,45 +3824,18 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len) /* Get the actual size per element */ order = get_order(sg_size); - /* Determine the actual number of bytes per element */ - bsize_elem = PAGE_SIZE * (1 << order); - - /* Determine the actual number of sg entries needed */ - if (buf_len % bsize_elem) - num_elem = (buf_len / bsize_elem) + 1; - else - num_elem = buf_len / bsize_elem; - /* Allocate a scatter/gather list for the DMA */ - sglist = kzalloc(sizeof(struct ipr_sglist) + -(sizeof(struct scatterlist) * (num_elem - 1)), -GFP_KERNEL); - + sglist = kzalloc(sizeof(struct ipr_sglist), GFP_KERNEL); if (sglist == NULL) { ipr_trace; return NULL; } - - scatterlist = sglist->scatterlist; - sg_init_table(scatterlist, num_elem); - sglist->order = order; - sglist->num_sg = num_elem; - - /* Allocate a bunch of sg elements */ - for (i = 0; i < num_elem; i++) { - page = alloc_pages(GFP_KERNEL, order); - if (!page) { - ipr_trace; - - /* Free up what we already allocated */ - for (j = i - 1; j >= 0; j--) - __free_pages(sg_page([j]), order); - kfree(sglist); - return NULL; - } - - sg_set_page([i], page, 0, 0); + sglist->scatterlist = sgl_alloc_order(buf_len, order, false, GFP_KERNEL, + >num_sg); + if (!sglist->scatterlist) { + kfree(sglist); + return NULL; } return sglist; @@ -3882,11 +3853,7 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len) **/ static void ipr_free_ucode_buffer(struct ipr_sglist *sglist) { - int i; - - for (i = 0; i < sglist->num_sg; i++) - __free_pages(sg_page(>scatterlist[i]), sglist->order); - + sgl_free_order(sglist->scatterlist, sglist->order); kfree(sglist); } diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index c7f0e9e3cd7d..93570734cbfb 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h @@ -1454,7 +1454,7 @@ struct ipr_sglist { u32 num_sg; u32 num_dma_sg; u32 buffer_len; - struct scatterlist scatterlist[1]; + struct scatterlist *scatterlist; }; enum ipr_sdt_state { -- 2.14.3
[PATCH v3 7/8] scsi/pmcraid: Remove an unused structure member
Signed-off-by: Bart Van AsscheReviewed-by: Johannes Thumshirn Cc: linux-scsi@vger.kernel.org Cc: Martin K. Petersen Cc: Anil Ravindranath --- drivers/scsi/pmcraid.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h index 8bfac72a242b..44da91712115 100644 --- a/drivers/scsi/pmcraid.h +++ b/drivers/scsi/pmcraid.h @@ -542,7 +542,6 @@ struct pmcraid_sglist { u32 order; u32 num_sg; u32 num_dma_sg; - u32 buffer_len; struct scatterlist scatterlist[1]; }; -- 2.14.3
[PATCH v3 8/8] scsi/pmcraid: Use sgl_alloc_order() and sgl_free_order()
Use the sgl_alloc_order() and sgl_free_order() functions instead of open coding these functions. Signed-off-by: Bart Van AsscheReviewed-by: Johannes Thumshirn Cc: linux-scsi@vger.kernel.org Cc: Martin K. Petersen Cc: Anil Ravindranath --- drivers/scsi/Kconfig | 1 + drivers/scsi/pmcraid.c | 43 --- drivers/scsi/pmcraid.h | 2 +- 3 files changed, 6 insertions(+), 40 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index d918115afdca..04400bed39a1 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -1577,6 +1577,7 @@ config ZFCP config SCSI_PMCRAID tristate "PMC SIERRA Linux MaxRAID adapter support" depends on PCI && SCSI && NET + select SGL_ALLOC ---help--- This driver supports the PMC SIERRA MaxRAID adapters. diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index b4d6cd8cd1ad..95fc0352f9bb 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -3232,12 +3232,7 @@ static int pmcraid_build_ioadl( */ static void pmcraid_free_sglist(struct pmcraid_sglist *sglist) { - int i; - - for (i = 0; i < sglist->num_sg; i++) - __free_pages(sg_page(&(sglist->scatterlist[i])), -sglist->order); - + sgl_free_order(sglist->scatterlist, sglist->order); kfree(sglist); } @@ -3254,50 +3249,20 @@ static void pmcraid_free_sglist(struct pmcraid_sglist *sglist) static struct pmcraid_sglist *pmcraid_alloc_sglist(int buflen) { struct pmcraid_sglist *sglist; - struct scatterlist *scatterlist; - struct page *page; - int num_elem, i, j; int sg_size; int order; - int bsize_elem; sg_size = buflen / (PMCRAID_MAX_IOADLS - 1); order = (sg_size > 0) ? get_order(sg_size) : 0; - bsize_elem = PAGE_SIZE * (1 << order); - - /* Determine the actual number of sg entries needed */ - if (buflen % bsize_elem) - num_elem = (buflen / bsize_elem) + 1; - else - num_elem = buflen / bsize_elem; /* Allocate a scatter/gather list for the DMA */ - sglist = kzalloc(sizeof(struct pmcraid_sglist) + -(sizeof(struct scatterlist) * (num_elem - 1)), -GFP_KERNEL); - + sglist = kzalloc(sizeof(struct pmcraid_sglist), GFP_KERNEL); if (sglist == NULL) return NULL; - scatterlist = sglist->scatterlist; - sg_init_table(scatterlist, num_elem); sglist->order = order; - sglist->num_sg = num_elem; - sg_size = buflen; - - for (i = 0; i < num_elem; i++) { - page = alloc_pages(GFP_KERNEL|GFP_DMA|__GFP_ZERO, order); - if (!page) { - for (j = i - 1; j >= 0; j--) - __free_pages(sg_page([j]), order); - kfree(sglist); - return NULL; - } - - sg_set_page([i], page, - sg_size < bsize_elem ? sg_size : bsize_elem, 0); - sg_size -= bsize_elem; - } + sgl_alloc_order(buflen, order, false, + GFP_KERNEL | GFP_DMA | __GFP_ZERO, >num_sg); return sglist; } diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h index 44da91712115..754ef30927e2 100644 --- a/drivers/scsi/pmcraid.h +++ b/drivers/scsi/pmcraid.h @@ -542,7 +542,7 @@ struct pmcraid_sglist { u32 order; u32 num_sg; u32 num_dma_sg; - struct scatterlist scatterlist[1]; + struct scatterlist *scatterlist; }; /* page D0 inquiry data of focal point resource */ -- 2.14.3
[PATCH] iSCSI-target: Use common error handling code in iscsi_decode_text_input()
From: Markus ElfringDate: Fri, 3 Nov 2017 22:20:38 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 39 -- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index caab1045742d..29a37b242d30 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -1380,10 +1380,8 @@ int iscsi_decode_text_input( char *key, *value; struct iscsi_param *param; - if (iscsi_extract_key_value(start, , ) < 0) { - kfree(tmpbuf); - return -1; - } + if (iscsi_extract_key_value(start, , ) < 0) + goto free_buffer; pr_debug("Got key: %s=%s\n", key, value); @@ -1396,38 +1394,37 @@ int iscsi_decode_text_input( param = iscsi_check_key(key, phase, sender, param_list); if (!param) { - if (iscsi_add_notunderstood_response(key, - value, param_list) < 0) { - kfree(tmpbuf); - return -1; - } + if (iscsi_add_notunderstood_response(key, value, +param_list) < 0) + goto free_buffer; + start += strlen(key) + strlen(value) + 2; continue; } - if (iscsi_check_value(param, value) < 0) { - kfree(tmpbuf); - return -1; - } + if (iscsi_check_value(param, value) < 0) + goto free_buffer; start += strlen(key) + strlen(value) + 2; if (IS_PSTATE_PROPOSER(param)) { - if (iscsi_check_proposer_state(param, value) < 0) { - kfree(tmpbuf); - return -1; - } + if (iscsi_check_proposer_state(param, value) < 0) + goto free_buffer; + SET_PSTATE_RESPONSE_GOT(param); } else { - if (iscsi_check_acceptor_state(param, value, conn) < 0) { - kfree(tmpbuf); - return -1; - } + if (iscsi_check_acceptor_state(param, value, conn) < 0) + goto free_buffer; + SET_PSTATE_ACCEPTOR(param); } } kfree(tmpbuf); return 0; + +free_buffer: + kfree(tmpbuf); + return -1; } int iscsi_encode_text_output( -- 2.15.0
[PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout
Make use of the swap macro and remove unnecessary variable tmp. This makes the code easier to read and maintain. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva--- drivers/scsi/bnx2i/bnx2i_hwi.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index e0640e0..9e3bf53 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -547,12 +547,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, nopout_wqe->op_attr = ISCSI_FLAG_CMD_FINAL; memcpy(nopout_wqe->lun, _hdr->lun, 8); - if (test_bit(BNX2I_NX2_DEV_57710, >hba->cnic_dev_type)) { - u32 tmp = nopout_wqe->lun[0]; - /* 57710 requires LUN field to be swapped */ - nopout_wqe->lun[0] = nopout_wqe->lun[1]; - nopout_wqe->lun[1] = tmp; - } + /* 57710 requires LUN field to be swapped */ + if (test_bit(BNX2I_NX2_DEV_57710, >hba->cnic_dev_type)) + swap(nopout_wqe->lun[0], nopout_wqe->lun[1]); nopout_wqe->itt = ((u16)task->itt | (ISCSI_TASK_TYPE_MPATH << -- 2.7.4
[scsi:for-next 182/194] drivers/scsi//mpt3sas/mpt3sas_base.c:1418:13: warning: cast from pointer to integer of different size
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next head: 1c356ec5e932c8d4c83d9782ab3c4164b6471d5d commit: 016d5c35e27824f31c394009dd0f72f2c6b0dc85 [182/194] scsi: mpt3sas: SGL to PRP Translation for I/Os to NVMe devices config: i386-randconfig-x071-201744 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: git checkout 016d5c35e27824f31c394009dd0f72f2c6b0dc85 # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/scsi//mpt3sas/mpt3sas_base.c: In function 'base_make_prp_nvme': >> drivers/scsi//mpt3sas/mpt3sas_base.c:1418:13: warning: cast from pointer to >> integer of different size [-Wpointer-to-int-cast] msg_phys = (dma_addr_t)mpt3sas_base_get_pcie_sgl_dma(ioc, smid); ^ vim +1418 drivers/scsi//mpt3sas/mpt3sas_base.c 1347 1348 /** 1349 * base_make_prp_nvme - 1350 * Prepare PRPs(Physical Region Page)- SGLs specific to NVMe drives only 1351 * 1352 * @ioc:per adapter object 1353 * @scmd: SCSI command from the mid-layer 1354 * @mpi_request:mpi request 1355 * @smid: msg Index 1356 * @sge_count: scatter gather element count. 1357 * 1358 * Returns: true: PRPs are built 1359 * false: IEEE SGLs needs to be built 1360 */ 1361 void 1362 base_make_prp_nvme(struct MPT3SAS_ADAPTER *ioc, 1363 struct scsi_cmnd *scmd, 1364 Mpi25SCSIIORequest_t *mpi_request, 1365 u16 smid, int sge_count) 1366 { 1367 int sge_len, offset, num_prp_in_chain = 0; 1368 Mpi25IeeeSgeChain64_t *main_chain_element, *ptr_first_sgl; 1369 u64 *curr_buff; 1370 dma_addr_t msg_phys; 1371 u64 sge_addr; 1372 u32 page_mask, page_mask_result; 1373 struct scatterlist *sg_scmd; 1374 u32 first_prp_len; 1375 int data_len = scsi_bufflen(scmd); 1376 u32 nvme_pg_size; 1377 1378 nvme_pg_size = max_t(u32, ioc->page_size, NVME_PRP_PAGE_SIZE); 1379 /* 1380 * Nvme has a very convoluted prp format. One prp is required 1381 * for each page or partial page. Driver need to split up OS sg_list 1382 * entries if it is longer than one page or cross a page 1383 * boundary. Driver also have to insert a PRP list pointer entry as 1384 * the last entry in each physical page of the PRP list. 1385 * 1386 * NOTE: The first PRP "entry" is actually placed in the first 1387 * SGL entry in the main message as IEEE 64 format. The 2nd 1388 * entry in the main message is the chain element, and the rest 1389 * of the PRP entries are built in the contiguous pcie buffer. 1390 */ 1391 page_mask = nvme_pg_size - 1; 1392 1393 /* 1394 * Native SGL is needed. 1395 * Put a chain element in main message frame that points to the first 1396 * chain buffer. 1397 * 1398 * NOTE: The ChainOffset field must be 0 when using a chain pointer to 1399 *a native SGL. 1400 */ 1401 1402 /* Set main message chain element pointer */ 1403 main_chain_element = (pMpi25IeeeSgeChain64_t)_request->SGL; 1404 /* 1405 * For NVMe the chain element needs to be the 2nd SG entry in the main 1406 * message. 1407 */ 1408 main_chain_element = (Mpi25IeeeSgeChain64_t *) 1409 ((u8 *)main_chain_element + sizeof(MPI25_IEEE_SGE_CHAIN64)); 1410 1411 /* 1412 * For the PRP entries, use the specially allocated buffer of 1413 * contiguous memory. Normal chain buffers can't be used 1414 * because each chain buffer would need to be the size of an OS 1415 * page (4k). 1416 */ 1417 curr_buff = mpt3sas_base_get_pcie_sgl(ioc, smid); > 1418 msg_phys = (dma_addr_t)mpt3sas_base_get_pcie_sgl_dma(ioc, smid); 1419 1420 main_chain_element->Address = cpu_to_le64(msg_phys); 1421 main_chain_element->NextChainOffset = 0; 1422 main_chain_element->Flags = MPI2_IEEE_SGE_FLAGS_CHAIN_ELEMENT | 1423 MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR | 1424 MPI26_IEEE_SGE_FLAGS_NSF_NVME_PRP; 1425 1426 /* Build first prp, sge need not to be page aligned*/ 1427 ptr_first_sgl = (pMpi25IeeeSgeChain64_t)_request->SGL; 1428 sg_scmd = scsi_sglist(scmd); 1429 sge_addr = sg_dma_address(sg_scmd); 1430 sge_len = sg_dma_len(sg_scmd); 1431 1432 offset = (u32)(sge_addr &
[PATCH] scsi: lpfc_els: use swap macro in lpfc_plogi_confirm_nport
Make use of the swap macro and remove unnecessary variable keep_nlp_flag. This makes the code easier to read and maintain. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva--- drivers/scsi/lpfc/lpfc_els.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index b14f7c5..1b745fe 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1525,7 +1525,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, struct fc_rport *rport; struct serv_parm *sp; uint8_t name[sizeof(struct lpfc_name)]; - uint32_t rc, keepDID = 0, keep_nlp_flag = 0; + uint32_t rc, keepDID = 0; uint16_t keep_nlp_state; struct lpfc_nvme_rport *keep_nrport = NULL; int put_node; @@ -1616,9 +1616,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, phba->cfg_rrq_xri_bitmap_sz); spin_lock_irq(shost->host_lock); - keep_nlp_flag = new_ndlp->nlp_flag; - new_ndlp->nlp_flag = ndlp->nlp_flag; - ndlp->nlp_flag = keep_nlp_flag; + swap(new_ndlp->nlp_flag, ndlp->nlp_flag); spin_unlock_irq(shost->host_lock); /* Set nlp_states accordingly */ -- 2.7.4
[GIT PULL] SCSI fixes for 4.14-rc7
One minor fix in the error leg of the qla2xxx driver (it oopses the system if we get an error trying to start the internal kernel thread). The fix is minor because the problem isn't often encountered in the field (although it can be induced by inserting the module in a low memory environment). The patch is available here: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes The short changelog is: Douglas Miller (1): scsi: qla2xxx: Fix oops in qla2x00_probe_one error path And the diffstat: drivers/scsi/qla2xxx/qla_os.c | 1 + 1 file changed, 1 insertion(+) With full diff below. James --- diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 3bd956d3bc5d..dce42a416876 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3212,6 +3212,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ql_log(ql_log_fatal, base_vha, 0x00ed, "Failed to start DPC thread.\n"); ret = PTR_ERR(ha->dpc_thread); + ha->dpc_thread = NULL; goto probe_failed; } ql_dbg(ql_dbg_init, base_vha, 0x00ee,
[PATCH v3] lpfc: Tie in to new dev_loss_tmo interface in nvme transport
This patch calls the new nvme transport routine for dev_loss_tmo whenever the SCSI fc transport calls the lldd to make a dynamic change to a remote ports dev_loss_tmo. Signed-off-by: James Smart--- This lpfc patch, as dependent upon the new nvme transport nvme_fc_set_remoteport_devloss() call, should enter via nvme-4.15 v2/v3: Ensure nvme_fc is enabled for compilation --- drivers/scsi/lpfc/lpfc_attr.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c17677f494af..3e02bc3a7c3f 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3246,6 +3246,11 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) continue; if (ndlp->rport) ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; +#if (IS_ENABLED(CONFIG_NVME_FC)) + if (ndlp->nrport) + nvme_fc_set_remoteport_devloss(ndlp->nrport->remoteport, + vport->cfg_devloss_tmo); +#endif } spin_unlock_irq(shost->host_lock); } -- 2.13.1
Re: [PATCH v2] lpfc: Tie in to new dev_loss_tmo interface in nvme transport
sorry or the noise. disregard. didn't pick up the chg
Re: [PATCH 00/13] mpt3sas driver NVMe support:
Suganath, > Ventura Series controller are Tri-mode. The controller and firmware > are capable of supporting NVMe devices and PCIe switches to be > connected with the controller. This patch set adds driver level > support for NVMe devices and PCIe switches. Applied to 4.15/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering
[PATCH v2] lpfc: Tie in to new dev_loss_tmo interface in nvme transport
This patch calls the new nvme transport routine for dev_loss_tmo whenever the SCSI fc transport calls the lldd to make a dynamic change to a remote ports dev_loss_tmo. Signed-off-by: James Smart--- This lpfc patch, as dependent upon the new nvme transport nvme_fc_set_remoteport_devloss() call, should enter via nvme-4.15 v2: Ensure nvme_fc is enabled for compilation --- drivers/scsi/lpfc/lpfc_attr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c17677f494af..1191a92e2dbc 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3246,6 +3246,9 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) continue; if (ndlp->rport) ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; + if (ndlp->nrport) + nvme_fc_set_remoteport_devloss(ndlp->nrport->remoteport, + vport->cfg_devloss_tmo); } spin_unlock_irq(shost->host_lock); } -- 2.13.1
Re: [PATCH] lpfc: Tie in to new dev_loss_tmo interface in nvme transport
please disregard. A v2 that ensures CONFIG_NVME_FC is enabled is on its way -- james On 11/3/2017 9:12 AM, James Smart wrote: This patch calls the new nvme transport routine for dev_loss_tmo whenever the SCSI fc transport calls the lldd to make a dynamic change to a remote ports dev_loss_tmo. Signed-off-by: James Smart--- This lpfc patch, as dependent upon the new nvme transport nvme_fc_set_remoteport_devloss() call, should enter via nvme-4.15 --- drivers/scsi/lpfc/lpfc_attr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c17677f494af..1191a92e2dbc 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3246,6 +3246,9 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) continue; if (ndlp->rport) ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; + if (ndlp->nrport) + nvme_fc_set_remoteport_devloss(ndlp->nrport->remoteport, + vport->cfg_devloss_tmo); } spin_unlock_irq(shost->host_lock); }
Re: [PATCH V3] scsi: storvsc: Allow only one remove lun work item to be issued per lun
Cathy, > When running multipath on a VM if all available paths go down the > driver can schedule large amounts of storvsc_remove_lun work items to > the same lun. In response to the failing paths typically storvsc > responds by taking host->scan_mutex and issuing a TUR per lun. If > there has been heavy IO to the failed device all the failed IOs are > returned from the host. A remove lun work item is issued per failed > IO. If the outstanding TURs have not been completed in a timely manner > the scan_mutex is never released or released too late. Consequently > the many remove lun work items are not completed as scsi_remove_device > also tries to take host->scan_mutex. This results in dragging the VM > down and sometimes completely. > > This patch only allows one remove lun to be issued to a particular lun > while it is an instantiated member of the scsi stack. Applied to 4.15/scsi-queue. Next time the change log needs to go after a "---" delimiter. Thank you! > Changes since v1: > Use single threaded workqueue to serialize work in > storvsc_handle_error [Christoph Hellwig] > > Changes since v2: > Replaced create_singlethread_workqueue with > alloc_ordered_workqueue [Christoph Hellwig] > > Added reviewed by's. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi: lpfc: fix kzalloc-simple.cocci warnings
Vasyl, > drivers/scsi/lpfc/lpfc_debugfs.c:5460:22-29: WARNING: kzalloc should be used > for phba -> nvmeio_trc, instead of kmalloc/memset > drivers/scsi/lpfc/lpfc_debugfs.c:2230:20-27: WARNING: kzalloc should be used > for phba -> nvmeio_trc, instead of kmalloc/memset > > Use kzalloc rather than kmalloc followed by memset with 0 Applied to 4.15/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
Himanshu, >> It is not. It needs a review/ack from the driver maintainers. > > What about Kyle Fortin's review ? Kyle's review is fine. But when a driver is actively maintained, like be2iscsi is, I always give ack/nack rights to the relevant maintainers. In this case that's Jitendra. -- Martin K. Petersen Oracle Linux Engineering
[PATCH] lpfc: Tie in to new dev_loss_tmo interface in nvme transport
This patch calls the new nvme transport routine for dev_loss_tmo whenever the SCSI fc transport calls the lldd to make a dynamic change to a remote ports dev_loss_tmo. Signed-off-by: James Smart--- This lpfc patch, as dependent upon the new nvme transport nvme_fc_set_remoteport_devloss() call, should enter via nvme-4.15 --- drivers/scsi/lpfc/lpfc_attr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c17677f494af..1191a92e2dbc 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3246,6 +3246,9 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) continue; if (ndlp->rport) ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; + if (ndlp->nrport) + nvme_fc_set_remoteport_devloss(ndlp->nrport->remoteport, + vport->cfg_devloss_tmo); } spin_unlock_irq(shost->host_lock); } -- 2.13.1
Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
On Fri, Nov 03, 2017 at 11:25:05AM -0400, Martin K. Petersen wrote: Hi Martin, > > Himanshu, > > > Just a reminder, is my patch in our queue ? > > It is not. It needs a review/ack from the driver maintainers. What about Kyle Fortin's review ? > -- > Martin K. PetersenOracle Linux Engineering Thanks Himanshu
Re: [PATCH] scsi: lpfc: fix kzalloc-simple.cocci warnings
On 10/11/2017 12:42 PM, Vasyl Gomonovych wrote: drivers/scsi/lpfc/lpfc_debugfs.c:5460:22-29: WARNING: kzalloc should be used for phba -> nvmeio_trc, instead of kmalloc/memset drivers/scsi/lpfc/lpfc_debugfs.c:2230:20-27: WARNING: kzalloc should be used for phba -> nvmeio_trc, instead of kmalloc/memset Use kzalloc rather than kmalloc followed by memset with 0 Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Signed-off-by: Vasyl Gomonovych--- drivers/scsi/lpfc/lpfc_debugfs.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index d50c481..2bf5ad3 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -2227,7 +2227,7 @@ kfree(phba->nvmeio_trc); /* Allocate new trace buffer and initialize */ - phba->nvmeio_trc = kmalloc((sizeof(struct lpfc_debugfs_nvmeio_trc) * + phba->nvmeio_trc = kzalloc((sizeof(struct lpfc_debugfs_nvmeio_trc) * sz), GFP_KERNEL); if (!phba->nvmeio_trc) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, @@ -2235,8 +2235,6 @@ "nvmeio_trc buffer\n"); return -ENOMEM; } - memset(phba->nvmeio_trc, 0, - (sizeof(struct lpfc_debugfs_nvmeio_trc) * sz)); atomic_set(>nvmeio_trc_cnt, 0); phba->nvmeio_trc_on = 0; phba->nvmeio_trc_output_idx = 0; @@ -5457,7 +5455,7 @@ static int lpfc_idiag_cmd_get(const char __user *buf, size_t nbytes, phba->nvmeio_trc_size = lpfc_debugfs_max_nvmeio_trc; /* Allocate trace buffer and initialize */ - phba->nvmeio_trc = kmalloc( + phba->nvmeio_trc = kzalloc( (sizeof(struct lpfc_debugfs_nvmeio_trc) * phba->nvmeio_trc_size), GFP_KERNEL); @@ -5467,9 +5465,6 @@ static int lpfc_idiag_cmd_get(const char __user *buf, size_t nbytes, "nvmeio_trc buffer\n"); goto nvmeio_off; } - memset(phba->nvmeio_trc, 0, - (sizeof(struct lpfc_debugfs_nvmeio_trc) * - phba->nvmeio_trc_size)); phba->nvmeio_trc_on = 1; phba->nvmeio_trc_output_idx = 0; phba->nvmeio_trc = NULL; looks good. Signed-off-by: James Smart
Re: [PATCH] scsi: lpfc: Fix a precedence bug in lpfc_nvme_io_cmd_wqe_cmpl()
On 10/12/2017 1:30 PM, Dan Carpenter wrote: The ! has higher precedence than the & operation. I've added parenthesis so this works as intended. Fixes: 952c303b329c ("scsi: lpfc: Ensure io aborts interlocked with the target.") Signed-off-by: Dan Carpenterdiff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 60f0dbd0f192..517ae570e507 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -948,7 +948,7 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, /* NVME targets need completion held off until the abort exchange * completes. */ - if (!lpfc_ncmd->flags & LPFC_SBUF_XBUSY) + if (!(lpfc_ncmd->flags & LPFC_SBUF_XBUSY)) nCmd->done(nCmd); spin_lock_irqsave(>hbalock, flags); yep Signed-off-by: James Smart
Re: [PATCH] scsi: megaraid_sas: fix spelling mistake: "thershold" -> "threshold"
Colin, > Trivial fix to spelling mistake in dev_info message Applied to 4.15/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 1/2] scsi: megaraid: Remove redundant code in megasas_alloc_cmds
Yisheng, > megasas_alloc_cmds is to alloc cmd_list of instance instead of fusion, > and fusion is useless in this function. Just remove it. Applied to 4.15/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
Himanshu, > Just a reminder, is my patch in our queue ? It is not. It needs a review/ack from the driver maintainers. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi: hisi_sas: select CONFIG_RAS
John, > Actually this interface is intended for logging UEFI CPER non-standard > records from kernel RAS/APEI framework to userspace. It is not intended > for kernel peripheral driver logging (like this case). Until we get a > community concensus on whether this is acceptable, I would rather revert > the original patch. OK, dropped it for now. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v2] scsi: be2iscsi: Use kasprintf
On Wed, Oct 11, 2017 at 09:06:14PM +0530, Himanshu Jha wrote: Hi James, Just a reminder, is my patch in our queue ? Thanks Himanshu Jha > Use kasprintf instead of combination of kmalloc and sprintf. > Also, remove BEISCSI_MSI_NAME macro used to specify size of string as > kasprintf handles size computations. > > Signed-off-by: Himanshu Jha> --- > v2: >-remove the unnecessary macro BEISCSI_MSI_NAME. > > drivers/scsi/be2iscsi/be_main.c | 12 +--- > drivers/scsi/be2iscsi/be_main.h | 2 -- > 2 files changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c > index b4542e7..6a9ee0e 100644 > --- a/drivers/scsi/be2iscsi/be_main.c > +++ b/drivers/scsi/be2iscsi/be_main.c > @@ -803,15 +803,14 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) > > if (pcidev->msix_enabled) { > for (i = 0; i < phba->num_cpus; i++) { > - phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, > - GFP_KERNEL); > + phba->msi_name[i] = kasprintf(GFP_KERNEL, > + "beiscsi_%02x_%02x", > + phba->shost->host_no, i); > if (!phba->msi_name[i]) { > ret = -ENOMEM; > goto free_msix_irqs; > } > > - sprintf(phba->msi_name[i], "beiscsi_%02x_%02x", > - phba->shost->host_no, i); > ret = request_irq(pci_irq_vector(pcidev, i), > be_isr_msix, 0, phba->msi_name[i], > _context->be_eq[i]); > @@ -824,13 +823,12 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) > goto free_msix_irqs; > } > } > - phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, GFP_KERNEL); > + phba->msi_name[i] = kasprintf(GFP_KERNEL, "beiscsi_mcc_%02x", > + phba->shost->host_no); > if (!phba->msi_name[i]) { > ret = -ENOMEM; > goto free_msix_irqs; > } > - sprintf(phba->msi_name[i], "beiscsi_mcc_%02x", > - phba->shost->host_no); > ret = request_irq(pci_irq_vector(pcidev, i), be_isr_mcc, 0, > phba->msi_name[i], _context->be_eq[i]); > if (ret) { > diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h > index 81ce3ff..8166de5 100644 > --- a/drivers/scsi/be2iscsi/be_main.h > +++ b/drivers/scsi/be2iscsi/be_main.h > @@ -155,8 +155,6 @@ > #define PAGES_REQUIRED(x) \ > ((x < PAGE_SIZE) ? 1 : ((x + PAGE_SIZE - 1) / PAGE_SIZE)) > > -#define BEISCSI_MSI_NAME 20 /* size of msi_name string */ > - > #define MEM_DESCR_OFFSET 8 > #define BEISCSI_DEFQ_HDR 1 > #define BEISCSI_DEFQ_DATA 0 > -- > 2.7.4 >
Re: [PATCH v2] ata: fixes kernel crash while tracing ata_eh_link_autopsy event
On Thu, Nov 02, 2017 at 04:31:07PM +0530, Rameshwar Prasad Sahu wrote: > When tracing ata link error event, the kernel crashes when the disk is > removed due to NULL pointer access by trace_ata_eh_link_autopsy API. > This occurs as the dev is NULL when the disk disappeared. This patch > fixes this crash by calling trace_ata_eh_link_autopsy only if "dev" > is not NULL. > > v2 changes: > Removed direct passing "link" pointer instead of "dev" in trace API. > > Signed-off-by: Rameshwar Prasad SahuApplied to libata/for-4.15. Thanks. -- tejun
Re: [PATCH] scsi: hisi_sas: select CONFIG_RAS
On 03/11/2017 10:19, Arnd Bergmann wrote: On Fri, Nov 3, 2017 at 11:14 AM, John Garrywrote: + Shiju, who authored the original patch index d42f29a5eb65..6ad8a6251d21 100644 --- a/drivers/scsi/hisi_sas/Kconfig +++ b/drivers/scsi/hisi_sas/Kconfig @@ -4,6 +4,7 @@ config SCSI_HISI_SAS depends on ARM64 || COMPILE_TEST select SCSI_SAS_LIBSAS select BLK_DEV_INTEGRITY + select RAS My impression is that we don't want this. Correction: shouldn't want this. Do you have the .config for the broken build? I couldn't recreate this by turning off CONFIG_RAS. Uploaded to https://pastebin.com/A1rJYhDr Maybe you were missing support for tracing in your configuration? Thanks Arnd, I can see it now. However, as you said, it looks like this interface is not being used correctly, and I tend to agree. Actually this interface is intended for logging UEFI CPER non-standard records from kernel RAS/APEI framework to userspace. It is not intended for kernel peripheral driver logging (like this case). Until we get a community concensus on whether this is acceptable, I would rather revert the original patch. Thanks, John Arnd .
Re: mptsas driver cannot detect hotplugging disk with the LSI SCSI SAS1068 controller in Ubuntu guest on VMware
On Fri, Nov 3, 2017 at 6:59 PM, Hannes Reineckewrote: > On 11/03/2017 04:38 AM, Gavin Guo wrote: >> On Sat, Oct 28, 2017 at 11:35 AM, Gavin Guo wrote: >>> On Fri, Oct 27, 2017 at 10:53 PM, Hannes Reinecke wrote: On 10/27/2017 04:02 PM, Gavin Guo wrote: > Hi Hannes, > > Thank you for looking into the issue. If there is anything I can help > to test the patch? I appreciate your help. Thank you. > If you had checked linux-scsi you would have found this patch: '[PATCH] mptsas: Fixup device hotplug for VMWare ESXi', which I guess is already scheduled for inclusion in 4.14. Anything else I could help you with? Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) >>> >>> Really appreciate your help. I will proceed the testing and keep you posted. >> >> Hello Hannes, >> >> I've tested the MPT SAS device controller, the patch works perfectly. >> However, the MPT SPI still cannot work with the hotplugging. The lspci >> of the LSI SPI device is listed: >> >> 00:10.0 SCSI storage controller [0100]: LSI Logic / Symbios Logic >> 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI [1000:0030] (rev 01) >> Subsystem: VMware LSI Logic Parallel SCSI Controller [15ad:1976] >> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- >> ParErr- Stepping- SERR- FastB2B- DisINTx- >> Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >>> TAbort- SERR- > Latency: 64 (1500ns min, 63750ns max) >> Interrupt: pin A routed to IRQ 17 >> Region 0: I/O ports at 1400 [size=256] >> Region 1: Memory at feba (64-bit, non-prefetchable) [size=128K] >> Region 3: Memory at febc (64-bit, non-prefetchable) [size=128K] >> [virtual] Expansion ROM at 40008000 [disabled] [size=16K] >> Kernel driver in use: mptspi >> >> The vendor id/device id[1000:0030] can also be found in the >> mptspi_pci_table(drivers/message/fusion/mptspi.c). >> >> PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_53C1030 >> >> If there is anything I missed in the testing? I appreciate your help. >> > Don't. Ever. Try. > > SCSI Parallel hotplugging is so loosely defined that essentially every > vendor can (and did!) implement their own thing, and _still_ be spec > compliant. > Plus there is no guarantee that we even see events when a hot-add > occurs. So any thingie we put in here has a really high chance of > breaking other installations. > I wouldn't even bother to attempt this; it's virtualized anyway so you > can as well switch to the SAS emulation here. > Or use a different SCSI parallel emulation like the Symbios/LSI 53c800 one. > > Cheers, > > Hannes > -- > Dr. Hannes ReineckeTeamlead Storage & Networking > h...@suse.de +49 911 74053 688 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton > HRB 21284 (AG Nürnberg) Hello Hannes, I totally understood your concern and appreciate your help again on the hotplugging patch for MPT SAS controller. :)
Re: mptsas driver cannot detect hotplugging disk with the LSI SCSI SAS1068 controller in Ubuntu guest on VMware
On 11/03/2017 04:38 AM, Gavin Guo wrote: > On Sat, Oct 28, 2017 at 11:35 AM, Gavin Guowrote: >> On Fri, Oct 27, 2017 at 10:53 PM, Hannes Reinecke wrote: >>> On 10/27/2017 04:02 PM, Gavin Guo wrote: Hi Hannes, Thank you for looking into the issue. If there is anything I can help to test the patch? I appreciate your help. Thank you. >>> If you had checked linux-scsi you would have found this patch: >>> '[PATCH] mptsas: Fixup device hotplug for VMWare ESXi', which I guess is >>> already scheduled for inclusion in 4.14. >>> Anything else I could help you with? >>> >>> Cheers, >>> >>> Hannes >>> -- >>> Dr. Hannes ReineckeTeamlead Storage & Networking >>> h...@suse.de +49 911 74053 688 >>> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg >>> GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton >>> HRB 21284 (AG Nürnberg) >> >> Really appreciate your help. I will proceed the testing and keep you posted. > > Hello Hannes, > > I've tested the MPT SAS device controller, the patch works perfectly. > However, the MPT SPI still cannot work with the hotplugging. The lspci > of the LSI SPI device is listed: > > 00:10.0 SCSI storage controller [0100]: LSI Logic / Symbios Logic > 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI [1000:0030] (rev 01) > Subsystem: VMware LSI Logic Parallel SCSI Controller [15ad:1976] > Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- > ParErr- Stepping- SERR- FastB2B- DisINTx- > Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >> TAbort- SERR- Latency: 64 (1500ns min, 63750ns max) > Interrupt: pin A routed to IRQ 17 > Region 0: I/O ports at 1400 [size=256] > Region 1: Memory at feba (64-bit, non-prefetchable) [size=128K] > Region 3: Memory at febc (64-bit, non-prefetchable) [size=128K] > [virtual] Expansion ROM at 40008000 [disabled] [size=16K] > Kernel driver in use: mptspi > > The vendor id/device id[1000:0030] can also be found in the > mptspi_pci_table(drivers/message/fusion/mptspi.c). > > PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_53C1030 > > If there is anything I missed in the testing? I appreciate your help. > Don't. Ever. Try. SCSI Parallel hotplugging is so loosely defined that essentially every vendor can (and did!) implement their own thing, and _still_ be spec compliant. Plus there is no guarantee that we even see events when a hot-add occurs. So any thingie we put in here has a really high chance of breaking other installations. I wouldn't even bother to attempt this; it's virtualized anyway so you can as well switch to the SAS emulation here. Or use a different SCSI parallel emulation like the Symbios/LSI 53c800 one. Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH] scsi: hisi_sas: select CONFIG_RAS
On Fri, Nov 3, 2017 at 11:14 AM, John Garrywrote: > + Shiju, who authored the original patch > >> index d42f29a5eb65..6ad8a6251d21 100644 >> --- a/drivers/scsi/hisi_sas/Kconfig >> +++ b/drivers/scsi/hisi_sas/Kconfig >> @@ -4,6 +4,7 @@ config SCSI_HISI_SAS >> depends on ARM64 || COMPILE_TEST >> select SCSI_SAS_LIBSAS >> select BLK_DEV_INTEGRITY >> + select RAS > > > My impression is that we don't want this. Correction: shouldn't want this. > > Do you have the .config for the broken build? I couldn't recreate this by > turning off CONFIG_RAS. Uploaded to https://pastebin.com/A1rJYhDr Maybe you were missing support for tracing in your configuration? Arnd
Re: [PATCH] scsi: hisi_sas: select CONFIG_RAS
+ Shiju, who authored the original patch Hi Arnd, Thanks for this. On 02/11/2017 16:50, Arnd Bergmann wrote: The driver now uses the RAS infrastructure, and fails to link if that is disabled: drivers/scsi/hisi_sas/hisi_sas_v2_hw.o: In function `fatal_ecc_int_v2_hw': hisi_sas_v2_hw.c:(.text+0xb08): undefined reference to `__tracepoint_non_standard_event' drivers/scsi/hisi_sas/hisi_sas_v2_hw.o: In function `fatal_axi_int_v2_hw': hisi_sas_v2_hw.c:(.text+0x1b34): undefined reference to `__tracepoint_non_standard_event' This adds an explicit Kconfig 'select RAS' statement. I don't know if the driver uses the interface correctly, as no other driver seems to do it like this, but the change fixes the link error. Fixes: dfeb5021f001 ("scsi: hisi_sas: report ECC and AXI errors in v2 hw to userspace") Signed-off-by: Arnd Bergmann--- drivers/scsi/hisi_sas/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig index d42f29a5eb65..6ad8a6251d21 100644 --- a/drivers/scsi/hisi_sas/Kconfig +++ b/drivers/scsi/hisi_sas/Kconfig @@ -4,6 +4,7 @@ config SCSI_HISI_SAS depends on ARM64 || COMPILE_TEST select SCSI_SAS_LIBSAS select BLK_DEV_INTEGRITY + select RAS My impression is that we don't want this. Correction: shouldn't want this. Do you have the .config for the broken build? I couldn't recreate this by turning off CONFIG_RAS. John depends on ATA help This driver supports HiSilicon's SAS HBA, including support based
Re: [PATCH V9 1/4] dma-mapping: Rework dma_get_cache_alignment()
Only patch 4 can be merged to stable, please ignore cc-stable in the rest. -- Original -- From: "Christoph Hellwig"; Date: Fri, Nov 3, 2017 01:14 PM To: "陈华才" ; Cc: "Marek Szyprowski" ; "Christoph Hellwig" ; "Robin Murphy" ; "Andrew Morton" ; "Fuxin Zhang" ; "linux-kernel" ; "Ralf Baechle" ; "JamesHogan" ; "linux-mips" ; "James E . J .Bottomley" ; "Martin K . Petersen" ; "linux-scsi" ; "stable" ; "Michael S . Tsirkin" ; "Pawel Osciak" ; "Kyungmin Park" ; "Michael Chan" ; "Benjamin Herrenschmidt" ; "Ivan Mikhaylov" ; "Tariq Toukan" ; "Andy Gross" ; "Mark A . Greer" ; "RobertBaldyga" ; Subject: Re: [PATCH V9 1/4] dma-mapping: Rework dma_get_cache_alignment() I can queue 1 up in the dma-mapping tree, and if I get reviews for the mips and scsi bits I'd be happy to queue those up as well. But I think you'd be better off moving patches 3 and 4 to the front without the dma_get_cache_alignment prototype change so that they can be merged to stable.