scsi: core: Optimize the SCSI printk() variants
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest2 patches 5 repliesIn review
Changes in v2 from the cover letter
- 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.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | scsi: core: Add KUnit tests for scsi_logging.cdrivers/ drivers/ drivers/ | +461 | 0 replies | |
| 2/2 | scsi: core: Eliminate scsi_log_{reserve,release}_buffer()drivers/ | +90 | 5 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] scsi: core: Optimize the SCSI printk() variants
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