Skip to contentSkip to conversation

scsi: megaraid_sas: make module parameter scmd_timeout writable

PATCH RESEND In review Lei Chen 2 participants 3 messages Apr 8, 2024 – Apr 9, 2024 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Lei Chen

author
#0 lore raw

PATCH RESEND 1/1 scsi: megaraid_sas: make module parameter scmd_timeout writable

When an scmd times out, block layer calls megasas_reset_timer to make further decisions. scmd_timeout indicates when an scmd is really timed-out. If we want to make this process more fast, we can decrease this value. This patch allows users to change this value in run-time.

---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +1 -1
index 3d4f13da1ae8..2a165e5dc7a3 100644
@@ -91,7 +91,7 @@ module_param(dual_qdepth_disable, int, 0444);
 MODULE_PARM_DESC(dual_qdepth_disable, "Disable dual queue depth feature. Default: 0");
 
 static unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;
-module_param(scmd_timeout, int, 0444);
+module_param(scmd_timeout, int, 0644);
 MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer.");
 
 int perf_mode = -1;
Signature · 1 line
2.44.0
#1 lore raw
Quoted 3 lines · Lei Chen

When an scmd times out, block layer calls megasas_reset_timer to make further decisions. scmd_timeout indicates when an scmd is really timed-out.

What does really timed-out mean?

Quoted 13 lines

If we want to make this process more fast, we can decrease this value. This patch allows users to change this value in run-time.

---
  drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +0 -0
index 3d4f13da1ae8..2a165e5dc7a3 100644

drivers/scsi/megaraid/megaraid_sas_base.c module_param(dual_qdepth_disable, int, 0444); · line 97

Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_base.c +1 -1
@@ -91,7 +91,7 @@ module_param(dual_qdepth_disable, int, 0444);
  MODULE_PARM_DESC(dual_qdepth_disable, "Disable dual queue depth feature. Default: 0");
 
  static unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;
-module_param(scmd_timeout, int, 0444);
+module_param(scmd_timeout, int, 0644);
  MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer.");
 
  int perf_mode = -1;

I don't know why megaraid_sas has special handling here (and bypasses SCSI midlayer).

If the host is overloaded and you get a time-out as a command simply could not be handled in time, can you alternatively try reducing the scsi device queue depth?

A message that is not in the archive (sent off-list or not yet received): CAKcXpBxp4ziNBTeNco9sxwE3TH2=GFJ4tGdapy8DGpnZjV_1qA@mail.gmail.com

author
#3 lore raw

Sorry for the non plain text format.

Quoted 7 lines · John Garry
Quoted 3 lines · Lei Chen

When an scmd times out, block layer calls megasas_reset_timer to make further decisions. scmd_timeout indicates when an scmd is really timed-out.

What does really timed-out mean?

scsi_times_out will call eh_timed_out (in megaraid driver, this indicates megasas_reset_timer),
megasas_reset_timer determines whether a scmd is timed out. If not, it will return
BLK_EH_RESET_TIMER to tell the block layer to reset the timer and do nothing.

Quoted 22 lines
Quoted 22 lines

If we want to make this process more fast, we can decrease this value. This patch allows users to change this value in run-time.

---
  drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +1 -1
index 3d4f13da1ae8..2a165e5dc7a3 100644
@@ -91,7 +91,7 @@ module_param(dual_qdepth_disable, int, 0444);
  MODULE_PARM_DESC(dual_qdepth_disable, "Disable dual queue depth feature. Default: 0");
 
  static unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT;
-module_param(scmd_timeout, int, 0444);
+module_param(scmd_timeout, int, 0644);
  MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer.");
 
Quoted 8 lines

drivers/scsi/megaraid/megaraid_sas_base.c module_param(dual_qdepth_disable, int, 0444); · line 97

Quoted 1 line
drivers/scsi/megaraid/megaraid_sas_base.c +0 -0
  int perf_mode = -1;

I don't know why megaraid_sas has special handling here (and bypasses SCSI midlayer).

If the host is overloaded and you get a time-out as a command simply could not be handled in time, can you alternatively try reducing the scsi device queue depth?

Yeah, scsi layer and drivers already have some methods to control the queue depth. For megaraid driver,
it will throttle queue depth in megasas_reset_timer. But since scsi disks on the same megaraid card share
the queue depth, that will impact other scsi disks.
In most cases, a scsi disk is more likely to be misworking than a RAID card, which makes scmd wrong and retry.
We want to adjust scmd_timeout without reloading the driver to make scmds against abnormal scsi disks completed faster.