linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-mtd: ubiattach taking long time
@ 2024-03-25 16:57 Pintu Agarwal
  2024-03-25 18:20 ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Pintu Agarwal @ 2024-03-25 16:57 UTC (permalink / raw)
  To: linux-fsdevel, linux-fsdevel, linux-mtd, artem.bityutskiy,
	Richard Weinberger, ezequiel, Richard Weinberger, Miquel Raynal,
	vigneshr

Hi All,

We are using arm64, quad-core, with Linux Kernel 5.15 with 1GB NAND.
We have A/B partitioning and around 9 ubi volumes.

During boot-up we observed that the ubiattach alone is taking around
1.2 secs (either user space or kernel space).
The snapshot of the log is shown below.

I have tried using fastmap as well, but still no difference.
Are there any other techniques to improve the ubiattach timing ?

Logs:
----------
Doing from initramfs:
{{{
[    6.949143][  T214] ubi0: attaching mtd54
[    8.023766][  T214] ubi0: scanning is finished
[    8.035901][  T214] ubi0: attached mtd54 (name "system", size 867 MiB)
[    8.042635][  T214] ubi0: PEB size: 262144 bytes (256 KiB), LEB
size: 253952 bytes
[    8.050423][  T214] ubi0: min./max. I/O unit sizes: 4096/4096,
sub-page size 4096
[    8.058134][  T214] ubi0: VID header offset: 4096 (aligned 4096),
data offset: 8192
[    8.066011][  T214] ubi0: good PEBs: 3470, bad PEBs: 0, corrupted PEBs: 0
[    8.072995][  T214] ubi0: user volume: 10, internal volumes: 1,
max. volumes count: 128
[    8.081225][  T214] ubi0: max/mean erase counter: 3/0, WL
threshold: 4096, image sequence number: 302691963
[    8.091242][  T214] ubi0: available PEBs: 0, total reserved PEBs:
3470, PEBs reserved for bad PEB handling: 80
[    8.101544][  T215] ubi0: background thread "ubi_bgt0d" started, PID 215
UBI device number 0, total 3470 LEBs (881213440 bytes, 840.3 MiB),
available 0 LEBs (0 bytes), LEB size 253952 bytes (248.0 KiB)
[    8.136907][  T227] block ubiblock0_0: created from ubi0:0(rootfs_a)
}}}

Doing from Kernel using cmdline: ubi.mtd=54,0,30 :
{{{
[    6.702817][    T1] ubi0: default fastmap pool size: 170
[    6.702822][    T1] ubi0: default fastmap WL pool size: 85
[    6.702826][    T1] ubi0: attaching mtd54
[…]
[    7.784955][    T1] ubi0: scanning is finished
[    7.797135][    T1] ubi0: attached mtd54 (name "system", size 867 MiB)
}}}


Thanks,
Pintu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-mtd: ubiattach taking long time
  2024-03-25 16:57 linux-mtd: ubiattach taking long time Pintu Agarwal
@ 2024-03-25 18:20 ` Richard Weinberger
  2024-03-26 13:45   ` Pintu Agarwal
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2024-03-25 18:20 UTC (permalink / raw)
  To: Pintu Agarwal
  Cc: linux-fsdevel, linux-fsdevel, linux-mtd, Artem Bityutskiy,
	Richard Weinberger, Ezequiel Garcia, Miquel Raynal,
	Vignesh Raghavendra

Pintu,

