lpfc: Update lpfc to revision 12.8.0.0
Subsystems (2)
cover lpfc: Update lpfc to revision 12.8.0.0
Update lpfc to revision 12.8.0.0
Patch set contains mainly fixes, a change to QD default, and a few cleanups.
The patches were cut against Martin's 5.7/scsi-queue tree
-- james
James Smart (12):
lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login
lpfc: Fix lockdep error - register non-static key
lpfc: Fix lpfc overwrite of sg_cnt field in nvmefc_tgt_fcp_req
lpfc: Fix scsi host template for SLI3 vports
lpfc: Fix crash after handling a pci error.
lpfc: Fix update of wq consumer index in lpfc_sli4_wq_release
lpfc: Fix crash in target side cable pulls hitting WAIT_FOR_UNREG
lpfc: Fix erroneous cpu limit of 128 on I/O statistics
lpfc: Change default SCSI LUN QD to 64
lpfc: Make debugfs ktime stats generic for NVME and SCSI
lpfc: Remove prototype FIPS/DSS options from SLI-3
lpfc: Update lpfc version to 12.8.0.0
drivers/scsi/lpfc/lpfc.h | 25 ++- drivers/scsi/lpfc/lpfc_attr.c | 71 +-------- drivers/scsi/lpfc/lpfc_crtn.h | 3 +- drivers/scsi/lpfc/lpfc_debugfs.c | 333 ++++++++++++++++++++++++++------------- drivers/scsi/lpfc/lpfc_debugfs.h | 3 +- drivers/scsi/lpfc/lpfc_hw.h | 20 +-- drivers/scsi/lpfc/lpfc_init.c | 106 +++++++++---- drivers/scsi/lpfc/lpfc_mbox.c | 2 - drivers/scsi/lpfc/lpfc_nvme.c | 147 ++++------------- drivers/scsi/lpfc/lpfc_nvmet.c | 62 ++++---- drivers/scsi/lpfc/lpfc_scsi.c | 90 +++-------- drivers/scsi/lpfc/lpfc_sli.c | 47 ++---- drivers/scsi/lpfc/lpfc_sli.h | 2 +- drivers/scsi/lpfc/lpfc_sli4.h | 19 ++- drivers/scsi/lpfc/lpfc_version.h | 2 +- 15 files changed, 441 insertions(+), 491 deletions(-)
Signature · 1 line
2.16.4
PATCH 1/12 lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login
The following kasan bug was called out:
BUG: KASAN: slab-out-of-bounds in lpfc_unreg_login+0x7c/0xc0 [lpfc] Read of size 2 at addr ffff889fc7c50a22 by task lpfc_worker_3/6676 ... Call Trace: dump_stack+0x96/0xe0 ? lpfc_unreg_login+0x7c/0xc0 [lpfc] print_address_description.constprop.6+0x1b/0x220 ? lpfc_unreg_login+0x7c/0xc0 [lpfc] ? lpfc_unreg_login+0x7c/0xc0 [lpfc] __kasan_report.cold.9+0x37/0x7c ? lpfc_unreg_login+0x7c/0xc0 [lpfc] kasan_report+0xe/0x20 lpfc_unreg_login+0x7c/0xc0 [lpfc] lpfc_sli_def_mbox_cmpl+0x334/0x430 [lpfc] ...
When processing the completion of a "Reg Rpi" login mailbox command in lpfc_sli_def_mbox_cmpl, a call may be made to lpfc_unreg_login. The vpi is extracted from the completing mailbox context and passed as an input for the next. However, the vpi stored in the mailbox command context is an absolute vpi, which for SLI4 represents both base + offset. When used with a non-zero base component, (function id > 0) this results in an out-of-range access beyond the allocated phba->vpi_ids array.
Fix by subtracting the function's base value to get an accurate vpi number.
--- drivers/scsi/lpfc/lpfc_sli.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +2 -0
@@ -2511,6 +2511,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) !pmb->u.mb.mbxStatus) { rpi = pmb->u.mb.un.varWords[0 ]; vpi = pmb->u.mb.un.varRegLogin.vpi; +if (phba->sli_rev ==LPFC_SLI_REV4 ) + vpi -= phba->sli4_hba.max_cfg_param.vpi_base;lpfc_unreg_login (phba, vpi, rpi, pmb); pmb->vport = vport; pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
Signature · 1 line
2.16.4
PATCH 2/12 lpfc: Fix lockdep error - register non-static key
In reply to James SmartThe following lockdep error was reported when unloading the lpfc driver:
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
...
Call Trace: dump_stack+0x96/0xe0 register_lock_class+0x8b8/0x8c0 ? lockdep_hardirqs_on+0x190/0x280 ? is_dynamic_key+0x150/0x150 ? wait_for_completion_interruptible+0x2a0/0x2a0 ? wake_up_q+0xd0/0xd0 __lock_acquire+0xda/0x21a0 ? register_lock_class+0x8c0/0x8c0 ? synchronize_rcu_expedited+0x500/0x500 ? __call_rcu+0x850/0x850 lock_acquire+0xf3/0x1f0 ? del_timer_sync+0x5/0xb0 del_timer_sync+0x3c/0xb0 ? del_timer_sync+0x5/0xb0 lpfc_pci_remove_one.cold.102+0x8b7/0x935 [lpfc] ...
Unloading the driver resulted in a call to del_timer_sync for the cpuhp_poll_timer. However the call to setup the timer had never been made, so the timer structures used by lockdep checking were not initialized.
Unconditionally call setup_timer for the cpuhp_poll_timer during driver initialization. Calls to start the timer remain "as needed".
--- drivers/scsi/lpfc/lpfc_init.c | 5 ++--- drivers/scsi/lpfc/lpfc_sli.c | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +2 -3
@@ -11173,11 +11173,9 @@ static void lpfc_cpuhp_add(struct lpfc_hba *phba)rcu_read_lock (); -if (!list_empty (&phba->poll_list)) { -timer_setup (&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer,0 ); +if (!list_empty (&phba->poll_list))mod_timer (&phba->cpuhp_poll_timer, jiffies +msecs_to_jiffies (LPFC_POLL_HB )); - }rcu_read_unlock ();
@@ -13145,6 +13143,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)lpfc_sli4_ras_setup (phba);INIT_LIST_HEAD (&phba->poll_list); +timer_setup (&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer,0 );cpuhp_state_add_instance_nocalls (lpfc_cpuhp_state, &phba->cpuhp);return 0 ;
drivers/scsi/lpfc/lpfc_sli.c +2 -4
@@ -14444,12 +14444,10 @@ static inline void lpfc_sli4_add_to_poll_list(struct lpfc_queue *eq) {struct lpfc_hba *phba = eq->phba; -if (list_empty (&phba->poll_list)) { -timer_setup (&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer,0 ); -/* kickstart slowpath processing for this eq */ +/* kickstart slowpath processing if needed */ +if (list_empty (&phba->poll_list))mod_timer (&phba->cpuhp_poll_timer, jiffies +msecs_to_jiffies (LPFC_POLL_HB )); - }list_add_rcu (&eq->_poll_list, &phba->poll_list);synchronize_rcu ();
Signature · 1 line
2.16.4
PATCH 3/12 lpfc: Fix lpfc overwrite of sg_cnt field in nvmefc_tgt_fcp_req
In reply to James SmartIn lpfc_nvmet_prep_fcp_wqe() the line "rsp->sg_cnt = 0" is modifying the transport's data structure. This may result in the transport believing the s/g list was already freed, thus may not unmap/free it properly. Lpfc driver should not modity the transport data structure.
The zeroing of the sg_cnt is to avoid use of the transport's sgl in a subsequent loop where the driver builds the necessary requests for the adapter firmware to complete the IO.
Change LLDD to use a local copy of the transport sg_cnt when building requests to be passed to the adapter fw.
--- drivers/scsi/lpfc/lpfc_nvmet.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_nvmet.c +4 -3
@@ -2598,7 +2598,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,union lpfc_wqe128 *wqe;struct ulp_bde64 *bde;dma_addr_t physaddr; -int i, cnt; +int i, cnt, nsegs;int do_pbde;int xc =1 ;
@@ -2629,6 +2629,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, phba->cfg_nvme_seg_cnt);return NULL ; } + nsegs = rsp->sg_cnt; tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; nvmewqe = ctxp->wqeq;
@@ -2868,7 +2869,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, wqe->fcp_trsp.rsvd_12_15[0 ] =0 ;/* Use rspbuf, NOT sg list */ - rsp->sg_cnt =0 ; + nsegs =0 ; sgl->word2 =0 ;atomic_inc (&tgtp->xmt_fcp_rsp);break ;
@@ -2885,7 +2886,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, nvmewqe->drvrTimeout = (phba->fc_ratov *3 ) +LPFC_DRVR_TIMEOUT ; nvmewqe->context1 = ndlp; -for_each_sg (rsp->sg, sgel, rsp->sg_cnt, i) { +for_each_sg (rsp->sg, sgel, nsegs, i) { physaddr =sg_dma_address (sgel); cnt =sg_dma_len (sgel); sgl->addr_hi =putPaddrHigh (physaddr);
Signature · 1 line
2.16.4
PATCH 4/12 lpfc: Fix scsi host template for SLI3 vports
In reply to James SmartSCSI layer sends driver IOs with more s/g segments than driver can handle. This results in "Too many sg segments from dma_map_sg. Config 64, seg_cnt 219" error messages from the lpfc_scsi_prep_dma_buf_s3() routine.
The was due to use the driver using individual templates for pport and vport, host reset enabled or not, nvme vs scsi, etc. In the end, there was a combination for a vport that didn't match the pport.
Rather than enumerating more templates and more discretionary assignments, revert to a base template that is copied to a template specific to the pport/vport. Then, based on role, attributes and sli type, modify the fields that are different for that port. Added a log message to lpfc_create_port to validate values.
--- drivers/scsi/lpfc/lpfc.h | 5 +++ drivers/scsi/lpfc/lpfc_crtn.h | 2 -- drivers/scsi/lpfc/lpfc_init.c | 73 +++++++++++++++++++++++++++++-------------- drivers/scsi/lpfc/lpfc_scsi.c | 48 ---------------------------- 4 files changed, 54 insertions(+), 74 deletions(-)
drivers/scsi/lpfc/lpfc.h +5 -0
@@ -1225,6 +1225,11 @@ struct lpfc_hba {#define LPFC_POLL_SLOWPATH 1/* called from slowpath */ char os_host_name[MAXHOSTNAMELEN ]; + +/* SCSI host template information - for physical port */ +struct scsi_host_template port_template; +/* SCSI host template information - for all vports */ +struct scsi_host_template vport_template; }; static inline struct Scsi_Host *
drivers/scsi/lpfc/lpfc_crtn.h +0 -2
@@ -404,9 +404,7 @@ void lpfc_free_sysfs_attr(struct lpfc_vport *);extern struct device_attribute *lpfc_hba_attrs[];extern struct device_attribute *lpfc_vport_attrs[];extern struct scsi_host_template lpfc_template; -extern struct scsi_host_template lpfc_template_no_hr;extern struct scsi_host_template lpfc_template_nvme; -extern struct scsi_host_template lpfc_vport_template;extern struct fc_function_template lpfc_transport_functions;extern struct fc_function_template lpfc_vport_transport_functions;
drivers/scsi/lpfc/lpfc_init.c +49 -24
112 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_scsi.c +0 -48
57 lines not on this page · raw message
Signature · 1 line
2.16.4
PATCH 5/12 lpfc: Fix crash after handling a pci error.
In reply to James SmartInjecting EEH on a 32GB card is causing kernel oops
The pci error handler is doing an IO flush and the offline code is also doing an IO flush. When the 1st flush is complete the hdwq is destroyed (freed), yet the second flush accesses the hdwq and crashes.
Added a check in lpfc_sli4_fush_io_rings to check both the HBA_IOQ_FLUSH flag and the hdwq pointer to see if it is already set and not already freed.
--- drivers/scsi/lpfc/lpfc_sli.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +5 -0
@@ -4046,6 +4046,11 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba)struct lpfc_iocbq *piocb, *next_iocb;spin_lock_irq (&phba->hbalock); +if (phba->hba_flag &HBA_IOQ_FLUSH || + !phba->sli4_hba.hdwq) { +spin_unlock_irq (&phba->hbalock); +return ; + }/* Indicate the I/O queues are flushed */ phba->hba_flag |=HBA_IOQ_FLUSH ;spin_unlock_irq (&phba->hbalock);
Signature · 1 line
2.16.4
PATCH 6/12 lpfc: Fix update of wq consumer index in lpfc_sli4_wq_release
In reply to James SmartThe lpfc_sli4_wq_release() routine iterates for each interim value when updating the wq consuemr index. This wastes cycles and possibly confuses things as thevalue itterates (and the modulo logic is being applied).
There's no reason for this. Just set it to the value from the hw.
--- drivers/scsi/lpfc/lpfc_sli.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +4 -13
@@ -230,25 +230,16 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe128 *wqe)* This routine will update the HBA index of a queue to reflect consumption of * Work Queue Entries by the HBA. When the HBA indicates that it has consumed * an entry the host calls this function to update the queue's internal -* pointers. This routine returns the number of entries that were consumed by -* the HBA. +* pointers. **/ -static uint32_t +static void lpfc_sli4_wq_release (struct lpfc_queue *q,uint32_t index) { -uint32_t released =0 ; -/* sanity check on queue memory */ if (unlikely (!q)) -return 0 ; +return ; -if (q->hba_index == index) -return 0 ; -do { - q->hba_index = ((q->hba_index +1 ) % q->entry_count); - released++; - }while (q->hba_index != index); -return released; + q->hba_index = index; }/**
Signature · 1 line
2.16.4
PATCH 7/12 lpfc: Fix crash in target side cable pulls hitting WAIT_FOR_UNREG
In reply to James SmartKernel is crashing with the following stacktrace:
BUG: unable to handle kernel NULL pointer dereference at
00000000000005bc
IP: lpfc_nvme_register_port+0x1a8/0x3a0 [lpfc]
...
Call Trace:
lpfc_nlp_state_cleanup+0x2b2/0x500 [lpfc]
lpfc_nlp_set_state+0xd7/0x1a0 [lpfc]
lpfc_cmpl_prli_prli_issue+0x1f7/0x450 [lpfc]
lpfc_disc_state_machine+0x7a/0x1e0 [lpfc]
lpfc_cmpl_els_prli+0x16f/0x1e0 [lpfc]
lpfc_sli_sp_handle_rspiocb+0x5b2/0x690 [lpfc]
lpfc_sli_handle_slow_ring_event_s4+0x182/0x230 [lpfc]
lpfc_do_work+0x87f/0x1570 [lpfc]
kthread+0x10d/0x130
ret_from_fork+0x35/0x40During target side fault injections, it is possible to hit the NLP_WAIT_FOR_UNREG case in lpfc_nvme_remoteport_delete. A prior commit fixed a rebind and delete race condition, but called lpfc_nlp_put unconditionally. This triggered a deletion and the crash.
Fix by movng nlp_put to inside the NLP_WAIT_FOR_UNREG case, where the nlp will be being unregistered/removed. Leave the reference if the flag isn't set.
--- drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +8 -6
@@ -382,13 +382,15 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport)if (ndlp->upcall_flags &NLP_WAIT_FOR_UNREG ) { ndlp->nrport =NULL ; ndlp->upcall_flags &= ~NLP_WAIT_FOR_UNREG ; - } -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&vport->phba->hbalock); -/* Remove original register reference. The host transport -* won't reference this rport/remoteport any further. -*/ -lpfc_nlp_put (ndlp); +/* Remove original register reference. The host transport +* won't reference this rport/remoteport any further. +*/ +lpfc_nlp_put (ndlp); + }else { +spin_unlock_irq (&vport->phba->hbalock); + } rport_err:return ;
Signature · 1 line
2.16.4
PATCH 8/12 lpfc: Fix erroneous cpu limit of 128 on I/O statistics
In reply to James SmartThe cpu io statistics were capped by a hard define limit of 128. This effectively was a max number of cpu's, not an actual cpu cou nor actual cpu numbers which can be even larger that both of those values. This made stats off/misleading and on large cpu count systems, wrong.
Fix the stats so that all cpus can have a stats struct. Fix the looping such that it loops by hdwq, finds cpus that used the hdwq, and sum the stats, then display.
--- drivers/scsi/lpfc/lpfc.h | 9 +- drivers/scsi/lpfc/lpfc_debugfs.c | 204 +++++++++++++++++++++++---------------- drivers/scsi/lpfc/lpfc_debugfs.h | 1 - drivers/scsi/lpfc/lpfc_init.c | 28 ++++++ drivers/scsi/lpfc/lpfc_nvme.c | 45 ++++----- drivers/scsi/lpfc/lpfc_nvmet.c | 55 +++++------ drivers/scsi/lpfc/lpfc_scsi.c | 23 +---- drivers/scsi/lpfc/lpfc_sli4.h | 19 ++-- 8 files changed, 215 insertions(+), 169 deletions(-)
drivers/scsi/lpfc/lpfc.h +4 -5
@@ -481,7 +481,7 @@ struct lpfc_vport {struct dentry *debug_nvmestat;struct dentry *debug_scsistat;struct dentry *debug_nvmektime; -struct dentry *debug_cpucheck; +struct dentry *debug_hdwqstat;struct dentry *vport_debugfs_root;struct lpfc_debugfs_trc *disc_trc;atomic_t disc_trc_cnt;
@@ -1175,12 +1175,11 @@ struct lpfc_hba {uint16_t sfp_warning;#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -uint16_t cpucheck_on; +uint16_t hdwqstat_on;#define LPFC_CHECK_OFF 0#define LPFC_CHECK_NVME_IO 1 -#define LPFC_CHECK_NVMET_RCV 2 -#define LPFC_CHECK_NVMET_IO 4 -#define LPFC_CHECK_SCSI_IO 8 +#define LPFC_CHECK_NVMET_IO 2 +#define LPFC_CHECK_SCSI_IO 4uint16_t ktime_on;uint64_t ktime_data_samples;uint64_t ktime_status_samples;
drivers/scsi/lpfc/lpfc_debugfs.c +120 -84
318 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_debugfs.h +0 -1
@@ -47,7 +47,6 @@/* nvmestat output buffer size */ #define LPFC_NVMESTAT_SIZE 8192#define LPFC_NVMEKTIME_SIZE 8192 -#define LPFC_CPUCHECK_SIZE 8192#define LPFC_NVMEIO_TRC_SIZE 8192/* scsistat output buffer size */
drivers/scsi/lpfc/lpfc_init.c +28 -0
@@ -6951,6 +6951,17 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) rc = -ENOMEM ; goto out_free_hba_cpu_map; } + +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS + phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); +if (!phba->sli4_hba.c_stat) { +lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , +"3332 Failed allocating per cpu hdwq stats\n" ); + rc = -ENOMEM ; + goto out_free_hba_eq_info; + } +#endif +/* * Enable sr-iov virtual functions if supported and configured * through the module parameter.
@@ -6970,6 +6981,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)return 0 ; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +out_free_hba_eq_info: +free_percpu (phba->sli4_hba.eq_info); +#endif out_free_hba_cpu_map:kfree (phba->sli4_hba.cpu_map); out_free_hba_eq_hdl:
@@ -7008,6 +7023,9 @@ lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba)struct lpfc_fcf_conn_entry *conn_entry, *next_conn_entry;free_percpu (phba->sli4_hba.eq_info); +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +free_percpu (phba->sli4_hba.c_stat); +#endif /* Free memory allocated for msi-x interrupt vector to CPU mapping */ kfree (phba->sli4_hba.cpu_map);
@@ -10848,6 +10866,9 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)#ifdef CONFIG_X86 struct cpuinfo_x86 *cpuinfo;#endif +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +struct lpfc_hdwq_stat *c_stat; +#endif max_phys_id =0 ; min_phys_id =LPFC_VECTOR_MAP_EMPTY ;
@@ -11099,10 +11120,17 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) idx =0 ;for_each_possible_cpu (cpu) { cpup = &phba->sli4_hba.cpu_map[cpu]; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS + c_stat =per_cpu_ptr (phba->sli4_hba.c_stat, cpu); + c_stat->hdwq_no = cpup->hdwq; +#endif if (cpup->hdwq !=LPFC_VECTOR_MAP_EMPTY )continue ; cpup->hdwq = idx++ % phba->cfg_hdw_queue; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS + c_stat->hdwq_no = cpup->hdwq; +#endif lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "3340 Set Affinity: not present " "CPU %d hdwq %d\n",
drivers/scsi/lpfc/lpfc_nvme.c +21 -24
65 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvmet.c +26 -29
86 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_scsi.c +4 -19
@@ -3805,9 +3805,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,struct Scsi_Host *shost;int idx;uint32_t logit =LOG_FCP ; -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -int cpu; -#endif /* Guard against abort handler being called at same time */ spin_lock (&lpfc_cmd->buf_lock);
@@ -3826,11 +3823,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++;#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -if (unlikely (phba->cpucheck_on &LPFC_CHECK_SCSI_IO )) { - cpu =raw_smp_processor_id (); -if (cpu <LPFC_CHECK_CPU_CNT && phba->sli4_hba.hdwq) - phba->sli4_hba.hdwq[idx].cpucheck_cmpl_io[cpu]++; - } +if (unlikely (phba->hdwqstat_on &LPFC_CHECK_SCSI_IO )) +this_cpu_inc (phba->sli4_hba.c_stat->cmpl_io);#endif shost = cmd->device->host;
@@ -4503,9 +4497,6 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)struct lpfc_io_buf *lpfc_cmd;struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));int err, idx; -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -int cpu; -#endif rdata =lpfc_rport_data_from_scsi_device (cmnd->device);
@@ -4626,14 +4617,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)lpfc_scsi_prep_cmnd (vport, lpfc_cmd, ndlp);#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -if (unlikely (phba->cpucheck_on &LPFC_CHECK_SCSI_IO )) { - cpu =raw_smp_processor_id (); -if (cpu <LPFC_CHECK_CPU_CNT ) { -struct lpfc_sli4_hdw_queue *hdwq = - &phba->sli4_hba.hdwq[lpfc_cmd->hdwq_no]; - hdwq->cpucheck_xmt_io[cpu]++; - } - } +if (unlikely (phba->hdwqstat_on &LPFC_CHECK_SCSI_IO )) +this_cpu_inc (phba->sli4_hba.c_stat->xmt_io);#endif err =lpfc_sli_issue_iocb (phba,LPFC_FCP_RING , &lpfc_cmd->cur_iocbq,SLI_IOCB_RET_IOCB );
drivers/scsi/lpfc/lpfc_sli4.h +12 -7
@@ -697,13 +697,6 @@ struct lpfc_sli4_hdw_queue {struct lpfc_lock_stat lock_conflict;#endif -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -#define LPFC_CHECK_CPU_CNT 128 -uint32_t cpucheck_rcv_io[LPFC_CHECK_CPU_CNT ]; -uint32_t cpucheck_xmt_io[LPFC_CHECK_CPU_CNT ]; -uint32_t cpucheck_cmpl_io[LPFC_CHECK_CPU_CNT ]; -#endif -/* Per HDWQ pool resources */ struct list_head sgl_list;struct list_head cmd_rsp_buf_list;
@@ -740,6 +733,15 @@ struct lpfc_sli4_hdw_queue {#define lpfc_qp_spin_lock (lock, qp, lstat) spin_lock(lock)#endif +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +struct lpfc_hdwq_stat { +u32 hdwq_no; +u32 rcv_io; +u32 xmt_io; +u32 cmpl_io; +}; +#endif +struct lpfc_sli4_hba {void __iomem *conf_regs_memmap_p;/* Kernel memory mapped address for * config space registers
@@ -921,6 +923,9 @@ struct lpfc_sli4_hba {struct cpumask numa_mask;uint16_t curr_disp_cpu;struct lpfc_eq_intr_info __percpu *eq_info; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +struct lpfc_hdwq_stat __percpu *c_stat; +#endif uint32_t conf_trunk;#define lpfc_conf_trunk_port0_WORD conf_trunk#define lpfc_conf_trunk_port0_SHIFT 0
Signature · 1 line
2.16.4
PATCH 9/12 lpfc: Change default SCSI LUN QD to 64
In reply to James SmartThe default lun queue depth by the driver has been 30 for many years. However, this value, when used with more recent hardware, has actually throttled some tests that concentrate io on a lun.
Increase the default lun queue depth to 64.
Queue full handling, reported by the target, remains in effect and unchanged.
--- drivers/scsi/lpfc/lpfc_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_attr.c +1 -1
@@ -3870,7 +3870,7 @@ LPFC_VPORT_ATTR_R(enable_da_id, 1, 0, 1,# lun_queue_depth: This parameter is used to limit the number of outstanding # commands per FCP LUN. Value range is [1,512]. Default value is 30. */ -LPFC_VPORT_ATTR_R (lun_queue_depth,30 ,1 ,512 , +LPFC_VPORT_ATTR_R (lun_queue_depth,64 ,1 ,512 ,"Max number of FCP commands we can queue to a specific LUN" );/*
Signature · 1 line
2.16.4
Re: [PATCH 09/12] lpfc: Change default SCSI LUN QD to 64
Hi James,
Quoted 20 lines · James Smart
The default lun queue depth by the driver has been 30 for many years. However, this value, when used with more recent hardware, has actually throttled some tests that concentrate io on a lun.
Increase the default lun queue depth to 64.
Queue full handling, reported by the target, remains in effect and unchanged.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/lpfc/lpfc_attr.c +0
-0
drivers/scsi/lpfc/lpfc_attr.c LPFC_VPORT_ATTR_R(enable_da_id, 1, 0, 1, · line 3871
Quoted 2 lines
drivers/scsi/lpfc/lpfc_attr.c +0
-0@@ -3870,7 +3870,7 @@ LPFC_VPORT_ATTR_R(enable_da_id, 1, 0, 1,# lun_queue_depth : This parameter is used to limit the number of outstanding# commands per FCP LUN. Value range is [1,512]. Default value is 30.
The documentation should also be updated here ^^^^
drivers/scsi/lpfc/lpfc_attr.c LPFC_VPORT_ATTR_R(enable_da_id, 1, 0, 1, · line 3875
Quoted 5 lines
drivers/scsi/lpfc/lpfc_attr.c +1
-1*/ -LPFC_VPORT_ATTR_R (lun_queue_depth,30 ,1 ,512 , +LPFC_VPORT_ATTR_R (lun_queue_depth,64 ,1 ,512 ,"Max number of FCP commands we can queue to a specific LUN" );
Thanks,
Daniel
Re: [PATCH 09/12] lpfc: Change default SCSI LUN QD to 64
Quoted 4 lines · Daniel Wagner
Quoted 1 line
# commands per FCP LUN. Value range is [1,512]. Default value is 30.The documentation should also be updated here ^^^^
yep - will repost this one patch. Removing the values from the comment as it not really necessary. All values (min, max, default) are specified in the macro.
-- james
PATCH 10/12 lpfc: Make debugfs ktime stats generic for NVME and SCSI
In reply to James SmartCurrently driver ktime stats, measuring code paths, is NVME-specific.
Convert the stats routines such that the code paths are generic, providing status for NVME and SCSI. Added ktime stat calls in SCSI queuecommand and cmpl routines.
--- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_debugfs.c | 129 ++++++++++++++++++++++++++++++++------- drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- drivers/scsi/lpfc/lpfc_nvme.c | 88 +------------------------- drivers/scsi/lpfc/lpfc_scsi.c | 23 +++++++ drivers/scsi/lpfc/lpfc_sli.h | 2 +- 7 files changed, 137 insertions(+), 110 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -1
@@ -480,7 +480,7 @@ struct lpfc_vport {struct dentry *debug_nodelist;struct dentry *debug_nvmestat;struct dentry *debug_scsistat; -struct dentry *debug_nvmektime; +struct dentry *debug_ioktime;struct dentry *debug_hdwqstat;struct dentry *vport_debugfs_root;struct lpfc_debugfs_trc *disc_trc;
drivers/scsi/lpfc/lpfc_crtn.h +1 -0
@@ -588,6 +588,7 @@ struct lpfc_io_buf *lpfc_get_io_buf(struct lpfc_hba *phba, int);void lpfc_release_io_buf (struct lpfc_hba *phba,struct lpfc_io_buf *ncmd,struct lpfc_sli4_hdw_queue *qp); +void lpfc_io_ktime (struct lpfc_hba *phba,struct lpfc_io_buf *ncmd);void lpfc_nvme_cmd_template (void );void lpfc_nvmet_cmd_template (void );void lpfc_nvme_cancel_iocb (struct lpfc_hba *phba,struct lpfc_iocbq *pwqeIn);
drivers/scsi/lpfc/lpfc_debugfs.c +107 -22
211 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_debugfs.h +1 -1
@@ -46,7 +46,7 @@/* nvmestat output buffer size */ #define LPFC_NVMESTAT_SIZE 8192 -#define LPFC_NVMEKTIME_SIZE 8192 +#define LPFC_IOKTIME_SIZE 8192#define LPFC_NVMEIO_TRC_SIZE 8192/* scsistat output buffer size */
drivers/scsi/lpfc/lpfc_nvme.c +3 -85
100 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_scsi.c +23 -0
@@ -4025,6 +4025,14 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, lpfc_cmd->pCmd =NULL ;spin_unlock (&lpfc_cmd->buf_lock); +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +if (lpfc_cmd->ts_cmd_start) { + lpfc_cmd->ts_isr_cmpl = pIocbIn->isr_timestamp; + lpfc_cmd->ts_data_io =ktime_get_ns (); + phba->ktime_last_cmd = lpfc_cmd->ts_data_io; +lpfc_io_ktime (phba, lpfc_cmd); + } +#endif /* The sdev is not guaranteed to be valid post scsi_done upcall. */ cmd->scsi_done (cmd);
@@ -4497,6 +4505,12 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)struct lpfc_io_buf *lpfc_cmd;struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));int err, idx; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +uint64_t start =0L ; + +if (phba->ktime_on) + start =ktime_get_ns (); +#endif rdata =lpfc_rport_data_from_scsi_device (cmnd->device);
@@ -4622,6 +4636,15 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)#endif err =lpfc_sli_issue_iocb (phba,LPFC_FCP_RING , &lpfc_cmd->cur_iocbq,SLI_IOCB_RET_IOCB ); +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +if (start) { + lpfc_cmd->ts_cmd_start = start; + lpfc_cmd->ts_last_cmd = phba->ktime_last_cmd; + lpfc_cmd->ts_cmd_wqput =ktime_get_ns (); + }else { + lpfc_cmd->ts_cmd_start =0 ; + } +#endif if (err) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_FCP , "3376 FCP could not issue IOCB err %x"
drivers/scsi/lpfc/lpfc_sli.h +1 -1
@@ -446,6 +446,6 @@ struct lpfc_io_buf {uint64_t ts_last_cmd;uint64_t ts_cmd_wqput;uint64_t ts_isr_cmpl; -uint64_t ts_data_nvme; +uint64_t ts_data_io;#endif };
Signature · 1 line
2.16.4
PATCH 11/12 lpfc: Remove prototype FIPS/DSS options from SLI-3
In reply to James SmartDuring code review, identified dss feature that was a prototype only and was never productized in SLI3. They shouldn't be there and prevents reuse of the command areas.
Remove any code in the driver to deal with dss, including code to deal with fips, which is associated with the dss feature.
--- drivers/scsi/lpfc/lpfc.h | 9 ++---- drivers/scsi/lpfc/lpfc_attr.c | 69 ------------------------------------------- drivers/scsi/lpfc/lpfc_hw.h | 20 ++++--------- drivers/scsi/lpfc/lpfc_mbox.c | 2 -- drivers/scsi/lpfc/lpfc_sli.c | 17 ----------- 5 files changed, 8 insertions(+), 109 deletions(-)
drivers/scsi/lpfc/lpfc.h +2 -7
@@ -207,8 +207,7 @@ typedef struct lpfc_vpd { } rev;struct {#ifdef __BIG_ENDIAN_BITFIELD -uint32_t rsvd3 :19 ;/* Reserved */ -uint32_t cdss :1 ;/* Configure Data Security SLI */ +uint32_t rsvd3 :20 ;/* Reserved */ uint32_t rsvd2 :3 ;/* Reserved */ uint32_t cbg :1 ;/* Configure BlockGuard */ uint32_t cmv :1 ;/* Configure Max VPIs */
@@ -230,8 +229,7 @@ typedef struct lpfc_vpd { uint32_t cmv : 1; /* Configure Max VPIs */ uint32_t cbg : 1; /* Configure BlockGuard */ uint32_t rsvd2 : 3; /* Reserved */ - uint32_t cdss : 1; /* Configure Data Security SLI */ - uint32_t rsvd3 :19; /* Reserved */ + uint32_t rsvd3 :20; /* Reserved */#endif } sli3Feat; } lpfc_vpd_t;
@@ -887,7 +885,6 @@ struct lpfc_hba {#define LPFC_INITIALIZE_LINK 0/* do normal init_link mbox */ #define LPFC_DELAY_INIT_LINK 1/* layered driver hold off */ #define LPFC_DELAY_INIT_LINK_INDEFINITELY 2/* wait, manual intervention */ -uint32_t cfg_enable_dss;uint32_t cfg_fdmi_on;#define LPFC_FDMI_NO_SUPPORT 0/* FDMI not supported */ #define LPFC_FDMI_SUPPORT 1/* FDMI supported? */
@@ -1156,8 +1153,6 @@ struct lpfc_hba {uint32_t iocb_cnt;uint32_t iocb_max;atomic_t sdev_cnt; -uint8_t fips_spec_rev; -uint8_t fips_level;spinlock_t devicelock;/* lock for luns list */ mempool_t *device_data_mem_pool;struct list_head luns;
drivers/scsi/lpfc/lpfc_attr.c +0 -69
99 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hw.h +6 -14
@@ -3262,8 +3262,7 @@ typedef struct {#endif #ifdef __BIG_ENDIAN_BITFIELD - uint32_t rsvd1 : 19; /* Reserved */ - uint32_t cdss : 1; /* Configure Data Security SLI */ + uint32_t rsvd1 : 20; /* Reserved */ uint32_t casabt : 1; /* Configure async abts status notice */ uint32_t rsvd2 : 2; /* Reserved */ uint32_t cbg : 1; /* Configure BlockGuard */
@@ -3287,12 +3286,10 @@ typedef struct { uint32_t cbg : 1; /* Configure BlockGuard */ uint32_t rsvd2 : 2; /* Reserved */ uint32_t casabt : 1; /* Configure async abts status notice */ - uint32_t cdss : 1; /* Configure Data Security SLI */ - uint32_t rsvd1 : 19; /* Reserved */ + uint32_t rsvd1 : 20; /* Reserved */#endif #ifdef __BIG_ENDIAN_BITFIELD - uint32_t rsvd3 : 19; /* Reserved */ - uint32_t gdss : 1; /* Configure Data Security SLI */ + uint32_t rsvd3 : 20; /* Reserved */ uint32_t gasabt : 1; /* Grant async abts status notice */ uint32_t rsvd4 : 2; /* Reserved */ uint32_t gbg : 1; /* Grant BlockGuard */
@@ -3316,8 +3313,7 @@ typedef struct { uint32_t gbg : 1; /* Grant BlockGuard */ uint32_t rsvd4 : 2; /* Reserved */ uint32_t gasabt : 1; /* Grant async abts status notice */ - uint32_t gdss : 1; /* Configure Data Security SLI */ - uint32_t rsvd3 : 19; /* Reserved */ + uint32_t rsvd3 : 20; /* Reserved */#endif #ifdef __BIG_ENDIAN_BITFIELD
@@ -3339,15 +3335,11 @@ typedef struct {uint32_t rsvd6;/* Reserved */ #ifdef __BIG_ENDIAN_BITFIELD - uint32_t fips_rev : 3; /* FIPS Spec Revision */ - uint32_t fips_level : 4; /* FIPS Level */ - uint32_t sec_err : 9; /* security crypto error */ + uint32_t rsvd7 : 16; uint32_t max_vpi : 16; /* Max number of virt N-Ports */#else /* __LITTLE_ENDIAN */ uint32_t max_vpi : 16; /* Max number of virt N-Ports */ - uint32_t sec_err : 9; /* security crypto error */ - uint32_t fips_level : 4; /* FIPS Level */ - uint32_t fips_rev : 3; /* FIPS Spec Revision */ + uint32_t rsvd7 : 16;#endif }CONFIG_PORT_VAR ;
drivers/scsi/lpfc/lpfc_mbox.c +0 -2
@@ -1299,8 +1299,6 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)if (phba->sli_rev ==LPFC_SLI_REV3 && phba->vpd.sli3Feat.cerbm) {if (phba->cfg_enable_bg) mb->un.varCfgPort.cbg =1 ;/* configure BlockGuard */ -if (phba->cfg_enable_dss) - mb->un.varCfgPort.cdss =1 ;/* Configure Security */ mb->un.varCfgPort.cerbm =1 ;/* Request HBQs */ mb->un.varCfgPort.ccrp =1 ;/* Command Ring Polling */ mb->un.varCfgPort.max_hbq =lpfc_sli_hbq_count ();
drivers/scsi/lpfc/lpfc_sli.c +0 -17
@@ -5032,23 +5032,6 @@ lpfc_sli_config_port(struct lpfc_hba *phba, int sli_mode) }else phba->max_vpi =0 ; - phba->fips_level =0 ; - phba->fips_spec_rev =0 ; -if (pmb->u.mb.un.varCfgPort.gdss) { - phba->sli3_options |=LPFC_SLI3_DSS_ENABLED ; - phba->fips_level = pmb->u.mb.un.varCfgPort.fips_level; - phba->fips_spec_rev = pmb->u.mb.un.varCfgPort.fips_rev; -lpfc_printf_log (phba,KERN_INFO ,LOG_INIT , -"2850 Security Crypto Active. FIPS x%d " -"(Spec Rev: x%d)" , - phba->fips_level, phba->fips_spec_rev); - } -if (pmb->u.mb.un.varCfgPort.sec_err) { -lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , -"2856 Config Port Security Crypto " -"Error: x%x " , - pmb->u.mb.un.varCfgPort.sec_err); - }if (pmb->u.mb.un.varCfgPort.gerbm) phba->sli3_options |=LPFC_SLI3_HBQ_ENABLED ;if (pmb->u.mb.un.varCfgPort.gcrp)
Signature · 1 line
2.16.4
PATCH 12/12 lpfc: Update lpfc version to 12.8.0.0
In reply to James SmartUpdate lpfc version to 12.8.0.0
--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "12.6.0.4" +#define LPFC_DRIVER_VERSION "12.8.0.0"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.16.4
Martin K. Petersen
AppliedJames,
Quoted 2 lines
Patch set contains mainly fixes, a change to QD default, and a few cleanups.
Applied to 5.7/scsi-queue. Please make sure to use the -vN argument to git-send-email when sending updated patches. Otherwise patchwork and b4 won't handle them correctly.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering