Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Danilo Krummrich <dakr@kernel.org>
Cc: Mario Peter <mario.peter@leica-geosystems.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	driver-core@lists.linux.dev, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] driver core: Take parent lock in async device attach
Date: Mon, 12 Oct 2026 17:12:41 +0200	[thread overview]
Message-ID: <asz46b5IgxH8vfBY@hovoldconsulting.com> (raw)
In-Reply-To: <DM2X6XX7EGLN.38C96USJFEV4Y@kernel.org>

On Mon, Oct 12, 2026 at 04:13:16PM +0200, Danilo Krummrich wrote:
> On Mon Oct 12, 2026 at 2:50 PM CEST, Johan Hovold wrote:
> > On Wed, Oct 07, 2026 at 01:15:14PM +0000, Mario Peter wrote:

> >> Take the parent lock in __device_attach_async_helper() as well, like
> >> __driver_attach_async_helper() does, and move
> >> __device_driver_lock/unlock() up for that. With this the warning was
> >> gone in 300 boots on the board and in 6000 iterations in QEMU.

> > Thanks for fixing this, USB interfaces should indeed always be probed
> > with the parent lock held:
> 
> I was about to pick this up, but can't this cause a subtle deadlock? What if
> async_schedule_dev() runs synchronously? Wouldn't we then attempt to take the
> parent lock again while e.g. bConfigurationValue_store() already holds it?

Hmm. Good catch. I guess we need to switch to
async_schedule_dev_nocall() and retry with explicit synchronous probe on
errors.

Johan

      reply	other threads:[~2026-10-12 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 13:15 [PATCH v2] driver core: Take parent lock in async device attach Mario Peter
2026-10-12 12:50 ` Johan Hovold
2026-10-12 14:13   ` Danilo Krummrich
2026-10-12 15:12     ` Johan Hovold [this message]

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=asz46b5IgxH8vfBY@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mario.peter@leica-geosystems.com \
    --cc=rafael@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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