linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@kymetacorp.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Javier Martinez Canillas <javier@dowhile0.org>,
	Doug Anderson <dianders@chromium.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Stefan Agner <stefan@agner.ch>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Jisheng Zhang <jszhang@marvell.com>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	"devicetree-spec@vger.kernel.org"
	<devicetree-spec@vger.kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Venu Byravarasu <vbyravarasu@nvidia.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Jon Hunter <jonathanh@nvidia.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2 0/4] Patches to allow consistent mmc / mmcblk numbering w/ device tree
Date: Tue, 3 May 2016 19:17:34 +0000	[thread overview]
Message-ID: <1462303111.9103.225.camel@rtred1test09.kymeta.local> (raw)
In-Reply-To: <20160430104832.GJ19428@n2100.arm.linux.org.uk>

On Sat, 2016-04-30 at 11:48 +0100, Russell King - ARM Linux wrote:
> On Fri, Apr 29, 2016 at 06:42:35PM -0400, Javier Martinez Canillas wrote:
> > Maybe a third opinion could make this conversation constructive again.

And maybe a forth.

> > I think Doug's point is that using a UUID or labels for consistency is
> > orthogonal to having a deterministic numbering for MMC devices. And I
> > agree with his point of view for what is worth.
> 
> Yes, it may be orthogonal, but there are two issues here:
> 
> 1. How does the system know which MMC device to mount for its rootfs.
> 
> This is the point that I've picked up on, which has been solved for
> years, and actually pre-dates MMC support in the kernel, and that is
> mount by UUID.

What about eMMC boot blocks and replay protected memory block?  These
are special sub-device like features of eMMC that provide storage from
different areas than the normal flash.  The kernel names them something
like "/dev/mmcblk0boot0" and "/dev/mmcblk1rpmb".

They typically don't have partition tables and in fact the kernel
xplicitly does not scan them for a partition table.  So how can they
have a UUID?

Suppose your device has two SD slots, neither with an SD card inserted
in it, one external and one internal behind a locked access panel.  They
serve different purposes.  How do you determine which is which via UUID
when they have no media?

> The kernel itself has no support for mount-by-label, which is normally
> solved by using an initramfs, which contains programs such as mount
> etc which will scan the block devices looking for an appropriately
> labelled filesystem.  Label has slightly more issues since its possible

But what is faster, using an initramfs that loads a working userspace
into RAM, scans the flash device for partition labels, determines the
device ID, and then switches to the real rootfs.  Or having the
bootloader, which already knows the partition the rootfs is in, tell the
kernel what device to mount from the beginning?

Which brings me to another reason for providing device enumeration
information via the device tree that isn't just about mounting the root
filesystem.

The bootloader will create an enumeration of devices so that it can
access them.  The kernel will also create an enumeration of the same
devices.  Should these enumerations be the same, or should they be
different?

Clearly there are advantages to the enumeration being the same.  It's
easier on users if device IDs can be the same between the two
environments, bootloader and kernel, the device can be accessed from.

It also makes it easier if information about a device needs to be passed
from the bootloader to the kernel.  This could be the root filesystem,
but that's not the only thing.  Console serial port is another.  But we
could also want to kernel to know which of the SoC's ports is connected
to the blank eMMC chip it should create a partition table on and format,
and which is connected to the SD card it should store logging data to.

I can't think of any advantage of the enumerations being different.

So if identical enumerations are desirable, how to achieve it?

One way would be to have the bootloader create its enumeration and then
throw it away when the kernel boots.  The the kernel creates a new
enumeration from scratch, using a different system with different code
and a different design, that happens to create the same enumeration that
the bootloader did.  This seems like a bad design to me.  Two different
code bases will need to kept in sync, to always to the same thing in a
different way.  It will be hard to avoid bugs from corner cases that
fail to produce the same enumerations.

Another way would be to have the bootloader tell the kernel what it
enumerated and then have the kernel use this enumeration.  This avoids
the need to keep two code bases in sync.  It avoids bugs where they fail
to produce the same enumeration.

And how to do this pass the enumeration from the bootloader to the
kernel?  The same way all other information from the bootloader is
passed to the kernel, via the device tree.

The alias system that already exists allows the bootloader to tell the
kernel about enumerations it has already created, which it must do since
it runs before the kernel, and would like the kernel to continue to use.

