diff mbox series

[OpenWrt-Devel,1/2] imx6: bootscript: enable UBI fastmap support

Message ID 1570054885-11705-1-git-send-email-tharvey@gateworks.com
State Changes Requested
Delegated to: Koen Vandeputte
Headers show
Series [OpenWrt-Devel,1/2] imx6: bootscript: enable UBI fastmap support | expand

Commit Message

Tim Harvey Oct. 2, 2019, 10:21 p.m. UTC
UBI Fastmap support is stable in the 4.4 kernel so lets take
advantage of it to shave off 5-10 seconds of boot time.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 target/linux/imx6/image/bootscript-ventana | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Koen Vandeputte Oct. 4, 2019, 12:30 p.m. UTC | #1
On 03.10.19 00:21, Tim Harvey wrote:
> UBI Fastmap support is stable in the 4.4 kernel so lets take
> advantage of it to shave off 5-10 seconds of boot time.
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>   target/linux/imx6/image/bootscript-ventana | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/target/linux/imx6/image/bootscript-ventana b/target/linux/imx6/image/bootscript-ventana
> index 941afb5..8451caf 100644
> --- a/target/linux/imx6/image/bootscript-ventana
> +++ b/target/linux/imx6/image/bootscript-ventana
> @@ -1,4 +1,4 @@
> -echo "Gateworks Ventana OpenWrt Boot script v1.01"
> +echo "Gateworks Ventana OpenWrt Boot script v1.02"
>   
>   # set some defaults
>   # set some defaults
> @@ -51,6 +51,8 @@ if itest.s "x${dtype}" == "xnand" ; then
>   	echo "mtdparts:${mtdparts}"
>   	setenv fsload ubifsload
>   	setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs"
> +	# enable UBI fastmap support
> +	setenv bootargs "${bootargs} ubi.fm_autoconvert=1"
>   else
>   	echo "Booting from block device ${bootdev}..."
>   	setenv fsload "${fs}load ${dtype} ${disk}:1"

Hi Tim,

Shouldn't this patch also enable the required kernel symbol? 
(MTD_UBI_FASTMAP)

Next to that, even in kernel 4.19 I'm reading following regarding this 
feature:

Important: this feature is experimental so far and the on-flash │
format for fastmap may change in the next kernel versions


Hi Richard,

Apologies for dragging you in here.

How stable is this fastmap format?

Will it leave Experimental state in the near future?


Thanks,

Koen
Koen Vandeputte Oct. 4, 2019, 2:16 p.m. UTC | #2
On 04.10.19 14:30, Koen Vandeputte wrote:
>
> On 03.10.19 00:21, Tim Harvey wrote:
>> UBI Fastmap support is stable in the 4.4 kernel so lets take
>> advantage of it to shave off 5-10 seconds of boot time.
>>
>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>> ---
>>   target/linux/imx6/image/bootscript-ventana | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/target/linux/imx6/image/bootscript-ventana 
>> b/target/linux/imx6/image/bootscript-ventana
>> index 941afb5..8451caf 100644
>> --- a/target/linux/imx6/image/bootscript-ventana
>> +++ b/target/linux/imx6/image/bootscript-ventana
>> @@ -1,4 +1,4 @@
>> -echo "Gateworks Ventana OpenWrt Boot script v1.01"
>> +echo "Gateworks Ventana OpenWrt Boot script v1.02"
>>     # set some defaults
>>   # set some defaults
>> @@ -51,6 +51,8 @@ if itest.s "x${dtype}" == "xnand" ; then
>>       echo "mtdparts:${mtdparts}"
>>       setenv fsload ubifsload
>>       setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs"
>> +    # enable UBI fastmap support
>> +    setenv bootargs "${bootargs} ubi.fm_autoconvert=1"
>>   else
>>       echo "Booting from block device ${bootdev}..."
>>       setenv fsload "${fs}load ${dtype} ${disk}:1"
>
> Hi Tim,
>
> Shouldn't this patch also enable the required kernel symbol? 
> (MTD_UBI_FASTMAP)
>
> Next to that, even in kernel 4.19 I'm reading following regarding this 
> feature:
>
> Important: this feature is experimental so far and the on-flash │
> format for fastmap may change in the next kernel versions
>
>
> Hi Richard,
>
> Apologies for dragging you in here.
>
> How stable is this fastmap format?
>
> Will it leave Experimental state in the near future?
>
>
> Thanks,
>
> Koen
>

I'm also seeing this warning:


[    0.000000] Kernel command line: console=ttymxc1,115200 ubi0:ubi 
ubi.mtd=2 rootfstype=squashfs,ubifs ubi.fm_autoconvert=1

[    2.356304] ubi0: default fastmap pool size: 95
[    2.360850] ubi0: default fastmap WL pool size: 47
[    2.365684] ubi0: attaching mtd2
[    2.551317] random: crng init done
[    2.786708] ubi0: scanning is finished

[    2.795380] ubi0 warning: ubi_eba_init: cannot reserve enough PEBs 
for bad PEB handling, reserved 38, need 40        <---

[    2.806651] ubi0: attached mtd2 (name "ubi", size 239 MiB)
[    2.812151] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 
bytes
[    2.819051] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    2.825855] ubi0: VID header offset: 2048 (aligned 2048), data 
offset: 4096
[    2.832825] ubi0: good PEBs: 1912, bad PEBs: 0, corrupted PEBs: 0
[    2.838937] ubi0: user volume: 3, internal volumes: 1, max. volumes 
count: 128
[    2.846175] ubi0: max/mean erase counter: 4/1, WL threshold: 4096, 
image sequence number: 1659699605
[    2.855327] ubi0: available PEBs: 0, total reserved PEBs: 1912, PEBs 
reserved for bad PEB handling: 38
[    2.864657] ubi0: background thread "ubi_bgt0d" started, PID 826
[    2.871496] block ubiblock0_1: created from ubi0:1(rootfs)
[    2.877025] ubiblock: device ubiblock0_1 (rootfs) set to be root 
filesystem


It doesn't seem to be a coincidence that it's missing 2 PEB's while 
fastmap uses 2 of them


Koen
Richard Weinberger Oct. 7, 2019, 7 a.m. UTC | #3
Koen,

----- Ursprüngliche Mail -----
>> +	# enable UBI fastmap support
>> +	setenv bootargs "${bootargs} ubi.fm_autoconvert=1"
>>   else
>>   	echo "Booting from block device ${bootdev}..."
>>   	setenv fsload "${fs}load ${dtype} ${disk}:1"
> 
> Hi Tim,
> 
> Shouldn't this patch also enable the required kernel symbol?
> (MTD_UBI_FASTMAP)
> 
> Next to that, even in kernel 4.19 I'm reading following regarding this
> feature:
> 
> Important: this feature is experimental so far and the on-flash │
> format for fastmap may change in the next kernel versions
> 
> 
> Hi Richard,
> 
> Apologies for dragging you in here.
> 
> How stable is this fastmap format?
> 
> Will it leave Experimental state in the near future?

Well, the format itself is stable. We never had a bug which required
such a change. So I guess we can consider it as stable.

So yes, it is high noon to remove the scary "experimental word" from
the Kconfig description. :)

That said, I suggest enabling Fastmap only if attach/boot time is
more important than NAND lifetime.
The downside of Fastmap is that it will wear out the first 64 blocks
of your NAND faster than other blocks and not doing a full scan
upon bootup might hide NAND problems which can cause trouble
when it is already too late.

Thanks,
//richard
Richard Weinberger Oct. 7, 2019, 7:01 a.m. UTC | #4
Koen,

----- Ursprüngliche Mail -----
> 
> I'm also seeing this warning:
> 
> 
> [    0.000000] Kernel command line: console=ttymxc1,115200 ubi0:ubi
> ubi.mtd=2 rootfstype=squashfs,ubifs ubi.fm_autoconvert=1
> 
> [    2.356304] ubi0: default fastmap pool size: 95
> [    2.360850] ubi0: default fastmap WL pool size: 47
> [    2.365684] ubi0: attaching mtd2
> [    2.551317] random: crng init done
> [    2.786708] ubi0: scanning is finished
> 
> [    2.795380] ubi0 warning: ubi_eba_init: cannot reserve enough PEBs
> for bad PEB handling, reserved 38, need 40        <---
> 
> [    2.806651] ubi0: attached mtd2 (name "ubi", size 239 MiB)
> [    2.812151] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976
> bytes
> [    2.819051] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
> [    2.825855] ubi0: VID header offset: 2048 (aligned 2048), data
> offset: 4096
> [    2.832825] ubi0: good PEBs: 1912, bad PEBs: 0, corrupted PEBs: 0
> [    2.838937] ubi0: user volume: 3, internal volumes: 1, max. volumes
> count: 128
> [    2.846175] ubi0: max/mean erase counter: 4/1, WL threshold: 4096,
> image sequence number: 1659699605
> [    2.855327] ubi0: available PEBs: 0, total reserved PEBs: 1912, PEBs
> reserved for bad PEB handling: 38
> [    2.864657] ubi0: background thread "ubi_bgt0d" started, PID 826
> [    2.871496] block ubiblock0_1: created from ubi0:1(rootfs)
> [    2.877025] ubiblock: device ubiblock0_1 (rootfs) set to be root
> filesystem
> 
> 
> It doesn't seem to be a coincidence that it's missing 2 PEB's while
> fastmap uses 2 of them

Did you create this UBI offline? If you choose a layout which leaves almost
no empty blocks, this can happen.

Thanks,
//richard
diff mbox series

Patch

diff --git a/target/linux/imx6/image/bootscript-ventana b/target/linux/imx6/image/bootscript-ventana
index 941afb5..8451caf 100644
--- a/target/linux/imx6/image/bootscript-ventana
+++ b/target/linux/imx6/image/bootscript-ventana
@@ -1,4 +1,4 @@ 
-echo "Gateworks Ventana OpenWrt Boot script v1.01"
+echo "Gateworks Ventana OpenWrt Boot script v1.02"
 
 # set some defaults
 # set some defaults
@@ -51,6 +51,8 @@  if itest.s "x${dtype}" == "xnand" ; then
 	echo "mtdparts:${mtdparts}"
 	setenv fsload ubifsload
 	setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs"
+	# enable UBI fastmap support
+	setenv bootargs "${bootargs} ubi.fm_autoconvert=1"
 else
 	echo "Booting from block device ${bootdev}..."
 	setenv fsload "${fs}load ${dtype} ${disk}:1"