[PATCH v1] ufs: core: support updating device command timeout

Bart Van Assche bvanassche at acm.org
Fri May 9 08:07:55 PDT 2025


On 5/9/25 12:08 AM, peter.wang at mediatek.com wrote:
> Some UFS device commands may timeout due to being blocked
> by regular SCSI write commands. Therefore, the timeout
> needs to be extended to 30 seconds, matching the SCSI write
> command timeout.

Does this happen with all UFS devices or only with some UFS devices? Is
this behavior perhaps a firmware bug? Processing of device commands
shouldn't be postponed until SCSI command processing has finished.

> +enum {
> +	QUERY_REQ_TIMEOUT_DEFAULT = 1500,
> +	QUERY_REQ_TIMEOUT_MAX     = 30000
> +};

[ ... ]

> +static int dev_cmd_timeout_set(const char *val, const struct kernel_param *kp)
> +{
> +	return param_set_uint_minmax(val, kp, QUERY_REQ_TIMEOUT_DEFAULT,
> +				     QUERY_REQ_TIMEOUT_MAX);
> +}

This change makes it impossible to reduce the device command timeout
below 1.5 seconds. I think that setting lower values can be useful for
error injection purposes.

Thanks,

Bart.



More information about the Linux-mediatek mailing list