From: Hannes Reinecke <hare@suse.de>
To: Sagi Grimberg <sagi@grimberg.me>, Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, linux-nvme@lists.infradead.org
Subject: Re: [PATCH 3/3] nvme: start keep-alive after admin queue setup
Date: Tue, 21 Nov 2023 08:29:04 +0100 [thread overview]
Message-ID: <c4539237-0740-4f92-a7d6-eebf825a66b0@suse.de> (raw)
In-Reply-To: <7401e53a-59b8-41d5-8055-600725ecee06@grimberg.me>
On 11/20/23 20:05, Sagi Grimberg wrote:
>
>
> On 11/20/23 18:01, Hannes Reinecke wrote:
>> On 11/20/23 14:39, Sagi Grimberg wrote:
>>>
>>>> Setting up I/O queues might take quite some time on larger and/or
>>>> busy setups, so KATO might expire before all I/O queues could be
>>>> set up.
>>>> Fix this by start keep alive from the ->init_ctrl_finish() callback,
>>>> and stopping it when calling nvme_cancel_admin_tagset().
>>>
>>> If this is a fix, the title should describe the issue it is fixing, and
>>> the body should say how it is fixing it.
>>>
>>>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>>>> ---
>>>> drivers/nvme/host/core.c | 6 +++---
>>>> drivers/nvme/host/fc.c | 6 ++++++
>>>> 2 files changed, 9 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>>>> index 62612f87aafa..f48b4f735d2d 100644
>>>> --- a/drivers/nvme/host/core.c
>>>> +++ b/drivers/nvme/host/core.c
>>>> @@ -483,6 +483,7 @@ EXPORT_SYMBOL_GPL(nvme_cancel_tagset);
>>>> void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl)
>>>> {
>>>> + nvme_stop_keep_alive(ctrl);
>>>> if (ctrl->admin_tagset) {
>>>> blk_mq_tagset_busy_iter(ctrl->admin_tagset,
>>>> nvme_cancel_request, ctrl);
>>>
>>> There is a cross dependency here, now nvme_cancel_admin_tagset needs to
>>> have the keep-alive stopped first, which may be waiting on I/O, which
>>> needs to be cancelled...
>>>
>>> Keep in mind that kato can be arbitrarily long, and now this function
>>> may be blocked on this kato period.
>>>
>>> I also think that now the function is doing something that is more
>>> than simply cancelling the inflight admin tagset, as it is named.
>>>
>> I am having a hard time following this reasoning.
>> While I do accept that nvme_stop_keep_alive() might trigger I/O
>> (ie if the work queue has just been started when calling
>> cancel_delayed_work), nvme_tcp_error_recovery_work() has this:
>>
>> nvme_stop_keep_alive(ctrl);
>> flush_work(&ctrl->async_event_work);
>> nvme_tcp_teardown_io_queues(ctrl, false);
>> /* unquiesce to fail fast pending requests */
>> nvme_unquiesce_io_queues(ctrl);
>> nvme_tcp_teardown_admin_queue(ctrl, false);
>>
>> and nvme_tcp_teardown_admin_queue() calls nvme_cancel_admin_tagset().
>> So by your above reasoning this code should be wrong, too.
>> What am I missing?
>
> Need to dig through the history, but it can most definitely move to
> after the teardown. It could be from the earlier days where the
> transport fencing was not as reliable particularly for admin requests.
Ah, no. We are both wrong. Colophon of cancel_delayed_work():
* Note:
* The work callback function may still be running on return, unless
* it returns %true and the work doesn't re-arm itself. Explicitly
flush or
* use cancel_delayed_work_sync() to wait on it.
Hence we won't be blocked by running I/O when calling
nvme_stop_keep_alive().
So the correct syntax would indeed be calling nvme_stop_keep_alive()
first, and then disable/cancel the admin tagset (which will terminate
any outstanding keep-alive requests).
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Ivo Totev, Andrew McDonald,
Werner Knoblich
next prev parent reply other threads:[~2023-11-21 7:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 6:13 [PATCHv2 0/3] nvme: start keep-alive after admin queue setup Hannes Reinecke
2023-10-24 6:13 ` [PATCH 1/3] nvme-tcp: avoid open-coding nvme_tcp_teardown_admin_queue() Hannes Reinecke
2023-10-24 6:13 ` [PATCH 2/3] nvme-loop: always quiesce and cancel commands before destroying admin q Hannes Reinecke
2023-10-24 6:13 ` [PATCH 3/3] nvme: start keep-alive after admin queue setup Hannes Reinecke
2023-11-06 17:17 ` Keith Busch
2023-11-20 13:39 ` Sagi Grimberg
2023-11-20 14:19 ` Hannes Reinecke
2023-11-20 14:25 ` Sagi Grimberg
2023-11-20 15:05 ` Hannes Reinecke
2023-11-20 19:03 ` Sagi Grimberg
2023-11-20 16:01 ` Hannes Reinecke
2023-11-20 19:05 ` Sagi Grimberg
2023-11-21 7:29 ` Hannes Reinecke [this message]
2023-11-21 9:16 ` Sagi Grimberg
2023-10-26 16:00 ` [PATCHv2 0/3] " Mark O'Donovan
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=c4539237-0740-4f92-a7d6-eebf825a66b0@suse.de \
--to=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@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