The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: guzebing <guzebing1612@gmail.com>
Cc: axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	Guzebing <guzebing@bytedance.com>
Subject: Re: [PATCH v4] nvme: reduce firmware activation poll interval
Date: Tue, 11 Aug 2026 10:08:58 -0600	[thread overview]
Message-ID: <antJGoTgL-1sbpyy@kbusch-mbp> (raw)
In-Reply-To: <20260728121735.1627370-1-guzebing1612@gmail.com>

On Tue, Jul 28, 2026 at 08:17:35PM +0800, guzebing wrote:
> +static int nvme_wait_csts(struct nvme_ctrl *ctrl, u32 mask, u32 val,
> +			  unsigned long timeout, bool exit_if_ctrl_disabled,
> +			  u32 *csts)
>  {
> -	unsigned long timeout_jiffies = jiffies + timeout * HZ;
> -	u32 csts;
>  	int ret;
>  
> -	while ((ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, &csts)) == 0) {
> -		if (csts == ~0)
> +	while ((ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, csts)) == 0) {
> +		if (*csts == ~0)
>  			return -ENODEV;
> -		if ((csts & mask) == val)
> -			break;
> +		if (exit_if_ctrl_disabled &&
> +		    !(ctrl->ctrl_config & NVME_CC_ENABLE))
> +			return 0;
> +		if ((*csts & mask) == val)
> +			return 0;
>  
>  		usleep_range(1000, 2000);
>  		if (fatal_signal_pending(current))
>  			return -EINTR;
> -		if (time_after(jiffies, timeout_jiffies)) {
> -			dev_err(ctrl->device,
> -				"Device not ready; aborting %s, CSTS=0x%x\n",
> -				op, csts);
> -			return -ENODEV;
> -		}
> +		if (time_after(jiffies, timeout))
> +			return -ETIMEDOUT;

Mostly looks fine, though I was hoping to converge a little more
commonality among these functions. I folded some minor changes in when
applying, so please have a look at the current git tree to see if the
result is okay.

  reply	other threads:[~2026-08-11 16:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 12:17 [PATCH v4] nvme: reduce firmware activation poll interval guzebing
2026-08-11 16:08 ` Keith Busch [this message]
2026-08-11 16:46 ` Keith Busch
2026-08-12  3:23   ` guzebing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=antJGoTgL-1sbpyy@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=guzebing1612@gmail.com \
    --cc=guzebing@bytedance.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox