From: jianchao.w.wang@oracle.com (jianchao.wang)
Subject: [PATCH V3 1/2] nvme: split resetting state into reset_prepate and resetting
Date: Mon, 15 Jan 2018 22:07:32 +0800 [thread overview]
Message-ID: <fd0e9504-fd57-64ed-395d-b5dd5afd4fb7@oracle.com> (raw)
In-Reply-To: <de132a4d-eb8b-10e8-7c96-7836edf1b52a@mellanox.com>
Hi max
Thanks for your kindly response and comment.
On 01/15/2018 09:28 PM, Max Gurtovoy wrote:
>>>
>>
>> setting RESET_PREPARE here??
>>
>> Also, the error recovery code is mutually excluded from reset_work
>> by trying to set the same state which is protected by the ctrl state
>> machine, so a similar change is needed there.
>
> Sagi,
> Do you mean to add this (if so, I agree):
>
>
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index d06641b..44ef52a 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -957,6 +957,12 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
> ??? struct nvme_rdma_ctrl *ctrl = container_of(work,
> ??????????? struct nvme_rdma_ctrl, err_work);
>
> +?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETING)) {
> +?????? /* state change failure should never happen */
> +?????? WARN_ON_ONCE(1);
> +?????? return;
> +?? }
> +
> ??? nvme_stop_keep_alive(&ctrl->ctrl);
>
> ??? if (ctrl->ctrl.queue_count > 1) {
> @@ -989,7 +995,7 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
>
> ?static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl)
> ?{
> -?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
> +?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESET_PREPARE))
> ??????? return;
>
> ??? queue_work(nvme_wq, &ctrl->err_work);
> @@ -1760,6 +1766,12 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
> ??? int ret;
> ??? bool changed;
>
> +?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETING)) {
> +?????? /* state change failure should never happen */
> +?????? WARN_ON_ONCE(1);
> +?????? return;
> +?? }
> +
> ??? nvme_stop_ctrl(&ctrl->ctrl);
> ??? nvme_rdma_shutdown_ctrl(ctrl, false);
RESET_PREPARE state should include not only the scheduling gap of reset_work, but also
the device disable procedure. All the previous state and work are cleared and canceled,
then start new one. It is a very obvious boundary there.
nvme_stop_ctrl(&ctrl->ctrl);
nvme_rdma_shutdown_ctrl(ctrl, false);
+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETING)) {
+ /* state change failure should never happen */
+ WARN_ON_ONCE(1);
+ return;
+ }
What do you think about ? :)
Thanks
Jianchao
next prev parent reply other threads:[~2018-01-15 14:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-11 5:07 [PATCH V3 0/2] nvme-pci: fix the timeout case when reset is ongoing Jianchao Wang
2018-01-11 5:07 ` [PATCH V3 1/2] nvme: split resetting state into reset_prepate and resetting Jianchao Wang
2018-01-14 9:48 ` Sagi Grimberg
2018-01-15 2:02 ` jianchao.wang
2018-01-15 2:11 ` Keith Busch
2018-01-15 2:31 ` jianchao.wang
2018-01-15 13:28 ` Max Gurtovoy
2018-01-15 13:36 ` [Suspected-Phishing]Re: " Max Gurtovoy
2018-01-16 5:57 ` jianchao.wang
2018-01-16 7:52 ` jianchao.wang
2018-01-17 10:37 ` Sagi Grimberg
2018-01-17 10:50 ` Max Gurtovoy
2018-01-17 12:02 ` Sagi Grimberg
2018-01-17 21:08 ` James Smart
2018-01-18 3:24 ` jianchao.wang
2018-01-15 14:07 ` jianchao.wang [this message]
2018-01-11 5:07 ` [PATCH V3 2/2] nvme-pci: fix the timeout case when reset is ongoing Jianchao Wang
2018-01-14 9:49 ` Sagi Grimberg
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=fd0e9504-fd57-64ed-395d-b5dd5afd4fb7@oracle.com \
--to=jianchao.w.wang@oracle.com \
/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