All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dennis Zhou <dennis@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: allow mmc to block wait_for_device_probe()
Date: Wed, 29 Mar 2023 13:29:52 -0700	[thread overview]
Message-ID: <ZCSfwBiponFGFXlN@snowbird> (raw)
In-Reply-To: <ZCPEcxueuGUaRNOP@kroah.com>

On Wed, Mar 29, 2023 at 06:54:11AM +0200, Greg Kroah-Hartman wrote:
> On Tue, Mar 28, 2023 at 03:37:40PM -0700, Dennis Zhou wrote:
> > I've been hitting a failed data device lookup when using dm-verity and a
> > root device on an emmc partition. This is because there is a race where
> > dm-verity is looking for a data device, but the partitions on the emmc
> > device haven't been probed yet.
> > 
> > Initially I looked at solving this by changing devt_from_devname() to
> > look for partitions, but it seems there is legacy reasons and issues due
> > to dm.
> > 
> > MMC uses 2 levels of probing. The first to handle initializing the
> > host and the second to iterate attached devices. The second is done by
> > a workqueue item. However, this paradigm makes wait_for_device_probe()
> > useless as a barrier for when we can assume attached devices have been
> > probed.
> > 
> > This patch fixes this by exposing 2 methods inc/dec_probe_count() to
> > allow device drivers that do asynchronous probing to delay waiters on
> > wait_for_device_probe() so that when they are released, they can assume
> > attached devices have been probed.
> 

Thanks for the quick reply.

> Please no.  For 2 reasons:
>   - the api names you picked here do not make much sense from a global
>     namespace standpoint.  Always try to do "noun/verb" as well, so if
>     we really wanted to do this it would be "driver_probe_incrememt()"
>     or something like that.

Yeah that is a bit of a blunder on my part...

>  - drivers and subsystems should not be messing around with the probe
>    count as it's a hack in the first place to get around other issues.
>    Please let's not make it worse and make a formal api for it and allow
>    anyone to mess with it.
> 

That's fair.

> Why can't you just use normal deferred probing for this?
> 

I'm not familiar with why mmc is written the way it is, but probing
creates a notion of the host whereas the devices attached are probed
later via a work item.

Examining it a bit closer, inlining the first discovery call
avoids all of this mess. I sent that out just now in [1]. Hopefully
that'll be fine.

[1] https://lore.kernel.org/lkml/20230329202148.71107-1-dennis@kernel.org/T/#u

> thanks,
> 
> greg k-h

Thanks,
Dennis

  reply	other threads:[~2023-03-29 20:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 22:37 [PATCH] mmc: allow mmc to block wait_for_device_probe() Dennis Zhou
2023-03-29  4:54 ` Greg Kroah-Hartman
2023-03-29 20:29   ` Dennis Zhou [this message]
2023-03-31  7:30     ` Greg Kroah-Hartman

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=ZCSfwBiponFGFXlN@snowbird \
    --to=dennis@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.