Re: [PATCH 2/2] ubi: introduce ubi.nocheck parameter to skip CRC check when attaching ubi vol

From: Boris Brezillon
Date: Mon Apr 23 2018 - 08:08:41 EST


On Mon, 23 Apr 2018 11:40:09 +0200
Quentin Schulz <quentin.schulz@xxxxxxxxxxx> wrote:

> Hi Boris,
>
> On Fri, Apr 20, 2018 at 07:19:24PM +0200, Boris Brezillon wrote:
> > On Fri, 20 Apr 2018 10:52:41 +0200
> > Quentin Schulz <quentin.schulz@xxxxxxxxxxx> wrote:
> >
> > > There's already ECC on NAND pages so there may be no need for one to
> > > check the CRC of a UBI volume.
> >
> > That's true that ECC can help detecting corruptions, but I don't think
> > this is the actual reason for disabling CRC check at volume open time.
> > The actual reason for doing that is when the UBI volume user (in our
> > case the squashfs FS) is also checking data consistency on its own
> > (which is the case for squashfs).
> >
> > >
> > > Let's introduce a ubi.nocheck parameter that let one skip the CRC check
> > > when attaching a UBI volume.
> > >
> > > This also drastically speeds kernel boot by removing a potentially
> > > useless check, e.g. I gained 3.2s on boot time of a SPEAr600-based board
> > > for a ~20MB UBI volume used as rootfs.
> >
> > Can you give the old and new open/mount time instead of telling how
> > much you gained on the whole boot-time?
>
> # grabserial -v -d /dev/ttyUSB0 -t "Starting kernel"
>
> Kernel command line is:
> rootfstype=squashfs root=/dev/ubiblock0_0 ubi.mtd=ubi ubi.block=0,rootfs mtdparts=nand:92M@36M(ubi)
>
> Current behaviour (CRC checking):
> [2.335558 0.017867] ubi0: attaching mtd7
> [2.504021 0.168463] ubi0: scanning is finished
> [2.519824 0.015803] ubi0: attached mtd7 (name "ubi", size 92 MiB)
> [2.523987 0.004163] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
> [2.530447 0.006460] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
> [2.535836 0.005389] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
> [2.541601 0.005765] ubi0: good PEBs: 736, bad PEBs: 0, corrupted PEBs: 0
> [2.547923 0.006322] ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
> [2.554223 0.006300] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 463835917
> [2.562460 0.008237] ubi0: available PEBs: 0, total reserved PEBs: 736, PEBs reserved for bad PEB handling: 20
> [2.569779 0.007319] ubi0: background thread "ubi_bgt0d" started, PID 546
> [4.550142 1.980363] block ubiblock0_0: created from ubi0:0(rootfs)
>
> Skipping CRC check (ubi.nocheck=0,rootfs):
> [2.349903 0.019126] ubi0: attaching mtd7
> [2.516995 0.167092] ubi0: scanning is finished
> [2.527101 0.010106] ubi0: skipping CRC check for volume rootfs
> [2.536719 0.009618] ubi0: attached mtd7 (name "ubi", size 92 MiB)
> [2.541859 0.005140] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
> [2.547744 0.005885] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
> [2.552990 0.005246] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
> [2.560497 0.007507] ubi0: good PEBs: 736, bad PEBs: 0, corrupted PEBs: 0
> [2.568010 0.007513] ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
> [2.574723 0.006713] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 463835917
> [2.586223 0.011500] ubi0: available PEBs: 0, total reserved PEBs: 736, PEBs reserved for bad PEB handling: 20
> [2.592365 0.006142] ubi0: background thread "ubi_bgt0d" started, PID 545
> [2.595960 0.003595] block ubiblock0_0: created from ubi0:0(rootfs)
>
> It seems like it's more in the magnitude of 2s rather than 3, but still.

No, I meant add this information to the commit message since telling
how many seconds are saved on the absolute boot-time does not give any
information on the before vs after ratio.