mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dominique Martinet <dominique.martinet@atmark-techno.com>
Cc: Richard Weinberger <richard@nod.at>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	 linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] mtd: spinand: winbond: enable continuous read for W25N04LW
Date: Wed, 26 Aug 2026 15:08:02 +0200	[thread overview]
Message-ID: <87ik4xf2rx.fsf@bootlin.com> (raw)
In-Reply-To: <ao6r15CbIMQZZWTB@atmark-techno.com> (Dominique Martinet's message of "Wed, 26 Aug 2026 18:03:19 +0900")

Hi Dominique,

>> > Fun fact:
>> > nanddump -C is about 9% faster than nanddump on large data (tried 10MB)
>> > even if continuous read is not supported.
>> 
>> That is strange. Is this really reproducible? Can you disable CPU PM and
>> try again? There should be no impact if continuous read is disabled.
>
> This system has no knob that I'm aware of (no cpufreq in
> /sys/devices/system/cpu at least), but I've shoved the IRQs aside except
> for the spi ones and it appears pretty stable (mtd1 is a 8MB partition)
>
> ------
> localhost:/mnt/mtd-utils# taskset -c 1 hyperfine --warmup 3 -r 20  './nanddump -f /dev/null /dev/mtd1' './nanddump -C -
> f /dev/null /dev/mtd1'
> Benchmark 1: ./nanddump -f /dev/null /dev/mtd1
>   Time (mean ± σ):     511.1 ms ±   0.5 ms    [User: 7.8 ms, System: 419.8 ms]
>   Range (min … max):   510.4 ms … 512.0 ms    20 runs
>  
> Benchmark 2: ./nanddump -C -f /dev/null /dev/mtd1
>   Time (mean ± σ):     480.9 ms ±   0.9 ms    [User: 0.5 ms, System: 399.6 ms]
>   Range (min … max):   480.1 ms … 483.3 ms    20 runs
>  
>   Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
>  
> Summary
>   ./nanddump -C -f /dev/null /dev/mtd1 ran
>     1.06 ± 0.00 times faster than ./nanddump -f /dev/null /dev/mtd1
> ------
> (this is on our 6.12 tree and not on the 7.2-rc I was on earlier, so
> ymmv, but iirc the 9% figure was taken on 7.2 with hyperfine so this
> should be reproducible with the latest and greatest)

No big change is expected between those versions, except possible
(important) fixes. Make sure you have them.

> I have much more important things to do so I obviously had to look
> further into this mystery :-), but I didn't see anything obvious...

:-)

> For some reason the contiguous read variant seems to spend less time in
> spinand_wait() between the load page and read from cache op (looking at
> a flamegraph), but dumping the actual ops used I see very similar
> sequences of load page (0x13), poll status (0xf), dirmap_read (0xeb),
> so that doesn't explain the difference...

I do not understand why. Did you compare the output? Do you get the same
correct data in both cases?

Maybe there is some kind of runtime PM getting in the way?

> The main difference I see is that nanddump -C passes a much larger
> buffer to read (observable with strace -c), so loops for reading inside
> the kernel, and without -C loops in userspace: I do not see the syscall
> overhead in my perf record flamegraph but perhaps that changes the
> timing just enough for the nand to behave differently or something like
> that?

While nanddump -C is nice, as you said it behaves differently. I would
instead suggest to run flash_speed which has a continuous read
option. You should observe no difference between the different runs.

Then you can hack into the core, enable continuous reads despite the use
of dirmaps (as a hack) and then observe a difference. You may or may not
get correct data depending on whether the controller may deassert the
CS, but we have no control over this, but that doesn't matter much for
the current investigation.

Thanks,
Miquèl

      reply	other threads:[~2026-08-26 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14  8:15 Dominique Martinet
2026-08-25  9:09 ` Miquel Raynal
2026-08-26  9:03   ` Dominique Martinet
2026-08-26 13:08     ` Miquel Raynal [this message]

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=87ik4xf2rx.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=dominique.martinet@atmark-techno.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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

all inboxes | Powered by JetHome®