linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: James Smart <jsmart2021@gmail.com>,
	Dick Kennedy <dick.kennedy@broadcom.com>
Subject: [PATCH v2 14/15] lpfc: Enhancements to LOG_TRACE_EVENT for better readability
Date: Mon,  4 Jan 2021 10:02:39 -0800	[thread overview]
Message-ID: <20210104180240.46824-15-jsmart2021@gmail.com> (raw)
In-Reply-To: <20210104180240.46824-1-jsmart2021@gmail.com>

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.

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>
---
 drivers/scsi/lpfc/lpfc_init.c | 20 +++++++++++++++++++-
 drivers/scsi/lpfc/lpfc_sli.c  |  2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index dbd7e40f67f9..71f340dd4fbd 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -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);
 }
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index d51d86959bbc..fa1a714a78f0 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -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");
 	}
-- 
2.26.2


  parent reply	other threads:[~2021-01-04 18:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 18:02 [PATCH v2 00/15] lpfc: Update lpfc to revision 12.8.0.7 James Smart
2021-01-04 18:02 ` [PATCH v2 01/15] lpfc: Fix PLOGI S_ID of 0 on pt2pt config James Smart
2021-01-04 18:02 ` [PATCH v2 02/15] lpfc: Fix auto sli_mode and its effect on CONFIG_PORT for SLI3 James Smart
2021-06-07 11:06   ` Daniel Wagner
2021-06-07 15:12     ` James Smart
2021-06-15 12:45       ` Daniel Wagner
2021-06-18  8:52         ` Daniel Wagner
2021-12-14 13:19           ` [PATCH] lpfc: Reintroduce old IRQ probe logic Daniel Wagner
2021-01-04 18:02 ` [PATCH v2 03/15] lpfc: Refresh ndlp when a new PRLI is received in the PRLI issue state James Smart
2021-01-04 18:02 ` [PATCH v2 04/15] lpfc: Fix crash when a fabric node is released prematurely James Smart
2021-01-04 18:02 ` [PATCH v2 05/15] lpfc: Use the nvme-fc transport supplied timeout for LS requests James Smart
2021-01-04 18:02 ` [PATCH v2 06/15] lpfc: Fix FW reset action if IOs are outstanding James Smart
2021-01-04 18:02 ` [PATCH v2 07/15] lpfc: Prevent duplicate requests to unregister with cpuhp framework James Smart
2021-01-04 18:02 ` [PATCH v2 08/15] lpfc: Fix error log messages being logged following scsi task mgnt James Smart
2021-01-04 18:02 ` [PATCH v2 09/15] lpfc: Fix target reset failing James Smart
2021-01-04 18:02 ` [PATCH v2 10/15] lpfc: Fix NVME recovery after mailbox timeout James Smart
2021-01-04 18:02 ` [PATCH v2 11/15] lpfc: Fix vport create logging James Smart
2021-01-04 18:02 ` [PATCH v2 12/15] lpfc: Fix crash when nvmet transport calls host_release James Smart
2021-01-04 18:02 ` [PATCH v2 13/15] lpfc: Implement health checking when aborting io James Smart
2021-01-04 18:02 ` James Smart [this message]
2021-01-04 18:02 ` [PATCH v2 15/15] lpfc: Update lpfc version to 12.8.0.7 James Smart
2021-01-08  4:02 ` [PATCH v2 00/15] lpfc: Update lpfc to revision 12.8.0.7 Martin K. Petersen
2021-01-13  5:48 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210104180240.46824-15-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=dick.kennedy@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).