public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dennis Zhou <dennis@kernel.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 06:54:11 +0200	[thread overview]
Message-ID: <ZCPEcxueuGUaRNOP@kroah.com> (raw)
In-Reply-To: <20230328223740.69446-1-dennis@kernel.org>

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.

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.
 - 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.

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

thanks,

greg k-h

  reply	other threads:[~2023-03-29  4:54 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 [this message]
2023-03-29 20:29   ` Dennis Zhou
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=ZCPEcxueuGUaRNOP@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dennis@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox