diff mbox series

scsi: qla2xxx: Format log strings only if needed

Message ID 20211112145446.51210-1-r.bolshakov@yadro.com (mailing list archive)
State Accepted
Commit 69002c8ce914ef0ae22a6ea14b43bb30b9a9a6a8
Headers show
Series scsi: qla2xxx: Format log strings only if needed | expand

Commit Message

Roman Bolshakov Nov. 12, 2021, 2:54 p.m. UTC
Commit 598a90f2002c4 ("scsi: qla2xxx: add ring buffer for tracing debug
logs") introduced unconditional log string formatting to ql_dbg() even
if ql_dbg_log event is disabled. It harms performance because some
strings are formatted in fastpath and/or interrupt context.

Cc: Rajan Shanmugavelu <rajan.shanmugavelu@oracle.com>
Cc: stable@vger.kernel.org
Fixes: 598a90f2002c4 ("scsi: qla2xxx: add ring buffer for tracing debug logs")
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 drivers/scsi/qla2xxx/qla_dbg.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Martin K. Petersen Dec. 7, 2021, 3:45 a.m. UTC | #1
On Fri, 12 Nov 2021 17:54:46 +0300, Roman Bolshakov wrote:

> Commit 598a90f2002c4 ("scsi: qla2xxx: add ring buffer for tracing debug
> logs") introduced unconditional log string formatting to ql_dbg() even
> if ql_dbg_log event is disabled. It harms performance because some
> strings are formatted in fastpath and/or interrupt context.
> 
> 

Applied to 5.16/scsi-fixes, thanks!

[1/1] scsi: qla2xxx: Format log strings only if needed
      https://git.kernel.org/mkp/scsi/c/69002c8ce914
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 25549a8a2d72..7cf1f78cbaee 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -2491,6 +2491,9 @@  ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
 	struct va_format vaf;
 	char pbuf[64];
 
+	if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled())
+		return;
+
 	va_start(va, fmt);
 
 	vaf.fmt = fmt;