diff mbox series

hwmon: (drivetemp) Set scsi command timeout to 10s

Message ID 20250115131340.3178988-1-russ@har.mn (mailing list archive)
State Accepted
Headers show
Series hwmon: (drivetemp) Set scsi command timeout to 10s | expand

Commit Message

Russell Harmon Jan. 15, 2025, 1:13 p.m. UTC
There's at least one drive (MaxDigitalData OOS14000G) such that if it
receives a large amount of I/O while entering an idle power state will
first exit idle before responding, including causing SMART temperature
requests to be delayed.

This causes the drivetemp request to exceed its timeout of 1 second.

Signed-off-by: Russell Harmon <russ@har.mn>
---
Here's a test case reproducing the issue:

$ time cat /sys/class/hwmon/hwmon9/temp1_input
28000
cat /sys/class/hwmon/hwmon9/temp1_input  0.00s user 0.00s system 7% cpu 0.023 total
$ dd if=/dev/sdep of=/dev/null bs=1M iflag=direct &  # Generate background load
$ ./openSeaChest_PowerControl -d /dev/sdep --transitionPower idle_a
$ time cat /sys/class/hwmon/hwmon9/temp1_input
0
cat /sys/class/hwmon/hwmon9/temp1_input  0.00s user 0.00s system 0% cpu 3.154 total
$ dmesg -t
sd 11:0:1:0: attempting task abort!scmd(0x00000000ef8da38c), outstanding
for 2098 ms & timeout 1000 ms
sd 11:0:1:0: [sdep] tag#4639 CDB: ATA command pass through(16) 85 08 0e
00 d5 00 01 00 e0 00 4f 00 c2 00 b0 00
scsi target11:0:1: handle(0x0009), sas_address(0x4433221105000000),
phy(5)
scsi target11:0:1: enclosure logical id(0x500062b202d7ea80), slot(6)
scsi target11:0:1: enclosure level(0x0000), connector name(     )
sd 11:0:1:0: task abort: SUCCESS scmd(0x00000000ef8da38c)
sd 11:0:1:0: Power-on or device reset occurred
$ time cat /sys/class/hwmon/hwmon9/temp1_input
28000
cat /sys/class/hwmon/hwmon9/temp1_input  0.00s user 0.00s system 48% cpu
0.005 total

 drivers/hwmon/drivetemp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Jan. 15, 2025, 2:22 p.m. UTC | #1
On Wed, Jan 15, 2025 at 05:13:41AM -0800, Russell Harmon wrote:
> There's at least one drive (MaxDigitalData OOS14000G) such that if it
> receives a large amount of I/O while entering an idle power state will
> first exit idle before responding, including causing SMART temperature
> requests to be delayed.
> 
> This causes the drivetemp request to exceed its timeout of 1 second.
> 
> Signed-off-by: Russell Harmon <russ@har.mn>
> ---

Applied. For the future, please remember to version your patches and to
provide change logs.

Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c
index 2a4ec55ddb47..291d91f68646 100644
--- a/drivers/hwmon/drivetemp.c
+++ b/drivers/hwmon/drivetemp.c
@@ -194,7 +194,7 @@  static int drivetemp_scsi_command(struct drivetemp_data *st,
 	scsi_cmd[14] = ata_command;
 
 	err = scsi_execute_cmd(st->sdev, scsi_cmd, op, st->smartdata,
-			       ATA_SECT_SIZE, HZ, 5, NULL);
+			       ATA_SECT_SIZE, 10 * HZ, 5, NULL);
 	if (err > 0)
 		err = -EIO;
 	return err;