Re: [PATCH v4] nvme: reduce firmware activation poll interval

guzebing <[email protected]>
Newsgroups org.infradead.lists.linux-nvme,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 8/12/26 12:46 AM, Keith Busch wrote:
> On Tue, Jul 28, 2026 at 08:17:35PM +0800, guzebing wrote:
>> +static int nvme_wait_ready(struct nvme_ctrl *ctrl, u32 mask, u32 val,
>> +			   u32 timeout, const char *op)
>> +{
>> +	unsigned long timeout_jiffies = jiffies + timeout * HZ;
>> +	u32 csts;
>> +	int ret;
>> +
>> +	ret = nvme_wait_csts(ctrl, mask, val, timeout_jiffies, false, &csts);
>> +	if (ret != -ETIMEDOUT)
>> +		return ret;
>> +
>> +	dev_err(ctrl->device,
>> +		"Device not ready; aborting %s, CSTS=0x%x\n", op, csts);
>> +	return -ENODEV;
> 
> Actually, I'm to back this out for a moment to think about this. I like
> that you've changed the error to ETIMEDOUT for that condition, but I'm
> not sure we need to convert it to ENODEV. None of the callers seem to
> care about the specific error, and the user visible side effect of the
> condition is more informative than ENODEV.
> 
> So if we can get rid of that legacy behavior, then this simplifies even
> more. Thoughts?

When restructuring the polling loop, I tried to preserve the existing
behavior and return values as much as possible. Converting -ETIMEDOUT
to -ENODEV was part of that effort.

However, I agree that -ETIMEDOUT more accurately describes the actual
failure. I checked the callers and confirmed that they do not
distinguish between -ENODEV and -ETIMEDOUT, so propagating -ETIMEDOUT
directly makes sense to me.

Please feel free to fold this change in, or let me know if you would
prefer a v5.

Thanks,
Guzebing
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.