From: Nathan Chancellor <nathan@kernel.org>
To: Stuart Hayes <stuart.w.hayes@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Martin Belanger <Martin.Belanger@dell.com>,
Oliver O'Halloran <oohall@gmail.com>,
Daniel Wagner <dwagner@suse.de>, Keith Busch <kbusch@kernel.org>,
Lukas Wunner <lukas@wunner.de>,
David Jeffery <djeffery@redhat.com>,
Jeremy Allison <jallison@ciq.com>, Jens Axboe <axboe@fb.com>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org,
Jan Kiszka <jan.kiszka@seimens.com>
Subject: Re: [PATCH] driver core: fix async device shutdown hang
Date: Thu, 19 Sep 2024 07:16:58 -0700 [thread overview]
Message-ID: <20240919141658.GA3737785@thelio-3990X> (raw)
In-Reply-To: <20240919043143.1194950-1-stuart.w.hayes@gmail.com>
On Wed, Sep 18, 2024 at 11:31:43PM -0500, Stuart Hayes wrote:
> Modify device_shutdown() so that supplier devices do not wait for
> consumer devices to be shut down first when the devlink is sync state
> only, since the consumer is not dependent on the supplier in this case.
>
> Without this change, a circular dependency could hang the system.
>
> Fixes: 8064952c6504 ("driver core: shut down devices asynchronously")
>
> Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
All of my virtual testing seems happy with this change.
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> The patch this fixes is in driver-core-next and linux-next.
>
> Please let me know if this needs to be a V2 or if it needs anything
> else... it is the identical patch I sent in yesterday, except I added
> a "Fixes:" tag and the comments. Thank you for the help!
>
> drivers/base/core.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index b69b82da8837..76513e360496 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -4898,8 +4898,16 @@ void device_shutdown(void)
>
> idx = device_links_read_lock();
> list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
> - device_links_read_lock_held())
> + device_links_read_lock_held()) {
> + /*
> + * sync_state_only suppliers don't need to wait,
> + * aren't reordered on devices_kset, so making them
> + * wait could result in a hang
> + */
> + if (device_link_flag_is_sync_state_only(link->flags))
> + continue;
> link->supplier->p->shutdown_after = cookie;
> + }
> device_links_read_unlock(idx);
> put_device(dev);
>
> --
> 2.39.3
>
next prev parent reply other threads:[~2024-09-19 14:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 4:31 [PATCH] driver core: fix async device shutdown hang Stuart Hayes
2024-09-19 5:17 ` Greg Kroah-Hartman
2024-09-19 14:16 ` Nathan Chancellor [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-17 20:15 Stuart Hayes
2024-09-17 20:42 ` Greg Kroah-Hartman
2024-09-18 0:20 ` stuart hayes
2024-09-18 6:12 ` Greg Kroah-Hartman
2024-09-18 21:07 ` Laurence Oberman
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=20240919141658.GA3737785@thelio-3990X \
--to=nathan@kernel.org \
--cc=Martin.Belanger@dell.com \
--cc=axboe@fb.com \
--cc=djeffery@redhat.com \
--cc=dwagner@suse.de \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=jallison@ciq.com \
--cc=jan.kiszka@seimens.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=lukas@wunner.de \
--cc=oohall@gmail.com \
--cc=rafael@kernel.org \
--cc=sagi@grimberg.me \
--cc=stuart.w.hayes@gmail.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