OSDN Git Service

scsi: lpfc: Enhancements to LOG_TRACE_EVENT for better readability
authorJames Smart <jsmart2021@gmail.com>
Mon, 4 Jan 2021 18:02:39 +0000 (10:02 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 8 Jan 2021 04:02:37 +0000 (23:02 -0500)
While testing recent discovery node rework, several items were seen that
could be done better with respect to the new trace event logic.

1) in the following msg:
      kernel: lpfc 0000:44:00.0: start 35 end 35 cnt 0
   If cnt is zero in the 1st message, there is no reason to display the
   1st message, which is just giving start/end positioning.

   Fix by not displaying message if cnt is 0.

2) If the driver is loaded with module log verbosity off, and later a
   single NPIV host instance verbosity is enabled via sysfs, it enables
   messages on all instances. This is due to the trace log verbosity checks
   (lpfc_dmp_dbg) looking at the phba only. It should look at the phba and
   the vport.

   Fix by enabling a check on both phba and vport.

3) in the following messages:
       2904 Firmware Dump Image Present on Adapter
       2887 Reset Needed: Attempting Port Recovery...
   These messages are not necessary for the trace event log, which is
   primarily for discovery.

   Fix by changing log level on these 2 messages to LOG_SLI.

Link: https://lore.kernel.org/r/20210104180240.46824-15-jsmart2021@gmail.com
Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c

index dbd7e40..71f340d 100644 (file)
@@ -1865,7 +1865,7 @@ lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action,
 
        /* need reset: attempt for port recovery */
        if (en_rn_msg)
-               lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
+               lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "2887 Reset Needed: Attempting Port "
                                "Recovery...\n");
 
@@ -14177,15 +14177,32 @@ void lpfc_dmp_dbg(struct lpfc_hba *phba)
        int i;
        int j = 0;
        unsigned long rem_nsec;
+       struct lpfc_vport **vports;
 
+       /* Don't dump messages if we explicitly set log_verbose for the
+        * physical port or any vport.
+        */
        if (phba->cfg_log_verbose)
                return;
 
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL) {
+               for (i = 0; i <= phba->max_vpi && vports[i] != NULL; i++) {
+                       if (vports[i]->cfg_log_verbose) {
+                               lpfc_destroy_vport_work_array(phba, vports);
+                               return;
+                       }
+               }
+       }
+       lpfc_destroy_vport_work_array(phba, vports);
+
        if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0)
                return;
 
        start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ;
        dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt);
+       if (!dbg_cnt)
+               goto out;
        temp_idx = start_idx;
        if (dbg_cnt >= DBG_LOG_SZ) {
                dbg_cnt = DBG_LOG_SZ;
@@ -14215,6 +14232,7 @@ void lpfc_dmp_dbg(struct lpfc_hba *phba)
                         rem_nsec / 1000,
                         phba->dbg_log[temp_idx].log);
        }
+out:
        atomic_set(&phba->dbg_log_cnt, 0);
        atomic_set(&phba->dbg_log_dmping, 0);
 }
index d51d869..fa1a714 100644 (file)
@@ -7491,7 +7491,7 @@ static void lpfc_sli4_dip(struct lpfc_hba *phba)
                        return;
 
                if (bf_get(lpfc_sliport_status_dip, &reg_data))
-                       lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
+                       lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                        "2904 Firmware Dump Image Present"
                                        " on Adapter");
        }