So this isn't just about finding the root filesystem.  It's about
passing enumeration information from the bootloader to the kernel.

  reply	other threads:[~2016-05-03 19:23 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 17:32 [PATCH v2 0/4] Patches to allow consistent mmc / mmcblk numbering w/ device tree Douglas Anderson
2016-04-29 17:32 ` [PATCH v2 1/4] Documentation: mmc: Document mmc aliases Douglas Anderson
2016-04-29 17:32 ` [PATCH v2 2/4] mmc: read mmc alias from device tree Douglas Anderson
2016-04-29 17:32 ` [PATCH v2 3/4] mmc: use SD/MMC host ID for block device name ID Douglas Anderson
2016-04-29 17:32 ` [PATCH v2 4/4] ARM: dts: rockchip: Add mmc aliases for rk3288 platform Douglas Anderson
2016-04-29 18:12 ` [PATCH v2 0/4] Patches to allow consistent mmc / mmcblk numbering w/ device tree Rob Herring
2016-04-29 19:31   ` Doug Anderson
2016-04-29 19:50     ` Russell King - ARM Linux
2016-04-29 20:02       ` Doug Anderson
2016-04-29 18:12 ` Russell King - ARM Linux
2016-04-29 19:43   ` Doug Anderson
2016-04-29 19:57     ` Russell King - ARM Linux
2016-04-29 20:04       ` Doug Anderson
2016-04-29 21:13         ` Russell King - ARM Linux
2016-04-29 21:17           ` Doug Anderson
2016-04-29 21:29             ` Russell King - ARM Linux
2016-04-29 21:39               ` Doug Anderson
2016-04-29 21:50                 ` Russell King - ARM Linux
2016-04-29 21:56                   ` Doug Anderson
2016-04-29 22:16                     ` Russell King - ARM Linux
2016-04-29 22:22                       ` Doug Anderson
2016-04-29 22:44                         ` Russell King - ARM Linux
2016-04-29 23:01                           ` Doug Anderson
2016-04-29 23:58                             ` Peter Hurley
     [not found]                               ` <CAD=FV=V_YyfBOSs7BLkyhv=_5HBmf3djUWACbL6d-bwnrueDjA@mail.gmail.com>
2016-04-30  0:31                                 ` Peter Hurley
2016-04-30  2:29                                   ` Doug Anderson
2016-04-30  8:38                                   ` Russell King - ARM Linux
2016-04-30 13:23                             ` Rob Herring
2016-04-29 22:42                       ` Javier Martinez Canillas
2016-04-30 10:48                         ` Russell King - ARM Linux
2016-05-03 19:17                           ` Trent Piepho [this message]
2016-05-04  7:18   ` Pavel Machek
2016-05-04 12:25     ` Rob Herring
2016-05-04 12:46       ` Pavel Machek
2019-03-05 12:39 ` Måns Rullgård
2019-03-15 21:52   ` Tim Harvey
2019-03-15 23:00     ` Marek Vasut
2019-03-15 23:13       ` Tim Harvey
2019-03-15 23:23       ` Doug Anderson
     [not found]       ` <yw1xftrn2em9.fsf@mansr.com>
2019-03-16 12:33         ` Marek Vasut
2019-03-16 15:39           ` Russell King - ARM Linux admin
2019-03-17 15:05             ` Stefan Agner
2019-03-17 15:43               ` Russell King - ARM Linux admin
2019-03-17 15:50                 ` Marek Vasut
2019-03-17 16:48               ` Måns Rullgård
2019-03-17 16:59                 ` Russell King - ARM Linux admin
2019-03-27 17:37                   ` Tim Harvey
2019-03-27 20:54                     ` Russell King - ARM Linux admin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462303111.9103.225.camel@rtred1test09.kymeta.local \
    --to=tpiepho@kymetacorp.com \
    --cc=adrian.hunter@intel.com \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree-spec@vger.kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=heiko@sntech.de \
    --cc=javier@dowhile0.org \
    --cc=jh80.chung@samsung.com \
    --cc=jonathanh@nvidia.com \
    --cc=jszhang@marvell.com \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=stefan@agner.ch \
    --cc=ulf.hansson@linaro.org \
    --cc=vbyravarasu@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).