public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Keith Busch <kbusch@meta.com>
Cc: Keith Busch <kbusch@kernel.org>, "hch@lst.de" <hch@lst.de>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCHv2] nvme: use ctrl state accessor
Date: Fri, 26 Jan 2024 08:25:38 +0000	[thread overview]
Message-ID: <221c0e4d-2aea-4e5f-8b17-76cd0a5284d7@nvidia.com> (raw)
In-Reply-To: <20240125155213.3727106-1-kbusch@meta.com>

On 1/25/24 07:52, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> The ctrl->state value is updated in another thread using WRITE_ONCE, so
> ensure all the readers use the appropriate accessor.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
>

Keith,

Not sure if nvme_check_ready() needs nvme_ctrl_state() ?

consider :-

* Thread A running timeout handler :-
nvme_timeout()
  ends up resetting ctrl state at the end of function using WRITE_ONCE() :-

  disable:
            nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)
             WRITE_ONCE()

* Thread B issuing I/O :-
nvme_queue_rq() or nvme_prep_rq_batch()
  nvme_check_ready()
   ctrl->state == NVME_CTRL_LIVE

Since timeout handler's nvme_change_ctrl_state() call will result in
updating ctrl->state with WRITE_ONCE(), hence reader in the 
nvme_check_ready()
should also read using nvme_ctrl_state()->READ_ONCE() ?

if it is not needed please ignore above question, looks good to me ..

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



  parent reply	other threads:[~2024-01-26  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 15:52 [PATCHv2] nvme: use ctrl state accessor Keith Busch
2024-01-26  7:20 ` Chaitanya Kulkarni
2024-02-05 17:00   ` Sven Peter
2024-01-26  8:25 ` Chaitanya Kulkarni [this message]
2024-01-26 16:30   ` Keith Busch

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=221c0e4d-2aea-4e5f-8b17-76cd0a5284d7@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --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