mbox series

[RFC,0/2] scsi: scsi_debug: Allow parameter changes through sysfs

Message ID 20240311065427.3006023-1-shinichiro.kawasaki@wdc.com (mailing list archive)
Headers show
Series scsi: scsi_debug: Allow parameter changes through sysfs | expand

Message

Shin'ichiro Kawasaki March 11, 2024, 6:54 a.m. UTC
Some of the blktests users run tests using kernels with built-in modules to run
tests easier and quicker. For that reason, it is desirable to run tests with the
built-in scsi_debug [1]. However, some of the scsi_debug parameters can be
modified only at module load, as module parameters. They are visible as sysfs
attribute files, but they are read-only and not writable. There are ten,
read-only scsi_debug parameters used in blktests [2]. Because of these
parameters, eight test cases are skipped when scsi_debug is built-in [3].

The values of those parameters are kept as global variables and referred to in
many places. Changes in the parameter values affect live scsi_debug hosts and
cause various troubles. That is why the parameters are read-only. I once tried
to make the parameters non-global and unique to each host, but found this
approach will need large code changes in scsi_debug.

To minimize the code changes for such parameter changes, I propose to allow the
parameter changes "only when scsi_debug has no hosts." Users need to remove all
hosts before changing the parameters. With this restriction, users can run tests
with any, desired parameter values using the built-in scsi_debug.

This series shows how the code will change with this approach. I chose
dev_size_mb as the example parameter, which is referred to in multiple blktests
test cases. The first patch in the series is preparation. The second patch makes
dev_size_mb writable through sysfs only when there is no host. This change will
allow the test case block/032 to run with the built-in scsi_debug. Corresponding
blktests side changes are available on github [4].

The work for the other listed parameters is in progress. While the work is on
going, I would like to ask for comments on this approach. Is this approach
acceptable? Is there any other better way?

[1] https://lore.kernel.org/linux-block/20220530130811.3006554-1-hch@lst.de/

[2] Parameters used in blktests which have read-only sysfs attribute files

  dev_size_mb
  sector_size
  lbpws
  lbpws10
  dix
  dif
  zbc
  zone_cap_mb
  zone_size_mb
  zone_nr_conv

[3] Test cases skipped with built-in scsi_debug

  block/009
  block/025
  block/028
  block/032
  loop/004
  zbd/008
  zbd/009
  zbd/010

[4] https://github.com/kawasaki/blktests/tree/scsi_debug

Shin'ichiro Kawasaki (2):
  scsi: scsi_debug: Factor out initialization of size parameters
  scsi: scsi_debug: Allow dev_size_mb changes through sysfs

 drivers/scsi/scsi_debug.c | 91 ++++++++++++++++++++++++++++++---------
 1 file changed, 70 insertions(+), 21 deletions(-)