Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B8C5C64ED6 for ; Mon, 27 Feb 2023 18:08:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbjB0SIQ (ORCPT ); Mon, 27 Feb 2023 13:08:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbjB0SIL (ORCPT ); Mon, 27 Feb 2023 13:08:11 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCA9A23863 for ; Mon, 27 Feb 2023 10:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677521214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=A0XiMaVk2NRHD3G7gBjNzwZV65APgDc5PN3bQr3CxgQ=; b=NbY45/nsk4nsMpGpHhShV5xPLj7/GMhg7nKS72KCMu5GyZ39l1Wx7zrBrQE8SADm/qQ0ik RS2XKN4XPbAZsIdx+6yepqdiNoJML1Wge+HjpPe35+S17jcwgqiYRUxLklToMNip1b8mO8 baGBPZzb6mOINY/cneQxSKy4kCzarfU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-xsKvlzbSMLCqXzj1QpnMwQ-1; Mon, 27 Feb 2023 13:06:52 -0500 X-MC-Unique: xsKvlzbSMLCqXzj1QpnMwQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1FD97802D2E; Mon, 27 Feb 2023 18:06:52 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.33.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A71062026D4B; Mon, 27 Feb 2023 18:06:51 +0000 (UTC) Received: by fedora.redhat.com (Postfix, from userid 1000) id 40EAF139788; Mon, 27 Feb 2023 13:06:51 -0500 (EST) Date: Mon, 27 Feb 2023 13:06:51 -0500 From: Vivek Goyal To: Stefan Hajnoczi Cc: dri-devel@lists.freedesktop.org, helen.koike@collabora.com, Al Viro , Miklos Szeredi , virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, wsa+renesas@sang-engineering.com, akpm@linux-foundation.org, David Heidelberg Subject: Re: [RESEND v2 PATCH] init/do_mounts.c: add virtiofs root fs support Message-ID: References: <20230224143751.36863-1-david@ixit.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 27, 2023 at 10:53:45AM -0500, Stefan Hajnoczi wrote: > On Fri, Feb 24, 2023 at 03:37:51PM +0100, David Heidelberg wrote: > > From: Stefan Hajnoczi > > > > Make it possible to boot directly from a virtiofs file system with tag > > 'myfs' using the following kernel parameters: > > > > rootfstype=virtiofs root=myfs rw > > > > Booting directly from virtiofs makes it possible to use a directory on > > the host as the root file system. This is convenient for testing and > > situations where manipulating disk image files is cumbersome. > > > > Reviewed-by: Helen Koike > > Signed-off-by: Stefan Hajnoczi > > Signed-off-by: David Heidelberg > > --- > > v2: added Reviewed-by and CCed everyone interested. > > > > We have used this option in Mesa3D CI for testing crosvm for > > more than one years and it's proven to work reliably. > > > > We are working on effort to removing custom patches to be able to do > > automated apply and test of patches from any tree. > > > > https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/.gitlab-ci/crosvm-runner.sh#L85 > > init/do_mounts.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > Vivek, do you remember where we ended up with boot from virtiofs? I > thought a different solution was merged some time ago. We merged a patch from Christoph Hellwig to support this. commit f9259be6a9e7c22d92e5a5000913147ae17e8321 Author: Christoph Hellwig Date: Wed Jul 14 16:23:20 2021 -0400 init: allow mounting arbitrary non-blockdevice filesystems as root Now one should be able to mount virtiofs using following syntax. "root=myfs rootfstype=virtiofs rw" IIUC, this patch should not be required anymore. Thanks Vivek > > There is documentation from the virtiofs community here: > https://virtio-fs.gitlab.io/howto-boot.html > > Stefan > > > > > diff --git a/init/do_mounts.c b/init/do_mounts.c > > index 811e94daf0a8..11c11abe23d7 100644 > > --- a/init/do_mounts.c > > +++ b/init/do_mounts.c > > @@ -578,6 +578,16 @@ void __init mount_root(void) > > printk(KERN_ERR "VFS: Unable to mount root fs via SMB.\n"); > > return; > > } > > +#endif > > +#ifdef CONFIG_VIRTIO_FS > > + if (root_fs_names && !strcmp(root_fs_names, "virtiofs")) { > > + if (!do_mount_root(root_device_name, "virtiofs", > > + root_mountflags, root_mount_data)) > > + return; > > + > > + panic("VFS: Unable to mount root fs \"%s\" from virtiofs", > > + root_device_name); > > + } > > #endif > > if (ROOT_DEV == 0 && root_device_name && root_fs_names) { > > if (mount_nodev_root() == 0) > > -- > > 2.39.1 > >