Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp697748rwl; Fri, 31 Mar 2023 00:42:44 -0700 (PDT) X-Google-Smtp-Source: AKy350YTwi+jZmEAT7+nfXwJImiMinh3fkt01ptdDVYjH6FvKXODeJSAsZWAkDZ8a9f20/dfju/F X-Received: by 2002:a05:6a00:22cb:b0:627:ff64:85cc with SMTP id f11-20020a056a0022cb00b00627ff6485ccmr5758130pfj.0.1680248564450; Fri, 31 Mar 2023 00:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680248564; cv=none; d=google.com; s=arc-20160816; b=fuEEGkqg1ozOYqSxI8xZTC0APcI6x3j4aU1eBz19QhDOT9KJlXg3hj5afREGPeY4Sc LRkp98oBEqabhu6wkVYOkbFI8/CbjwO8HwbTJEYwvfmlgA1i9AQOgLBh5Sps3rYgU6Xg hkXLZ09W/1XKPHjNMx6Xvj4o0tI8Qo4HaDe6nHfIVBjGGJwGhOLAo6hdjJfr/N14TJo0 UKRY2NlTKPH1ZCZXDJE00oNDFe3gKETth74Sk9D99uOwgJZqFj55timK7VUcantk6FBE HMRRjqiiEQEDIEZOS6Cdu5NsiPktOlXtOIqW2BQW+X7po9teinLBN7LS7U3ggalvM3at o59g== 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=VLFWU0RwBHO4bT4sefghhWYG3HYdlRQ4BcW0uhzZJI4=; b=DBmNRj27GSJY75TJal/BJ01lwQ+wH3rlEm1RREPPWYH1ZSZI8bBjl0bLDC/Vv3Zmqf CtA/NdmCGOcP0OtFQzgdAV8zZeNAFjUExMgHGx5tc6ANzmgdFuPRSu+qVRjtbFjFMvOz sjQBCHRAiHQArw4Z2nJZheyhBT8iR3WCUoBZC87GVogiki3W6/V9mSQRtX15U5XEPrDG PfcOAY96RTXf8ov9cnSw7/IIm+tdnzLWuNsMxwllgILKQkoY28OoEfTQDcKgeXl1MzYh wmEi5B30/QWRyeKCmYyn3F7HHVn3PmW7sttr3XOPUhvu1PFTbAM0lDRxLecGhv+/bTZ3 PWgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c0eDMujf; 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 y71-20020a638a4a000000b0051334c90cbbsi1797518pgd.22.2023.03.31.00.42.32; Fri, 31 Mar 2023 00:42:44 -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=c0eDMujf; 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 S230239AbjCaHaS (ORCPT + 99 others); Fri, 31 Mar 2023 03:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjCaHaR (ORCPT ); Fri, 31 Mar 2023 03:30: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 5D100768B; Fri, 31 Mar 2023 00:30: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 026AF623EB; Fri, 31 Mar 2023 07:30:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3B6FC433EF; Fri, 31 Mar 2023 07:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680247815; bh=zXw6u1EURy0w/G8+aTN3bFZY3VPBIAO84MiEoOwOeoM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c0eDMujfzGZl/a/qQcu/oXOkm8+AdridpQm92a6IcGD0dvb3iwN5DeyVgwzFMflbd hdM5mIitXezpKMM70JE2iP+StMHwP8+u5A/eRVNN/QQTlff4Yl4gQ311AzN3Y83/o4 bT2MMtIoLIl0N4dudexssqUrnlNmSWEB4q2zO5Fs= Date: Fri, 31 Mar 2023 09:30:12 +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: 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 Wed, Mar 29, 2023 at 01:29:52PM -0700, Dennis Zhou wrote: > 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 Looks much better, except for the kernel test bot issues... thanks, greg k-h