Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp106558rwl; Tue, 28 Mar 2023 22:00:30 -0700 (PDT) X-Google-Smtp-Source: AKy350YjYrhzRrrzs0vf5ApS6SjVAyjNKOXQi9fAy2c3mUaCi3hZmUmeFFtaQg84XqNbGhNLydLA X-Received: by 2002:a17:903:186:b0:19d:16fa:ba48 with SMTP id z6-20020a170903018600b0019d16faba48mr19647495plg.28.1680066030628; Tue, 28 Mar 2023 22:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680066030; cv=none; d=google.com; s=arc-20160816; b=Hwk5Vsq4iUg8phgWWCUEQ0stQ5mqNZe+xt/Pob/eIuWPA5oThTnJBorI05SQjhPULz yZWBg1coviB/rloQ3D5EZegZ0GDNxL5Jh7E4ILxGKrGbN9I5haU365AQiKfPSsOrDvnh feOPgqLEm/kf6bFcpyj1z+tjOcIxW4ypzDi6mNcta/P9Q1FdA+7gqqUZ35UzJQE/F0HM 8xe/NkiKKbwSgPigXr8CHxSLHxJiRM7U7urHSCE/0cThDpPnJFdZ7HhY3PMIgsNxOQH5 /a8kw7hFmt4dLAwANrr1DayB97h3QR1F6N3+IdImyINe1UPaJSERyRChb48Mh7657i6P b1/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yMhsSHjEWl02BSvYQrgHNzqUwIr9yoBz7BYAix/8dSs=; b=IlqKRLIO3K8rJLDTY7LCegroPsWAv9Ue8DAodlysD9q7ZI6ti2XGF2Di9v6XP0rMEH U8VXrlAhdragn6wxkB54YCpJiGjD2Lg6Uad1Qptu7r63j8cX+Y+T4I7202gvKtJpZh41 /m2uQYuK7tRsoLAnZMVP2hiNpd432oWsGEFzoYA30EKPOneL0hrMM4fVp8fGvTlw20xE PLfsr8TUcOQnmLk/5yF+QesUwZv0ttNhTV06QRE+I3H1vrnRyhgR99t6bqKRgYZVh8eA Y2G6bNojoxlGK/27WJSunvFx/iYSgtoul7Dczvam5kYy1xqn3LnM1/T9UII1Qfw/0DX+ dWuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EIBb9vmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kp11-20020a170903280b00b001a043389a7asi23619179plb.310.2023.03.28.22.00.17; Tue, 28 Mar 2023 22:00:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EIBb9vmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229756AbjC2EyS (ORCPT + 99 others); Wed, 29 Mar 2023 00:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbjC2EyR (ORCPT ); Wed, 29 Mar 2023 00:54:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA2BC3AA2; Tue, 28 Mar 2023 21:54:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E23861A55; Wed, 29 Mar 2023 04:54:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 181D5C433D2; Wed, 29 Mar 2023 04:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680065654; bh=LIS7zJz90cEjLNZjPPsW13H2Bm79KhPrHCbBLaDIygk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EIBb9vmTKbNd8JZraTMtu9YRJzCkLv0giiCVXRHmhRjOXXk0JlcpeI6eb+rB1wmpa aU+a5QBLzaoffHAg+/W+h9eHEy3QMvMtlZcoNiKpl7p+YNBrFI9fgh0G3Y+0Ex+mAZ 3MvN0053bWgFGyccsEoedcqYD0de68QK5LHRVwlo= Date: Wed, 29 Mar 2023 06:54:11 +0200 From: Greg Kroah-Hartman To: Dennis Zhou Cc: "Rafael J . Wysocki" , Ulf Hansson , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mmc: allow mmc to block wait_for_device_probe() Message-ID: References: <20230328223740.69446-1-dennis@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230328223740.69446-1-dennis@kernel.org> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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