From: Greg Kroah-Hartman Date: Thu, 24 May 2018 08:17:13 +0000 (+0200) Subject: 4.16-stable patches X-Git-Tag: v3.18.110~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8228cb54c94bdebb40732fdc7fa987813d6329b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.16-stable patches added patches: scsi-aacraid-insure-command-thread-is-not-recursively-stopped.patch scsi-core-make-scsi-status-condition-met-equivalent-to-good.patch scsi-devinfo-add-hp-disk-subsystem-device-for-hp-xp-arrays.patch scsi-lpfc-fix-frequency-of-release-wqe-cqes.patch scsi-lpfc-fix-io-failure-during-hba-reset-testing-with-nvme-io.patch scsi-lpfc-fix-issue_lip-if-link-is-disabled.patch scsi-lpfc-fix-nonrecovery-of-nvme-controller-after-cable-swap.patch scsi-lpfc-fix-nvme-initiator-firstburst.patch scsi-lpfc-fix-soft-lockup-in-lpfc-worker-thread-during-lip-testing.patch scsi-mvsas-fix-wrong-endianness-of-sgpio-api.patch --- diff --git a/queue-4.16/scsi-aacraid-insure-command-thread-is-not-recursively-stopped.patch b/queue-4.16/scsi-aacraid-insure-command-thread-is-not-recursively-stopped.patch new file mode 100644 index 00000000000..ab1b8b54ff7 --- /dev/null +++ b/queue-4.16/scsi-aacraid-insure-command-thread-is-not-recursively-stopped.patch @@ -0,0 +1,89 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: Dave Carroll +Date: Tue, 3 Apr 2018 15:50:42 -0600 +Subject: scsi: aacraid: Insure command thread is not recursively stopped + +From: Dave Carroll + +[ Upstream commit 1c6b41fb92936fa5facea464d5d7cbf855966d04 ] + +If a recursive IOP_RESET is invoked, usually due to the eh_thread +handling errors after the first reset, be sure we flag that the command +thread has been stopped to avoid an Oops of the form; + + [ 336.620256] CPU: 28 PID: 1193 Comm: scsi_eh_0 Kdump: loaded Not tainted 4.14.0-49.el7a.ppc64le #1 + [ 336.620297] task: c000003fd630b800 task.stack: c000003fd61a4000 + [ 336.620326] NIP: c000000000176794 LR: c00000000013038c CTR: c00000000024bc10 + [ 336.620361] REGS: c000003fd61a7720 TRAP: 0300 Not tainted (4.14.0-49.el7a.ppc64le) + [ 336.620395] MSR: 9000000000009033 CR: 22084022 XER: 20040000 + [ 336.620435] CFAR: c000000000130388 DAR: 0000000000000000 DSISR: 40000000 SOFTE: 1 + [ 336.620435] GPR00: c00000000013038c c000003fd61a79a0 c0000000014c7e00 0000000000000000 + [ 336.620435] GPR04: 000000000000000c 000000000000000c 9000000000009033 0000000000000477 + [ 336.620435] GPR08: 0000000000000477 0000000000000000 0000000000000000 c008000010f7d940 + [ 336.620435] GPR12: c00000000024bc10 c000000007a33400 c0000000001708a8 c000003fe3b881d8 + [ 336.620435] GPR16: c000003fe3b88060 c000003fd61a7d10 fffffffffffff000 000000000000001e + [ 336.620435] GPR20: 0000000000000001 c000000000ebf1a0 0000000000000001 c000003fe3b88000 + [ 336.620435] GPR24: 0000000000000003 0000000000000002 c000003fe3b88840 c000003fe3b887e8 + [ 336.620435] GPR28: c000003fe3b88000 c000003fc8181788 0000000000000000 c000003fc8181700 + [ 336.620750] NIP [c000000000176794] exit_creds+0x34/0x160 + [ 336.620775] LR [c00000000013038c] __put_task_struct+0x8c/0x1f0 + [ 336.620804] Call Trace: + [ 336.620817] [c000003fd61a79a0] [c000003fe3b88000] 0xc000003fe3b88000 (unreliable) + [ 336.620853] [c000003fd61a79d0] [c00000000013038c] __put_task_struct+0x8c/0x1f0 + [ 336.620889] [c000003fd61a7a00] [c000000000171418] kthread_stop+0x1e8/0x1f0 + [ 336.620922] [c000003fd61a7a40] [c008000010f7448c] aac_reset_adapter+0x14c/0x8d0 [aacraid] + [ 336.620959] [c000003fd61a7b00] [c008000010f60174] aac_eh_host_reset+0x84/0x100 [aacraid] + [ 336.621010] [c000003fd61a7b30] [c000000000864f24] scsi_try_host_reset+0x74/0x180 + [ 336.621046] [c000003fd61a7bb0] [c000000000867ac0] scsi_eh_ready_devs+0xc00/0x14d0 + [ 336.625165] [c000003fd61a7ca0] [c0000000008699e0] scsi_error_handler+0x550/0x730 + [ 336.632101] [c000003fd61a7dc0] [c000000000170a08] kthread+0x168/0x1b0 + [ 336.639031] [c000003fd61a7e30] [c00000000000b528] ret_from_kernel_thread+0x5c/0xb4 + [ 336.645971] Instruction dump: + [ 336.648743] 384216a0 7c0802a6 fbe1fff8 f8010010 f821ffd1 7c7f1b78 60000000 60000000 + [ 336.657056] 39400000 e87f0838 f95f0838 7c0004ac <7d401828> 314affff 7d40192d 40c2fff4 + [ 336.663997] -[ end trace 4640cf8d4945ad95 ]- + +So flag when the thread is stopped by setting the thread pointer to NULL. + +Signed-off-by: Dave Carroll +Reviewed-by: Raghava Aditya Renukunta +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/aacraid/commsup.c | 4 +++- + drivers/scsi/aacraid/linit.c | 1 + + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/aacraid/commsup.c ++++ b/drivers/scsi/aacraid/commsup.c +@@ -1502,9 +1502,10 @@ static int _aac_reset_adapter(struct aac + host = aac->scsi_host_ptr; + scsi_block_requests(host); + aac_adapter_disable_int(aac); +- if (aac->thread->pid != current->pid) { ++ if (aac->thread && aac->thread->pid != current->pid) { + spin_unlock_irq(host->host_lock); + kthread_stop(aac->thread); ++ aac->thread = NULL; + jafo = 1; + } + +@@ -1591,6 +1592,7 @@ static int _aac_reset_adapter(struct aac + aac->name); + if (IS_ERR(aac->thread)) { + retval = PTR_ERR(aac->thread); ++ aac->thread = NULL; + goto out; + } + } +--- a/drivers/scsi/aacraid/linit.c ++++ b/drivers/scsi/aacraid/linit.c +@@ -1562,6 +1562,7 @@ static void __aac_shutdown(struct aac_de + up(&fib->event_wait); + } + kthread_stop(aac->thread); ++ aac->thread = NULL; + } + + aac_send_shutdown(aac); diff --git a/queue-4.16/scsi-core-make-scsi-status-condition-met-equivalent-to-good.patch b/queue-4.16/scsi-core-make-scsi-status-condition-met-equivalent-to-good.patch new file mode 100644 index 00000000000..c787f6cf7ab --- /dev/null +++ b/queue-4.16/scsi-core-make-scsi-status-condition-met-equivalent-to-good.patch @@ -0,0 +1,62 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: Douglas Gilbert +Date: Tue, 6 Mar 2018 22:19:49 -0500 +Subject: scsi: core: Make SCSI Status CONDITION MET equivalent to GOOD + +From: Douglas Gilbert + +[ Upstream commit 1875ede02ed5e176a18dccbca84abc28d5b3e141 ] + +The SCSI PRE-FETCH (10 or 16) command is present both on hard disks +and some SSDs. It is useful when the address of the next block(s) to +be read is known but it is not following the LBA of the current READ +(so read-ahead won't help). It returns two "good" SCSI Status values. +If the requested blocks have fitted (or will most likely fit (when +the IMMED bit is set)) into the disk's cache, it returns CONDITION +MET. If it didn't (or will not) fit then it returns GOOD status. + +The goal of this patch is to stop the SCSI subsystem treating the +CONDITION MET SCSI status as an error. The current state makes the +PRE-FETCH command effectively unusable via pass-throughs. + +Signed-off-by: Douglas Gilbert +Reviewed-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/scsi_lib.c | 11 +++++++++++ + include/scsi/scsi.h | 2 ++ + 2 files changed, 13 insertions(+) + +--- a/drivers/scsi/scsi_lib.c ++++ b/drivers/scsi/scsi_lib.c +@@ -856,6 +856,17 @@ void scsi_io_completion(struct scsi_cmnd + /* for passthrough error may be set */ + error = BLK_STS_OK; + } ++ /* ++ * Another corner case: the SCSI status byte is non-zero but 'good'. ++ * Example: PRE-FETCH command returns SAM_STAT_CONDITION_MET when ++ * it is able to fit nominated LBs in its cache (and SAM_STAT_GOOD ++ * if it can't fit). Treat SAM_STAT_CONDITION_MET and the related ++ * intermediate statuses (both obsolete in SAM-4) as good. ++ */ ++ if (status_byte(result) && scsi_status_is_good(result)) { ++ result = 0; ++ error = BLK_STS_OK; ++ } + + /* + * special case: failed zero length commands always need to +--- a/include/scsi/scsi.h ++++ b/include/scsi/scsi.h +@@ -47,6 +47,8 @@ static inline int scsi_status_is_good(in + */ + status &= 0xfe; + return ((status == SAM_STAT_GOOD) || ++ (status == SAM_STAT_CONDITION_MET) || ++ /* Next two "intermediate" statuses are obsolete in SAM-4 */ + (status == SAM_STAT_INTERMEDIATE) || + (status == SAM_STAT_INTERMEDIATE_CONDITION_MET) || + /* FIXME: this is obsolete in SAM-3 */ diff --git a/queue-4.16/scsi-devinfo-add-hp-disk-subsystem-device-for-hp-xp-arrays.patch b/queue-4.16/scsi-devinfo-add-hp-disk-subsystem-device-for-hp-xp-arrays.patch new file mode 100644 index 00000000000..09e0f11865c --- /dev/null +++ b/queue-4.16/scsi-devinfo-add-hp-disk-subsystem-device-for-hp-xp-arrays.patch @@ -0,0 +1,43 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: Xose Vazquez Perez +Date: Thu, 15 Mar 2018 18:32:01 +0100 +Subject: scsi: devinfo: add HP DISK-SUBSYSTEM device, for HP XP arrays + +From: Xose Vazquez Perez + +[ Upstream commit 5f96f42b76e00e2871033745ff029056cc725c76 ] + +"The DISK-SUBSYSTEM is a special model name returned when LUs +are not installed. For example, when LU#0 is not installed in "OPEN-" +models, LU#0 is detected as the DISK-SUBSYSTEM model": +https://marc.info/?l=linux-scsi&m=125424006417825 + +It's missing for HP XP rebranded arrays, "HP"/"OPEN-". +Only the HITACHI one is present: +13f7e5acc8b329080672c13f05f252ace5b79825 +627511e3e67553b04f6917c03e39b797df210e04 + +Cc: Anthony Cheung +Cc: Takahiro Yasui +Cc: Matthias Rudolph +Cc: Martin K. Petersen +Cc: James E.J. Bottomley +Cc: SCSI ML +Signed-off-by: Xose Vazquez Perez +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/scsi_devinfo.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/scsi/scsi_devinfo.c ++++ b/drivers/scsi/scsi_devinfo.c +@@ -189,6 +189,7 @@ static struct { + {"HP", "C5713A", NULL, BLIST_NOREPORTLUN}, + {"HP", "DF400", "*", BLIST_REPORTLUN2}, + {"HP", "DF500", "*", BLIST_REPORTLUN2}, ++ {"HP", "DISK-SUBSYSTEM", "*", BLIST_REPORTLUN2}, + {"HP", "OP-C-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"HP", "3380-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"HP", "3390-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, diff --git a/queue-4.16/scsi-lpfc-fix-frequency-of-release-wqe-cqes.patch b/queue-4.16/scsi-lpfc-fix-frequency-of-release-wqe-cqes.patch new file mode 100644 index 00000000000..adfb8e2c6c0 --- /dev/null +++ b/queue-4.16/scsi-lpfc-fix-frequency-of-release-wqe-cqes.patch @@ -0,0 +1,41 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: James Smart +Date: Tue, 30 Jan 2018 15:58:45 -0800 +Subject: scsi: lpfc: Fix frequency of Release WQE CQEs + +From: James Smart + +[ Upstream commit 04673e38f56b30cd39b1fa0f386137d818b17781 ] + +The driver controls when the hardware sends completions that communicate +consumption of elements from the WQ. This is done by setting a WQEC bit +on a WQE. + +The current driver sets it on every Nth WQE posting. However, the driver +isn't clearing the bit if the WQE is reused. Thus, if the queue depth +isn't evenly divisible by N, with enough time, it can be set on every +element, creating a lot of overhead and risking CQ full conditions. + +Correct by clearing the bit when not setting it on an Nth element. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_sli.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -129,6 +129,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, u + /* set consumption flag every once in a while */ + if (!((q->host_index + 1) % q->entry_repost)) + bf_set(wqe_wqec, &wqe->generic.wqe_com, 1); ++ else ++ bf_set(wqe_wqec, &wqe->generic.wqe_com, 0); + if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED) + bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id); + lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size); diff --git a/queue-4.16/scsi-lpfc-fix-io-failure-during-hba-reset-testing-with-nvme-io.patch b/queue-4.16/scsi-lpfc-fix-io-failure-during-hba-reset-testing-with-nvme-io.patch new file mode 100644 index 00000000000..999e235fa37 --- /dev/null +++ b/queue-4.16/scsi-lpfc-fix-io-failure-during-hba-reset-testing-with-nvme-io.patch @@ -0,0 +1,56 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: James Smart +Date: Tue, 30 Jan 2018 15:58:51 -0800 +Subject: scsi: lpfc: Fix IO failure during hba reset testing with nvme io. + +From: James Smart + +[ Upstream commit 91455b850956bc13708a074bd1400f54aae74890 ] + +A stress test repeatedly resetting the adapter while performing io would +eventually report I/O failures and missing nvme namespaces. + +The driver was setting the nvmefc_fcp_req->private pointer to NULL +during the IO completion routine before upcalling done(). If the +transport was also running an abort for that IO, the driver would fail +the abort with message 6140. Failing the abort is not allowed by the +nvme-fc transport, as it mandates that the io must be returned back to +the transport. As that does not happen, the transport controller delete +has an outstanding reference and can't complete teardown. + +The NULL-ing of the private pointer should be done only when the io is +considered complete. It's complete when the adapter returns the exchange +with the "exchange busy" flag clear. + +Move the NULL'ing of the structure to the done case. This leaves the io +contexts set while it is busy and until the subsequent XRI_ABORTED +completion which returns the exchange is received. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_nvme.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_nvme.c ++++ b/drivers/scsi/lpfc/lpfc_nvme.c +@@ -982,14 +982,14 @@ out_err: + phba->cpucheck_cmpl_io[lpfc_ncmd->cpu]++; + } + #endif +- freqpriv = nCmd->private; +- freqpriv->nvme_buf = NULL; + + /* NVME targets need completion held off until the abort exchange + * completes unless the NVME Rport is getting unregistered. + */ + + if (!(lpfc_ncmd->flags & LPFC_SBUF_XBUSY)) { ++ freqpriv = nCmd->private; ++ freqpriv->nvme_buf = NULL; + nCmd->done(nCmd); + lpfc_ncmd->nvmeCmd = NULL; + } diff --git a/queue-4.16/scsi-lpfc-fix-issue_lip-if-link-is-disabled.patch b/queue-4.16/scsi-lpfc-fix-issue_lip-if-link-is-disabled.patch new file mode 100644 index 00000000000..ff721b3473e --- /dev/null +++ b/queue-4.16/scsi-lpfc-fix-issue_lip-if-link-is-disabled.patch @@ -0,0 +1,37 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: James Smart +Date: Tue, 30 Jan 2018 15:58:55 -0800 +Subject: scsi: lpfc: Fix issue_lip if link is disabled + +From: James Smart + +[ Upstream commit 2289e9598dde9705400559ca2606fb8c145c34f0 ] + +The driver ignored checks on whether the link should be kept +administratively down after a link bounce. Correct the checks. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_attr.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -905,7 +905,12 @@ lpfc_issue_lip(struct Scsi_Host *shost) + LPFC_MBOXQ_t *pmboxq; + int mbxstatus = MBXERR_ERROR; + ++ /* ++ * If the link is offline, disabled or BLOCK_MGMT_IO ++ * it doesn't make any sense to allow issue_lip ++ */ + if ((vport->fc_flag & FC_OFFLINE_MODE) || ++ (phba->hba_flag & LINK_DISABLED) || + (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO)) + return -EPERM; + diff --git a/queue-4.16/scsi-lpfc-fix-nonrecovery-of-nvme-controller-after-cable-swap.patch b/queue-4.16/scsi-lpfc-fix-nonrecovery-of-nvme-controller-after-cable-swap.patch new file mode 100644 index 00000000000..7e53f1d74d1 --- /dev/null +++ b/queue-4.16/scsi-lpfc-fix-nonrecovery-of-nvme-controller-after-cable-swap.patch @@ -0,0 +1,112 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: James Smart +Date: Tue, 30 Jan 2018 15:59:01 -0800 +Subject: scsi: lpfc: Fix nonrecovery of NVME controller after cable swap. + +From: James Smart + +[ Upstream commit 815a9c437617e221842d12b3366ff6911b3df628 ] + +In a test that is doing large numbers of cable swaps on the target, the +nvme controllers wouldn't reconnect. + +During the cable swaps, the targets n_port_id would change. This +information was passed to the nvme-fc transport, in the new remoteport +registration. However, the nvme-fc transport didn't update the n_port_id +value in the remoteport struct when it reused an existing structure. +Later, when a new association was attempted on the remoteport, the +driver's NVME LS routine would use the stale n_port_id from the +remoteport struct to address the LS. As the device is no longer at that +address, the LS would go into never never land. + +Separately, the nvme-fc transport will be corrected to update the +n_port_id value on a re-registration. + +However, for now, there's no reason to use the transports values. The +private pointer points to the drivers node structure and the node +structure is up to date. Therefore, revise the LS routine to use the +drivers data structures for the LS. Augmented the debug message for +better debugging in the future. + +Also removed a duplicate if check that seems to have slipped in. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_nvme.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_nvme.c ++++ b/drivers/scsi/lpfc/lpfc_nvme.c +@@ -241,10 +241,11 @@ lpfc_nvme_cmpl_gen_req(struct lpfc_hba * + ndlp = (struct lpfc_nodelist *)cmdwqe->context1; + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, + "6047 nvme cmpl Enter " +- "Data %p DID %x Xri: %x status %x cmd:%p lsreg:%p " +- "bmp:%p ndlp:%p\n", ++ "Data %p DID %x Xri: %x status %x reason x%x cmd:%p " ++ "lsreg:%p bmp:%p ndlp:%p\n", + pnvme_lsreq, ndlp ? ndlp->nlp_DID : 0, + cmdwqe->sli4_xritag, status, ++ (wcqe->parameter & 0xffff), + cmdwqe, pnvme_lsreq, cmdwqe->context3, ndlp); + + lpfc_nvmeio_data(phba, "NVME LS CMPL: xri x%x stat x%x parm x%x\n", +@@ -419,6 +420,7 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po + { + int ret = 0; + struct lpfc_nvme_lport *lport; ++ struct lpfc_nvme_rport *rport; + struct lpfc_vport *vport; + struct lpfc_nodelist *ndlp; + struct ulp_bde64 *bpl; +@@ -437,19 +439,18 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po + */ + + lport = (struct lpfc_nvme_lport *)pnvme_lport->private; ++ rport = (struct lpfc_nvme_rport *)pnvme_rport->private; + vport = lport->vport; + + 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); ++ /* Need the ndlp. It is stored in the driver's rport. */ ++ ndlp = rport->ndlp; + if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE | LOG_NVME_IOERR, +- "6051 DID x%06x not an active rport.\n", +- pnvme_rport->port_id); ++ "6051 Remoteport %p, rport has invalid ndlp. " ++ "Failing LS Req\n", pnvme_rport); + return -ENODEV; + } + +@@ -500,8 +501,9 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po + + /* Expand print to include key fields. */ + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, +- "6149 ENTER. lport %p, rport %p lsreq%p rqstlen:%d " +- "rsplen:%d %pad %pad\n", ++ "6149 Issue LS Req to DID 0x%06x lport %p, rport %p " ++ "lsreq%p rqstlen:%d rsplen:%d %pad %pad\n", ++ ndlp->nlp_DID, + pnvme_lport, pnvme_rport, + pnvme_lsreq, pnvme_lsreq->rqstlen, + pnvme_lsreq->rsplen, &pnvme_lsreq->rqstdma, +@@ -517,7 +519,7 @@ lpfc_nvme_ls_req(struct nvme_fc_local_po + ndlp, 2, 30, 0); + if (ret != WQE_SUCCESS) { + atomic_inc(&lport->xmt_ls_err); +- lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, ++ lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC, + "6052 EXIT. issue ls wqe failed lport %p, " + "rport %p lsreq%p Status %x DID %x\n", + pnvme_lport, pnvme_rport, pnvme_lsreq, diff --git a/queue-4.16/scsi-lpfc-fix-nvme-initiator-firstburst.patch b/queue-4.16/scsi-lpfc-fix-nvme-initiator-firstburst.patch new file mode 100644 index 00000000000..33aab944ebf --- /dev/null +++ b/queue-4.16/scsi-lpfc-fix-nvme-initiator-firstburst.patch @@ -0,0 +1,66 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: James Smart +Date: Mon, 5 Mar 2018 12:04:02 -0800 +Subject: scsi: lpfc: Fix NVME Initiator FirstBurst + +From: James Smart + +[ Upstream commit 0709263abe0de70a798dcdf481d5dd489ca4752e ] + +First Burst support was not properly indicated in NVMe PRLI. + +Correct the bit position and the logic to check and set first burst support. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_nportdisc.c | 15 ++++++++++++++- + drivers/scsi/lpfc/lpfc_nvme.h | 2 ++ + 2 files changed, 16 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c +@@ -1998,8 +1998,14 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vp + ndlp->nlp_type |= NLP_NVME_TARGET; + if (bf_get_be32(prli_disc, nvpr)) + ndlp->nlp_type |= NLP_NVME_DISCOVERY; ++ ++ /* ++ * If prli_fba is set, the Target supports FirstBurst. ++ * If prli_fb_sz is 0, the FirstBurst size is unlimited, ++ * otherwise it defines the actual size supported by ++ * the NVME Target. ++ */ + if ((bf_get_be32(prli_fba, nvpr) == 1) && +- (bf_get_be32(prli_fb_sz, nvpr) > 0) && + (phba->cfg_nvme_enable_fb) && + (!phba->nvmet_support)) { + /* Both sides support FB. The target's first +@@ -2008,6 +2014,13 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vp + ndlp->nlp_flag |= NLP_FIRSTBURST; + ndlp->nvme_fb_size = bf_get_be32(prli_fb_sz, + nvpr); ++ ++ /* Expressed in units of 512 bytes */ ++ if (ndlp->nvme_fb_size) ++ ndlp->nvme_fb_size <<= ++ LPFC_NVME_FB_SHIFT; ++ else ++ ndlp->nvme_fb_size = LPFC_NVME_MAX_FB; + } + } + +--- a/drivers/scsi/lpfc/lpfc_nvme.h ++++ b/drivers/scsi/lpfc/lpfc_nvme.h +@@ -27,6 +27,8 @@ + + #define LPFC_NVME_WAIT_TMO 10 + #define LPFC_NVME_EXPEDITE_XRICNT 8 ++#define LPFC_NVME_FB_SHIFT 9 ++#define LPFC_NVME_MAX_FB (1 << 20) /* 1M */ + + struct lpfc_nvme_qhandle { + uint32_t index; /* WQ index to use */ diff --git a/queue-4.16/scsi-lpfc-fix-soft-lockup-in-lpfc-worker-thread-during-lip-testing.patch b/queue-4.16/scsi-lpfc-fix-soft-lockup-in-lpfc-worker-thread-during-lip-testing.patch new file mode 100644 index 00000000000..67a4a694cd1 --- /dev/null +++ b/queue-4.16/scsi-lpfc-fix-soft-lockup-in-lpfc-worker-thread-during-lip-testing.patch @@ -0,0 +1,50 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: James Smart +Date: Tue, 30 Jan 2018 15:58:54 -0800 +Subject: scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing + +From: James Smart + +[ Upstream commit 161df4f09987ae2e9f0f97f0b38eee298b4a39ff ] + +During link bounce testing in a point-to-point topology, the host may +enter a soft lockup on the lpfc_worker thread: + + Call Trace: + lpfc_work_done+0x1f3/0x1390 [lpfc] + lpfc_do_work+0x16f/0x180 [lpfc] + kthread+0xc7/0xe0 + ret_from_fork+0x3f/0x70 + +The driver was simultaneously setting a combination of flags that caused +lpfc_do_work()to effectively spin between slow path work and new event +data, causing the lockup. + +Ensure in the typical wq completions, that new event data flags are set +if the slow path flag is running. The slow path will eventually +reschedule the wq handling. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_hbadisc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_hbadisc.c ++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c +@@ -696,8 +696,9 @@ lpfc_work_done(struct lpfc_hba *phba) + phba->hba_flag & HBA_SP_QUEUE_EVT)) { + if (pring->flag & LPFC_STOP_IOCB_EVENT) { + pring->flag |= LPFC_DEFERRED_RING_EVENT; +- /* Set the lpfc data pending flag */ +- set_bit(LPFC_DATA_READY, &phba->data_flags); ++ /* Preserve legacy behavior. */ ++ if (!(phba->hba_flag & HBA_SP_QUEUE_EVT)) ++ set_bit(LPFC_DATA_READY, &phba->data_flags); + } else { + if (phba->link_state >= LPFC_LINK_UP || + phba->link_flag & LS_MDS_LOOPBACK) { diff --git a/queue-4.16/scsi-mvsas-fix-wrong-endianness-of-sgpio-api.patch b/queue-4.16/scsi-mvsas-fix-wrong-endianness-of-sgpio-api.patch new file mode 100644 index 00000000000..1b4c50ef29f --- /dev/null +++ b/queue-4.16/scsi-mvsas-fix-wrong-endianness-of-sgpio-api.patch @@ -0,0 +1,88 @@ +From foo@baz Thu May 24 10:12:00 CEST 2018 +From: Wilfried Weissmann +Date: Fri, 23 Feb 2018 20:52:34 +0100 +Subject: scsi: mvsas: fix wrong endianness of sgpio api + +From: Wilfried Weissmann + +[ Upstream commit e75fba9c0668b3767f608ea07485f48d33c270cf ] + +This patch fixes the byte order of the SGPIO api and brings it back in +sync with ledmon v0.80 and above. + +[mkp: added missing SoB and fixed whitespace] + +Signed-off-by: Wilfried Weissmann +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/mvsas/mv_94xx.c | 23 ++++++++++++----------- + 1 file changed, 12 insertions(+), 11 deletions(-) + +--- a/drivers/scsi/mvsas/mv_94xx.c ++++ b/drivers/scsi/mvsas/mv_94xx.c +@@ -1080,16 +1080,16 @@ static int mvs_94xx_gpio_write(struct mv + void __iomem *regs = mvi->regs_ex - 0x10200; + + int drive = (i/3) & (4-1); /* drive number on host */ +- u32 block = mr32(MVS_SGPIO_DCTRL + ++ int driveshift = drive * 8; /* bit offset of drive */ ++ u32 block = ioread32be(regs + MVS_SGPIO_DCTRL + + MVS_SGPIO_HOST_OFFSET * mvi->id); + +- + /* + * if bit is set then create a mask with the first + * bit of the drive set in the mask ... + */ +- u32 bit = (write_data[i/8] & (1 << (i&(8-1)))) ? +- 1<<(24-drive*8) : 0; ++ u32 bit = get_unaligned_be32(write_data) & (1 << i) ? ++ 1 << driveshift : 0; + + /* + * ... and then shift it to the right position based +@@ -1098,26 +1098,27 @@ static int mvs_94xx_gpio_write(struct mv + switch (i%3) { + case 0: /* activity */ + block &= ~((0x7 << MVS_SGPIO_DCTRL_ACT_SHIFT) +- << (24-drive*8)); ++ << driveshift); + /* hardwire activity bit to SOF */ + block |= LED_BLINKA_SOF << ( + MVS_SGPIO_DCTRL_ACT_SHIFT + +- (24-drive*8)); ++ driveshift); + break; + case 1: /* id */ + block &= ~((0x3 << MVS_SGPIO_DCTRL_LOC_SHIFT) +- << (24-drive*8)); ++ << driveshift); + block |= bit << MVS_SGPIO_DCTRL_LOC_SHIFT; + break; + case 2: /* fail */ + block &= ~((0x7 << MVS_SGPIO_DCTRL_ERR_SHIFT) +- << (24-drive*8)); ++ << driveshift); + block |= bit << MVS_SGPIO_DCTRL_ERR_SHIFT; + break; + } + +- mw32(MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id, +- block); ++ iowrite32be(block, ++ regs + MVS_SGPIO_DCTRL + ++ MVS_SGPIO_HOST_OFFSET * mvi->id); + + } + +@@ -1132,7 +1133,7 @@ static int mvs_94xx_gpio_write(struct mv + void __iomem *regs = mvi->regs_ex - 0x10200; + + mw32(MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id, +- be32_to_cpu(((u32 *) write_data)[i])); ++ ((u32 *) write_data)[i]); + } + return reg_count; + } diff --git a/queue-4.16/series b/queue-4.16/series index 68d40e48d7f..17b804be441 100644 --- a/queue-4.16/series +++ b/queue-4.16/series @@ -104,3 +104,13 @@ crypto-inside-secure-fix-the-extra-cache-computation.patch crypto-inside-secure-do-not-overwrite-the-threshold-value.patch crypto-sunxi-ss-add-module_alias-to-sun4i-ss.patch crypto-inside-secure-fix-the-invalidation-step-during-cra_exit.patch +scsi-aacraid-insure-command-thread-is-not-recursively-stopped.patch +scsi-devinfo-add-hp-disk-subsystem-device-for-hp-xp-arrays.patch +scsi-lpfc-fix-nvme-initiator-firstburst.patch +scsi-core-make-scsi-status-condition-met-equivalent-to-good.patch +scsi-mvsas-fix-wrong-endianness-of-sgpio-api.patch +scsi-lpfc-fix-issue_lip-if-link-is-disabled.patch +scsi-lpfc-fix-nonrecovery-of-nvme-controller-after-cable-swap.patch +scsi-lpfc-fix-soft-lockup-in-lpfc-worker-thread-during-lip-testing.patch +scsi-lpfc-fix-io-failure-during-hba-reset-testing-with-nvme-io.patch +scsi-lpfc-fix-frequency-of-release-wqe-cqes.patch