scsi: scsi_debug: Fix cmd_per_lun, set to max_queue
authorDouglas Gilbert <dgilbert@interlog.com>
Thu, 15 Apr 2021 01:50:31 +0000 (21:50 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 3 May 2021 02:41:44 +0000 (22:41 -0400)
commitfc09acb7de31badb2ea9e85d21e071be1a5736e4
tree65d53ad054ff5a2e71e81afd5293ed4992e92086
parentce4f62f9dd8cf43ac044045ed598a0b80ef33890
scsi: scsi_debug: Fix cmd_per_lun, set to max_queue

Make sure that the cmd_per_lun value placed in the host template never
exceeds the can_queue value. If the max_queue driver parameter is not
specified then both cmd_per_lun and can_queue are set to CAN_QUEUE.
CAN_QUEUE is a compile time constant and is used to dimension an array to
hold queued requests. If the max_queue driver parameter is given it is must
be less than or equal to CAN_QUEUE and if so, the host template values are
adjusted.

Remove undocumented code that allowed queue_depth to exceed CAN_QUEUE and
cause stack full type errors. There is a documented way to do that with
every_nth and

    echo 0x8000 > /sys/bus/pseudo/drivers/scsi_debug/opts

See: https://sg.danny.cz/sg/scsi_debug.html

Tweak some formatting, and add a suggestion to the "trim poll_queues"
warning.

Link: https://lore.kernel.org/r/20210415015031.607153-1-dgilbert@interlog.com
Reported-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reviewed-by: John Garry <john.garry@hauwei.com>
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c