----- Ursprüngliche Mail -----
> Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> I have tried using fastmap as well, but still no difference.
> Are there any other techniques to improve the ubiattach timing ?
> 
> Logs:
> ----------
> Doing from initramfs:
> {{{
> [    6.949143][  T214] ubi0: attaching mtd54
> [    8.023766][  T214] ubi0: scanning is finished

No fastmap attach here.

Make sure to set fm_autoconvert:
http://www.linux-mtd.infradead.org/doc/ubi.html#L_fastmap
If set, UBI create after a few writes a fastmap.

Speaking of other techniques, you can improve scanning time also by
tuning UBI for your NAND controller/setup.
E.g. transferring only the amount of bytes needed for an header.
Or reading without ECC and re-reading with ECC if the header CRC-check fails.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-mtd: ubiattach taking long time
  2024-03-25 18:20 ` Richard Weinberger
@ 2024-03-26 13:45   ` Pintu Agarwal
  2024-03-26 14:10     ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Pintu Agarwal @ 2024-03-26 13:45 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: linux-fsdevel, linux-fsdevel, linux-mtd, Artem Bityutskiy,
	Richard Weinberger, Ezequiel Garcia, Miquel Raynal,
	Vignesh Raghavendra

Dear Richard, Thank you so much for your reply. Please find some
comments inline.

On Mon, 25 Mar 2024 at 23:50, Richard Weinberger <richard@nod.at> wrote:
>
> Pintu,
>
> ----- Ursprüngliche Mail -----
> > Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> > I have tried using fastmap as well, but still no difference.
> > Are there any other techniques to improve the ubiattach timing ?
> >
> > Logs:
> > ----------
> > Doing from initramfs:
> > {{{
> > [    6.949143][  T214] ubi0: attaching mtd54
> > [    8.023766][  T214] ubi0: scanning is finished
>
> No fastmap attach here.
>
> Make sure to set fm_autoconvert:
> http://www.linux-mtd.infradead.org/doc/ubi.html#L_fastmap
> If set, UBI create after a few writes a fastmap.
>
Yes, I have set fm_autoconvert=1 on cmdline and enabled fastmap on the
other logs.
{{{
[    0.000000][    T0] Kernel command line: ... fm_autoconvert=1
ubi.mtd=54,0,30 ...
[...]
[    6.702817][    T1] ubi0: default fastmap pool size: 170
[    6.702822][    T1] ubi0: default fastmap WL pool size: 85
[    6.702826][    T1] ubi0: attaching mtd54
[…]
[    7.784955][    T1] ubi0: scanning is finished
[    7.797135][    T1] ubi0: attached mtd54 (name "system", size 867 MiB)
}}}
Is there anything missing here ?
Can we increase the pool size ? Will it help to improve the timing ?

> Speaking of other techniques, you can improve scanning time also by
> tuning UBI for your NAND controller/setup.
> E.g. transferring only the amount of bytes needed for an header.
> Or reading without ECC and re-reading with ECC if the header CRC-check fails.
>
Sorry, I could not get this fully.
Is it possible to elaborate more with some reference ?
Do we have some special commands/parameters to do it if we use initramfs ?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-mtd: ubiattach taking long time
  2024-03-26 13:45   ` Pintu Agarwal
@ 2024-03-26 14:10     ` Richard Weinberger
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2024-03-26 14:10 UTC (permalink / raw)
  To: Pintu Agarwal
  Cc: linux-fsdevel, linux-fsdevel, linux-mtd, Artem Bityutskiy,
	Richard Weinberger, Ezequiel Garcia, Miquel Raynal,
	Vignesh Raghavendra

Pintu,

----- Ursprüngliche Mail -----
> Von: "Pintu Agarwal" <pintu.ping@gmail.com>

> Is there anything missing here ?
> Can we increase the pool size ? Will it help to improve the timing ?

As long you see "scanning is finished", fastmap was not used.
Usually a fastmap is created after ubidetach or writing more than pool size.
 
>> Speaking of other techniques, you can improve scanning time also by
>> tuning UBI for your NAND controller/setup.
>> E.g. transferring only the amount of bytes needed for an header.
>> Or reading without ECC and re-reading with ECC if the header CRC-check fails.
>>
> Sorry, I could not get this fully.
> Is it possible to elaborate more with some reference ?
> Do we have some special commands/parameters to do it if we use initramfs ?

You need to touch code for that. These are highly specific adoptions.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-26 14:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 16:57 linux-mtd: ubiattach taking long time Pintu Agarwal
2024-03-25 18:20 ` Richard Weinberger
2024-03-26 13:45   ` Pintu Agarwal
2024-03-26 14:10     ` Richard Weinberger

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).