Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22]
Hi, On (08/24/17 12:39), Boqun Feng wrote: > On Wed, Aug 23, 2017 at 02:55:17PM +0900, Sergey Senozhatsky wrote: > > On (08/23/17 13:35), Boqun Feng wrote: > > > > KERN_CONT and "\n" should not be together. "\n" flushes the cont > > > > buffer immediately. > > > > > > > > > > Hmm.. Not quite familiar with printk() stuffs, but I could see several > > > usages of printk(KERN_CONT "...\n") in kernel. > > > > > > Did a bit research myself, and I now think the inappropriate use is to > > > use a KERN_CONT printk *after* another printk ending with a "\n". > > > > ah... I didn't check __print_lock_name(): it leaves unflushed cont buffer > > upon the return. sorry, your code is correct. > > > > So means printk(KERN_CON "..."); + printk(KERN_CONT "...\n") is a > correct usage, right? well, yes. with one precondition - there should be no printk-s from other CPUs/tasks in between printk(KERN_CON "..."); + printk(KERN_CONT "...\n") ^ here we can have a preliminary flush and broken cont line. but it's been this way forever. -ss
Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22]
On Wed, Aug 23, 2017 at 02:55:17PM +0900, Sergey Senozhatsky wrote: > On (08/23/17 13:35), Boqun Feng wrote: > > > KERN_CONT and "\n" should not be together. "\n" flushes the cont > > > buffer immediately. > > > > > > > Hmm.. Not quite familiar with printk() stuffs, but I could see several > > usages of printk(KERN_CONT "...\n") in kernel. > > > > Did a bit research myself, and I now think the inappropriate use is to > > use a KERN_CONT printk *after* another printk ending with a "\n". > > ah... I didn't check __print_lock_name(): it leaves unflushed cont buffer > upon the return. sorry, your code is correct. > So means printk(KERN_CON "..."); + printk(KERN_CONT "...\n") is a correct usage, right? Thanks. Again, not familiar with printk stuff, glad you can help me go through this ;-) Regards, Boqun > -ss > > > > > printk("\n *** DEADLOCK ***\n\n"); > > > > + } else if (cross_lock(src->instance)) { > > > > + printk(" Possible unsafe locking scenario by > > > > crosslock:\n\n"); > > > > + printk(" CPU0CPU1\n"); > > > > + printk(" \n"); > > > > + printk(" lock("); > > > > + __print_lock_name(target); > > > > + printk(KERN_CONT ");\n"); > > > > + printk(" lock("); > > > > + __print_lock_name(source); > > > > + printk(KERN_CONT ");\n"); > > > > + printk(" lock("); > > > > + __print_lock_name(parent == source ? target : parent); > > > > + printk(KERN_CONT ");\n"); > > > > + printk(" unlock("); > > > > + __print_lock_name(source); > > > > + printk(KERN_CONT ");\n"); > > > > + printk("\n *** DEADLOCK ***\n\n"); > > > > } else { > > > > printk(" Possible unsafe locking scenario:\n\n"); > > > > printk(" CPU0CPU1\n"); > > > > -- > > > > 2.14.1 > > > > > > signature.asc Description: PGP signature
Re: [PATCH] scsi: ufs: reqs and tasks were put in the wrong order
Zang, Applied to 4.14/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v3 00/20] lpfc updates for 11.4.0.3
James, > This patch set provides a number of bug fixes and one additions. > The additions are BB credit support. > > The patches were cut against the Martin's 4.13/scsi-fixes tree. > There are no outside dependencies. Applied to 4.14/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v3 00/14] megaraid_sas: Updates for scsi-next
Shivasharan, > Shivasharan S (14): > megaraid_sas: mismatch of allocated MFI frame size and length exposed > in MFI MPT pass through command > megaraid_sas: set minimum value of resetwaittime to be 1 secs > megaraid_sas: Use synchronize_irq in target reset case > megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second > while there are pending commands > megaraid_sas: Do not re-fire shutdown DCMD after OCR > megaraid_sas: Fix endianness issues in DCMD handling > megaraid_sas: Check valid aen class range to avoid kernel panic > megaraid_sas: Use SMID for Task abort case only > megaraid_sas: use vmalloc for crash dump buffers and driver's local > RAID map > megaraid_sas: Return pended IOCTLs with cmd_status > MFI_STAT_WRONG_STATE in case adapter is dead > megaraid_sas: replace internal FALSE/TRUE definitions with false/true > megaraid_sas: modified few prints in OCR and IOC INIT path > megaraid_sas: call megasas_dump_frame with correct IO frame size > megaraid_sas: driver version upgrade Applied to 4.14/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 00/31] qla2xxx: Patches for scsi "misc" branch
Himanshu, > This series contains various bug fixes and driver updates. Please > apply the following patches to the 4.14/scsi-queue branch at your > earliest convenience for inclusion in the next mainline merge window. Applied to 4.14/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering
[PATCH] scsi: ufs: reqs and tasks were put in the wrong order
Signed-off-by: Zang Leigangdiff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5bc9dc14e075..794a4600e952 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -438,7 +438,7 @@ static void ufshcd_print_host_state(struct ufs_hba *hba) { dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); dev_err(hba->dev, "lrb in use=0x%lx, outstanding reqs=0x%lx tasks=0x%lx\n", - hba->lrb_in_use, hba->outstanding_tasks, hba->outstanding_reqs); + hba->lrb_in_use, hba->outstanding_reqs, hba->outstanding_tasks); dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", hba->saved_err, hba->saved_uic_err); dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n", -- 2.14.1
Re: [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test
Gustavo, > Remove variable assignments. The value stored in local variable _rc_ > is overwritten at line 2448:rc = > lpfc_sli4_bsg_set_link_diag_state(phba, 0); before it can be used. Applied to 4.14/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi: qedf: Fix a potential NULL pointer dereference
Christophe, > At the beginning of 'qedf_srr_compl()' and of 'qedf_rec_compl()', we > check if 'orig_io_req' is NULL. If this happens, a NULL pointer > dereference will occur in the error handling path. Applied to 4.13/scsi-fixes. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [GIT PULL] SCSI fixes for 4.13-rc6
On 8/24/17 00:27, Martin K. Petersen wrote: > > Hi Bart, > >> Had you noticed that Damien had asked not to send the "sd_zbc: Write >> unlock zone from sd_uninit_cmnd()" patch to Linus without my "scsi-mq: >> Always unprepare before requeuing a request" patch? > > He did change his mind later in that thread, though. > > However, what's more important is that we still need a good version of > your patch for 4.13. I took Brian's workaround for ipr but I still think > Christoph's concerns need to be addressed for me to put your change back > in. Yes, I did ask for the patch to be kept since it does not make things worse for the SMR/mq case (still have a potential dispatch deadlock) but does cleanup the code in the legacy/sq case. Since it looks like the jiffies_at_alloc and retry counter initialization fixes are progressing, we hopefully should be able to get Bart's pacth back in soon (this week ?) and remove the mq dispatch deadlock. Best regards. -- Damien Le Moal, Western Digital Research
[PATCH v2] scsi: lpfc: avoid false positive gcc-8 warning
Arnd Bergmann, testing gcc-8, encountered the following: > This is an interesting regression with gcc-8, showing a harmless > warning for correct code: > >In file included from include/linux/kernel.h:13:0, >... >from drivers/scsi/lpfc/lpfc_debugfs.c:23: >include/linux/printk.h:301:2: error: 'eq' may be used >uninitialized in this function [-Werror=maybe-uninitialized] > printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) > ^~ >In file included from drivers/scsi/lpfc/lpfc_debugfs.c:58:0: >drivers/scsi/lpfc/lpfc_debugfs.h:451:31: note: 'eq' was >declared here The code is fine: a for loop which if there's at least 1 itteration, will assign eq a value. Followed by an if test that checks for no itterations and assigns eq a default value. But the checker doesn't see the relationship between the two so assumes eq may not a have a value. I believe, simply initializing with a NULL will solve the issue. Signed-off-by: James Smart--- drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index 7b7d314af0e0..32e86d7813a0 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -448,7 +448,7 @@ lpfc_debug_dump_wq(struct lpfc_hba *phba, int qtype, int wqidx) static inline void lpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx) { - struct lpfc_queue *wq, *cq, *eq; + struct lpfc_queue *wq, *cq, *eq = NULL; char *qtypestr; int eqidx; -- 2.13.1
[PATCH v2 0/1] bsg: fix regression resulting in panics when sending commands via BSG
Hello all, This is the second try for fixing the regression in the BSG-interface that exists since v4.11 (for more infos see the first series). I separated my other changes from the bug-fix so that it is easier to apply if judged good. I will rebase my cleanups I sent in v1 and send them when I get a bit more time. But the regression-fix is more important, so here's that. I did some more tests on it than on v1, including some heavy parallel I/O on the same blk-queue using both BSG and the normal SCSI-stack at the same time (throwing some intentional bad commands in it too). That seemed to work all well enough - i.e. it didn't crash and got the expected results. I haven't done any external error-inject, but IMO that would be beyond the scope right now. The fix is based on Christoph's idea, I discussed this with him off-list already. I rebased the series on Jens' for-next. Reviews are more than welcome :) Beste Grüße / Best regards, - Benjamin Block Benjamin Block (1): bsg-lib: fix kernel panic resulting from missing allocation of reply-buffer block/bsg-lib.c | 74 + include/linux/blkdev.h | 1 - include/linux/bsg-lib.h | 2 ++ 3 files changed, 46 insertions(+), 31 deletions(-) -- Linux on z Systems Development / IBM Systems & Technology Group IBM Deutschland Research & Development GmbH Vorsitz. AufsR.: Martina Koederitz /Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
[PATCH v2 1/1] bsg-lib: fix kernel panic resulting from missing allocation of reply-buffer
Since we split the scsi_request out of struct request bsg fails to provide a reply-buffer for the drivers. This was done via the pointer for sense-data, that is not preallocated anymore. Failing to allocate/assign it results in illegal dereferences because LLDs use this pointer unquestioned. An example panic on s390x, using the zFCP driver, looks like this (I had debugging on, otherwise NULL-pointer dereferences wouldn't even panic on s390x): Unable to handle kernel pointer dereference in virtual kernel address space Failing address: 6b6b6b6b6b6b6000 TEID: 6b6b6b6b6b6b6403 Fault in home space mode while using kernel ASCE. AS:01590007 R3:0024 Oops: 0038 ilc:2 [#1] PREEMPT SMP DEBUG_PAGEALLOC Modules linked in: CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.12.0-bsg-regression+ #3 Hardware name: IBM 2964 N96 702 (z/VM 6.4.0) task: 65cb0100 task.stack: 65cb4000 Krnl PSW : 0704e0018000 03ff801e4156 (zfcp_fc_ct_els_job_handler+0x16/0x58 [zfcp]) R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0 RI:0 EA:3 Krnl GPRS: 0001 5fa9d0d0 5fa9d078 00e16866 03ff0290 6b6b6b6b6b6b6b6b 59f78f00 000f 593a0958 593a0958 60d88800 5ddd4c38 58b50100 0700659cba08 03ff801e8556 659cb9a8 Krnl Code: 03ff801e4146: e3102054lg %r1,80(%r2) 03ff801e414c: 58402040 l %r4,64(%r2) #03ff801e4150: e3502024 lg %r5,32(%r2) >03ff801e4156: 50405004 st %r4,4(%r5) 03ff801e415a: e54c5008 mvhi8(%r5),0 03ff801e4160: e33010280012 lt %r3,40(%r1) 03ff801e4166: a718fffb lhi %r1,-5 03ff801e416a: 1803 lr %r0,%r3 Call Trace: ([<03ff801e8556>] zfcp_fsf_req_complete+0x726/0x768 [zfcp]) [<03ff801ea82a>] zfcp_fsf_reqid_check+0x102/0x180 [zfcp] [<03ff801eb980>] zfcp_qdio_int_resp+0x230/0x278 [zfcp] [<009b91b6>] qdio_kick_handler+0x2ae/0x2c8 [<009b9e3e>] __tiqdio_inbound_processing+0x406/0xc10 [<001684c2>] tasklet_action+0x15a/0x1d8 [<00bd28ec>] __do_softirq+0x3ec/0x848 [<001675a4>] irq_exit+0x74/0xf8 [<0010dd6a>] do_IRQ+0xba/0xf0 [<00bd19e8>] io_int_handler+0x104/0x2d4 [<001033b6>] enabled_wait+0xb6/0x188 ([<0010339e>] enabled_wait+0x9e/0x188) [<0010396a>] arch_cpu_idle+0x32/0x50 [<00bd0112>] default_idle_call+0x52/0x68 [<001cd0fa>] do_idle+0x102/0x188 [<001cd41e>] cpu_startup_entry+0x3e/0x48 [<00118c64>] smp_start_secondary+0x11c/0x130 [<00bd2016>] restart_int_handler+0x62/0x78 [<>] (null) INFO: lockdep is turned off. Last Breaking-Event-Address: [<03ff801e41d6>] zfcp_fc_ct_job_handler+0x3e/0x48 [zfcp] Kernel panic - not syncing: Fatal exception in interrupt This patch moves bsg-lib to allocate and setup struct bsg_job ahead of time, including the allocation of a buffer for the reply-data. This means, struct bsg_job is not allocated separately anymore, but as part of struct request allocation - similar to struct scsi_cmd. Reflect this in the function names that used to handle creation/destruction of struct bsg_job. Reported-by: Steffen MaierSuggested-by: Christoph Hellwig Signed-off-by: Benjamin Block Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request") Cc: #4.11+ --- block/bsg-lib.c | 74 + include/linux/blkdev.h | 1 - include/linux/bsg-lib.h | 2 ++ 3 files changed, 46 insertions(+), 31 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index c4513b23f57a..dd56d7460cb9 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -29,26 +29,25 @@ #include /** - * bsg_destroy_job - routine to teardown/delete a bsg job + * bsg_teardown_job - routine to teardown a bsg job * @job: bsg_job that is to be torn down */ -static void bsg_destroy_job(struct kref *kref) +static void bsg_teardown_job(struct kref *kref) { struct bsg_job *job = container_of(kref, struct bsg_job, kref); struct request *rq = job->req; - blk_end_request_all(rq, BLK_STS_OK); - put_device(job->dev); /* release reference for the request */ kfree(job->request_payload.sg_list); kfree(job->reply_payload.sg_list); - kfree(job); + + blk_end_request_all(rq, BLK_STS_OK); } void bsg_job_put(struct bsg_job *job) { - kref_put(>kref, bsg_destroy_job); + kref_put(>kref, bsg_teardown_job); } EXPORT_SYMBOL_GPL(bsg_job_put); @@ -100,7 +99,7 @@ EXPORT_SYMBOL_GPL(bsg_job_done); */ static void bsg_softirq_done(struct request *rq) { -
[PATCH v3 20/20] lpfc: lpfc version bump 11.4.0.3
From: Dick KennedyUpdate driver version to 11.4.0.3 Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- 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 c6a24c3e2d5e..6aa192b3e4bf 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.1" +#define LPFC_DRIVER_VERSION "11.4.0.3" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */ -- 2.13.1
[PATCH v3 18/20] lpfc: Add Buffer to Buffer credit recovery support
Add Buffer to buffer credit recovery support to the driver. This is a negotiated feature with the peer that allows for both sides to detect dropped RRDY's and FC Frames and recover credit. Signed-off-by: Dick KennedySigned-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc.h | 3 ++- drivers/scsi/lpfc/lpfc_attr.c| 41 drivers/scsi/lpfc/lpfc_attr.h| 10 ++ drivers/scsi/lpfc/lpfc_els.c | 14 +- drivers/scsi/lpfc/lpfc_hbadisc.c | 12 ++-- drivers/scsi/lpfc/lpfc_hw.h | 18 +++--- drivers/scsi/lpfc/lpfc_hw4.h | 23 ++ drivers/scsi/lpfc/lpfc_init.c| 5 + drivers/scsi/lpfc/lpfc_mbox.c| 35 +++--- drivers/scsi/lpfc/lpfc_sli4.h| 15 +++ 10 files changed, 162 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 7039549cad02..8eb3f96fe068 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -733,7 +733,6 @@ struct lpfc_hba { uint32_t fc_rttov; /* R_T_TOV timer value */ uint32_t fc_altov; /* AL_TOV timer value */ uint32_t fc_crtov; /* C_R_TOV timer value */ - uint32_t fc_citov; /* C_I_TOV timer value */ struct serv_parm fc_fabparam; /* fabric service parameters buffer */ uint8_t alpa_map[128]; /* AL_PA map from READ_LA */ @@ -757,6 +756,7 @@ struct lpfc_hba { #define LPFC_NVMET_MAX_PORTS 32 uint8_t mds_diags_support; uint32_t initial_imax; + uint8_t bbcredit_support; /* HBA Config Parameters */ uint32_t cfg_ack0; @@ -836,6 +836,7 @@ struct lpfc_hba { uint32_t cfg_enable_SmartSAN; uint32_t cfg_enable_mds_diags; uint32_t cfg_enable_fc4_type; + uint32_t cfg_enable_bbcr; /*Enable BB Credit Recovery*/ uint32_t cfg_xri_split; #define LPFC_ENABLE_FCP 1 #define LPFC_ENABLE_NVME 2 diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index d3d01ff44423..0806323829e6 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1889,6 +1889,36 @@ static inline bool lpfc_rangecheck(uint val, uint min, uint max) } /** + * lpfc_enable_bbcr_set: Sets an attribute value. + * @phba: pointer the the adapter structure. + * @val: integer attribute value. + * + * Description: + * Validates the min and max values then sets the + * adapter config field if in the valid range. prints error message + * and does not set the parameter if invalid. + * + * Returns: + * zero on success + * -EINVAL if val is invalid + */ +static ssize_t +lpfc_enable_bbcr_set(struct lpfc_hba *phba, uint val) +{ + if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "3068 %s_enable_bbcr changed from %d to %d\n", + LPFC_DRIVER_NAME, phba->cfg_enable_bbcr, val); + phba->cfg_enable_bbcr = val; + return 0; + } + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "0451 %s_enable_bbcr cannot set to %d, range is 0, 1\n", + LPFC_DRIVER_NAME, val); + return -EINVAL; +} + +/** * lpfc_param_show - Return a cfg attribute value in decimal * * Description: @@ -5111,6 +5141,14 @@ LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, */ LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics"); +/* + * lpfc_enable_bbcr: Enable BB Credit Recovery + * 0 = BB Credit Recovery disabled + * 1 = BB Credit Recovery enabled (default) + * Value range is [0,1]. Default value is 1. + */ +LPFC_BBCR_ATTR_RW(enable_bbcr, 1, 0, 1, "Enable BBC Recovery"); + struct device_attribute *lpfc_hba_attrs[] = { _attr_nvme_info, _attr_bg_info, @@ -5218,6 +5256,7 @@ struct device_attribute *lpfc_hba_attrs[] = { _attr_protocol, _attr_lpfc_xlane_supported, _attr_lpfc_enable_mds_diags, + _attr_lpfc_enable_bbcr, NULL, }; @@ -6229,11 +6268,13 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) lpfc_nvmet_fb_size_init(phba, lpfc_nvmet_fb_size); lpfc_fcp_io_channel_init(phba, lpfc_fcp_io_channel); lpfc_nvme_io_channel_init(phba, lpfc_nvme_io_channel); + lpfc_enable_bbcr_init(phba, lpfc_enable_bbcr); if (phba->sli_rev != LPFC_SLI_REV4) { /* NVME only supported on SLI4 */ phba->nvmet_support = 0; phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; + phba->cfg_enable_bbcr = 0; } else { /* We MUST have FCP support */ if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) diff --git
[PATCH v3 05/20] lpfc: convert info messages to standard messages
From: Dick KennedyTransitioned some informational discovery messages to now always be displayed when log_verbose is set. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_ct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 9c0c1463057d..33417681f5d4 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -955,7 +955,7 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, CTrsp = (struct lpfc_sli_ct_request *)outp->virt; fc4_data_0 = be32_to_cpu(CTrsp->un.gft_acc.fc4_types[0]); fc4_data_1 = be32_to_cpu(CTrsp->un.gft_acc.fc4_types[1]); - lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "3062 DID x%06x GFT Wd0 x%08x Wd1 x%08x\n", did, fc4_data_0, fc4_data_1); @@ -969,7 +969,7 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp->nlp_fc4_type |= NLP_FC4_FCP; if (fc4_data_1 & LPFC_FC4_TYPE_BITMASK) ndlp->nlp_fc4_type |= NLP_FC4_NVME; - lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "3064 Setting ndlp %p, DID x%06x with " "FC4 x%08x, Data: x%08x x%08x\n", ndlp, did, ndlp->nlp_fc4_type, -- 2.13.1
[PATCH v3 12/20] lpfc: Limit amount of work processed in IRQ
From: Dick KennedyVarious oops being seen on being in the ISR too long and cpu lockups, when under heavy load. The amount of work being posted off of completion queues kept the ISR running almost all the time Correct the issue by limiting the amount of work per itteration. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_sli.c | 31 +++ drivers/scsi/lpfc/lpfc_sli4.h | 1 + 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 6569fffb8b71..d731979e4c7c 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -80,8 +80,8 @@ static int lpfc_sli4_fp_handle_cqe(struct lpfc_hba *, struct lpfc_queue *, struct lpfc_cqe *); static int lpfc_sli4_post_sgl_list(struct lpfc_hba *, struct list_head *, int); -static void lpfc_sli4_hba_handle_eqe(struct lpfc_hba *, struct lpfc_eqe *, - uint32_t); +static int lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, + struct lpfc_eqe *eqe, uint32_t qidx); static bool lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba); static bool lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba); static int lpfc_sli4_abort_nvme_io(struct lpfc_hba *phba, @@ -13010,7 +13010,7 @@ lpfc_sli4_sp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq, * completion queue, and then return. * **/ -static void +static int lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, struct lpfc_queue *speq) { @@ -13034,7 +13034,7 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "0365 Slow-path CQ identifier " "(%d) does not exist\n", cqid); - return; + return 0; } /* Save EQ associated with this CQ */ @@ -13071,7 +13071,7 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "0370 Invalid completion queue type (%d)\n", cq->type); - return; + return 0; } /* Catch the no cq entry condition, log an error */ @@ -13086,6 +13086,8 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, /* wake up worker thread if there are works to be done */ if (workposted) lpfc_worker_wake_up(phba); + + return ecount; } /** @@ -13393,7 +13395,7 @@ lpfc_sli4_fp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq, * queue and process all the entries on the completion queue, rearm the * completion queue, and then return. **/ -static void +static int lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, uint32_t qidx) { @@ -13409,7 +13411,7 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, "event: majorcode=x%x, minorcode=x%x\n", bf_get_le32(lpfc_eqe_major_code, eqe), bf_get_le32(lpfc_eqe_minor_code, eqe)); - return; + return 0; } /* Get the reference to the corresponding CQ */ @@ -13446,8 +13448,9 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, /* Otherwise this is a Slow path event */ if (cq == NULL) { - lpfc_sli4_sp_handle_eqe(phba, eqe, phba->sli4_hba.hba_eq[qidx]); - return; + ecount = lpfc_sli4_sp_handle_eqe(phba, eqe, +phba->sli4_hba.hba_eq[qidx]); + return ecount; } process_cq: @@ -13456,7 +13459,7 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, "0368 Miss-matched fast-path completion " "queue identifier: eqcqid=%d, fcpcqid=%d\n", cqid, cq->queue_id); - return; + return 0; } /* Save EQ associated with this CQ */ @@ -13486,6 +13489,8 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, /* wake up worker thread if there are works to be done */ if (workposted) lpfc_worker_wake_up(phba); + + return ecount; } static void @@ -13706,6 +13711,7 @@ lpfc_sli4_hba_intr_handler(int irq, void *dev_id) struct lpfc_eqe *eqe; unsigned long iflag; int ecount = 0; + int ccount = 0; int hba_eqidx; /* Get the driver's phba
[PATCH v3 06/20] lpfc: Correct return error codes to align with nvme_fc transport
From: Dick KennedyModify driver return error codes to align with host nvme transport. Driver isn't returning Exxx error codes to properly reflect out of resource or connectivity conditions (-EBUSY), yet there were hard error conditions returning -EBUSY. Ensure the following situations return the proper return code: temporary failures or temporary resource availability: -EBUSY Connectivity issues: -ENODEV all others are treated as hard errors and return an -Exxx value that indicates the type of error. Also, lpfc_sli4_issue_wqe() was modified to not translate error from -Exxx to WQE state. This allows lpfc_nvme_fcp_io_submit() routine to just return whatever -E value was returned from other routines. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- v3: slight reword of patch description per review --- drivers/scsi/lpfc/lpfc_nvme.c | 9 - drivers/scsi/lpfc/lpfc_sli.c | 23 ++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index ce8d6bbf8148..24dc69de6023 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -364,7 +364,7 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, genwqe->sli4_xritag, genwqe->iotag, ndlp->nlp_DID); rc = lpfc_sli4_issue_wqe(phba, LPFC_ELS_RING, genwqe); - if (rc == WQE_ERROR) { + if (rc) { lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, "6045 Issue GEN REQ WQE to NPORT x%x " "Data: x%x x%x\n", @@ -1270,7 +1270,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, * not exceed the programmed depth. */ if (atomic_read(>cmd_pending) >= ndlp->cmd_qdepth) { - ret = -EAGAIN; + ret = -EBUSY; goto out_fail; } @@ -1279,7 +1279,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR, "6065 driver's buffer pool is empty, " "IO failed\n"); - ret = -ENOMEM; + ret = -EBUSY; goto out_fail; } #ifdef CONFIG_SCSI_LPFC_DEBUG_FS @@ -1332,7 +1332,6 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, "sid: x%x did: x%x oxid: x%x\n", ret, vport->fc_myDID, ndlp->nlp_DID, lpfc_ncmd->cur_iocbq.sli4_xritag); - ret = -EBUSY; goto out_free_nvme_buf; } @@ -1576,7 +1575,7 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport, abts_buf->wqe_cmpl = lpfc_nvme_abort_fcreq_cmpl; ret_val = lpfc_sli4_issue_wqe(phba, LPFC_FCP_RING, abts_buf); spin_unlock_irqrestore(>hbalock, flags); - if (ret_val == IOCB_ERROR) { + if (ret_val) { lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_ABTS, "6137 Failed abts issue_wqe with status x%x " "for nvme_fcreq %p.\n", diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 0a8c9b59365a..6569fffb8b71 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -106,7 +106,7 @@ lpfc_get_iocb_from_iocbq(struct lpfc_iocbq *iocbq) * -ENOMEM. * The caller is expected to hold the hbalock when calling this routine. **/ -static uint32_t +static int lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe) { union lpfc_wqe *temp_wqe; @@ -123,7 +123,7 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe) idx = ((q->host_index + 1) % q->entry_count); if (idx == q->hba_index) { q->WQ_overflow++; - return -ENOMEM; + return -EBUSY; } q->WQ_posted++; /* set consumption flag every once in a while */ @@ -10741,7 +10741,7 @@ lpfc_sli4_abort_nvme_io(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, abtsiocbp->vport = vport; abtsiocbp->wqe_cmpl = lpfc_nvme_abort_fcreq_cmpl; retval = lpfc_sli4_issue_wqe(phba, LPFC_FCP_RING, abtsiocbp); - if (retval == IOCB_ERROR) { + if (retval) { lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME, "6147 Failed abts issue_wqe with status x%x " "for oxid x%x\n", @@ -1,6 +1,7 @@ lpfc_sli4_issue_wqe(struct lpfc_hba *phba, uint32_t ring_number, struct lpfc_sglq *sglq; struct lpfc_sli_ring *pring; unsigned long iflags; + uint32_t ret = 0; /* NVME_LS and NVME_LS ABTS requests. */
[PATCH v3 17/20] lpfc: remove console log clutter
Change hw queue binding messages to info - not error. Signed-off-by: Dick KennedySigned-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index bb9ede2521b9..79ba3ce063a4 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -110,7 +110,7 @@ lpfc_nvme_create_queue(struct nvme_fc_local_port *pnvme_lport, qhandle->index = qidx; } - lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME, + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME, "6073 Binding %s HdwQueue %d (cpu %d) to " "io_channel %d qhandle %p\n", str, qidx, qhandle->cpu_id, qhandle->index, qhandle); -- 2.13.1
[PATCH v3 15/20] lpfc: Fix nvme target failure after 2nd adapter reset
From: Dick KennedyFix nvme target failure after 2nd adapter reset The nonrecovery occurred because the lpfc nvme initiator function did not reestablish its localport creation with the nvme host transport in lpfc_oneline. Because of that, an NVME rport binding could not take place. Corrected by recreating the localport in the adapter reset recovery routine. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- v3: rework indentation per review comment --- drivers/scsi/lpfc/lpfc_init.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index c22b88a08c1b..b21ac2bb0dd3 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -3047,7 +3047,7 @@ lpfc_online(struct lpfc_hba *phba) { struct lpfc_vport *vport; struct lpfc_vport **vports; - int i; + int i, error = 0; bool vpis_cleared = false; if (!phba) @@ -3071,6 +3071,18 @@ lpfc_online(struct lpfc_hba *phba) if (!phba->sli4_hba.max_cfg_param.vpi_used) vpis_cleared = true; spin_unlock_irq(>hbalock); + + /* Reestablish the local initiator port. +* The offline process destroyed the previous lport. +*/ + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && + !phba->nvmet_support) { + error = lpfc_nvme_create_localport(phba->pport); + if (error) + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "6132 NVME restore reg failed " + "on nvmei error x%x\n", error); + } } else { lpfc_sli_queue_init(phba); if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ -- 2.13.1
[PATCH v3 19/20] scsi: lpfc: fix "integer constant too large" error on 32bit archs
From: Maurizio Lombardicc1: warnings being treated as errors drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_get_wwpn': drivers/scsi/lpfc/lpfc_init.c:3253: error: integer constant is too large for 'long' type Signed-off-by: Maurizio Lombardi Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- v2: use rol64() --- drivers/scsi/lpfc/lpfc_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 1b81f734e3ef..7e7ae786121b 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -3728,9 +3729,7 @@ lpfc_get_wwpn(struct lpfc_hba *phba) if (phba->sli_rev == LPFC_SLI_REV4) return be64_to_cpu(wwn); else - return (((wwn & 0x) >> 32) | - ((wwn & 0x) << 32)); - + return rol64(wwn, 32); } /** -- 2.13.1
[PATCH v3 13/20] lpfc: Fix MRQ > 1 context list handling
From: Dick KennedyVarious oops including cpu LOCKUPs were seen. For asynchronously received ius where the driver must assign exchange resources, the resources were on a single get (free) list and put list (finished, waiting to be put on get list). As all cpus are sharing the lists, an interrupt for a receive frame may have to wait for all the other cpus to place their done work onto the put list before it can acquire the lock to pull from the list. Fix by breaking the resource lists into per-cpu lists or at least more than 1 list with cpu's sharing the lists). A cpu would allocate from the free list for its own cpu, and put its done work on the its own put list - avoiding the contention. As cpu load may vary, when empty, a cpu may grab from another cpu, thereby changing resource distribution. But searching for a resource only occurs on 1 or a few cpus until a single resource can be allocated. if the condition reoccurs, it starts looking at a different cpu. Signed-off-by: Dick Kennedy Signed-off-by: James Smart -- v3: remove unnecessary typecast per review use list_splict_init per review --- drivers/scsi/lpfc/lpfc_attr.c| 11 +- drivers/scsi/lpfc/lpfc_crtn.h| 5 +- drivers/scsi/lpfc/lpfc_debugfs.c | 11 +- drivers/scsi/lpfc/lpfc_init.c| 17 +-- drivers/scsi/lpfc/lpfc_nvmet.c | 264 ++- drivers/scsi/lpfc/lpfc_nvmet.h | 14 +++ drivers/scsi/lpfc/lpfc_sli.c | 2 +- drivers/scsi/lpfc/lpfc_sli4.h| 7 +- 8 files changed, 234 insertions(+), 97 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 4ed48ed38e79..d3d01ff44423 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -245,13 +245,10 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, atomic_read(>xmt_abort_rsp), atomic_read(>xmt_abort_rsp_error)); - spin_lock(>sli4_hba.nvmet_ctx_get_lock); - spin_lock(>sli4_hba.nvmet_ctx_put_lock); - tot = phba->sli4_hba.nvmet_xri_cnt - - (phba->sli4_hba.nvmet_ctx_get_cnt + - phba->sli4_hba.nvmet_ctx_put_cnt); - spin_unlock(>sli4_hba.nvmet_ctx_put_lock); - spin_unlock(>sli4_hba.nvmet_ctx_get_lock); + /* Calculate outstanding IOs */ + tot = atomic_read(>rcv_fcp_cmd_drop); + tot += atomic_read(>xmt_fcp_release); + tot = atomic_read(>rcv_fcp_cmd_in) - tot; len += snprintf(buf + len, PAGE_SIZE - len, "IO_CTX: %08x WAIT: cur %08x tot %08x\n" diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index da669dce12fe..7e300734b345 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -556,9 +556,8 @@ int lpfc_nvmet_update_targetport(struct lpfc_hba *phba); void lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba); void lpfc_nvmet_unsol_ls_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *piocb); -void lpfc_nvmet_unsol_fcp_event(struct lpfc_hba *phba, - struct lpfc_sli_ring *pring, - struct rqb_dmabuf *nvmebuf, uint64_t isr_ts); +void lpfc_nvmet_unsol_fcp_event(struct lpfc_hba *phba, uint32_t idx, + struct rqb_dmabuf *nvmebuf, uint64_t isr_ts); void lpfc_nvme_mod_param_dep(struct lpfc_hba *phba); void lpfc_nvme_abort_fcreq_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 5cc8b0f7d885..c292264aa687 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -848,13 +848,10 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) spin_unlock(>sli4_hba.abts_nvme_buf_list_lock); } - spin_lock(>sli4_hba.nvmet_ctx_get_lock); - spin_lock(>sli4_hba.nvmet_ctx_put_lock); - tot = phba->sli4_hba.nvmet_xri_cnt - - (phba->sli4_hba.nvmet_ctx_get_cnt + - phba->sli4_hba.nvmet_ctx_put_cnt); - spin_unlock(>sli4_hba.nvmet_ctx_put_lock); - spin_unlock(>sli4_hba.nvmet_ctx_get_lock); + /* Calculate outstanding IOs */ + tot = atomic_read(>rcv_fcp_cmd_drop); + tot += atomic_read(>xmt_fcp_release); + tot = atomic_read(>rcv_fcp_cmd_in) - tot; len += snprintf(buf + len, size - len, "IO_CTX: %08x WAIT: cur %08x tot %08x\n" diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index
[PATCH v3 14/20] lpfc: Fix relative offset error on large nvmet target ios
From: Dick Kennedyif the nvmet_fc transport breaks an io into multiple sequences, the driver will improperly set the relative offset on the 2nd through N sequences. Correct by properly formatting the hw cmd so the relative offset is picked up from the hw cmd. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nvmet.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c index 41abdef27909..ce871de70bf1 100644 --- a/drivers/scsi/lpfc/lpfc_nvmet.c +++ b/drivers/scsi/lpfc/lpfc_nvmet.c @@ -559,7 +559,7 @@ lpfc_nvmet_xmt_fcp_op_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, /* lpfc_nvmet_xmt_fcp_release() will recycle the context */ } else { ctxp->entry_cnt++; - start_clean = offsetof(struct lpfc_iocbq, wqe); + start_clean = offsetof(struct lpfc_iocbq, iocb_flag); memset(((char *)cmdwqe) + start_clean, 0, (sizeof(struct lpfc_iocbq) - start_clean)); #ifdef CONFIG_SCSI_LPFC_DEBUG_FS @@ -1024,7 +1024,6 @@ lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) /* Word 7 */ bf_set(wqe_ct, >generic.wqe_com, SLI4_CT_RPI); bf_set(wqe_class, >generic.wqe_com, CLASS3); - bf_set(wqe_pu, >generic.wqe_com, 1); /* Word 10 */ bf_set(wqe_nvme, >fcp_tsend.wqe_com, 1); bf_set(wqe_ebde_cnt, >generic.wqe_com, 0); @@ -1973,6 +1972,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, nvmewqe->sli4_xritag); /* Word 7 */ + bf_set(wqe_pu, >fcp_tsend.wqe_com, 1); bf_set(wqe_cmnd, >fcp_tsend.wqe_com, CMD_FCP_TSEND64_WQE); /* Word 8 */ @@ -2081,6 +2081,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, nvmewqe->sli4_xritag); /* Word 7 */ + bf_set(wqe_pu, >fcp_treceive.wqe_com, 1); bf_set(wqe_ar, >fcp_treceive.wqe_com, 0); bf_set(wqe_cmnd, >fcp_treceive.wqe_com, CMD_FCP_TRECEIVE64_WQE); @@ -2164,6 +2165,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, nvmewqe->sli4_xritag); /* Word 7 */ + bf_set(wqe_pu, >fcp_trsp.wqe_com, 0); bf_set(wqe_ag, >fcp_trsp.wqe_com, 1); bf_set(wqe_cmnd, >fcp_trsp.wqe_com, CMD_FCP_TRSP64_WQE); -- 2.13.1
[PATCH v3 08/20] lpfc: Fix duplicate NVME rport entries and namespaces.
From: Dick KennedyAfter lip, the driver sometimes would have two rports for the same device, allowing the namespaces to be duplicated by nvme. In lpfc_plogi_confirm_nport() the driver was not swapping the nrport maintained by the ndlp's undergoing address swapping. This allowed the 2nd rport to sneak in as it was considered a separate device. This patch adds the fixes to Swap the nrport in each ndlp and take care of the reference counts on the ndlps similar to FCP rports. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- v3: revise comment to clarify per review --- drivers/scsi/lpfc/lpfc_els.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 19af0e6e7667..ffbd3eddeabb 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1527,6 +1527,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, uint8_t name[sizeof(struct lpfc_name)]; uint32_t rc, keepDID = 0, keep_nlp_flag = 0; uint16_t keep_nlp_state; + struct lpfc_nvme_rport *keep_nrport = NULL; int put_node; int put_rport; unsigned long *active_rrqs_xri_bitmap = NULL; @@ -1624,6 +1625,10 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, keep_nlp_state = new_ndlp->nlp_state; lpfc_nlp_set_state(vport, new_ndlp, ndlp->nlp_state); + /* interchange the nvme remoteport structs */ + keep_nrport = new_ndlp->nrport; + new_ndlp->nrport = ndlp->nrport; + /* Move this back to NPR state */ if (memcmp(>nlp_portname, name, sizeof(struct lpfc_name)) == 0) { /* The new_ndlp is replacing ndlp totally, so we need @@ -1646,6 +1651,13 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, } new_ndlp->nlp_type = ndlp->nlp_type; } + + /* Fix up the nvme rport */ + if (ndlp->nrport) { + ndlp->nrport = NULL; + lpfc_nlp_put(ndlp); + } + /* We shall actually free the ndlp with both nlp_DID and * nlp_portname fields equals 0 to avoid any ndlp on the * nodelist never to be used. @@ -1690,6 +1702,14 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, keep_nlp_state = NLP_STE_NPR_NODE; lpfc_nlp_set_state(vport, ndlp, keep_nlp_state); + /* Previous ndlp no longer active with nvme host transport. +* Remove reference from earlier registration unless the +* nvme host took care of it. +*/ + if (ndlp->nrport) + lpfc_nlp_put(ndlp); + ndlp->nrport = keep_nrport; + /* Fix up the rport accordingly */ rport = ndlp->rport; if (rport) { -- 2.13.1
[PATCH v3 16/20] lpfc: Fix bad sgl reposting after 2nd adapter reset
From: Dick KennedyFix bad sgl reposting after 2nd adapter reset port issue was fixed, the hbacmd reset would take more than 8 minutes to complete. There were conflicting NVME SGL posting/reposting responsibilities between lpfc_online()/lpfc_sli4_hba_setup() and lpfc_nvme_create_localport(). The lpfc_online() causes a REPOST on existing NVME SGLs which is not released during the fc port reset. However, lpfc_nvme_create_localport() wants to allocate new NVME buffers and post them. Both cancelled out each other which had a side effect of hosing the mailbox handling that was used to remove the sgl lists - causing multiple 60s mbx timeouts. Fix by preserving all SGL lists over the fc port reset. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nvme.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 24dc69de6023..bb9ede2521b9 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -2181,8 +2181,15 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) vport->localport = localport; lport->vport = vport; vport->nvmei_support = 1; - len = lpfc_new_nvme_buf(vport, phba->sli4_hba.nvme_xri_max); - vport->phba->total_nvme_bufs += len; + + /* Don't post more new bufs if repost already recovered +* the nvme sgls. +*/ + if (phba->sli4_hba.nvme_xri_cnt == 0) { + len = lpfc_new_nvme_buf(vport, +phba->sli4_hba.nvme_xri_max); + vport->phba->total_nvme_bufs += len; + } } return ret; -- 2.13.1
[PATCH v3 10/20] lpfc: Fix NVME PRLI handling during RSCN
From: Dick KennedyA race condition was found whereby the initiator would receive the RSCN for a new NVME device before it had a chance to register its FC4 support with the fabric. Thus, when queried by the initiator, it would see that the target supported FC-NVME. Corrected by making the assumption that the target always supports FC-NVME thus a PRLI is sent. It's ok for the target to reject it. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_els.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index ffbd3eddeabb..6de470e158ef 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -2177,6 +2177,16 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, uint16_t cmdsize; u32 local_nlp_type, elscmd; + /* +* If we are in RSCN mode, the FC4 types supported from a +* previous GFT_ID command may not be accurate. So, if we +* are a NVME Initiator, always look for the possibility of +* the remote NPort beng a NVME Target. +*/ + if (phba->sli_rev == LPFC_SLI_REV4 && + vport->fc_flag & FC_RSCN_MODE && + vport->nvmei_support) + ndlp->nlp_fc4_type |= NLP_FC4_NVME; local_nlp_type = ndlp->nlp_fc4_type; send_next_prli: -- 2.13.1
[PATCH v3 11/20] lpfc: Correct issues with FAWWN and FDISCs
From: Dick KennedyWhen using fabric-assigned WWNs, the switch doesn't like copy of the FLOGI payload, which includes valid VVL bits, to be used as the FDISC paylaod. Rather than wait for corrected switch firmware, ensure the VVL bits are marked invalid on FDISCs. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 6de470e158ef..8d8fbfab0c9f 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -8860,6 +8860,7 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, pcmd += sizeof(uint32_t); /* Node Name */ pcmd += sizeof(uint32_t); /* Node Name */ memcpy(pcmd, >fc_nodename, 8); + sp->cmn.valid_vendor_ver_level = 0; memset(sp->un.vendorVersion, 0, sizeof(sp->un.vendorVersion)); lpfc_set_disctmo(vport); -- 2.13.1
[PATCH v3 09/20] lpfc: Fix crash in lpfc nvmet when fc port is reset
From: Dick Kennedyin adapter reset tests, an oops was seen with a NULL pointer in lpfc_free_rq_buffer+0x20/0x60 The driver is failing to properly repost the nvmet sgl list when recovering from the reset. Thus the driver eventually trys to walk an errant buffer list. Corrected the sgl buffer recovery as well as strengthening the initialization of the bufferlist. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_init.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 9294c89c7ccd..f82618a8918f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -3226,6 +3226,13 @@ lpfc_offline(struct lpfc_hba *phba) /* stop port and all timers associated with this hba */ lpfc_stop_port(phba); + + /* Tear down the local and target port registrations. The +* nvme transports need to cleanup. +*/ + lpfc_nvmet_destroy_targetport(phba); + lpfc_nvme_destroy_localport(phba->pport); + vports = lpfc_create_vport_work_array(phba); if (vports != NULL) for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) @@ -6516,6 +6523,12 @@ lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); kfree(sglq_entry); } + + /* Update the nvmet_xri_cnt to reflect no current sgls. +* The next initialization cycle sets the count and allocates +* the sgls over again. +*/ + phba->sli4_hba.nvmet_xri_cnt = 0; } /** @@ -8301,6 +8314,9 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) goto out_error; } + /* Put list in known state in case driver load fails. */ + INIT_LIST_HEAD(>rqbp->rqb_buffer_list); + /* Create NVMET Receive Queue for data */ qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.rq_esize, -- 2.13.1
[PATCH v3 04/20] lpfc: Fix oops when NVME Target is discovered in a nonNVME environment
From: Dick Kennedylpfc oops when it discovers a NVME target but is configured for SCSI only operation. Oops is in lpfc_nvme_register_port+0x33/0x300. The localport is not valid so it should not have been referenced. Added validity check for localport Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_nvme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index c18db8707fed..ce8d6bbf8148 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -2296,6 +2296,9 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) ndlp->nlp_DID, ndlp->nlp_type); localport = vport->localport; + if (!localport) + return 0; + lport = (struct lpfc_nvme_lport *)localport->private; /* NVME rports are not preserved across devloss. -- 2.13.1
[PATCH v3 01/20] lpfc: Fix plogi collision that causes illegal state transition
From: Dick KennedyMessage "0271 Illegal State Transition: node" seen in logs, all luns are unuseable for that target. A window exists in the rcv_plogi path where if the state is plogi issue but the driver has not issued a plogi, then two reglogins will be sent for the same RPI. The first one to complete will advance the state to prli issue the second one will be detected as an illegal state, and leave the node in an unusable state. Correct the completion routine for the PLOGI ACC that detects the state change when the driver starts discovery on the node again and drop the REGLOGIN mailbox command. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- v3: revise if test for better indentation per review removed unnecessary typecast --- drivers/scsi/lpfc/lpfc_els.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 6d1d6f691df4..2dae501dc323 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3930,7 +3930,25 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, if (mbox) { if ((rspiocb->iocb.ulpStatus == 0) && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { - lpfc_unreg_rpi(vport, ndlp); + if (!lpfc_unreg_rpi(vport, ndlp) && + (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || +ndlp->nlp_state == NLP_STE_REG_LOGIN_ISSUE)) { + lpfc_printf_vlog(vport, KERN_INFO, + LOG_DISCOVERY, + "0314 PLOGI recov DID x%x " + "Data: x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_state, + ndlp->nlp_rpi, ndlp->nlp_flag); + mp = mbox->context1; + if (mp) { + lpfc_mbuf_free(phba, mp->virt, + mp->phys); + kfree(mp); + } + mempool_free(mbox, phba->mbox_mem_pool); + goto out; + } + /* Increment reference count to ndlp to hold the * reference to ndlp for the callback function. */ -- 2.13.1
[PATCH v3 07/20] lpfc: Fix handling of FCP and NVME FC4 types in Pt2Pt topology
From: Dick KennedyAfter link bounce in a NVME Pt2Pt config, the driver managed to map the same nport twice, resulting in multiple device nodes for the same namespace. In Pt2Pt, the driver must send PRLI's for both (scsi) FCP and NVME rather than using fabric aids. The driver was inconsistent on handling various PRLI completions, especially rejects, which had reject codes cross the different protocol PRLI completions. Fixed to perform the following: if nvmet mode (fc port can only be a nvme target) - rejects all unsolicitly FCP PRLI's. Never issues a FCP PRLI. The multiple protocol PRLI's are sent simultaneously. However, driver will now only state transition after both PRLI's are complete. New flags were added to aid tracking the responses from the different PRLI's. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- v3: small change to if test for better indentation per review --- drivers/scsi/lpfc/lpfc_disc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 28 drivers/scsi/lpfc/lpfc_nportdisc.c | 9 + 3 files changed, 38 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 094c97b9e5f7..f9a566eaef04 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h @@ -159,6 +159,7 @@ struct lpfc_node_rrq { #define NLP_RNID_SND 0x0400 /* sent RNID request for this entry */ #define NLP_ELS_SND_MASK 0x07e0 /* sent ELS request for this entry */ #define NLP_NVMET_RECOV0x1000 /* NVMET auditing node for recovery. */ +#define NLP_FCP_PRLI_RJT 0x2000 /* Rport does not support FCP PRLI. */ #define NLP_DEFER_RM 0x0001 /* Remove this ndlp if no longer used */ #define NLP_DELAY_TMO 0x0002 /* delay timeout is running for node */ #define NLP_NPR_2B_DISC0x0004 /* node is included in num_disc_nodes */ diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 2dae501dc323..19af0e6e7667 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1966,6 +1966,7 @@ int lpfc_issue_els_plogi(struct lpfc_vport *vport, uint32_t did, uint8_t retry) { struct lpfc_hba *phba = vport->phba; + struct Scsi_Host *shost; struct serv_parm *sp; struct lpfc_nodelist *ndlp; struct lpfc_iocbq *elsiocb; @@ -1984,6 +1985,11 @@ lpfc_issue_els_plogi(struct lpfc_vport *vport, uint32_t did, uint8_t retry) if (!elsiocb) return 1; + shost = lpfc_shost_from_vport(vport); + spin_lock_irq(shost->host_lock); + ndlp->nlp_flag &= ~NLP_FCP_PRLI_RJT; + spin_unlock_irq(shost->host_lock); + pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); /* For PLOGI request, remainder of payload is service parameters */ @@ -3442,6 +3448,21 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, goto out_retry; } break; + case LSRJT_CMD_UNSUPPORTED: + /* lpfc nvmet returns this type of LS_RJT when it +* receives an FCP PRLI because lpfc nvmet only +* support NVME. ELS request is terminated for FCP4 +* on this rport. +*/ + if (stat.un.b.lsRjtRsnCodeExp == + LSEXP_REQ_UNSUPPORTED && cmd == ELS_CMD_PRLI) { + spin_lock_irq(shost->host_lock); + ndlp->nlp_flag |= NLP_FCP_PRLI_RJT; + spin_unlock_irq(shost->host_lock); + retry = 0; + goto out_retry; + } + break; } break; @@ -8007,6 +8028,13 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, rjt_exp = LSEXP_NOTHING_MORE; break; } + + /* NVMET accepts NVME PRLI only. Reject FCP PRLI */ + if (cmd == ELS_CMD_PRLI && phba->nvmet_support) { + rjt_err = LSRJT_CMD_UNSUPPORTED; + rjt_exp = LSEXP_REQ_UNSUPPORTED; + break; + } lpfc_disc_state_machine(vport, ndlp, elsiocb, NLP_EVT_RCV_PRLI); break; case ELS_CMD_LIRR: diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index a4488d6339c1..f3ad7cac355d 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -1895,6 +1895,15 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, goto out; } +
[PATCH v3 03/20] lpfc: Fix rediscovery on switch blade pull
From: Dick KennedyWhen the switch blade is pulled out then plugged back in, the driver does not issue a PLOGI to the target When the switch blade is pulled out, it does not reset the link. The driver ends up issuing a LOGO to the target, and finally sees devloss. Since the driver believes that a LOGO is outstanding, it does not issue a PLOGI to the target upon link up Correct by placing the ndlp in UNUSED state When devloss happens in LOGO_ISSUE state. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nportdisc.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 95b2b43ac37d..a4488d6339c1 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -2192,12 +2192,15 @@ lpfc_device_rm_logo_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, void *arg, uint32_t evt) { /* -* Take no action. If a LOGO is outstanding, then possibly DevLoss has -* timed out and is calling for Device Remove. In this case, the LOGO -* must be allowed to complete in state LOGO_ISSUE so that the rpi -* and other NLP flags are correctly cleaned up. +* DevLoss has timed out and is calling for Device Remove. +* In this case, abort the LOGO and cleanup the ndlp */ - return ndlp->nlp_state; + + lpfc_unreg_rpi(vport, ndlp); + /* software abort outstanding PLOGI */ + lpfc_els_abort(vport->phba, ndlp); + lpfc_drop_node(vport, ndlp); + return NLP_STE_FREED_NODE; } static uint32_t -- 2.13.1
[PATCH v3 00/20] lpfc updates for 11.4.0.3
This patch set provides a number of bug fixes and one additions. The additions are BB credit support. The patches were cut against the Martin's 4.13/scsi-fixes tree. There are no outside dependencies. V2: removed redundant Expresslane patch removed if type 6 support. Will add later. Incorporated patch from Maurizio Lombardi int constant too large V3: Address v2 review comments: revise if tests for better indentation removed unnecessary typecasts slight reword patch description or comment use list_splict_init Dick Kennedy (17): lpfc: Fix plogi collision that causes illegal state transition lpfc: Fix loop mode target discovery lpfc: Fix rediscovery on switch blade pull lpfc: Fix oops when NVME Target is discovered in a nonNVME environment lpfc: convert info messages to standard messages lpfc: Correct return error codes to align with nvme_fc transport lpfc: Fix handling of FCP and NVME FC4 types in Pt2Pt topology lpfc: Fix duplicate NVME rport entries and namespaces. lpfc: Fix crash in lpfc nvmet when fc port is reset lpfc: Fix NVME PRLI handling during RSCN lpfc: Correct issues with FAWWN and FDISCs lpfc: Limit amount of work processed in IRQ lpfc: Fix MRQ > 1 context list handling lpfc: Fix relative offset error on large nvmet target ios lpfc: Fix nvme target failure after 2nd adapter reset lpfc: Fix bad sgl reposting after 2nd adapter reset lpfc: lpfc version bump 11.4.0.3 James Smart (2): lpfc: remove console log clutter lpfc: Add Buffer to Buffer credit recovery support Maurizio Lombardi (1): scsi: lpfc: fix "integer constant too large" error on 32bit archs drivers/scsi/lpfc/lpfc.h | 3 +- drivers/scsi/lpfc/lpfc_attr.c | 52 ++- drivers/scsi/lpfc/lpfc_attr.h | 10 ++ drivers/scsi/lpfc/lpfc_crtn.h | 5 +- drivers/scsi/lpfc/lpfc_ct.c| 4 +- drivers/scsi/lpfc/lpfc_debugfs.c | 11 +- drivers/scsi/lpfc/lpfc_disc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 93 - drivers/scsi/lpfc/lpfc_hbadisc.c | 12 +- drivers/scsi/lpfc/lpfc_hw.h| 18 ++- drivers/scsi/lpfc/lpfc_hw4.h | 23 +++- drivers/scsi/lpfc/lpfc_init.c | 57 +--- drivers/scsi/lpfc/lpfc_mbox.c | 35 - drivers/scsi/lpfc/lpfc_nportdisc.c | 25 +++- drivers/scsi/lpfc/lpfc_nvme.c | 25 ++-- drivers/scsi/lpfc/lpfc_nvmet.c | 270 - drivers/scsi/lpfc/lpfc_nvmet.h | 14 ++ drivers/scsi/lpfc/lpfc_sli.c | 56 +--- drivers/scsi/lpfc/lpfc_sli4.h | 23 +++- drivers/scsi/lpfc/lpfc_version.h | 2 +- 20 files changed, 584 insertions(+), 155 deletions(-) -- 2.13.1
[PATCH v3 02/20] lpfc: Fix loop mode target discovery
From: Dick KennedyThe driver does not discover targets when in loop mode. The NLP type is correctly getting set when a fabric connection is detected but, not for loop. The unknown NLP type means that the driver does not issue a PRLI when in loop topology. Thus target discovery fails. Fix by checking the topology during discovery. If it is loop, set the NLP FC4 type to FCP. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nportdisc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index f74cb0142fd4..95b2b43ac37d 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -1724,6 +1724,9 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, lpfc_nvme_update_localport(vport); } + } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { + ndlp->nlp_fc4_type |= NLP_FC4_FCP; + } else if (ndlp->nlp_fc4_type == 0) { rc = lpfc_ns_cmd(vport, SLI_CTNS_GFT_ID, 0, ndlp->nlp_DID); -- 2.13.1
Re: [v4.13-rc BUG] system lockup when running big buffered write(4M) to IB SRP via mpath
On Wed, Aug 23 2017 at 11:12am -0400, Bart Van Asschewrote: > On Wed, 2017-08-23 at 19:35 +0800, Ming Lei wrote: > > soft lockup still can be observed easily with patch d4acf3650c7c( > > block: Make blk_mq_delay_kick_requeue_list() rerun the queue at a quiet > > time), > > but no hard lockup. > > Hello Ming, > > I never claimed that commit d4acf3650c7c was a full solution to avoid these > soft lockups. I assume these results mean that patch series "[PATCH 0/7] > Device mapper and dm-mpath fixes" was not applied to the kernel used in your > tests? A colleague of you has reported that that patch series is sufficient > to avoid these soft lockups. See also > https://www.redhat.com/archives/dm-devel/2017-August/msg00122.html. FYI, I'll try to review/stage that patchset for 4.14 over the next few days. (I'm not yet back to working full-time but will try to handle my upstream responsibilities) Mike
[PATCH 22/31] qla2xxx: Add support for minimum link speed
From: Sawan ChandakSigned-off-by: Sawan Chandak Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 36 drivers/scsi/qla2xxx/qla_def.h | 4 drivers/scsi/qla2xxx/qla_fw.h | 4 +++- drivers/scsi/qla2xxx/qla_isr.c | 5 + drivers/scsi/qla2xxx/qla_mbx.c | 46 ++--- 5 files changed, 91 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 9d2862233e3c..75c4b312645e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -1481,6 +1481,38 @@ qla2x00_pep_version_show(struct device *dev, struct device_attribute *attr, ha->pep_version[0], ha->pep_version[1], ha->pep_version[2]); } +static ssize_t +qla2x00_min_link_speed_show(struct device *dev, struct device_attribute *attr, +char *buf) +{ + scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); + struct qla_hw_data *ha = vha->hw; + + if (!IS_QLA27XX(ha)) + return scnprintf(buf, PAGE_SIZE, "\n"); + + return scnprintf(buf, PAGE_SIZE, "%s\n", + ha->min_link_speed == 5 ? "32Gps" : + ha->min_link_speed == 4 ? "16Gps" : + ha->min_link_speed == 3 ? "8Gps" : + ha->min_link_speed == 2 ? "4Gps" : + ha->min_link_speed != 0 ? "unknown" : ""); +} + +static ssize_t +qla2x00_max_speed_sup_show(struct device *dev, struct device_attribute *attr, +char *buf) +{ + scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); + struct qla_hw_data *ha = vha->hw; + + if (!IS_QLA27XX(ha)) + return scnprintf(buf, PAGE_SIZE, "\n"); + + return scnprintf(buf, PAGE_SIZE, "%s\n", + ha->max_speed_sup ? "32Gps" : "16Gps"); +} + static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); @@ -1526,6 +1558,8 @@ static DEVICE_ATTR(allow_cna_fw_dump, S_IRUGO | S_IWUSR, qla2x00_allow_cna_fw_dump_show, qla2x00_allow_cna_fw_dump_store); static DEVICE_ATTR(pep_version, S_IRUGO, qla2x00_pep_version_show, NULL); +static DEVICE_ATTR(min_link_speed, S_IRUGO, qla2x00_min_link_speed_show, NULL); +static DEVICE_ATTR(max_speed_sup, S_IRUGO, qla2x00_max_speed_sup_show, NULL); struct device_attribute *qla2x00_host_attrs[] = { _attr_driver_version, @@ -1560,6 +1594,8 @@ struct device_attribute *qla2x00_host_attrs[] = { _attr_fw_dump_size, _attr_allow_cna_fw_dump, _attr_pep_version, + _attr_min_link_speed, + _attr_max_speed_sup, NULL, }; diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 609687d04e3c..0f80b812f4a7 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -902,6 +902,7 @@ struct mbx_cmd_32 { #define MBA_SHUTDOWN_REQUESTED 0x8062 /* Shutdown Requested */ #define MBA_TEMPERATURE_ALERT 0x8070 /* Temperature Alert */ #define MBA_DPORT_DIAGNOSTICS 0x8080 /* D-port Diagnostics */ +#define MBA_TRANS_INSERT 0x8130 /* Transceiver Insertion */ #define MBA_FW_INIT_FAILURE0x8401 /* Firmware initialization failure */ #define MBA_MIRROR_LUN_CHANGE 0x8402 /* Mirror LUN State Change Notification */ @@ -4026,6 +4027,8 @@ struct qla_hw_data { struct qlt_hw_data tgt; int allow_cna_fw_dump; + uint16_t min_link_speed; + uint16_t max_speed_sup; atomic_tnvme_active_aen_cnt; uint16_tnvme_last_rptd_aen; /* Last recorded aen count */ @@ -4212,6 +4215,7 @@ typedef struct scsi_qla_host { int fcport_count; wait_queue_head_t fcport_waitQ; wait_queue_head_t vref_waitq; + uint8_t min_link_speed_feat; } scsi_qla_host_t; struct qla27xx_image_status { diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index b9c9886e8b1d..94eb1694fc3e 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -1745,7 +1745,9 @@ struct nvram_81xx { uint16_t reserved_6_3[14]; /* Offset 192. */ - uint16_t reserved_7[32]; + uint8_t min_link_speed; + uint8_t reserved_7_0; + uint16_t reserved_7[31]; /* * BIT 0 = Enable spinup delay diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index c58fb493dbd9..527c5218e10b 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1233,6 +1233,11 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) schedule_work(>board_disable);
[PATCH 20/31] qla2xxx: Print correct mailbox registers in failed summary
From: Joe CarnuccioSigned-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_mbx.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 52cb9882bf31..da992b761402 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -106,7 +106,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) uint16_t __iomem *optr; uint32_tcnt; uint32_tmboxes; - uint16_t __iomem *mbx_reg; unsigned long wait_time; struct qla_hw_data *ha = vha->hw; scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); @@ -490,21 +489,24 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) mbx_done: if (rval) { - ql_dbg(ql_dbg_disc, base_vha, 0x1020, - " Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, mb[3]=%x, cmd=%x .\n", - mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3], command); - + if (ql2xextended_error_logging & (ql_dbg_disc|ql_dbg_mbx)) { + pr_warn("%s [%s]-%04x:%ld: Failed", QL_MSGHDR, + dev_name(>pdev->dev), 0x1020+0x800, + vha->host_no); + mboxes = mcp->in_mb; + cnt = 4; + for (i = 0; i < ha->mbx_count && cnt; i++, mboxes >>= 1) + if (mboxes & BIT_0) { + printk(" mb[%u]=%x", i, mcp->mb[i]); + cnt--; + } + pr_warn(" cmd=%x \n", command); + } ql_dbg(ql_dbg_mbx, vha, 0x1198, - "host status: 0x%x, flags:0x%lx, intr ctrl reg:0x%x, intr status:0x%x\n", + "host_status=%#x intr_ctrl=%#x intr_status=%#x\n", RD_REG_DWORD(>isp24.host_status), - ha->fw_dump_cap_flags, RD_REG_DWORD(>isp24.ictrl), RD_REG_DWORD(>isp24.istatus)); - - mbx_reg = >isp24.mailbox0; - for (i = 0; i < 6; i++) - ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1199, - "mbox[%d] 0x%04x\n", i, RD_REG_WORD(mbx_reg++)); } else { ql_dbg(ql_dbg_mbx, base_vha, 0x1021, "Done %s.\n", __func__); } -- 2.12.0
[PATCH 23/31] qla2xxx: Add LR distance support from nvram bit
From: Joe CarnuccioSigned-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 9 ++- drivers/scsi/qla2xxx/qla_fw.h | 24 +++--- drivers/scsi/qla2xxx/qla_mbx.c | 56 -- 3 files changed, 61 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 0f80b812f4a7..486c075998f6 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3471,7 +3471,7 @@ struct qla_hw_data { uint32_tusing_lr_setting:1; } flags; - u8 long_range_distance; /* 32G & above */ + uint16_t long_range_distance; /* 32G & above */ #define LR_DISTANCE_5K 1 #define LR_DISTANCE_10K 0 @@ -4027,6 +4027,7 @@ struct qla_hw_data { struct qlt_hw_data tgt; int allow_cna_fw_dump; + uint32_t fw_ability_mask; uint16_t min_link_speed; uint16_t max_speed_sup; @@ -4034,6 +4035,12 @@ struct qla_hw_data { uint16_tnvme_last_rptd_aen; /* Last recorded aen count */ }; +#define FW_ABILITY_MAX_SPEED_MASK 0xFUL +#define FW_ABILITY_MAX_SPEED_16G 0x0 +#define FW_ABILITY_MAX_SPEED_32G 0x1 +#define FW_ABILITY_MAX_SPEED(ha) \ + (ha->fw_ability_mask & FW_ABILITY_MAX_SPEED_MASK) + /* * Qlogic scsi host structure */ diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 94eb1694fc3e..bec641aae7b3 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -1699,6 +1699,15 @@ struct access_chip_rsp_84xx { #define FAC_OPT_CMD_UNLOCK_SEMAPHORE 0x04 #define FAC_OPT_CMD_GET_SECTOR_SIZE0x05 +/* enhanced features bit definitions */ +#define NEF_LR_DIST_ENABLE BIT_0 + +/* LR Distance bit positions */ +#define LR_DIST_NV_POS 2 +#define LR_DIST_FW_POS 12 +#define LR_DIST_FW_SHIFT (LR_DIST_FW_POS - LR_DIST_NV_POS) +#define LR_DIST_FW_FIELD(x)((x) << LR_DIST_FW_SHIFT & 0xf000) + struct nvram_81xx { /* NVRAM header. */ uint8_t id[4]; @@ -1841,16 +1850,13 @@ struct nvram_81xx { uint8_t reserved_21[16]; uint16_t reserved_22[3]; - /* -* BIT 0 = Extended BB credits for LR -* BIT 1 = Virtual Fabric Enable -* BIT 2 = Enhanced Features Unused -* BIT 3-7 = Enhanced Features Reserved + /* Offset 406 (0x196) Enhanced Features +* BIT 0= Extended BB credits for LR +* BIT 1= Virtual Fabric Enable +* BIT 2-5 = Distance Support if BIT 0 is on +* BIT 6-15 = Unused */ - /* Enhanced Features */ - uint8_t enhanced_features; - - uint8_t reserved_23; + uint16_t enhanced_features; uint16_t reserved_24[4]; /* Offset 416. */ diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 32bbbd50567d..99502fa90810 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -567,6 +567,28 @@ qla2x00_load_ram(scsi_qla_host_t *vha, dma_addr_t req_dma, uint32_t risc_addr, #defineEXTENDED_BB_CREDITS BIT_0 #defineNVME_ENABLE_FLAGBIT_3 +static inline uint16_t qla25xx_set_sfp_lr_dist(struct qla_hw_data *ha) +{ + uint16_t mb4 = BIT_0; + + if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) + mb4 |= ha->long_range_distance << LR_DIST_FW_POS; + + return mb4; +} + +static inline uint16_t qla25xx_set_nvr_lr_dist(struct qla_hw_data *ha) +{ + uint16_t mb4 = BIT_0; + + if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) { + struct nvram_81xx *nv = ha->nvram; + + mb4 |= LR_DIST_FW_FIELD(nv->enhanced_features); + } + + return mb4; +} /* * qla2x00_execute_fw @@ -602,27 +624,25 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr) mcp->mb[2] = LSW(risc_addr); mcp->mb[3] = 0; mcp->mb[4] = 0; + ha->flags.using_lr_setting = 0; if (IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) { if (ql2xautodetectsfp) { if (ha->flags.detected_lr_sfp) { - mcp->mb[4] |= EXTENDED_BB_CREDITS; - if (IS_QLA27XX(ha)) - mcp->mb[4] |= - (u16)ha->long_range_distance << 12; + mcp->mb[4] |= + qla25xx_set_sfp_lr_dist(ha); ha->flags.using_lr_setting = 1; } } else { struct nvram_81xx *nv = ha->nvram; - +
[PATCH 27/31] qla2xxx: Recheck session state after RSCN
From: Quinn TranWhen RSCN is delivered for specific remote port, Use ADISC to verify the session is still valid or not. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_gs.c | 16 +++- drivers/scsi/qla2xxx/qla_init.c | 4 +--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 3aada5dd597f..0b219b3ca653 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -106,7 +106,7 @@ int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *, void *); int qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *); int qla24xx_detect_sfp(scsi_qla_host_t *vha); - +int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8); /* * Global Data in qla_os.c source file. */ diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 0ec250993e93..bc3db6abc9a0 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -2816,13 +2816,19 @@ void qla24xx_handle_gidpn_event(scsi_qla_host_t *vha, struct event_arg *ea) case MODE_INITIATOR: case MODE_DUAL: default: + ql_dbg(ql_dbg_disc, vha, 0x201f, + "%s %d %8phC post %s\n", __func__, + __LINE__, fcport->port_name, + (atomic_read(>state) == + FCS_ONLINE) ? "gpdb" : "gnl"); + if (atomic_read(>state) == FCS_ONLINE) - break; - ql_dbg(ql_dbg_disc, vha, 0x201f, - "%s %d %8phC post gnl\n", - __func__, __LINE__, fcport->port_name); - qla24xx_post_gnl_work(vha, fcport); + qla24xx_post_gpdb_work(vha, + fcport, PDO_FORCE_ADISC); + else + qla24xx_post_gnl_work(vha, + fcport); break; } } else { /* fcport->d_id.b24 != ea->id.b24 */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index fe2d196833aa..30b3acacbfca 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -36,7 +36,6 @@ static int qla2x00_restart_isp(scsi_qla_host_t *); static struct qla_chip_state_84xx *qla84xx_get_chip(struct scsi_qla_host *); static int qla84xx_init_chip(scsi_qla_host_t *); static int qla25xx_init_queues(struct qla_hw_data *); -static int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8); static int qla24xx_post_prli_work(struct scsi_qla_host*, fc_port_t *); static void qla24xx_handle_plogi_done_event(struct scsi_qla_host *, struct event_arg *); @@ -774,8 +773,7 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport) return rval; } -static int qla24xx_post_gpdb_work(struct scsi_qla_host *vha, fc_port_t *fcport, -u8 opt) +int qla24xx_post_gpdb_work(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) { struct qla_work_evt *e; -- 2.12.0
[PATCH 29/31] qla2xxx: Ability to process multiple SGEs in Command SGL for CT passthrough commands.
From: Giridhar MalavaliSigned-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_iocb.c | 55 ++--- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index a36c485fae50..2f94159186d7 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2682,12 +2682,12 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) uint32_t*cur_dsd; struct scatterlist *sg; int index; - uint16_t tot_dsds; + uint16_t cmd_dsds, rsp_dsds; scsi_qla_host_t *vha = sp->vha; struct qla_hw_data *ha = vha->hw; struct bsg_job *bsg_job = sp->u.bsg_job; - int loop_iterartion = 0; int entry_count = 1; + cont_a64_entry_t *cont_pkt = NULL; ct_iocb->entry_type = CT_IOCB_TYPE; ct_iocb->entry_status = 0; @@ -2698,30 +2698,46 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) ct_iocb->vp_index = sp->vha->vp_idx; ct_iocb->comp_status = cpu_to_le16(0); - ct_iocb->cmd_dsd_count = - cpu_to_le16(bsg_job->request_payload.sg_cnt); + cmd_dsds = bsg_job->request_payload.sg_cnt; + rsp_dsds = bsg_job->reply_payload.sg_cnt; + + ct_iocb->cmd_dsd_count = cpu_to_le16(cmd_dsds); ct_iocb->timeout = 0; -ct_iocb->rsp_dsd_count = - cpu_to_le16(bsg_job->reply_payload.sg_cnt); -ct_iocb->rsp_byte_count = -cpu_to_le32(bsg_job->reply_payload.payload_len); + ct_iocb->rsp_dsd_count = cpu_to_le16(rsp_dsds); ct_iocb->cmd_byte_count = cpu_to_le32(bsg_job->request_payload.payload_len); -ct_iocb->dseg_0_address[0] = cpu_to_le32(LSD(sg_dma_address -(bsg_job->request_payload.sg_list))); -ct_iocb->dseg_0_address[1] = cpu_to_le32(MSD(sg_dma_address - (bsg_job->request_payload.sg_list))); -ct_iocb->dseg_0_len = cpu_to_le32(sg_dma_len -(bsg_job->request_payload.sg_list)); - avail_dsds = 1; - cur_dsd = (uint32_t *)ct_iocb->dseg_1_address; + avail_dsds = 2; + cur_dsd = (uint32_t *)ct_iocb->dseg_0_address; index = 0; - tot_dsds = bsg_job->reply_payload.sg_cnt; - for_each_sg(bsg_job->reply_payload.sg_list, sg, tot_dsds, index) { + for_each_sg(bsg_job->request_payload.sg_list, sg, cmd_dsds, index) { + dma_addr_t sle_dma; + + /* Allocate additional continuation packets? */ + if (avail_dsds == 0) { + /* +* Five DSDs are available in the Cont. +* Type 1 IOCB. +*/ + cont_pkt = qla2x00_prep_cont_type1_iocb( + vha, ha->req_q_map[0]); + cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; + avail_dsds = 5; + entry_count++; + } + + sle_dma = sg_dma_address(sg); + *cur_dsd++ = cpu_to_le32(LSD(sle_dma)); + *cur_dsd++ = cpu_to_le32(MSD(sle_dma)); + *cur_dsd++ = cpu_to_le32(sg_dma_len(sg)); + avail_dsds--; + } + + index = 0; + + for_each_sg(bsg_job->reply_payload.sg_list, sg, rsp_dsds, index) { dma_addr_t sle_dma; - cont_a64_entry_t *cont_pkt; /* Allocate additional continuation packets? */ if (avail_dsds == 0) { @@ -2740,7 +2756,6 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) *cur_dsd++ = cpu_to_le32(LSD(sle_dma)); *cur_dsd++ = cpu_to_le32(MSD(sle_dma)); *cur_dsd++ = cpu_to_le32(sg_dma_len(sg)); - loop_iterartion++; avail_dsds--; } ct_iocb->entry_count = entry_count; -- 2.12.0
[PATCH 28/31] qla2xxx: Skip zero queue count entry during FW dump capture
From: Joe CarnuccioIf queue count is zero while reading FW dump template, for entry T263/T274, skip capturing those entries during FW dump capture. Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_tmpl.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index b18646d6057f..733e8dcccf5c 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -443,8 +443,12 @@ qla27xx_fwdt_entry_t263(struct scsi_qla_host *vha, qla27xx_skip_entry(ent, buf); } - if (buf) - ent->t263.num_queues = count; + if (buf) { + if (count) + ent->t263.num_queues = count; + else + qla27xx_skip_entry(ent, buf); + } return false; } @@ -692,11 +696,12 @@ qla27xx_fwdt_entry_t274(struct scsi_qla_host *vha, qla27xx_skip_entry(ent, buf); } - if (buf) - ent->t274.num_queues = count; - - if (!count) - qla27xx_skip_entry(ent, buf); + if (buf) { + if (count) + ent->t274.num_queues = count; + else + qla27xx_skip_entry(ent, buf); + } return false; } -- 2.12.0
[PATCH 30/31] qla2xxx: Do not call abort handler function during chip reset
From: Sawan ChandakIf there are IO's running and host reset or chip reset is triggered, IO's can fail due to rport time out. During chip reset recovery process, driver notifies the transport layer that remote port no longer exist, by calling fc_remote_port_delete(). When this function is called, it actually delays deletion by "blocking" it. It sets the remote port state to "FC_PORTSTATE_BLOCKED" and sets FC_RPORT_DEVLOSS_PENDING. When driver tries to abort the command by calling its abort handler function, abort handler will wait until remote port state is blocked state or wait for dev_loss_tmo time. Due to this bocking, rport times out and results in an IO failure. This patch adds a check for any active reset process before calling abort handler function. Signed-off-by: Sawan Chandak Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 715427f8e732..56bd086b79ea 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1732,6 +1732,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) >hardware_lock, flags); } else if (GET_CMD_SP(sp) && !ha->flags.eeh_busy && + (!test_bit(ABORT_ISP_ACTIVE, + >dpc_flags)) && (sp->type == SRB_SCSI_CMD)) { /* * Don't abort commands in -- 2.12.0
[PATCH 21/31] qla2xxx: Remove potential macro parameter side-effect in ql_dump_regs()
From: Joe CarnuccioSigned-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 065449e0f347..3e9dc54b89a3 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -2736,9 +2736,9 @@ ql_dump_regs(uint32_t level, scsi_qla_host_t *vha, int32_t id) mbx_reg = MAILBOX_REG(ha, reg, 0); ql_dbg(level, vha, id, "Mailbox registers:\n"); - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++, mbx_reg++) ql_dbg(level, vha, id, - "mbox[%d] 0x%04x\n", i, RD_REG_WORD(mbx_reg++)); + "mbox[%d] 0x%04x\n", i, RD_REG_WORD(mbx_reg)); } -- 2.12.0
[PATCH 31/31] qla2xxx: Update driver version to 10.00.00.01-k
Signed-off-by: Himanshu Madhani--- drivers/scsi/qla2xxx/qla_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 005a378f7fab..8c4b505c9f66 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h @@ -7,7 +7,7 @@ /* * Driver version */ -#define QLA2XXX_VERSION "10.00.00.00-k" +#define QLA2XXX_VERSION "10.00.00.01-k" #define QLA_DRIVER_MAJOR_VER 10 #define QLA_DRIVER_MINOR_VER 0 -- 2.12.0
[PATCH 26/31] qla2xxx: Increase ql2xmaxqdepth to 64
From: Michael Hernandezql2xmaxqdepth is the module parameter that seeds the per target queue depth in the Scsi midlayer (sdev->queue_depth). Performance testing revealed that increasing this value would improve IOPS numbers under certain workloads. Signed-off-by: Michael Hernandez Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 0814ff4fa2c0..715427f8e732 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -113,12 +113,12 @@ MODULE_PARM_DESC(ql2xfdmienable, "Enables FDMI registrations. " "0 - no FDMI. Default is 1 - perform FDMI."); -#define MAX_Q_DEPTH32 +#define MAX_Q_DEPTH64 static int ql2xmaxqdepth = MAX_Q_DEPTH; module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(ql2xmaxqdepth, "Maximum queue depth to set for each LUN. " - "Default is 32."); + "Default is 64."); #if (IS_ENABLED(CONFIG_NVME_FC)) int ql2xenabledif; -- 2.12.0
[PATCH 25/31] qla2xxx: Enable Async TMF processing
Signed-off-by: Himanshu MadhaniSigned-off-by: Giridhar Malavali --- drivers/scsi/qla2xxx/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index c217cec4dd49..0814ff4fa2c0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -200,7 +200,7 @@ MODULE_PARM_DESC(ql2xgffidenable, "Enables GFF_ID checks of port type. " "Default is 0 - Do not use GFF_ID information."); -int ql2xasynctmfenable; +int ql2xasynctmfenable = 1; module_param(ql2xasynctmfenable, int, S_IRUGO); MODULE_PARM_DESC(ql2xasynctmfenable, "Enables issue of TM IOCBs asynchronously via IOCB mechanism" -- 2.12.0
[PATCH 19/31] qla2xxx: Fix task mgmt handling for NPIV
From: Quinn TranFix task management response for NPIV Target mode. Current code uses the wrong vp index. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 7 ++- drivers/scsi/qla2xxx/qla_target.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 6a6d9db6479f..4f1621fd5ef2 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1901,6 +1901,7 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha, mcmd->reset_count = ha->base_qpair->chip_reset; mcmd->tmr_func = QLA_TGT_ABTS; mcmd->qpair = ha->base_qpair; + mcmd->vha = vha; /* * LUN is looked up by target-core internally based on the passed @@ -2003,7 +2004,7 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, static void qlt_24xx_send_task_mgmt_ctio(struct qla_qpair *qpair, struct qla_tgt_mgmt_cmd *mcmd, uint32_t resp_code) { - struct scsi_qla_host *ha = qpair->vha; + struct scsi_qla_host *ha = mcmd->vha; struct atio_from_isp *atio = >orig_iocb.atio; struct ctio7_to_24xx *ctio; uint16_t temp; @@ -3464,6 +3465,9 @@ static int __qlt_send_term_exchange(struct qla_qpair *qpair, ql_dbg(ql_dbg_tgt, vha, 0xe009, "Sending TERM EXCH CTIO (ha=%p)\n", ha); + if (cmd) + vha = cmd->vha; + pkt = (request_t *)qla2x00_alloc_iocbs_ready(qpair, NULL); if (pkt == NULL) { ql_dbg(ql_dbg_tgt, vha, 0xe050, @@ -4379,6 +4383,7 @@ static int qlt_issue_task_mgmt(struct fc_port *sess, u64 lun, mcmd->flags = flags; mcmd->reset_count = ha->base_qpair->chip_reset; mcmd->qpair = ha->base_qpair; + mcmd->vha = vha; switch (fn) { case QLA_TGT_LUN_RESET: diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 7fe02d036bdf..96fce43e1e46 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -959,6 +959,7 @@ struct qla_tgt_mgmt_cmd { uint8_t fc_tm_rsp; struct fc_port *sess; struct qla_qpair *qpair; + struct scsi_qla_host *vha; struct se_cmd se_cmd; struct work_struct free_work; unsigned int flags; -- 2.12.0
[PATCH 18/31] qla2xxx: Allow SNS fabric login to be retried
From: Joe CarnuccioIf SNS fabric login fails, set loop resync flag to retry via dpc. Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index d00e0129c51b..fe2d196833aa 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4752,24 +4752,16 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) qla2x00_fdmi_register(vha); /* Ensure we are logged into the SNS. */ - if (IS_FWI2_CAPABLE(ha)) - loop_id = NPH_SNS; - else - loop_id = SIMPLE_NAME_SERVER; + loop_id = NPH_SNS_LID(ha); rval = ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff, 0xfc, mb, BIT_1|BIT_0); - if (rval != QLA_SUCCESS) { + if (rval != QLA_SUCCESS || mb[0] != MBS_COMMAND_COMPLETE) { + ql_dbg(ql_dbg_disc, vha, 0x20a1, + "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x (%x).\n", + loop_id, mb[0], mb[1], mb[2], mb[6], mb[7], rval); set_bit(LOOP_RESYNC_NEEDED, >dpc_flags); return rval; } - if (mb[0] != MBS_COMMAND_COMPLETE) { - ql_dbg(ql_dbg_disc, vha, 0x20a1, - "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x " - "mb[6]=%x mb[7]=%x.\n", loop_id, mb[0], mb[1], - mb[2], mb[6], mb[7]); - return (QLA_SUCCESS); - } - if (test_and_clear_bit(REGISTER_FC4_NEEDED, >dpc_flags)) { if (qla2x00_rft_id(vha)) { /* EMPTY */ -- 2.12.0
[PATCH 17/31] qla2xxx: Add timeout ability to wait_for_sess_deletion().
From: Joe CarnuccioSigned-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 2 +- drivers/scsi/qla2xxx/qla_target.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 10c3ee53ec3a..c217cec4dd49 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1141,7 +1141,7 @@ qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha) { qla2x00_mark_all_devices_lost(vha, 0); - wait_event(vha->fcport_waitQ, test_fcport_count(vha)); + wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha), 10*HZ); } /* diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 3bcfbee2ae26..6a6d9db6479f 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1479,7 +1479,7 @@ int qlt_stop_phase1(struct qla_tgt *tgt) ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00a, "Waiting for tgt %p: sess_count=%d\n", tgt, tgt->sess_count); - wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); + wait_event_timeout(tgt->waitQ, test_tgt_sess_count(tgt), 10*HZ); /* Big hammer */ if (!ha->flags.host_shutting_down && @@ -1487,7 +1487,7 @@ int qlt_stop_phase1(struct qla_tgt *tgt) qlt_disable_vha(vha); /* Wait for sessions to clear out (just in case) */ - wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); + wait_event_timeout(tgt->waitQ, test_tgt_sess_count(tgt), 10*HZ); return 0; } EXPORT_SYMBOL(qlt_stop_phase1); -- 2.12.0
[PATCH 24/31] qla2xxx: Cleanup NPIV host in target mode during config teardown
From: Quinn TranWhen we tear down the NPIV host configuration in target mode, the qla_tgt struct was left dangling on the global list. This patch cleans up link list and frees memory. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 11 +++ drivers/scsi/qla2xxx/qla_target.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 4f1621fd5ef2..43113d52893b 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1528,6 +1528,7 @@ static void qlt_release(struct qla_tgt *tgt) u64 key = 0; u16 i; struct qla_qpair_hint *h; + struct qla_hw_data *ha = vha->hw; if ((vha->vha_tgt.qla_tgt != NULL) && !tgt->tgt_stop && !tgt->tgt_stopped) @@ -1548,12 +1549,18 @@ static void qlt_release(struct qla_tgt *tgt) } } kfree(tgt->qphints); + mutex_lock(_tgt_mutex); + list_del(>vha_tgt.qla_tgt->tgt_list_entry); + mutex_unlock(_tgt_mutex); btree_for_each_safe64(>lun_qpair_map, key, node) btree_remove64(>lun_qpair_map, key); btree_destroy64(>lun_qpair_map); + if (ha->tgt.tgt_ops && ha->tgt.tgt_ops->remove_target) + ha->tgt.tgt_ops->remove_target(vha); + vha->vha_tgt.qla_tgt = NULL; ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00d, @@ -6175,10 +6182,6 @@ int qlt_remove_target(struct qla_hw_data *ha, struct scsi_qla_host *vha) /* free left over qfull cmds */ qlt_init_term_exchange(vha); - mutex_lock(_tgt_mutex); - list_del(>vha_tgt.qla_tgt->tgt_list_entry); - mutex_unlock(_tgt_mutex); - ql_dbg(ql_dbg_tgt, vha, 0xe03c, "Unregistering target for host %ld(%p)", vha->host_no, ha); qlt_release(vha->vha_tgt.qla_tgt); diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 96fce43e1e46..aba58d3848a6 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -705,6 +705,7 @@ struct qla_tgt_func_tmpl { int (*get_dif_tags)(struct qla_tgt_cmd *cmd, uint16_t *pfw_prot_opts); int (*chk_dif_tags)(uint32_t tag); void (*add_target)(struct scsi_qla_host *); + void (*remove_target)(struct scsi_qla_host *); }; int qla2x00_wait_for_hba_online(struct scsi_qla_host *); -- 2.12.0
[PATCH 13/31] qla2xxx: Add ability to autodetect SFP type
From: Quinn TranSFP can come in 2 formats: short range/SR and long range/LR. For LR, user the can increase the number of Buffer to Buffer credits between end points, via Cavium's command line tool. By default, FW uses a lower BB Credit value optimized for SR. This patch will read the SFP for each link up event and during chip reset sequence. If the SFP type and setting are mismatch, then the chip is reset 1 time to use the appropriate setting. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 42 ++-- drivers/scsi/qla2xxx/qla_def.h | 92 +- drivers/scsi/qla2xxx/qla_gbl.h | 3 + drivers/scsi/qla2xxx/qla_init.c | 143 drivers/scsi/qla2xxx/qla_isr.c | 5 ++ drivers/scsi/qla2xxx/qla_mbx.c | 83 +-- drivers/scsi/qla2xxx/qla_os.c | 36 +- 7 files changed, 361 insertions(+), 43 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 08a1feb3a195..9d2862233e3c 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -565,47 +565,17 @@ qla2x00_sysfs_read_sfp(struct file *filp, struct kobject *kobj, { struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj, struct device, kobj))); - struct qla_hw_data *ha = vha->hw; - uint16_t iter, addr, offset; int rval; - if (!capable(CAP_SYS_ADMIN) || off != 0 || count != SFP_DEV_SIZE * 2) + if (!capable(CAP_SYS_ADMIN) || off != 0 || count < SFP_DEV_SIZE) return 0; - if (ha->sfp_data) - goto do_read; - - ha->sfp_data = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, - >sfp_data_dma); - if (!ha->sfp_data) { - ql_log(ql_log_warn, vha, 0x706c, - "Unable to allocate memory for SFP read-data.\n"); + if (qla2x00_reset_active(vha)) return 0; - } - -do_read: - memset(ha->sfp_data, 0, SFP_BLOCK_SIZE); - addr = 0xa0; - for (iter = 0, offset = 0; iter < (SFP_DEV_SIZE * 2) / SFP_BLOCK_SIZE; - iter++, offset += SFP_BLOCK_SIZE) { - if (iter == 4) { - /* Skip to next device address. */ - addr = 0xa2; - offset = 0; - } - - rval = qla2x00_read_sfp(vha, ha->sfp_data_dma, ha->sfp_data, - addr, offset, SFP_BLOCK_SIZE, BIT_1); - if (rval != QLA_SUCCESS) { - ql_log(ql_log_warn, vha, 0x706d, - "Unable to read SFP data (%x/%x/%x).\n", rval, - addr, offset); - return -EIO; - } - memcpy(buf, ha->sfp_data, SFP_BLOCK_SIZE); - buf += SFP_BLOCK_SIZE; - } + rval = qla2x00_read_sfp_dev(vha, buf, count); + if (rval) + return -EIO; return count; } @@ -615,7 +585,7 @@ static struct bin_attribute sysfs_sfp_attr = { .name = "sfp", .mode = S_IRUSR | S_IWUSR, }, - .size = SFP_DEV_SIZE * 2, + .size = SFP_DEV_SIZE, .read = qla2x00_sysfs_read_sfp, }; diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index e3b225cc83f2..609687d04e3c 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3465,8 +3465,15 @@ struct qla_hw_data { uint32_tn2n_ae:1; uint32_tfw_started:1; uint32_tfw_init_done:1; + + uint32_tdetected_lr_sfp:1; + uint32_tusing_lr_setting:1; } flags; + u8 long_range_distance; /* 32G & above */ +#define LR_DISTANCE_5K 1 +#define LR_DISTANCE_10K 0 + /* This spinlock is used to protect "io transactions", you must * acquire it before doing any IO to the card, eg with RD_REG*() and * WRT_REG*() for the duration of your entire commandtransaction. @@ -3714,7 +3721,7 @@ struct qla_hw_data { struct sns_cmd_pkt *sns_cmd; dma_addr_t sns_cmd_dma; -#define SFP_DEV_SIZE256 +#define SFP_DEV_SIZE512 #define SFP_BLOCK_SIZE 64 void*sfp_data; dma_addr_t sfp_data_dma; @@ -4095,6 +4102,7 @@ typedef struct scsi_qla_host { #define FX00_HOST_INFO_RESEND 26 #define QPAIR_ONLINE_CHECK_NEEDED 27 #define SET_ZIO_THRESHOLD_NEEDED 28 +#define DETECT_SFP_CHANGE 29 unsigned long pci_flags; #define PFLG_DISCONNECTED 0 /* PCI device removed */ @@ -4378,6 +4386,88 @@ enum nexus_wait_type { WAIT_LUN, }; +/* Refer to SNIA SFF 8247 */ +struct sff_8247_a0 { + u8 txid;/* transceiver id */ + u8
[PATCH 10/31] qla2xxx: Remove extra register read
From: Quinn TranRemove extra register read for each interrupt for performance improvement. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c| 9 - drivers/scsi/qla2xxx/qla_target.c | 1 - 2 files changed, 10 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index c6c066186d97..df8a7f378e72 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3157,7 +3157,6 @@ qla24xx_msix_rsp_q(int irq, void *dev_id) struct device_reg_24xx __iomem *reg; struct scsi_qla_host *vha; unsigned long flags; - uint32_t stat = 0; rsp = (struct rsp_que *) dev_id; if (!rsp) { @@ -3171,19 +3170,11 @@ qla24xx_msix_rsp_q(int irq, void *dev_id) spin_lock_irqsave(>hardware_lock, flags); vha = pci_get_drvdata(ha->pdev); - /* -* Use host_status register to check to PCI disconnection before we -* we process the response queue. -*/ - stat = RD_REG_DWORD(>host_status); - if (qla2x00_check_reg32_for_disconnect(vha, stat)) - goto out; qla24xx_process_response_queue(vha, rsp); if (!ha->flags.disable_msix_handshake) { WRT_REG_DWORD(>hccr, HCCRX_CLR_RISC_INT); RD_REG_DWORD_RELAXED(>hccr); } -out: spin_unlock_irqrestore(>hardware_lock, flags); return IRQ_HANDLED; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 4e2a64773060..3bcfbee2ae26 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -6530,7 +6530,6 @@ qlt_24xx_process_atio_queue(struct scsi_qla_host *vha, uint8_t ha_locked) /* Adjust ring index */ WRT_REG_DWORD(ISP_ATIO_Q_OUT(vha), ha->tgt.atio_ring_index); - RD_REG_DWORD_RELAXED(ISP_ATIO_Q_OUT(vha)); } void -- 2.12.0
[PATCH 14/31] qla2xxx: Prevent sp->free null/uninitialized pointer dereference.
From: Joe CarnuccioSigned-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 12 ++-- drivers/scsi/qla2xxx/qla_mr.c | 7 --- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index b380a7c97d5b..d00e0129c51b 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -808,6 +808,12 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) if (!sp) goto done; + sp->type = SRB_MB_IOCB; + sp->name = "gpdb"; + sp->gen1 = fcport->rscn_gen; + sp->gen2 = fcport->login_gen; + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); + pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, _dma); if (pd == NULL) { ql_log(ql_log_warn, vha, 0xd043, @@ -816,12 +822,6 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) } memset(pd, 0, max(PORT_DATABASE_SIZE, PORT_DATABASE_24XX_SIZE)); - sp->type = SRB_MB_IOCB; - sp->name = "gpdb"; - sp->gen1 = fcport->rscn_gen; - sp->gen2 = fcport->login_gen; - qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); - mb = sp->u.iocb_cmd.u.mbx.out_mb; mb[0] = MBC_GET_PORT_DATABASE; mb[1] = fcport->loop_id; diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index 10b742d27e16..e23a3d4c36f3 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -1819,6 +1819,10 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) if (!sp) goto done; + sp->type = SRB_FXIOCB_DCMD; + sp->name = "fxdisc"; + qla2x00_init_timer(sp, FXDISC_TIMEOUT); + fdisc = >u.iocb_cmd; switch (fx_type) { case FXDISC_GET_CONFIG_INFO: @@ -1920,9 +1924,6 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) goto done_unmap_req; } - sp->type = SRB_FXIOCB_DCMD; - sp->name = "fxdisc"; - qla2x00_init_timer(sp, FXDISC_TIMEOUT); fdisc->timeout = qla2x00_fxdisc_iocb_timeout; fdisc->u.fxiocb.req_func_type = cpu_to_le16(fx_type); sp->done = qla2x00_fxdisc_sp_done; -- 2.12.0
[PATCH 16/31] qla2xxx: Move logging default mask to execute once only.
From: Joe CarnuccioSigned-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dbg.c | 2 -- drivers/scsi/qla2xxx/qla_os.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 7e7cd79038be..065449e0f347 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -2520,8 +2520,6 @@ qla83xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) static inline int ql_mask_match(uint32_t level) { - if (ql2xextended_error_logging == 1) - ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK; return (level & ql2xextended_error_logging) == level; } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 5b033e265a3b..10c3ee53ec3a 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -6648,6 +6648,8 @@ qla2x00_module_init(void) strcpy(qla2x00_version_str, QLA2XXX_VERSION); if (ql2xextended_error_logging) strcat(qla2x00_version_str, "-debug"); + if (ql2xextended_error_logging == 1) + ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK; qla2xxx_transport_template = fc_attach_transport(_transport_functions); -- 2.12.0
[PATCH 15/31] qla2xxx: Use sp->free instead of hard coded call.
From: Joe CarnuccioCalling sp->free() ensures the context-correct free routine is called. Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index b6b070db5891..5b033e265a3b 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -742,7 +742,7 @@ qla2x00_sp_compl(void *ptr, int res) if (!atomic_dec_and_test(>ref_count)) return; - qla2x00_sp_free_dma(sp); + sp->free(sp); cmd->scsi_done(cmd); } @@ -814,7 +814,7 @@ qla2xxx_qpair_sp_compl(void *ptr, int res) if (!atomic_dec_and_test(>ref_count)) return; - qla2xxx_qpair_sp_free_dma(sp); + sp->free(sp); cmd->scsi_done(cmd); } @@ -935,7 +935,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) return 0; qc24_host_busy_free_sp: - qla2x00_sp_free_dma(sp); + sp->free(sp); qc24_host_busy: return SCSI_MLQUEUE_HOST_BUSY; @@ -1024,7 +1024,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd, return 0; qc24_host_busy_free_sp: - qla2xxx_qpair_sp_free_dma(sp); + sp->free(sp); qc24_host_busy: return SCSI_MLQUEUE_HOST_BUSY; -- 2.12.0
[PATCH 12/31] qla2xxx: Use fabric name for Get Port Speed command
From: Quinn TranThe Get Port Speed switch command needs the fabric port name of the remote device. Current code uses the registered WWPN. Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") Cc: # 4.10+ Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index b323a7c71eda..0ec250993e93 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3080,7 +3080,7 @@ int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport) GPSC_RSP_SIZE); /* GPSC req */ - memcpy(ct_req->req.gpsc.port_name, fcport->port_name, + memcpy(ct_req->req.gpsc.port_name, fcport->fabric_port_name, WWN_SIZE); sp->u.iocb_cmd.u.ctarg.req = fcport->ct_desc.ct_sns; -- 2.12.0
[PATCH 04/31] qla2xxx: Add command completion for error path
From: Duane GrigsbyThe driver held spinlocks during callbacks for NVME errors which resulted in a deadlock because recovery LS cmds needed the same lock. Signed-off-by: Duane Grigsby Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 2 ++ drivers/scsi/qla2xxx/qla_gbl.h | 2 ++ drivers/scsi/qla2xxx/qla_init.c | 1 + drivers/scsi/qla2xxx/qla_mid.c | 7 +++ drivers/scsi/qla2xxx/qla_nvme.c | 13 - drivers/scsi/qla2xxx/qla_os.c | 1 + 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index b3e3982a9db0..e3b225cc83f2 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -427,6 +427,7 @@ struct srb_iocb { enum nvmefc_fcp_datadir dir; uint32_t dl; uint32_t timeout_sec; + struct list_head entry; } nvme; } u; @@ -3338,6 +3339,7 @@ struct qla_qpair { struct work_struct q_work; struct list_head qp_list_elem; /* vha->qp_list */ struct list_head hints_list; + struct list_head nvme_done_list; uint16_t cpuid; struct qla_tgt_counters tgt_counters; }; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 97dcabc790c9..f614c37efc9c 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -865,4 +865,6 @@ void qlt_update_host_map(struct scsi_qla_host *, port_id_t); void qlt_remove_target_resources(struct qla_hw_data *); void qlt_clr_qp_table(struct scsi_qla_host *vha); +void qla_nvme_cmpl_io(struct srb_iocb *); + #endif /* _QLA_GBL_H */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 8f83571afc7b..988fb5d0f9e7 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -7806,6 +7806,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, qpair->vp_idx = vp_idx; qpair->fw_started = ha->flags.fw_started; INIT_LIST_HEAD(>hints_list); + INIT_LIST_HEAD(>nvme_done_list); qpair->chip_reset = ha->base_qpair->chip_reset; qpair->enable_class_2 = ha->base_qpair->enable_class_2; qpair->enable_explicit_conf = diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 3089094b48fa..608d1aeb97be 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -759,11 +759,18 @@ static void qla_do_work(struct work_struct *work) struct qla_qpair *qpair = container_of(work, struct qla_qpair, q_work); struct scsi_qla_host *vha; struct qla_hw_data *ha = qpair->hw; + struct srb_iocb *nvme, *nxt_nvme; spin_lock_irqsave(>qp_lock, flags); vha = pci_get_drvdata(ha->pdev); qla24xx_process_response_queue(vha, qpair->rsp); spin_unlock_irqrestore(>qp_lock, flags); + + list_for_each_entry_safe(nvme, nxt_nvme, >nvme_done_list, + u.nvme.entry) { + list_del_init(>u.nvme.entry); + qla_nvme_cmpl_io(nvme); + } } /* create response queue */ diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 97a7b222b549..5692ae128655 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -154,6 +154,16 @@ static void qla_nvme_sp_ls_done(void *ptr, int res) qla2x00_rel_sp(sp); } +void qla_nvme_cmpl_io(struct srb_iocb *nvme) +{ + srb_t *sp; + struct nvmefc_fcp_req *fd = nvme->u.nvme.desc; + + sp = container_of(nvme, srb_t, u.iocb_cmd); + fd->done(fd); + qla2xxx_rel_qpair_sp(sp->qpair, sp); +} + static void qla_nvme_sp_done(void *ptr, int res) { srb_t *sp = ptr; @@ -175,7 +185,8 @@ static void qla_nvme_sp_done(void *ptr, int res) fd->status = 0; fd->rcv_rsplen = nvme->u.nvme.rsp_pyld_len; - fd->done(fd); + list_add_tail(>u.nvme.entry, >qpair->nvme_done_list); + return; rel: qla2xxx_rel_qpair_sp(sp->qpair, sp); } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index d9a115577dc8..b43520ca6645 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -379,6 +379,7 @@ static void qla_init_base_qpair(struct scsi_qla_host *vha, struct req_que *req, ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; ha->base_qpair->msix = >msix_entries[QLA_MSIX_RSP_Q]; INIT_LIST_HEAD(>base_qpair->hints_list); + INIT_LIST_HEAD(>base_qpair->nvme_done_list); ha->base_qpair->enable_class_2 = ql2xenableclass2; /* init qpair to this cpu. Will adjust at run time. */ qla_cpu_update(rsp->qpair,
[PATCH 05/31] qla2xxx: Fix WWPN/WWNN in debug message
From: Darren TrapSigned-off-by: Darren Trap Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_nvme.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 5692ae128655..1f59e7a74c7b 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -60,8 +60,8 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) rport->req.port_id = fcport->d_id.b24; ql_log(ql_log_info, vha, 0x2102, - "%s: traddr=pn-0x%016llx:nn-0x%016llx PortID:%06x\n", - __func__, rport->req.port_name, rport->req.node_name, + "%s: traddr=nn-0x%016llx:pn-0x%016llx PortID:%06x\n", + __func__, rport->req.node_name, rport->req.port_name, rport->req.port_id); ret = nvme_fc_register_remoteport(vha->nvme_local_port, >req, @@ -723,8 +723,8 @@ void qla_nvme_register_hba(struct scsi_qla_host *vha) pinfo.port_id = vha->d_id.b24; ql_log(ql_log_info, vha, 0x, - "register_localport: host-traddr=pn-0x%llx:nn-0x%llx on portID:%x\n", - pinfo.port_name, pinfo.node_name, pinfo.port_id); + "register_localport: host-traddr=nn-0x%llx:pn-0x%llx on portID:%x\n", + pinfo.node_name, pinfo.port_name, pinfo.port_id); qla_nvme_fc_transport.dma_boundary = vha->host->dma_boundary; ret = nvme_fc_register_localport(, tmpl, -- 2.12.0
[PATCH 09/31] qla2xxx: Fix NPIV host enable after chip reset
From: Quinn TranFor NPIV ports, call configure_hba() so that NPIV ports can proceed to loop initialization. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dbg.c | 2 +- drivers/scsi/qla2xxx/qla_init.c | 2 +- drivers/scsi/qla2xxx/qla_mbx.c | 2 ++ drivers/scsi/qla2xxx/qla_mid.c | 5 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 7b74973d5788..7e7cd79038be 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -41,7 +41,7 @@ * | || 0x70ad-0x70ae | * | || 0x70d0-0x70d6 | * | || 0x70d7-0x70db | - * | Task Management | 0x8042 | 0x8000,0x800b | + * | Task Management | 0x8042 | 0x8000 | * | || 0x8019 | * | || 0x8025,0x8026 | * | || 0x8031,0x8032 | diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 988fb5d0f9e7..8f84cedab853 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5913,7 +5913,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) if (!status) { ql_dbg(ql_dbg_taskm, vha, 0x8022, "%s succeeded.\n", __func__); - + qla2x00_configure_hba(vha); spin_lock_irqsave(>vport_slock, flags); list_for_each_entry(vp, >vp_list, list) { if (vp->vp_idx) { diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 6164a2c9a1f4..f101aaa5254b 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -55,6 +55,8 @@ static struct rom_cmd { { MBC_GET_RETRY_COUNT }, { MBC_TRACE_CONTROL }, { MBC_INITIALIZE_MULTIQ }, + { MBC_IOCB_COMMAND_A64 }, + { MBC_GET_ADAPTER_LOOP_ID }, }; static int is_rom_cmd(uint16_t cmd) diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 608d1aeb97be..c0f8f6c17b79 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -187,6 +187,11 @@ qla24xx_enable_vp(scsi_qla_host_t *vha) !(ha->current_topology & ISP_CFG_F)) { vha->vp_err_state = VP_ERR_PORTDWN; fc_vport_set_state(vha->fc_vport, FC_VPORT_LINKDOWN); + ql_dbg(ql_dbg_taskm, vha, 0x800b, + "%s skip enable. loop_state %x topo %x\n", + __func__, base_vha->loop_state.counter, + ha->current_topology); + goto enable_failed; } -- 2.12.0
[PATCH 11/31] qla2xxx: Change ha->wq max_active value to default
From: Quinn Tranupdate ha->wq max_active from 1 to default. MQ interrupts are queued up via this work queue. This allows interrupts to be process in parrallel, instead of serialized by the work queue. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index d668ed4bd53e..fe5148899117 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3170,7 +3170,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) if (ha->mqenable) { bool mq = false; bool startit = false; - ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1); + ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); if (QLA_TGT_MODE_ENABLED()) { mq = true; -- 2.12.0
[PATCH 08/31] qla2xxx: Use BIT_6 to acquire FAWWPN from switch
From: Sawan ChandakIf FA-WWPN feature disabled on the switch side and enabled for the adapter, then driver would update the port name with switch port name. This patch fixes issue by checking correct BIT flag to validate. Fixes: 41dc529a4602 ("qla2xxx: Improve RSCN handling in driver") Cc: Signed-off-by: Sawan Chandak Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 234ef442ef5d..6164a2c9a1f4 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3682,7 +3682,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, if (qla_ini_mode_enabled(vha) && ha->flags.fawwpn_enabled && (rptid_entry->u.f1.flags & -VP_FLAGS_NAME_VALID)) { +BIT_6)) { memcpy(vha->port_name, rptid_entry->u.f1.port_name, WWN_SIZE); -- 2.12.0
[PATCH 07/31] qla2xxx: Fix system panic due to pointer access problem
From: Duane Grigsby[ 1013.772926] BUG: unable to handle kernel paging request at 00030020 [ 1013.772950] IP: qla24xx_els_ct_entry.isra.17+0x78/0x2a0 [qla2xxx] [ 1013.772951] PGD 0 [ 1013.772952] P4D 0 [ 1013.772952] [ 1013.772953] Oops: [#1] SMP [ 1013.772955] Modules linked in: qla2xxx(+) scsi_transport_fc nvme_fc nvme_fabrics nvme_core netconsole configfs af_packet iscsi_ibft iscsi_boot_sysfs xfs intel_rapl sb_edac libcrc32c x86_pkg_temp_thermal intel_powerclamp coretemp mgag200 kvm_intel ttm kvm drm_kms_helper ipmi_ssif irqbypass tg3 drm fb_sys_fops crct10dif_pclmul syscopyarea crc32_pclmul ghash_clmulni_intel ptp pcbc sysfillrect pps_core aesni_intel joydev aes_x86_64 sysimgblt crypto_simd iTCO_wdt libphy iTCO_vendor_support i2c_algo_bit glue_helper ipmi_si lpc_ich hpwdt ioatdma cryptd ipmi_devintf pcspkr mfd_core pcc_cpufreq ipmi_msghandler hpilo thermal dca button shpchp btrfs xor raid6_pq hid_generic usbhid sr_mod cdrom sd_mod ata_generic crc32c_intel serio_raw ata_piix ahci libahci uhci_hcd ehci_pci ehci_hcd libata usbcore hpsa scsi_transport_sas [ 1013.772994] sg scsi_mod autofs4 [ 1013.772998] CPU: 0 PID: 374 Comm: systemd-journal Not tainted 4.13.0-rc1-2-default #2 [ 1013.772999] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 07/15/2012 [ 1013.773000] task: 88082c188380 task.stack: c90004d7c000 [ 1013.773011] RIP: 0010:qla24xx_els_ct_entry.isra.17+0x78/0x2a0 [qla2xxx] [ 1013.773012] RSP: :88042f603d90 EFLAGS: 00010082 [ 1013.773013] RAX: 88039f723ac8 RBX: 88039f723ac8 RCX: 8803a2e18010 [ 1013.773014] RDX: 88039f723ac0 RSI: 88042f603dc4 RDI: 88041b6787c0 [ 1013.773015] RBP: 88042f603e00 R08: 0002 R09: 000d [ 1013.773016] R10: 0002 R11: R12: 8803a2e80080 [ 1013.773016] R13: 88041b6787c0 R14: 0003 R15: 0102 [ 1013.773018] FS: 7fa2e0a73880() GS:88042f60() knlGS: [ 1013.773019] CS: 0010 DS: ES: CR0: 80050033 [ 1013.773020] CR2: 00030020 CR3: 00042cd7e000 CR4: 000406f0 [ 1013.773021] Call Trace: [ 1013.773022] [ 1013.773026] ? consume_skb+0x34/0xa0 [ 1013.773040] qla24xx_process_response_queue+0x319/0x700 [qla2xxx] [ 1013.773050] qla24xx_msix_rsp_q+0x7b/0xd0 [qla2xxx] [ 1013.773054] __handle_irq_event_percpu+0x3c/0x1b0 [ 1013.773056] handle_irq_event_percpu+0x23/0x60 [ 1013.773057] handle_irq_event+0x42/0x70 [ 1013.773059] handle_edge_irq+0x8f/0x190 [ 1013.773062] handle_irq+0x1d/0x30 [ 1013.773065] do_IRQ+0x48/0xd0 [ 1013.773067] common_interrupt+0x93/0x93 [ 1013.773068] RIP: 0033:0xed622c6e42 [ 1013.773069] RSP: 002b:7ffee8b5c820 EFLAGS: 0202 ORIG_RAX: ff17 [ 1013.773071] RAX: 00ed6316a3f0 RBX: 00ed6316a840 RCX: 000c4e33 [ 1013.773071] RDX: 00ed6316a878 RSI: 00ed6316a840 RDI: 00ed631682d0 [ 1013.773072] RBP: 0001 R08: 0001 R09: 00ed63179b70 [ 1013.773073] R10: 0005f6f8 R11: 0202 R12: 0001 [ 1013.773074] R13: 7ffee8b5c85c R14: 00ed6316a840 R15: 7ffee8b5c850 [ 1013.773074] [ 1013.773076] Code: a9 8a 9a e0 48 8d 75 c4 48 89 da 4c 89 e1 4c 89 ef e8 54 6e fb ff 48 85 c0 48 89 c3 0f 84 0e 02 00 00 44 0f b7 48 36 4c 8b 70 58 <4d> 8b 7e 20 41 8d 41 fd 66 83 f8 0c 77 6c 0f b7 c0 ff 24 c5 88 [ 1013.773102] RIP: qla24xx_els_ct_entry.isra.17+0x78/0x2a0 [qla2xxx] RSP: 88042f603d90 [ 1013.773102] CR2: 00030020 [ 1013.773129] ---[ end trace 532363559924f426 ]--- [ 1013.773131] Kernel panic - not syncing: Fatal exception in interrupt [ 1013.19] Kernel Offset: disabled [ 1013.827528] ---[ end Kernel panic - not syncing: Fatal exception in interrupt Signed-off-by: Duane Grigsby Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index d3a51df27b0d..c6c066186d97 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1537,8 +1537,6 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); if (!sp) return; - bsg_job = sp->u.bsg_job; - bsg_reply = bsg_job->reply; type = NULL; switch (sp->type) { @@ -1577,6 +1575,8 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, /* return FC_CTELS_STATUS_OK and leave the decoding of the ELS/CT * fc payload to the caller */ + bsg_job = sp->u.bsg_job; + bsg_reply = bsg_job->reply; bsg_reply->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK; bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(fw_status);
[PATCH 06/31] qla2xxx: Handle PCIe error for driver
From: Sawan ChandakDriver will perform following - Set PFLG_DRIVER_REMOVING flag and do not disable PCIe error reporting during adapter shutdown. - If PCIe device count is already zero, return correct error type from PCI error interface. - When device is offline, return correct error type from PCIe error path. - If there is board disable thread active during shutdown and PCIe device count is zero then cancel scheduling board disable thread during shutdown and return. Signed-off-by: Sawan Chandak Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 32 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index b43520ca6645..d668ed4bd53e 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3385,12 +3385,22 @@ qla2x00_shutdown(struct pci_dev *pdev) scsi_qla_host_t *vha; struct qla_hw_data *ha; - if (!atomic_read(>enable_cnt)) - return; - vha = pci_get_drvdata(pdev); ha = vha->hw; + ql_log(ql_log_info, vha, 0xfffa, + "Adapter shutdown\n"); + + /* +* Prevent future board_disable and wait +* until any pending board_disable has completed. +*/ + set_bit(PFLG_DRIVER_REMOVING, >pci_flags); + cancel_work_sync(>board_disable); + + if (!atomic_read(>enable_cnt)) + return; + /* Notify ISPFX00 firmware */ if (IS_QLAFX00(ha)) qlafx00_driver_shutdown(vha, 20); @@ -3421,8 +3431,9 @@ qla2x00_shutdown(struct pci_dev *pdev) qla2x00_free_fw_dump(ha); - pci_disable_pcie_error_reporting(pdev); pci_disable_device(pdev); + ql_log(ql_log_info, vha, 0xfffe, + "Adapter shutdown successfully.\n"); } /* Deletes all the virtual ports for a given ha */ @@ -5495,6 +5506,13 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work) ql_log(ql_log_warn, base_vha, 0x015b, "Disabling adapter.\n"); + if (!atomic_read(>enable_cnt)) { + ql_log(ql_log_info, base_vha, 0xfffc, + "PCI device disabled, no action req for PCI error=%lx\n", + base_vha->pci_flags); + return; + } + qla2x00_wait_for_sess_deletion(base_vha); set_bit(UNLOADING, _vha->dpc_flags); @@ -6197,6 +6215,12 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) ql_dbg(ql_dbg_aer, vha, 0x9000, "PCI error detected, state %x.\n", state); + if (!atomic_read(>enable_cnt)) { + ql_log(ql_log_info, vha, 0x, + "PCI device is disabled,state %x\n", state); + return PCI_ERS_RESULT_NEED_RESET; + } + switch (state) { case pci_channel_io_normal: ha->flags.eeh_busy = 0; -- 2.12.0
[PATCH 00/31] qla2xxx: Patches for scsi "misc" branch
Hi Martin, This series contains various bug fixes and driver updates. Please apply the following patches to the 4.14/scsi-queue branch at your earliest convenience for inclusion in the next mainline merge window. Thanks, Himanshu Darren Trap (1): qla2xxx: Fix WWPN/WWNN in debug message Duane Grigsby (2): qla2xxx: Add command completion for error path qla2xxx: Fix system panic due to pointer access problem Giridhar Malavali (1): qla2xxx: Ability to process multiple SGEs in Command SGL for CT passthrough commands. Himanshu Madhani (3): qla2xxx: Update fw_started flags at qpair creation. qla2xxx: Enable Async TMF processing qla2xxx: Update driver version to 10.00.00.01-k Joe Carnuccio (10): qla2xxx: Correction to vha->vref_count timeout qla2xxx: Prevent sp->free null/uninitialized pointer dereference. qla2xxx: Use sp->free instead of hard coded call. qla2xxx: Move logging default mask to execute once only. qla2xxx: Add timeout ability to wait_for_sess_deletion(). qla2xxx: Allow SNS fabric login to be retried qla2xxx: Print correct mailbox registers in failed summary qla2xxx: Remove potential macro parameter side-effect in ql_dump_regs() qla2xxx: Add LR distance support from nvram bit qla2xxx: Skip zero queue count entry during FW dump capture Michael Hernandez (2): qla2xxx: Fix target multiqueue configuration qla2xxx: Increase ql2xmaxqdepth to 64 Quinn Tran (8): qla2xxx: Fix NPIV host enable after chip reset qla2xxx: Remove extra register read qla2xxx: Change ha->wq max_active value to default qla2xxx: Use fabric name for Get Port Speed command qla2xxx: Add ability to autodetect SFP type qla2xxx: Fix task mgmt handling for NPIV qla2xxx: Cleanup NPIV host in target mode during config teardown qla2xxx: Recheck session state after RSCN Sawan Chandak (4): qla2xxx: Handle PCIe error for driver qla2xxx: Use BIT_6 to acquire FAWWPN from switch qla2xxx: Add support for minimum link speed qla2xxx: Do not call abort handler function during chip reset drivers/scsi/qla2xxx/qla_attr.c| 78 --- drivers/scsi/qla2xxx/qla_dbg.c | 8 +- drivers/scsi/qla2xxx/qla_def.h | 105 +++- drivers/scsi/qla2xxx/qla_fw.h | 28 -- drivers/scsi/qla2xxx/qla_gbl.h | 7 +- drivers/scsi/qla2xxx/qla_gs.c | 18 ++-- drivers/scsi/qla2xxx/qla_init.c| 181 ++- drivers/scsi/qla2xxx/qla_iocb.c| 55 +++ drivers/scsi/qla2xxx/qla_isr.c | 25 ++--- drivers/scsi/qla2xxx/qla_mbx.c | 190 - drivers/scsi/qla2xxx/qla_mid.c | 14 ++- drivers/scsi/qla2xxx/qla_mr.c | 7 +- drivers/scsi/qla2xxx/qla_nvme.c| 21 +++- drivers/scsi/qla2xxx/qla_os.c | 91 +++--- drivers/scsi/qla2xxx/qla_target.c | 25 +++-- drivers/scsi/qla2xxx/qla_target.h | 2 + drivers/scsi/qla2xxx/qla_tmpl.c| 19 ++-- drivers/scsi/qla2xxx/qla_version.h | 2 +- 18 files changed, 696 insertions(+), 180 deletions(-) -- 2.12.0
[PATCH 02/31] qla2xxx: Fix target multiqueue configuration
From: Michael HernandezFollowing error will be logged in to message file while trying to configure target with multiqueue. "Cmd 0x1f aborted with timeout since ISP Abort is pending" "qla25xx_init_queues Rsp que: 1 init failed." Fixes: 82de802ad46e ("scsi: qla2xxx: Preparation for Target MQ.") Cc: Signed-off-by: Quinn Tran Signed-off-by: Michael Hernandez Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c| 2 +- drivers/scsi/qla2xxx/qla_mbx.c| 1 + drivers/scsi/qla2xxx/qla_target.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 916f685872aa..d3a51df27b0d 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3454,7 +3454,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) } /* Enable MSI-X vector for response queue update for queue 0 */ - if (IS_QLA25XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) { + if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) { if (ha->msixbase && ha->mqiobase && (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 || ql2xmqsupport)) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 1f91b87b6416..234ef442ef5d 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -54,6 +54,7 @@ static struct rom_cmd { { MBC_GET_MEM_OFFLOAD_CNTRL_STAT }, { MBC_GET_RETRY_COUNT }, { MBC_TRACE_CONTROL }, + { MBC_INITIALIZE_MULTIQ }, }; static int is_rom_cmd(uint16_t cmd) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index e101cd3043b9..4e2a64773060 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -6796,7 +6796,7 @@ qlt_probe_one_stage1(struct scsi_qla_host *base_vha, struct qla_hw_data *ha) if (!QLA_TGT_MODE_ENABLED()) return; - if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha)) { + if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) { ISP_ATIO_Q_IN(base_vha) = >mqiobase->isp25mq.atio_q_in; ISP_ATIO_Q_OUT(base_vha) = >mqiobase->isp25mq.atio_q_out; } else { -- 2.12.0
[PATCH 03/31] qla2xxx: Update fw_started flags at qpair creation.
Fixes: 4b60c82736d0 ("scsi: qla2xxx: Add fw_started flags to qpair") Cc:Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 072ad1aa5505..8f83571afc7b 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -7804,6 +7804,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, ha->queue_pair_map[qpair_id] = qpair; qpair->id = qpair_id; qpair->vp_idx = vp_idx; + qpair->fw_started = ha->flags.fw_started; INIT_LIST_HEAD(>hints_list); qpair->chip_reset = ha->base_qpair->chip_reset; qpair->enable_class_2 = ha->base_qpair->enable_class_2; -- 2.12.0
[PATCH 01/31] qla2xxx: Correction to vha->vref_count timeout
From: Joe CarnuccioFix incorrect second argument for wait_event_timeout() Fixes: c4a9b538ab2a ("qla2xxx: Allow vref count to timeout on vport delete.") Cc: Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_mid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index f0605cd196fb..3089094b48fa 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -74,7 +74,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) * ensures no active vp_list traversal while the vport is removed * from the queue) */ - wait_event_timeout(vha->vref_waitq, atomic_read(>vref_count), + wait_event_timeout(vha->vref_waitq, !atomic_read(>vref_count), 10*HZ); spin_lock_irqsave(>vport_slock, flags); -- 2.12.0
[PATCH 19/19] iscsi_tcp: Remove a set-but-not-used variable
This patch avoids that gcc reports the following warning when building with W=1: drivers/scsi/iscsi_tcp.c:166:24: warning: variable ?session? set but not used [-Wunused-but-set-variable] Signed-off-by: Bart Van AsscheCc: Lee Duncan Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/iscsi_tcp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 4842fc0e809d..4d934d6c3e13 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -163,7 +163,6 @@ static void iscsi_sw_tcp_state_change(struct sock *sk) struct iscsi_tcp_conn *tcp_conn; struct iscsi_sw_tcp_conn *tcp_sw_conn; struct iscsi_conn *conn; - struct iscsi_session *session; void (*old_state_change)(struct sock *); read_lock_bh(>sk_callback_lock); @@ -172,7 +171,6 @@ static void iscsi_sw_tcp_state_change(struct sock *sk) read_unlock_bh(>sk_callback_lock); return; } - session = conn->session; iscsi_sw_sk_state_check(sk); -- 2.14.0
[PATCH 18/19] scsi_debug: Remove a set-but-not-used variable
This patch avoids that gcc reports the following warning when building with W=1: drivers/scsi/scsi_debug.c:2264:15: warning: variable ?pcontrol? set but not used [-Wunused-but-set-variable] Signed-off-by: Bart Van AsscheCc: Douglas Gilbert Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Johannes Thumshirn --- drivers/scsi/scsi_debug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 3be980d47268..77a0335eb757 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -2261,7 +2261,7 @@ static int resp_ie_l_pg(unsigned char * arr) static int resp_log_sense(struct scsi_cmnd * scp, struct sdebug_dev_info * devip) { - int ppc, sp, pcontrol, pcode, subpcode, alloc_len, len, n; + int ppc, sp, pcode, subpcode, alloc_len, len, n; unsigned char arr[SDEBUG_MAX_LSENSE_SZ]; unsigned char *cmd = scp->cmnd; @@ -2272,7 +2272,6 @@ static int resp_log_sense(struct scsi_cmnd * scp, mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, ppc ? 1 : 0); return check_condition_result; } - pcontrol = (cmd[2] & 0xc0) >> 6; pcode = cmd[2] & 0x3f; subpcode = cmd[3] & 0xff; alloc_len = get_unaligned_be16(cmd + 7); -- 2.14.0
[PATCH 17/19] scsi_transport_srp: Suppress a W=1 compiler warning
Avoid that the following compiler warning is reported when building with W=1: drivers/scsi/scsi_transport_srp.c:92:19: warning: comparison is always false due to limited range of data type [-Wtype-limits] Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/scsi_transport_srp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 698cc4681706..b8f5e4c47579 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -89,7 +89,7 @@ int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, int dev_loss_tmo) if (fast_io_fail_tmo < 0 && dev_loss_tmo > SCSI_DEVICE_BLOCK_MAX_TIMEOUT) return -EINVAL; - if (dev_loss_tmo >= LONG_MAX / HZ) + if (dev_loss_tmo + 0UL >= LONG_MAX / HZ) return -EINVAL; if (fast_io_fail_tmo >= 0 && dev_loss_tmo >= 0 && fast_io_fail_tmo >= dev_loss_tmo) -- 2.14.0
[PATCH 16/19] scsi_transport_sas, sas_tlr_supported(): Check kzalloc() return value
Check whether memory allocation succeeded before dereferencing the pointer to the allocated memory. Signed-off-by: Bart Van AsscheCc: Hannes Reinecke Cc: Christoph Hellwig Cc: Johannes Thumshirn --- drivers/scsi/scsi_transport_sas.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index a318c46db7cc..1a0fa79fd49a 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -423,6 +423,9 @@ sas_tlr_supported(struct scsi_device *sdev) char *buffer = kzalloc(vpd_len, GFP_KERNEL); int ret = 0; + if (!buffer) + goto out; + if (scsi_get_vpd_page(sdev, 0x90, buffer, vpd_len)) goto out; -- 2.14.0
[PATCH 15/19] libsas: Annotate fall-through in a switch statement
Signed-off-by: Bart Van AsscheCc: Hannes Reinecke Cc: Christoph Hellwig Cc: Johannes Thumshirn --- drivers/scsi/libsas/sas_ata.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 87f5e694dbed..70be4425ae0b 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -343,6 +343,7 @@ static int smp_ata_check_ready(struct ata_link *link) case SAS_END_DEVICE: if (ex_phy->attached_sata_dev) return sas_ata_clear_pending(dev, ex_phy); + /* fall through */ default: return -ENODEV; } -- 2.14.0
[PATCH 14/19] libsas: Remove a set-but-not-used variable
This was detected by building with W=1. Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/libsas/sas_scsi_host.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 87e5079d816b..fc90b8c65860 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -855,7 +855,6 @@ int sas_target_alloc(struct scsi_target *starget) int sas_slave_configure(struct scsi_device *scsi_dev) { struct domain_device *dev = sdev_to_domain_dev(scsi_dev); - struct sas_ha_struct *sas_ha; BUG_ON(dev->rphy->identify.device_type != SAS_END_DEVICE); @@ -864,8 +863,6 @@ int sas_slave_configure(struct scsi_device *scsi_dev) return 0; } - sas_ha = dev->port->ha; - sas_read_port_mode_page(scsi_dev); if (scsi_dev->tagged_supported) { -- 2.14.0
[PATCH 12/19] sg: Fix type of last blk_trace_setup() argument
Avoid that sparse reports the following: drivers/scsi/sg.c:1114:41: warning: incorrect type in argument 5 (different address spaces) drivers/scsi/sg.c:1114:41:expected char [noderef] *arg drivers/scsi/sg.c:1114:41:got char * This patch does not change any functionality. Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/sg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f5705a95319f..03194c4b6744 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1110,8 +1110,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) return blk_trace_setup(sdp->device->request_queue, sdp->disk->disk_name, MKDEV(SCSI_GENERIC_MAJOR, sdp->index), - NULL, - (char *)arg); + NULL, p); case BLKTRACESTART: return blk_trace_startstop(sdp->device->request_queue, 1); case BLKTRACESTOP: -- 2.14.0
[PATCH 13/19] libiscsi: Fix indentation
This patch avoids that smatch reports the following: drivers/scsi/libiscsi.c:1081: iscsi_handle_reject() warn: inconsistent indenting Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/libiscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 42381adf0769..bd4605a34f54 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1078,7 +1078,7 @@ static int iscsi_handle_reject(struct iscsi_conn *conn, struct iscsi_hdr *hdr, if (opcode != ISCSI_OP_NOOP_OUT) return 0; -if (rejected_pdu.itt == cpu_to_be32(ISCSI_RESERVED_TAG)) { + if (rejected_pdu.itt == cpu_to_be32(ISCSI_RESERVED_TAG)) { /* * nop-out in response to target's nop-out rejected. * Just resend. -- 2.14.0
[PATCH 10/19] sd: Fix indentation
This patch avoids that smatch reports the following: drivers/scsi/sd.c:3540: sd_suspend_common() warn: inconsistent indenting Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a88639fbedb3..8b3d7994e182 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3537,7 +3537,7 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) * doesn't support sync. There's not much to do and * suspend shouldn't fail. */ -ret = 0; + ret = 0; } } -- 2.14.0
[PATCH 11/19] sd: Remove a useless comparison
This patch avoids that gcc reports the following warning when building with W=1: drivers/scsi/sd.c:315:10: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] if (val >= 0 && val <= T10_PI_TYPE3_PROTECTION) Signed-off-by: Bart Van Assche--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8b3d7994e182..7c0f9eb5a5fd 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -312,7 +312,7 @@ protection_type_store(struct device *dev, struct device_attribute *attr, if (err) return err; - if (val >= 0 && val <= T10_PI_TYPE3_PROTECTION) + if (val <= T10_PI_TYPE3_PROTECTION) sdkp->protection_type = val; return count; -- 2.14.0
[PATCH 09/19] sd, sr: Convert two assignments into warning statements
Before scsi_prep_fn() calls the ULP .init_command() callback function it stores the SCSI command pointer in request.special. This means that the SCpnt = rq->special assignments in the sd and sr drivers assign a pointer to itself. Hence convert these two assignment statements into warning statements. Signed-off-by: Bart Van AsscheReviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Cc: Christoph Hellwig --- drivers/scsi/sd.c | 2 +- drivers/scsi/sr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bea36adeee17..a88639fbedb3 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1013,7 +1013,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt) ret = scsi_init_io(SCpnt); if (ret != BLKPREP_OK) goto out; - SCpnt = rq->special; + WARN_ON_ONCE(SCpnt != rq->special); /* from here on until we're complete, any goto out * is used for a killable error condition */ diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index a8f630213a1a..9be34d37c356 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -393,7 +393,7 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) ret = scsi_init_io(SCpnt); if (ret != BLKPREP_OK) goto out; - SCpnt = rq->special; + WARN_ON_ONCE(SCpnt != rq->special); cd = scsi_cd(rq->rq_disk); /* from here on until we're complete, any goto out -- 2.14.0
[PATCH 06/19] Document which queue type a function is intended for
Document which queue type a function is intended for if this is not easy to derive from the function name. Signed-off-by: Bart Van AsscheCc: Hannes Reinecke Cc: Christoph Hellwig Cc: Johannes Thumshirn --- drivers/scsi/scsi_lib.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f9a0d5b13707..1905962fb992 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2006,6 +2006,7 @@ static enum blk_eh_timer_return scsi_timeout(struct request *req, return scsi_times_out(req); } +/* scsi-mq */ static int scsi_init_request(struct blk_mq_tag_set *set, struct request *rq, unsigned int hctx_idx, unsigned int numa_node) { @@ -2031,6 +2032,7 @@ static int scsi_init_request(struct blk_mq_tag_set *set, struct request *rq, return 0; } +/* scsi-mq */ static void scsi_exit_request(struct blk_mq_tag_set *set, struct request *rq, unsigned int hctx_idx) { @@ -2070,6 +2072,7 @@ static u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost) return bounce_limit; } +/* scsi-sq and scsi-mq */ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) { struct device *dev = shost->dma_dev; @@ -2109,6 +2112,7 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) } EXPORT_SYMBOL_GPL(__scsi_init_queue); +/* scsi-sq */ static int scsi_init_rq(struct request_queue *q, struct request *rq, gfp_t gfp) { struct Scsi_Host *shost = q->rq_alloc_data; @@ -2139,6 +2143,7 @@ static int scsi_init_rq(struct request_queue *q, struct request *rq, gfp_t gfp) return -ENOMEM; } +/* scsi-sq */ static void scsi_exit_rq(struct request_queue *q, struct request *rq) { struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq); @@ -2149,6 +2154,7 @@ static void scsi_exit_rq(struct request_queue *q, struct request *rq) cmd->sense_buffer); } +/* scsi-sq */ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) { struct Scsi_Host *shost = sdev->host; -- 2.14.0
[PATCH 07/19] Fix RCU handling of scsi_device.vpd_pg8[03]
Only annotate pointers that are shared across threads with __rcu. Use rcu_dereference() when dereferencing an RCU pointer. Protect also the RCU pointer dereferences when freeing RCU pointers. This patch suppresses about twenty sparse complaints about the vpd_pg8[03] pointers. Fixes: commit 09e2b0b14690 ("scsi: rescan VPD attributes") Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Shane Seymour --- drivers/scsi/scsi.c | 6 +++--- drivers/scsi/scsi_lib.c | 8 drivers/scsi/scsi_sysfs.c | 7 +-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 3d38c6d463b8..5bb15e698969 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -426,7 +426,7 @@ void scsi_attach_vpd(struct scsi_device *sdev) int vpd_len = SCSI_VPD_PG_LEN; int pg80_supported = 0; int pg83_supported = 0; - unsigned char __rcu *vpd_buf, *orig_vpd_buf = NULL; + unsigned char *vpd_buf, *orig_vpd_buf = NULL; if (!scsi_device_supports_vpd(sdev)) return; @@ -474,7 +474,7 @@ void scsi_attach_vpd(struct scsi_device *sdev) goto retry_pg80; } mutex_lock(>inquiry_mutex); - orig_vpd_buf = sdev->vpd_pg80; + orig_vpd_buf = rcu_dereference(sdev->vpd_pg80); sdev->vpd_pg80_len = result; rcu_assign_pointer(sdev->vpd_pg80, vpd_buf); mutex_unlock(>inquiry_mutex); @@ -503,7 +503,7 @@ void scsi_attach_vpd(struct scsi_device *sdev) goto retry_pg83; } mutex_lock(>inquiry_mutex); - orig_vpd_buf = sdev->vpd_pg83; + orig_vpd_buf = rcu_dereference(sdev->vpd_pg83); sdev->vpd_pg83_len = result; rcu_assign_pointer(sdev->vpd_pg83, vpd_buf); mutex_unlock(>inquiry_mutex); diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 1905962fb992..2ca91d251c5f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -3282,7 +3282,7 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) u8 cur_id_type = 0xff; u8 cur_id_size = 0; unsigned char *d, *cur_id_str; - unsigned char __rcu *vpd_pg83; + unsigned char *vpd_pg83; int id_size = -EINVAL; rcu_read_lock(); @@ -3431,7 +3431,7 @@ EXPORT_SYMBOL(scsi_vpd_lun_id); int scsi_vpd_tpg_id(struct scsi_device *sdev, int *rel_id) { unsigned char *d; - unsigned char __rcu *vpd_pg83; + unsigned char *vpd_pg83; int group_id = -EAGAIN, rel_port = -1; rcu_read_lock(); @@ -3441,8 +3441,8 @@ int scsi_vpd_tpg_id(struct scsi_device *sdev, int *rel_id) return -ENXIO; } - d = sdev->vpd_pg83 + 4; - while (d < sdev->vpd_pg83 + sdev->vpd_pg83_len) { + d = vpd_pg83 + 4; + while (d < vpd_pg83 + sdev->vpd_pg83_len) { switch (d[1] & 0xf) { case 0x4: /* Relative target port */ diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 5ed473a87589..cf8a2088a9ba 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -456,8 +456,11 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) /* NULL queue means the device can't be used */ sdev->request_queue = NULL; - kfree(sdev->vpd_pg83); - kfree(sdev->vpd_pg80); + mutex_lock(>inquiry_mutex); + kfree(rcu_dereference(sdev->vpd_pg83)); + kfree(rcu_dereference(sdev->vpd_pg80)); + mutex_unlock(>inquiry_mutex); + kfree(sdev->inquiry); kfree(sdev); -- 2.14.0
[PATCH 08/19] Use blk_mq_rq_to_pdu() to convert a request to a SCSI command pointer
Since commit e9c787e65c0c ("scsi: allocate scsi_cmnd structures as part of struct request") struct request and struct scsi_cmnd are adjacent. This means that there is now an alternative to reading req->special to convert a pointer to a prepared request into a SCSI command pointer, namely by using blk_mq_rq_to_pdu(). Make this change where appropriate. Although this patch does not change any functionality, it slightly improves performance and slightly improves readability. Signed-off-by: Bart Van AsscheReviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Cc: Christoph Hellwig --- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/scsi_lib.c | 18 +- include/scsi/scsi_tcq.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 01b2d2055edf..38942050b265 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -259,7 +259,7 @@ void scsi_eh_scmd_add(struct scsi_cmnd *scmd) */ enum blk_eh_timer_return scsi_times_out(struct request *req) { - struct scsi_cmnd *scmd = req->special; + struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req); enum blk_eh_timer_return rtn = BLK_EH_NOT_HANDLED; struct Scsi_Host *host = scmd->device->host; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2ca91d251c5f..e4966f8edbf9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -627,7 +627,7 @@ static void scsi_release_bidi_buffers(struct scsi_cmnd *cmd) static bool scsi_end_request(struct request *req, blk_status_t error, unsigned int bytes, unsigned int bidi_bytes) { - struct scsi_cmnd *cmd = req->special; + struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); struct scsi_device *sdev = cmd->device; struct request_queue *q = sdev->request_queue; @@ -1176,7 +1176,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) static int scsi_setup_scsi_cmnd(struct scsi_device *sdev, struct request *req) { - struct scsi_cmnd *cmd = req->special; + struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); /* * Passthrough requests may transfer data, in which case they must @@ -1207,7 +1207,7 @@ static int scsi_setup_scsi_cmnd(struct scsi_device *sdev, struct request *req) */ static int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) { - struct scsi_cmnd *cmd = req->special; + struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); if (unlikely(sdev->handler && sdev->handler->prep_fn)) { int ret = sdev->handler->prep_fn(sdev, req); @@ -1222,7 +1222,7 @@ static int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) static int scsi_setup_cmnd(struct scsi_device *sdev, struct request *req) { - struct scsi_cmnd *cmd = req->special; + struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); if (!blk_rq_bytes(req)) cmd->sc_data_direction = DMA_NONE; @@ -1359,7 +1359,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) static void scsi_unprep_fn(struct request_queue *q, struct request *req) { - scsi_uninit_cmd(req->special); + scsi_uninit_cmd(blk_mq_rq_to_pdu(req)); } /* @@ -1550,7 +1550,7 @@ static int scsi_lld_busy(struct request_queue *q) */ static void scsi_kill_request(struct request *req, struct request_queue *q) { - struct scsi_cmnd *cmd = req->special; + struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); struct scsi_device *sdev; struct scsi_target *starget; struct Scsi_Host *shost; @@ -1581,7 +1581,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) static void scsi_softirq_done(struct request *rq) { - struct scsi_cmnd *cmd = rq->special; + struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq); unsigned long wait_for = (cmd->allowed + 1) * rq->timeout; int disposition; @@ -1769,8 +1769,8 @@ static void scsi_request_fn(struct request_queue *q) blk_start_request(req); spin_unlock_irq(q->queue_lock); - cmd = req->special; - if (unlikely(cmd == NULL)) { + cmd = blk_mq_rq_to_pdu(req); + if (cmd != req->special) { printk(KERN_CRIT "impossible request in %s.\n" "please mail a stack trace to " "linux-scsi@vger.kernel.org\n", diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index 4416b1026189..5b416debf101 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h @@ -39,7 +39,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, if (!req) return NULL; - return req->special; + return
[PATCH 05/19] scsi_setup_fs_cmnd(): Call scsi_req_init() instead of open-coding it
The functional changes in this patch for scsi_setup_fs_cmnd() are: - scsi_request.sense_len is cleared. This is OK since it is the responsibility of the LLD to set .sense_len before calling .scsi_done(). - scsi_request.cmd_len is changed to BLK_MAX_CDB. This is fine since scsi_driver.init_command() must overwrite this member for FS commands. Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/scsi_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index efdcd9e79404..f9a0d5b13707 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1215,8 +1215,8 @@ static int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) return ret; } - cmd->cmnd = scsi_req(req)->cmd = scsi_req(req)->__cmd; - memset(cmd->cmnd, 0, BLK_MAX_CDB); + scsi_req_init(>req); + cmd->cmnd = cmd->req.cmd; return scsi_cmd_to_driver(cmd)->init_command(cmd); } -- 2.14.0
[PATCH 02/19] Avoid sign extension of scsi_device.type
This patch avoids that smatch reports the following: drivers/scsi/scsi_sysfs.c:506 scsi_bus_uevent() warn: argument 3 to %02x specifier has type 'char' drivers/scsi/scsi_sysfs.c:872 sdev_show_modalias() warn: argument 4 to %02x specifier has type 'char' Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- include/scsi/scsi_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 0979a5f3b69a..f054f3f43c75 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -111,7 +111,7 @@ struct scsi_device { unsigned sector_size; /* size in bytes */ void *hostdata; /* available to low-level driver */ - char type; + unsigned char type; char scsi_level; char inq_periph_qual; /* PQ from INQUIRY data */ struct mutex inquiry_mutex; -- 2.14.0
[PATCH 04/19] Convert a strncmp() call into a strcmp() call
This patch avoids that smatch reports the following warning: drivers/scsi/scsi_sysfs.c:117: check_set() error: strncmp() '"-"' too small (2 vs 20) Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 41891db20108..5ed473a87589 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -114,7 +114,7 @@ static int check_set(unsigned long long *val, char *src) { char *last; - if (strncmp(src, "-", 20) == 0) { + if (strcmp(src, "-") == 0) { *val = SCAN_WILD_CARD; } else { /* -- 2.14.0
[PATCH 03/19] Suppress gcc 7 fall-through warnings reported with W=1
The conclusion of a recent discussion about the new warnings reported by gcc 7 is that the new warnings reported when building with W=1 should be suppressed. However, gcc 7 still warns about fall-through in switch statements when building with W=1. Suppress these warnings by annotating the SCSI core properly. See also Linus Torvalds, Lots of new warnings with gcc-7.1.1, 11 July 2017 (https://www.mail-archive.com/linux-media@vger.kernel.org/msg115428.html). References: commit bd664f6b3e37 ("disable new gcc-7.1.1 warnings for now") Signed-off-by: Bart Van AsscheCc: Hannes Reinecke Cc: Christoph Hellwig Cc: Johannes Thumshirn --- drivers/scsi/scsi_error.c | 8 +++- drivers/scsi/scsi_ioctl.c | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index ea9f40e51f68..01b2d2055edf 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -552,6 +552,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd) set_host_byte(scmd, DID_ALLOC_FAILURE); return SUCCESS; } + /* FALLTHROUGH */ case COPY_ABORTED: case VOLUME_OVERFLOW: case MISCOMPARE: @@ -573,6 +574,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd) return ADD_TO_MLQUEUE; else set_host_byte(scmd, DID_TARGET_FAILURE); + /* FALLTHROUGH */ case ILLEGAL_REQUEST: if (sshdr.asc == 0x20 || /* Invalid command operation code */ @@ -683,6 +685,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd) switch (status_byte(scmd->result)) { case GOOD: scsi_handle_queue_ramp_up(scmd->device); + /* FALLTHROUGH */ case COMMAND_TERMINATED: return SUCCESS; case CHECK_CONDITION: @@ -1734,6 +1737,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) set_host_byte(scmd, DID_TIME_OUT); return SUCCESS; } + /* FALLTHROUGH */ case DID_NO_CONNECT: case DID_BAD_TARGET: /* @@ -1819,6 +1823,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) * the case of trying to send too many commands to a * tagged queueing device. */ + /* FALLTHROUGH */ case BUSY: /* * device can't talk to us at the moment. Should only @@ -1831,6 +1836,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) if (scmd->cmnd[0] == REPORT_LUNS) scmd->device->sdev_target->expecting_lun_change = 0; scsi_handle_queue_ramp_up(scmd->device); + /* FALLTHROUGH */ case COMMAND_TERMINATED: return SUCCESS; case TASK_ABORTED: @@ -2320,8 +2326,8 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg) rtn = scsi_try_host_reset(scmd); if (rtn == SUCCESS) break; - default: /* FALLTHROUGH */ + default: rtn = FAILED; break; } diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index b6bf3f29a12a..0a875491f5a7 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -116,13 +116,15 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, case NOT_READY: /* This happens if there is no disc in drive */ if (sdev->removable) break; + /* FALLTHROUGH */ case UNIT_ATTENTION: if (sdev->removable) { sdev->changed = 1; result = 0; /* This is no longer considered an error */ break; } - default:/* Fall through for non-removable media */ + /* FALLTHROUGH -- for non-removable media */ + default: sdev_printk(KERN_INFO, sdev, "ioctl_internal_command return code = %x\n", result); -- 2.14.0
[PATCH 01/19] Remove an obsolete function declaration
Commit e9c787e65c0c ("scsi: allocate scsi_cmnd structures as part of struct request") removed the scsi_get_command() function. Hence also remove the declaration of that function. Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- include/scsi/scsi_cmnd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index a1266d318c85..f5afcff8d76f 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -158,7 +158,6 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) return *(struct scsi_driver **)cmd->request->rq_disk->private_data; } -extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); extern void scsi_put_command(struct scsi_cmnd *); extern void scsi_finish_command(struct scsi_cmnd *cmd); -- 2.14.0
[PATCH 00/19] SCSI patches for kernel v4.14
Hello Martin, The patches in this series fall into two categories: - Two patches are related to using blk_mq_rq_to_pdu() instead of struct request.special. - Seventeen patches suppress warnings reported by static analysis tools. These tools are very useful but unfortunately the current code base makes these tools report a significant number of false positives. Please consider these patches for kernel v4.14. Thanks, Bart. Bart Van Assche (19): Remove an obsolete function declaration Avoid sign extension of scsi_device.type Suppress gcc 7 fall-through warnings reported with W=1 Convert a strncmp() call into a strcmp() call scsi_setup_fs_cmnd(): Call scsi_req_init() instead of open-coding it Document which queue type a function is intended for Fix RCU handling of scsi_device.vpd_pg8[03] Use blk_mq_rq_to_pdu() to convert a request to a SCSI command pointer sd, sr: Convert two assignments into warning statements sd: Fix indentation sd: Remove a useless comparison sg: Fix type of last blk_trace_setup() argument libiscsi: Fix indentation libsas: Remove a set-but-not-used variable libsas: Annotate fall-through in a switch statement scsi_transport_sas, sas_tlr_supported(): Check kzalloc() return value scsi_transport_srp: Suppress a W=1 compiler warning scsi_debug: Remove a set-but-not-used variable iscsi_tcp: Remove a set-but-not-used variable drivers/scsi/iscsi_tcp.c| 2 -- drivers/scsi/libiscsi.c | 2 +- drivers/scsi/libsas/sas_ata.c | 1 + drivers/scsi/libsas/sas_scsi_host.c | 3 --- drivers/scsi/scsi.c | 6 +++--- drivers/scsi/scsi_debug.c | 3 +-- drivers/scsi/scsi_error.c | 10 -- drivers/scsi/scsi_ioctl.c | 4 +++- drivers/scsi/scsi_lib.c | 36 +--- drivers/scsi/scsi_sysfs.c | 9 ++--- drivers/scsi/scsi_transport_sas.c | 3 +++ drivers/scsi/scsi_transport_srp.c | 2 +- drivers/scsi/sd.c | 6 +++--- drivers/scsi/sg.c | 3 +-- drivers/scsi/sr.c | 2 +- include/scsi/scsi_cmnd.h| 1 - include/scsi/scsi_device.h | 2 +- include/scsi/scsi_tcq.h | 2 +- 18 files changed, 55 insertions(+), 42 deletions(-) -- 2.14.0
[PATCH] Improve requeuing behavior
Requests are unprepared and reprepared when being requeued. Avoid that requeuing resets .jiffies_at_alloc and .retries by initializing these two member variables from inside blk_get_request() and by preserving both member variables when preparing a request. This patch affects the requeuing behavior of scsi-sq and scsi-mq. Reported-by: Brian KingReferences: https://lkml.org/lkml/2017/8/18/923 ("Re: [BUG][bisected 270065e] linux-next fails to boot on powerpc") Signed-off-by: Bart Van Assche Cc: Brian King Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Johannes Thumshirn --- drivers/scsi/scsi_lib.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ebc5c713ee37..8d1ec1e7b0e2 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1122,6 +1122,8 @@ void scsi_initialize_rq(struct request *rq) struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq); scsi_req_init(>req); + cmd->jiffies_at_alloc = jiffies; + cmd->retries = 0; } EXPORT_SYMBOL(scsi_initialize_rq); @@ -1160,6 +1162,8 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) void *buf = cmd->sense_buffer; void *prot = cmd->prot_sdb; unsigned int unchecked_isa_dma = cmd->flags & SCMD_UNCHECKED_ISA_DMA; + unsigned long jiffies_at_alloc = cmd->jiffies_at_alloc; + int retries = cmd->retries; /* zero out the cmd, except for the embedded scsi_request */ memset((char *)cmd + sizeof(cmd->req), 0, @@ -1170,7 +1174,8 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) cmd->prot_sdb = prot; cmd->flags = unchecked_isa_dma; INIT_DELAYED_WORK(>abort_work, scmd_eh_abort_handler); - cmd->jiffies_at_alloc = jiffies; + cmd->jiffies_at_alloc = jiffies_at_alloc; + cmd->retries = retries; scsi_add_cmd_to_list(cmd); } -- 2.14.0
Re: [PATCH 0/2] generate uevent for SCSI sense code
Dear Hannes and James, Could you please kindly review this patch and let me know what do we need to move forward with this? Thanks and Regards, Song > On Aug 4, 2017, at 10:18 AM, Song Liuwrote: > > Hi all, > > Could you please share your feedback on this version of the change? > > Thanks in advance, > Song > >>> On 7/21/17, 3:58 PM, "Song Liu" wrote: > >This change is to follow up our discussion on event log for media >management during LSF/MM 2017. > >Changes from RFC v3: > Incorporate feedback by Johannes Thumshirn > >Thanks, >Song > >Song Liu (2): > scsi: generate uevent for SCSI sense code > scsi: add rate limit to scsi sense code uevent > > drivers/scsi/Kconfig | 14 +++ > drivers/scsi/hosts.c | 4 > drivers/scsi/scsi_error.c | 58 > ++ > drivers/scsi/scsi_lib.c| 58 > +- > drivers/scsi/scsi_sysfs.c | 51 > include/scsi/scsi_common.h | 6 + > include/scsi/scsi_device.h | 27 - > include/scsi/scsi_host.h | 13 +++ > 8 files changed, 229 insertions(+), 2 deletions(-) > >-- >2.9.3 > >
Re: [GIT PULL] SCSI fixes for 4.13-rc6
On 08/23/2017 10:44 AM, Bart Van Assche wrote: > On Wed, 2017-08-23 at 11:27 -0400, Martin K. Petersen wrote: >> However, what's more important is that we still need a good version of >> your patch for 4.13. I took Brian's workaround for ipr but I still think >> Christoph's concerns need to be addressed for me to put your change back >> in. > > Hello Martin, > > I am not aware of any requests to modify the patch "scsi-mq: Always unprepare > before requeuing a request". See also > https://www.spinics.net/lists/linux-scsi/msg111541.html. Are you perhaps > referring to another patch? > > What I remember is that my patch uncovered a bug in the ipr driver. As you > mentioned, a workaround for that bug has already been queued for kernel v4.14 > (https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?h=4.13/scsi-fixes=723cd772fde2344a9810eeaf5106787d535ec4a4). I don't completely agree with that statement. The patch "scsi-mq: Always unprepare before requeueing a request" introduces a regression in the scsi stack. It alters the behavior of retries such that the retry counter no longer works and the jiffies_at_alloc use to ensure we don't spend a tremendous amount of time retrying ops gets broken as well. As far as ipr is concerned, we do have the workaround in place now and I'll also queue up a further improvement to ipr to return a better failure response. However, until we fix the retry counter in scsi, any driver that returns an error response that scsi wants to retry could get us stuck in an eternal retry loop, like we were seeing with ipr. > Further improvements for the SCSI core that are the result of the analysis of > the behavior of the SCSI subsystem on PowerPC systems are under discussion. > See > also "[PATCHv2 1/2] scsi: Move scsi_cmd->jiffies_at_alloc initialization to > allocation time" (https://marc.info/?l=linux-next=150335524812989) and > "[PATCH 2/2] scsi: Preserve retry counter through scsi_prep_fn" > (https://marc.info/?l=linux-scsi=150335371112485). While my patches highlight the problem, I don't think they are the right fix and need to be reworked. It looks like we go through scsi_init_rq at hctx setup time rather than for each new i/o submission. Adding a simple kprobe to scsi_init_rq never triggers when issuing i/o to already configured devices. Therefore, we cannot simply move the initialization of jiffies_at_alloc to scsi_init_rq. I've been working on moving the retry counter and jiffies_at_alloc into struct scsi_request, as that doesn't get reinitialized. Thanks, Brian -- Brian King Power Linux I/O IBM Linux Technology Center
Re: [PATCH] scsi: lpfc: avoid false-positive gcc-8 warning
On Wed, Aug 23, 2017 at 5:01 PM, Arnd Bergmannwrote: > This is an interesting regression with gcc-8, showing a harmless > warning for correct code: > > In file included from include/linux/kernel.h:13:0, > ... > from drivers/scsi/lpfc/lpfc_debugfs.c:23: > include/linux/printk.h:301:2: error: 'eq' may be used uninitialized in this > function [-Werror=maybe-uninitialized] > printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) > ^~ > In file included from drivers/scsi/lpfc/lpfc_debugfs.c:58:0: > drivers/scsi/lpfc/lpfc_debugfs.h:451:31: note: 'eq' was declared here > > I tried to come up with a reduced test case for gcc here > a few times, but every time ended up with code that is actually > wrong with older gcc versions missing the bug and gcc-8 finding > it. As this is the only false-positive -Wmaybe-uninitialized > warnign I got with gcc-8 randconfig builds, I'd suggest we > work around it. > > Making the index variable 'unsigned' is enough to shut up > the warning, as gcc can then see that comparing eqidx to > phba->io_channel_irqs is fine here. > > Signed-off-by: Arnd Bergmann Sorry, I have to retract my patch. While it apparently solved the problem for most randconfig builds, I have now run into another case that it did not address, and I still get the warning for one caller: In file included from /git/arm-soc/include/linux/kernel.h:13:0, from /git/arm-soc/arch/x86/include/asm/percpu.h:44, from /git/arm-soc/arch/x86/include/asm/current.h:5, from /git/arm-soc/include/linux/sched.h:11, from /git/arm-soc/include/linux/blkdev.h:4, from /git/arm-soc/drivers/scsi/lpfc/lpfc_debugfs.c:23: /git/arm-soc/drivers/scsi/lpfc/lpfc_debugfs.c: In function 'lpfc_debug_dump_all_queues': /git/arm-soc/include/linux/printk.h:301:2: error: 'eq' may be used uninitialized in this function [-Werror=maybe-uninitialized] printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) ^~ In file included from /git/arm-soc/drivers/scsi/lpfc/lpfc_debugfs.c:58:0: /git/arm-soc/drivers/scsi/lpfc/lpfc_debugfs.h:451:31: note: 'eq' was declared here struct lpfc_queue *wq, *cq, *eq; ^~ In file included from /git/arm-soc/include/linux/kernel.h:13:0, from /git/arm-soc/arch/x86/include/asm/percpu.h:44, from /git/arm-soc/arch/x86/include/asm/current.h:5, from /git/arm-soc/include/linux/sched.h:11, from /git/arm-soc/include/linux/blkdev.h:4, from /git/arm-soc/drivers/scsi/lpfc/lpfc_debugfs.c:23: /git/arm-soc/include/linux/printk.h:301:2: error: 'eq' may be used uninitialized in this function [-Werror=maybe-uninitialized] printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) ^~ In file included from /git/arm-soc/drivers/scsi/lpfc/lpfc_debugfs.c:58:0: /git/arm-soc/drivers/scsi/lpfc/lpfc_debugfs.h:451:31: note: 'eq' was declared here struct lpfc_queue *wq, *cq, *eq; ^~ cc1: all warnings being treated as errors Arnd
[PATCH] scsi_transport_sas: Fix error handling in sas_smp_request()
sas_function_template.smp_handler implementations either return 0 or a Unix error code. Convert that error code into a SCSI result. This patch is what I came up with after having analyzed the following sparse warnings: drivers/scsi/scsi_transport_sas.c:187:21: warning: incorrect type in assignment (different base types) drivers/scsi/scsi_transport_sas.c:187:21:expected restricted blk_status_t [usertype] ret drivers/scsi/scsi_transport_sas.c:187:21:got int drivers/scsi/scsi_transport_sas.c:188:39: warning: incorrect type in assignment (different base types) drivers/scsi/scsi_transport_sas.c:188:39:expected int [signed] result drivers/scsi/scsi_transport_sas.c:188:39:got restricted blk_status_t [usertype] ret Fixes: commit 17d5363b83f8 ("scsi: introduce a result field in struct scsi_request") Signed-off-by: Bart Van AsscheCc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: --- drivers/scsi/scsi_transport_sas.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 5006a656e16a..a318c46db7cc 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -173,7 +173,7 @@ static void sas_smp_request(struct request_queue *q, struct Scsi_Host *shost, struct sas_rphy *rphy) { struct request *req; - blk_status_t ret; + int ret; int (*handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); while ((req = blk_fetch_request(q)) != NULL) { @@ -185,7 +185,9 @@ static void sas_smp_request(struct request_queue *q, struct Scsi_Host *shost, blk_rq_bytes(req->next_rq); handler = to_sas_internal(shost->transportt)->f->smp_handler; ret = handler(shost, rphy, req); - scsi_req(req)->result = ret; + WARN_ONCE(ret != 0 && !IS_ERR_VALUE(ret + 0UL), + "%s: ret = %d\n", __func__, ret); + scsi_req(req)->result = ret ? DID_ERROR << 16 : 0; blk_end_request_all(req, 0); -- 2.14.0
Re: [PATCH] scsi: lpfc: avoid false-positive gcc-8 warning
On 8/23/2017 8:01 AM, Arnd Bergmann wrote: This is an interesting regression with gcc-8, showing a harmless warning for correct code: In file included from include/linux/kernel.h:13:0, ... from drivers/scsi/lpfc/lpfc_debugfs.c:23: include/linux/printk.h:301:2: error: 'eq' may be used uninitialized in this function [-Werror=maybe-uninitialized] printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) ^~ In file included from drivers/scsi/lpfc/lpfc_debugfs.c:58:0: drivers/scsi/lpfc/lpfc_debugfs.h:451:31: note: 'eq' was declared here I tried to come up with a reduced test case for gcc here a few times, but every time ended up with code that is actually wrong with older gcc versions missing the bug and gcc-8 finding it. As this is the only false-positive -Wmaybe-uninitialized warnign I got with gcc-8 randconfig builds, I'd suggest we work around it. Making the index variable 'unsigned' is enough to shut up the warning, as gcc can then see that comparing eqidx to phba->io_channel_irqs is fine here. Signed-off-by: Arnd Bergmann--- drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) looks good. Thanks Signed-off-by: James Smart -- james
Re: [PATCH] scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_test
On 8/22/2017 1:53 PM, Gustavo A. R. Silva wrote: Remove variable assignments. The value stored in local variable _rc_ is overwritten at line 2448:rc = lpfc_sli4_bsg_set_link_diag_state(phba, 0); before it can be used. Addresses-Coverity-ID: 1226935 Signed-off-by: Gustavo A. R. Silva--- This issue was detected by Coverity and it was tested by compilation only. Notice that this code has been there since 2011. drivers/scsi/lpfc/lpfc_bsg.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) looks good. Thanks Signed-off-by: James Smart -- james
Re: [v4.13-rc BUG] system lockup when running big buffered write(4M) to IB SRP via mpath
On Wed, Aug 23, 2017 at 11:12 PM, Bart Van Asschewrote: > On Wed, 2017-08-23 at 19:35 +0800, Ming Lei wrote: >> soft lockup still can be observed easily with patch d4acf3650c7c( >> block: Make blk_mq_delay_kick_requeue_list() rerun the queue at a quiet >> time), >> but no hard lockup. > > Hello Ming, > > I never claimed that commit d4acf3650c7c was a full solution to avoid these > soft lockups. I assume these results mean that patch series "[PATCH 0/7] > Device mapper and dm-mpath fixes" was not applied to the kernel used in your > tests? A colleague of you has reported that that patch series is sufficient OK, thanks for your clarification. I run v4.13-rc6 with block for-next, so these patches are not applied in my kernel. -- Ming Lei
Re: [PATCH] scsi: qedf: Fix a potential NULL pointer dereference
On Sun, 20 Aug 2017, 1:09pm, Christophe JAILLET wrote: > At the beginning of 'qedf_srr_compl()' and of 'qedf_rec_compl()', we check > if 'orig_io_req' is NULL. If this happens, a NULL pointer dereference will > occur in the error handling path. > > Fix it by adding an additionnal label in the error handling path in order > to avoid this NULL pointer dereference. > > Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver > framework.") > Signed-off-by: Christophe JAILLET> --- > drivers/scsi/qedf/qedf_els.c | 14 -- > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c > index eb07f1de8afa..59c18ca4cda9 100644 > --- a/drivers/scsi/qedf/qedf_els.c > +++ b/drivers/scsi/qedf/qedf_els.c > @@ -489,7 +489,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg) > > /* If a SRR times out, simply free resources */ > if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO) > - goto out_free; > + goto out_put; > > /* Normalize response data into struct fc_frame */ > mp_req = &(srr_req->mp_req); > @@ -501,7 +501,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg) > if (!fp) { > QEDF_ERR(&(qedf->dbg_ctx), > "fc_frame_alloc failure.\n"); > - goto out_free; > + goto out_put; > } > > /* Copy frame header from firmware into fp */ > @@ -526,9 +526,10 @@ static void qedf_srr_compl(struct qedf_els_cb_arg > *cb_arg) > } > > fc_frame_free(fp); > -out_free: > +out_put: > /* Put reference for original command since SRR completed */ > kref_put(_io_req->refcount, qedf_release_cmd); > +out_free: > kfree(cb_arg); > } > > @@ -780,7 +781,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg) > > /* If a REC times out, free resources */ > if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO) > - goto out_free; > + goto out_put; > > /* Normalize response data into struct fc_frame */ > mp_req = &(rec_req->mp_req); > @@ -792,7 +793,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg) > if (!fp) { > QEDF_ERR(&(qedf->dbg_ctx), > "fc_frame_alloc failure.\n"); > - goto out_free; > + goto out_put; > } > > /* Copy frame header from firmware into fp */ > @@ -884,9 +885,10 @@ static void qedf_rec_compl(struct qedf_els_cb_arg > *cb_arg) > > out_free_frame: > fc_frame_free(fp); > -out_free: > +out_put: > /* Put reference for original command since REC completed */ > kref_put(_io_req->refcount, qedf_release_cmd); > +out_free: > kfree(cb_arg); > } > > Thanks for the catch. Acked-by: Chad Dupuis
Re: [GIT PULL] SCSI fixes for 4.13-rc6
On Wed, 2017-08-23 at 11:27 -0400, Martin K. Petersen wrote: > However, what's more important is that we still need a good version of > your patch for 4.13. I took Brian's workaround for ipr but I still think > Christoph's concerns need to be addressed for me to put your change back > in. Hello Martin, I am not aware of any requests to modify the patch "scsi-mq: Always unprepare before requeuing a request". See also https://www.spinics.net/lists/linux-scsi/msg111541.html. Are you perhaps referring to another patch? What I remember is that my patch uncovered a bug in the ipr driver. As you mentioned, a workaround for that bug has already been queued for kernel v4.14 (https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?h=4.13/scsi-fixes=723cd772fde2344a9810eeaf5106787d535ec4a4). Further improvements for the SCSI core that are the result of the analysis of the behavior of the SCSI subsystem on PowerPC systems are under discussion. See also "[PATCHv2 1/2] scsi: Move scsi_cmd->jiffies_at_alloc initialization to allocation time" (https://marc.info/?l=linux-next=150335524812989) and "[PATCH 2/2] scsi: Preserve retry counter through scsi_prep_fn" (https://marc.info/?l=linux-scsi=150335371112485). Please correct me if I got anything wrong. Bart.
Re: [GIT PULL] SCSI fixes for 4.13-rc6
Hi Bart, > Had you noticed that Damien had asked not to send the "sd_zbc: Write > unlock zone from sd_uninit_cmnd()" patch to Linus without my "scsi-mq: > Always unprepare before requeuing a request" patch? He did change his mind later in that thread, though. However, what's more important is that we still need a good version of your patch for 4.13. I took Brian's workaround for ipr but I still think Christoph's concerns need to be addressed for me to put your change back in. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] storvsc: do not assume SG list is continuous when doing bounce buffers (for 4.1 stable only)
Christoph, > Ok. If the stable maintainers are ok with your small fix > I'm not going to complain too loudly. But I'm always worried about > stable trees divering too much from mainline. The seemingly innocuous transition from SG_GAPS to virt boundary has caused several data corruption regressions in the distro kernels. So has the corresponding conversion of storvsc. As a result, getting the current upstream code into 4.1 would mean backporting and testing a significant amount of both block layer and driver code. I don't think it's worth the risk. This patch is simple and the path of least resistance. Acked-by: Martin K. Petersen-- Martin K. Petersen Oracle Linux Engineering
Re: [v4.13-rc BUG] system lockup when running big buffered write(4M) to IB SRP via mpath
On Wed, 2017-08-23 at 19:35 +0800, Ming Lei wrote: > soft lockup still can be observed easily with patch d4acf3650c7c( > block: Make blk_mq_delay_kick_requeue_list() rerun the queue at a quiet time), > but no hard lockup. Hello Ming, I never claimed that commit d4acf3650c7c was a full solution to avoid these soft lockups. I assume these results mean that patch series "[PATCH 0/7] Device mapper and dm-mpath fixes" was not applied to the kernel used in your tests? A colleague of you has reported that that patch series is sufficient to avoid these soft lockups. See also https://www.redhat.com/archives/dm-devel/2017-August/msg00122.html. Bart.