Opened 3 years ago

Last modified 7 months ago

#1066 new enhancement

Please add a timeout parameter

Reported by: Philipp Guehring Owned by:
Priority: minor Milestone: Release 7.3
Component: smartctl Version: 7.2
Keywords: Cc: Jinoh Kang

Description

I am trying to debug a SSD firmware, which takes longer than the hardcoded timeouts in smartctl permits. Could you please add a commandline parameter to smartctl so that I can specify or even disable the timeout when needed?

Change History (7)

comment:1 Changed 3 years ago by Christian Franke

Keywords: timeout removed
Milestone: undecided
Priority: trivialminor

In most cases, timeouts are set to 60 seconds or 0 (kernel default). For SCSI_SEND_DIAGNOSTIC, timeout is set to 5 hours. I agree that this might not be suitable for all uses cases.

Adding a generic timeout setting that covers all protocols (ATA, SCSI, NVMe), all supported platforms with all supported RAID controllers would be non-trivial.

For which specific configuration (protocol, drive command, platform) do you need longer timeouts?

comment:2 Changed 3 years ago by Philipp Guehring

5 hours is sufficient for debugging, but the 60 seconds are the problem that I have. Currently, I am using a SATA SSD on an iMX6 SATA controller on ARM. I succeeded to change the kernel default with "echo 1000000 >/sys/block/sda/device/timeout" for all other commands I have been testing now, only smartctl . Since I have optimized the JTAG interfaces, most sessions take less than an hour now, before that, I sometimes had workloads that took days.

comment:3 Changed 3 years ago by Philipp Guehring

The command I am currently using is "smartctl -r ioctl,2 -a /dev/sda --identify".
As far as I have seen, the 60 seconds timeout is defined centrally, so if you can override it with a commandline parameter before the other modules are using it, that should help for most platforms, I guess.

comment:4 Changed 3 years ago by Christian Franke

Milestone: undecidedunscheduled

The SCSI timeout is defined centrally as SCSI_TIMEOUT_DEFAULT in scsicmds.h. This is also used for SAT such that is also affects default (S)ATA access on Linux. Other ATA, NVMe and RAID controller timeouts not defined centrally (for example see r4750).

We possibly add a --timeout=SECONDS option in the future after adding a timeout setting also to ATA and NVMe pass-through structs. I only see two rare use cases for long timeouts: CAPTIVE/FOREGROUND self-tests and drive firmware debugging (see also ticket #832). Both are not relevant for the typical smartmontools user.

For the short term, please consider to set SCSI_TIMEOUT_DEFAULT to the desired value and then compile a custom version of smartctl.

comment:5 Changed 22 months ago by Alex Samorukov

Side note - not every interface allow to set timeouts, e.g. all high-level interfaces (like in Darwin) handling this internally.

comment:6 Changed 7 months ago by Jinoh Kang

Cc: Jinoh Kang added
Version: 6.67.2

On the other hand, the current behavior might not be the most consistent choice either, as it uses SCSI_TIMEOUT_DEFAULT for supported platforms and the system default for others.

How about the following (either or both):

  1. Add flag --default-timeout, --timeout=default, --timeout=system-default, or --use-system-timeout, which would revert to system default rather than use SCSI_TIMEOUT_DEFAULT. On Linux this is configurable via SG_[GS]ET_TIMEOUT (not rq_timeout).
  2. Fail if --timeout is specified, but the system does not support specifying a non-default timeout.

comment:7 Changed 7 months ago by Christian Franke

Milestone: unscheduledRelease 7.3

Selection of system default could also be done with --timeout=0.

Note: See TracTickets for help on using tickets.