Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4367803rwd; Tue, 30 May 2023 04:37:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68LdnOfB88PU12QxqTrwDVCzbEGpThvO2H5cAYoZSiM8SIlWIHrSATp+YvvtmBK0w5ZcRl X-Received: by 2002:a17:90b:17ca:b0:256:69ac:eb1 with SMTP id me10-20020a17090b17ca00b0025669ac0eb1mr2365041pjb.1.1685446657795; Tue, 30 May 2023 04:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685446657; cv=none; d=google.com; s=arc-20160816; b=shzb1phkeIeFH5HTxD7gx6X/ZLOFNgAfUfLt6QFhk4WECsSMWMASAKB7ObCs//D5Wd TxvAhjb+bPddTjaRLlbHwomeRC5P3vhq/0AcLh5NTv43ZAxMHt1qAn08WikjQFcooWzF maP4GoumsNEOh6IOwTj9Wz2HqWLcRn9glVnzgqER4PCfL4TVT+gMfFiFgSmvwFgl568x qtSJ+HBfcvxm6FC/H1TLymQseA2sDHxkEc4xebOBOf5n3+t3vPH/6jw9h7LB90lgjm1f BPLF6dqVia7OTUu38JUKGCpod6Iio7IHEIiOVUnnZOpJ6JzlBkHR50NMdsW0QwRlj+no 9J9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fpeVFf4HYSFKWVkH4psx6XWClCE7Pw9O6mlEXg3ssXA=; b=N6/RuLpIds2KGCrMWvBsl2wOEXJM/95RHRdwxvOxEhouWin7Avl+HWcy9ORLGdLtRE U0rWd7cSQKEG2aorWZRQBdLudBqIxgJ/TR9qlv5/aJ1w2P8x/vAzukpn7YqGNILLZqrC zxkfQfhy79X9f66WmfeGMTUta7GUOdBtwVUNiC03reKka40Cq4ls38r6i280ZNEzJWBd Kf8+JK5QJmxUKU3nF8JfG6HidGNFG8AYWumzPiJrpASy2QBN05vq7s0HtLjRknJod0oE QyDEyTyw92Yzixk0n1y7+cwAgtLsIYlQTnc8ofQ/AnAfmSLobPib8Z6+B2m/Ia42WxPr VT6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bRBy8OFF; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 4-20020a17090a018400b00251662efc9dsi9923579pjc.53.2023.05.30.04.37.23; Tue, 30 May 2023 04:37:37 -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=@linaro.org header.s=google header.b=bRBy8OFF; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231520AbjE3LYe (ORCPT + 99 others); Tue, 30 May 2023 07:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231738AbjE3LYd (ORCPT ); Tue, 30 May 2023 07:24:33 -0400 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA35116 for ; Tue, 30 May 2023 04:24:26 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-392116ae103so2703689b6e.0 for ; Tue, 30 May 2023 04:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685445866; x=1688037866; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fpeVFf4HYSFKWVkH4psx6XWClCE7Pw9O6mlEXg3ssXA=; b=bRBy8OFF8M6ESV/CqxPG0Zm0fgDgnY+H+ScocLqDlCzx813Qj8hChJYzTWrA4S/3i6 zP8zv4usC/Hp5ttnexNyYUru/t9hJziAtQIWOwgKmv5iW8USBWHFVIwUMHSu3WQK6hfF wlzBIRXbgD3m8PBJVwxPz0C/aOA1lzVddAC6xgB8bxMvRz8ZMotb2g/0LQWghPXfpbm2 eeCdAFIgsYdRnQnCoC3V/r4TNwMBqTTW4ke7rpgFg+s/IgEqQSAp6dR7iyIeY9Yoyo0N /svdQssSVJZs6zc3F+x7j+p7GVCaz/q0QVj7dC4+ZeaJv9b3Py8QGYibLQ4fCovZC2jA AZXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685445866; x=1688037866; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fpeVFf4HYSFKWVkH4psx6XWClCE7Pw9O6mlEXg3ssXA=; b=QgmxQxkxp9blvl+U0zWVngrTErcBi4DNGRq5tWElLol+Jb1RtAgiXaKGIctiuiEfqf hEBRydW1T0M0uIZhLguJFjbsFXtjHzszEo8fpM+LJ0ot5D9gyM67c6PMDFv1iQe7oMFy gTgWbP+53Td45b2zZeU+FR77yq1wvcVrzsqZaw0MP4LT3zT5EKrwLaSJGOUZkL0ByxRo p9g35ATKJSPiXmex6m6gPmP80FTyfitIcZrn66OgzvlRlY+Ko3mKY2e18pLjaKL4R9I6 wIaqM9S/oeGt3/Uh/9/TTDONk9XPBqRh4/eTs5yJ776EIiY6AYkhHKaX3XFMFJy64b/j /Oxg== X-Gm-Message-State: AC+VfDyq4VLLFUcLJ4PQfRvNBm9Ud/IhmxGM5ECOMer3P2WO/B8digft SL2XRWZHcGYRlg5m+NAe/A2EJm0l84JWJkevoXFA6Q== X-Received: by 2002:a05:6808:2184:b0:398:4b04:25ca with SMTP id be4-20020a056808218400b003984b0425camr1292658oib.14.1685445866121; Tue, 30 May 2023 04:24:26 -0700 (PDT) MIME-Version: 1.0 References: <20230526130716.2932507-1-loic.poulain@linaro.org> <20230530-polytechnisch-besten-258f74577eff@brauner> In-Reply-To: <20230530-polytechnisch-besten-258f74577eff@brauner> From: Loic Poulain Date: Tue, 30 May 2023 13:23:50 +0200 Message-ID: Subject: Re: [PATCH] init: Add support for rootwait timeout parameter To: Christian Brauner Cc: corbet@lwn.net, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Hi Christian, On Tue, 30 May 2023 at 11:45, Christian Brauner wrote: > > On Fri, May 26, 2023 at 03:07:16PM +0200, Loic Poulain wrote: > > Add an optional timeout arg to 'rootwait' as the maximum time in > > seconds to wait for the root device to show up before attempting > > forced mount of the root filesystem. > > > > This can be helpful to force boot failure and restart in case the > > root device does not show up in time, allowing the bootloader to > > take any appropriate measures (e.g. recovery, A/B switch, retry...). > > > > In success case, mounting happens as soon as the root device is ready, > > contrary to the existing 'rootdelay' parameter (unconditional delay). > > > > Signed-off-by: Loic Poulain > > --- > > Not terribly opposed and not terribly convinced yet. > So, we have rootdelay= with a timeout parameter that allows to specify a > delay before attempting to mount the root device. And we have rootwait > currently as an indefinite wait. Adding a timeout for rootwait doesn't > seem crazy and is backwards compatible. But there's no mention of any > concrete users or use-case for this which is usually preferable. If this > is just "could be useful for someone eventually" it's way less desirable > to merge this than when it's "here's a/multiple user/users"... So I > would love to see a use-case described here. I can integrate the following use case into a v2 if you think it makes sense: In case of device mapper usage for the root filesystem (e.g. root=/dev/dm-0), if the mapper is not able to create the virtual block for any reasons (wrong arguments, bad dm-verity signature, etc), the `rootwait` parameter will cause the kernel to wait forever. Adding a timeout allows it to detect the 'error' (panic) and reset the device after a few seconds, the bootloader can then decide to mark this non-bootable partition/parameter and fallback to another partition (A/B case) or into a recovery mode. But it's not specific to device mapper, if a eMMC/SDCARD is not detected at boot time because of hardware or software problems (e.g. updated with a bad devicetree), it could be desirable to panic/reboot instead of waiting for something that will never happen. > > And this is only useful if there isn't an early userspace init that > parses and manages root=. So we need to hit prepare_namespaces() as a > rootwait timeout isn't meaningful if this is done by and early init in > the initramfs for example. Indeed, and I do not use initramfs in the above use case, the mapped device is created directly from the kernel (thanks to dm-mod.create=), mostly for boot time optimization reason, and this is for the same reason that rootdelay does not fit. Regards, Loic