Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] scsi: core: Optimize the SCSI printk() variants
@ 2026-08-31 17:58 Bart Van Assche
  2026-08-31 17:58 ` [PATCH v2 1/2] scsi: core: Add KUnit tests for scsi_logging.c Bart Van Assche
  2026-08-31 17:58 ` [PATCH v2 2/2] scsi: core: Eliminate scsi_log_{reserve,release}_buffer() Bart Van Assche
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Van Assche @ 2026-08-31 17:58 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, John Garry, Bart Van Assche

Hi Martin,

The SCSI logging functions currently allocate a temporary 128-byte
buffer via kmalloc(..., GFP_ATOMIC). This design has several drawbacks:
 - Runtime memory allocation and freeing overhead on logging paths.
 - Truncation of log messages to 127 characters.
 - Discarded log messages if the buffer allocation fails under memory
   pressure.

This patch series eliminates temporary buffer allocations from
scsi_logging.c by formatting messages directly using struct va_format
(%pV) and dev_printk(), as well as formatting hex buffers directly
with %*ph.

To ensure formatting and logging behavior remain free of regressions,
the first patch introduces a comprehensive KUnit test suite for the
SCSI logging functions. The second patch refactors scsi_logging.c to use
the direct formatting helpers.

Please consider applying this series.

Thanks,

Bart.

Changes compared to v1:
 - Expanded a single patch into a series of two patches by adding a
   patch with unit tests.
 - Restored a newline in a format string that was missing from v1.

Bart Van Assche (2):
  scsi: core: Add KUnit tests for scsi_logging.c
  scsi: core: Eliminate scsi_log_{reserve,release}_buffer()

 drivers/scsi/Kconfig             |   9 +
 drivers/scsi/scsi_logging.c      | 285 +++++++++------------
 drivers/scsi/scsi_logging_test.c | 422 +++++++++++++++++++++++++++++++
 3 files changed, 547 insertions(+), 169 deletions(-)
 create mode 100644 drivers/scsi/scsi_logging_test.c


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-31 20:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 17:58 [PATCH v2 0/2] scsi: core: Optimize the SCSI printk() variants Bart Van Assche
2026-08-31 17:58 ` [PATCH v2 1/2] scsi: core: Add KUnit tests for scsi_logging.c Bart Van Assche
2026-08-31 20:05   ` sashiko-bot
2026-08-31 17:58 ` [PATCH v2 2/2] scsi: core: Eliminate scsi_log_{reserve,release}_buffer() Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox