Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9921974rwp; Thu, 20 Jul 2023 11:42:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWRa0oM2vndxK7iLJ8b9H+xBbjU/wOjI6YheBysWf7llUbdtt5eHsVqH8PF6gU5ULub78v X-Received: by 2002:a17:903:244e:b0:1b8:8d48:958d with SMTP id l14-20020a170903244e00b001b88d48958dmr392683pls.1.1689878561774; Thu, 20 Jul 2023 11:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689878561; cv=none; d=google.com; s=arc-20160816; b=TVYyBkn9vS01ExPbHaHi+7ZMBd9bH5+j4Y6eYMF0x9hII9FsYBbORrXT+rlFXaCOXw m0aqDKFOscDcxssn4MTMfv92VQmBsnBDB0P1r/+4O8t0o7C7PuTKKr6AwD0N+Hi8qveJ Wm39k+C+Y+6/HDm1DsUsPqZfUN+CVU2AMFQjbGXO+5U/q6tCvTdcN3fndLRxtnIIeR10 jZXP1GjnrP8XENB4ukXi47Ml7JvFlGnuCw5MfDHXCl3TVnk4ik6F1l/sjW1hKYy3Buvt GU88+FjgdWPm28xXSoD5LBDdGIF+cogfmHkpcEsY4d5PuKBASSWzbssbLt74TrSjhmz8 qQ3Q== 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=KZfP7+/9P19u+WXO4y4p/iMVav3N0K3Q8VoZwi/eNf0=; fh=tiujOI5jJP6CbtSIPip7suGicscCoQQ1CyboING3YXg=; b=nRJmYB6UqONfEeVHj5kg2AjSu18mmlzEY5pno9Zx9roAhF5VLdm4DK12GB6oyPFSjY Gq12k4lWSGVgdM7LhGUgYRKQTGrks+LlpD0S1RknDDsyGukJDuYEVI7GRPxSPycl7Pok sDObG9GXMZF6JJn1VfetpnREkD/zxWG10nn92Ss8OxOWnpqsgrdUcUEm2194/XCqchjp JT9O0VdQrmkOite1NzUoKUhGoCULqgjD8s4ADvm/u+gAcLFTyBuO85zN1f6LnTKSBpc8 uIu4HnpWG2+25mnWBvcfALivhHbtjDLBBQYWlk0NDZkGUPvWGkQQjCOREwPs0WmUg4++ DfDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xq/zReWC"; 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 u11-20020a6540cb000000b0055c993fe858si1242665pgp.892.2023.07.20.11.42.29; Thu, 20 Jul 2023 11:42:41 -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="xq/zReWC"; 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 S229699AbjGTR6A (ORCPT + 99 others); Thu, 20 Jul 2023 13:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232011AbjGTR56 (ORCPT ); Thu, 20 Jul 2023 13:57:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4BB4270E; Thu, 20 Jul 2023 10:57:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3FF4A61BB6; Thu, 20 Jul 2023 17:57:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2150BC433C8; Thu, 20 Jul 2023 17:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689875875; bh=jwoVf1k/2DgnDdDINMgCGUjRiLmfJ+Q0tnPUMEak6D4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xq/zReWCoVx3iIsML8lwq7mmfwRhUgXMHizkUQ3yxJgG13uL36LEZeXE6gEMA58Xd lL0VIFeIT6Oi/svxhwWo4qL5se6EiCV3J/qS9TCLKT9Y1pcgAAGasOitFv9ZrTDzBR q96YBxWtmzCw8NVCC+uGg28SNkkMKVSHJoIU+QYc= Date: Thu, 20 Jul 2023 19:57:53 +0200 From: Greg KH To: Mark-PK Tsai Cc: snitzer@redhat.com, agk@redhat.com, corbet@lwn.net, dm-devel@redhat.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, peter@korsgaard.com, snitzer@kernel.org, stable@vger.kernel.org, yj.chiang@mediatek.com Subject: Re: [PATCH 5.15] dm init: add dm-mod.waitfor to wait for asynchronously probed block devices Message-ID: <2023072033-hedge-buffing-8862@gregkh> References: <20230717015728.12641-1-mark-pk.tsai@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230717015728.12641-1-mark-pk.tsai@mediatek.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Mon, Jul 17, 2023 at 09:57:28AM +0800, Mark-PK Tsai wrote: > > On Sun, Jul 16, 2023, 11:16 AM Greg KH wrote: > > > > > On Thu, Jul 13, 2023 at 01:58:37PM +0800, Mark-PK Tsai wrote: > > > > From: Peter Korsgaard > > > > > > > > Just calling wait_for_device_probe() is not enough to ensure that > > > > asynchronously probed block devices are available (E.G. mmc, usb), so > > > > add a "dm-mod.waitfor=[,..,]" parameter to get > > > > dm-init to explicitly wait for specific block devices before > > > > initializing the tables with logic similar to the rootwait logic that > > > > was introduced with commit cc1ed7542c8c ("init: wait for > > > > asynchronously scanned block devices"). > > > > > > > > E.G. with dm-verity on mmc using: > > > > dm-mod.waitfor="PARTLABEL=hash-a,PARTLABEL=root-a" > > > > > > > > [ 0.671671] device-mapper: init: waiting for all devices to be > > > available before creating mapped devices > > > > [ 0.671679] device-mapper: init: waiting for device PARTLABEL=hash-a > > > ... > > > > [ 0.710695] mmc0: new HS200 MMC card at address 0001 > > > > [ 0.711158] mmcblk0: mmc0:0001 004GA0 3.69 GiB > > > > [ 0.715954] mmcblk0boot0: mmc0:0001 004GA0 partition 1 2.00 MiB > > > > [ 0.722085] mmcblk0boot1: mmc0:0001 004GA0 partition 2 2.00 MiB > > > > [ 0.728093] mmcblk0rpmb: mmc0:0001 004GA0 partition 3 512 KiB, > > > chardev (249:0) > > > > [ 0.738274] mmcblk0: p1 p2 p3 p4 p5 p6 p7 > > > > [ 0.751282] device-mapper: init: waiting for device PARTLABEL=root-a > > > ... > > > > [ 0.751306] device-mapper: init: all devices available > > > > [ 0.751683] device-mapper: verity: sha256 using implementation > > > "sha256-generic" > > > > [ 0.759344] device-mapper: ioctl: dm-0 (vroot) is ready > > > > [ 0.766540] VFS: Mounted root (squashfs filesystem) readonly on > > > device 254:0. > > > > > > > > Signed-off-by: Peter Korsgaard > > > > Signed-off-by: Mike Snitzer > > > > Cc: stable@vger.kernel.org > > > > Signed-off-by: Mark-PK Tsai > > > > --- > > > > .../admin-guide/device-mapper/dm-init.rst | 8 +++++++ > > > > drivers/md/dm-init.c | 22 ++++++++++++++++++- > > > > 2 files changed, 29 insertions(+), 1 deletion(-) > > > > > > What is the git commit id of this change in Linus's tree? > > > > > > thanks, > > > > > > greg k-h > > > > > > > > > > Hey Greg, > > > > This change shouldn't be backported to stable@. It is a feature, if > > Mark-PK feels they need it older kernels they need to carry the change > > in their own tree. Or at a minimum they need to explain why this > > change is warranted in stable@. > > Thanks for your comment. > The reason why we think this should be backported to stable kernel is > that it actually fix the potential race condition when make block > device probe async in stable kernel. > And we'd like to fix this upstream rather than just take it in > our custom tree. Potential race condition, is this actually able to be hit in real life? thanks, greg k-h