From: Nilay Shroff <nilay@linux.ibm.com>
To: Maurizio Lombardi <mlombard@redhat.com>
Cc: kbusch@kernel.org, linux-nvme@lists.infradead.org, hch@lst.de,
sagi@grimberg.me, gjoyce@linux.ibm.com, axboe@fb.com
Subject: Re: [PATCH v3 1/1] nvme-pci : Fix EEH failure on ppc after subsystem reset
Date: Wed, 12 Jun 2024 16:37:23 +0530 [thread overview]
Message-ID: <15192c9d-ce45-4dbc-bdbb-752cdfd4e663@linux.ibm.com> (raw)
In-Reply-To: <CAFL455ndCZipuN1bFTWgqjj4Sfh6AB3WUX014W1V2WY4gqzK8w@mail.gmail.com>
On 6/10/24 18:02, Maurizio Lombardi wrote:
> út 4. 6. 2024 v 11:16 odesílatel Nilay Shroff <nilay@linux.ibm.com> napsal:
>>
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index f5d150c62955..afb8419566a9 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -562,6 +562,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
>> switch (old_state) {
>> case NVME_CTRL_NEW:
>> case NVME_CTRL_LIVE:
>> + case NVME_CTRL_CONNECTING:
>> changed = true;
>> fallthrough;
>> default:
>
> Side note:
>
> I believe this could fix a race condition in the nvme-tcp driver.
> Some time ago we received a kernel dump where the controller was
> flagged as NVME_CTRL_LIVE but the sockets were marked as TCP_CLOSED,
> the kernel was hanging into io_work.
> It might be possible that the socket's nvme_tcp_error_recovery
> callback was executed while the ctrl was still marked as
> NVME_CTRL_CONNECTING, nvme_change_ctrl_state() doesn't allow a
> reconnecting controller to switch to the resetting state and therefore
> nvme_tcp_error_recovery() simply returns without triggering an error
> recovery.
>
> nvme_tcp_setup_ctrl() then moves the ctrl to the LIVE state, but with
> closed tcp sockets.
>
> I guess that this change would fix the possible race condition, even
> if I am not completely sure what could happen in case of a race
> between nvme_tcp_setup_ctrl() and the error recovery code.
>
I think for your case you shall consider using nvme_wait_reset() before
queuing error recovery work. For instance, it could be done something
like below assuming that all callers of nvme_tcp_error_recovery() are
allowed to sleep (not fully tested) :
static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl)
{
if (!nvme_wait_reset(ctrl))
return;
dev_warn(ctrl->device, "starting error recovery\n");
queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work);
}
The nvme_wait_reset() shall wait until the nvme_tcp_setup_ctrl() finish
its work and then the tcp error recovery work would be initiated.
Thanks,
--Nilay
next prev parent reply other threads:[~2024-06-12 11:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 9:10 [PATCH v3 0/1] nvme-pci: recover from NVM subsystem reset Nilay Shroff
2024-06-04 9:10 ` [PATCH v3 1/1] nvme-pci : Fix EEH failure on ppc after " Nilay Shroff
2024-06-10 12:32 ` Maurizio Lombardi
2024-06-12 11:07 ` Nilay Shroff [this message]
2024-06-12 13:10 ` Maurizio Lombardi
2024-06-12 17:07 ` Nilay Shroff
2024-06-13 7:02 ` Maurizio Lombardi
2024-06-14 9:51 ` Hannes Reinecke
2024-06-21 16:37 ` Keith Busch
2024-06-22 15:07 ` Nilay Shroff
2024-06-24 16:07 ` 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=15192c9d-ce45-4dbc-bdbb-752cdfd4e663@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=axboe@fb.com \
--cc=gjoyce@linux.ibm.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mlombard@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).