From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Pratyush Yadav <pratyush@kernel.org>,
Michael Walle <michael@walle.cc>,
linux-mtd@lists.infradead.org, Julien Su <juliensu@mxic.com.tw>,
Jaime Liao <jaimeliao@mxic.com.tw>,
Jaime Liao <jaimeliao.tw@gmail.com>,
Alvin Zhou <alvinzhou@mxic.com.tw>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Michal Simek <monstr@monstr.eu>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 7/8] mtd: spi-nor: Enhance locking to support reads while writes
Date: Tue, 28 Mar 2023 10:22:46 +0200 [thread overview]
Message-ID: <20230328102246.7d36675d@xps-13> (raw)
In-Reply-To: <ebe01832-96c3-449a-462e-342ed706ef8a@linaro.org>
Hi Tudor,
tudor.ambarus@linaro.org wrote on Mon, 27 Mar 2023 10:29:03 +0100:
> On 3/24/23 17:41, Miquel Raynal wrote:
> > Hi Tudor,
> >
>
> Hi!
>
> > tudor.ambarus@linaro.org wrote on Fri, 17 Mar 2023 05:59:08 +0000:
> >
> >> Hi, Miquel,
> >>
> >> I find the overall idea good.
> >
> > Thanks a lot for the detailed review!
> >
> >> On 2/1/23 11:36, Miquel Raynal wrote:
> >>> On devices featuring several banks, the Read While Write (RWW) feature
> >>> is here to improve the overall performance when performing parallel
> >>> reads and writes at different locations (different banks). The following
> >>> constraints have to be taken into account:
> >>> 1#: A single operation can be performed in a given bank.
> >>> 2#: Only a single program or erase operation can happen on the entire
> >>> chip (common hardware limitation to limit costs)
> >>> 3#: Reads must remain serialized even though reads on different banks
> >>> might occur at the same time.
> >>
> >> 3# is unclear if one limits just at reading the commit message. Are the
> >> reads serialized per bank or per flash?
> >
> > Per flash.
> >
> >> After reading the code, it looks like all the reads are serialized per
> >> flash regardless if it reads registers or memory. I assume you meant
> >> that crossing a bank boundary with a single read is fine.
> >
> > Yes, I will update that item to clarify.
>
> thanks!
>
> >
> >> But can you
> >> really read from bank 1 and bank 3 at the same time? The code doesn't
> >> take this into consideration.
> >
> > Yes this is taken into account and supported, a read can cross a bank
> > boundary.
>
> No, I meant that you can't do a read from bank 1 and while the first
> read is in progress, to start a second read from the 3rd bank and
> process both reads in parallel, reading from both banks at the same
> time. At least not with the current code, because you set
> rww.{ongoing_io, ongoing_rd} to true and the second read will wait.
> Cross boundary reads on successive banks should work with current code,
> yes. So what does the hw support?
Ok, sorry for the confusion. So, I think I remember a discussion where
I was told that this was not supported even though it would not be
extremely complex to support at a physical level ("just" by increasing
the current source). But IIRC right now this is not supported. Anyhow,
the main target of the RWW is to perform a read during a while, this is
very handy for performing eg. system updates besides reducing the
overall latency, but I don't think we want to bring even more
parallelism between reads. Actually the current implementation would
not work and a whole mtd I/O scheduler would be needed for that, which
is yet another task.
[...]
> >>> @@ -1087,7 +1157,81 @@ static void spi_nor_unprep(struct spi_nor *nor)
> >>> nor->controller_ops->unprepare(nor);
> >>> }
> >>>
> >>> +static void spi_nor_offset_to_banks(struct spi_nor *nor, loff_t start, size_t len,
> >>
> >> pass directly the bank_size instead of the pointer to nor, you'll avoid
> >> the double dereference.
> >
> > Done
> >
> >>
> >>> + unsigned int *first, unsigned int *last)
> >>
> >> unsigned long long *first, *last ?
> >
> > Actually I want these to remain unsigned int, the ULL suffix just mean
> > the input might be a 64-bit value, but it is quite common to treat the
> > output as 32-bit. Here we do not expect values greater than 4.
>
> Ok. Then maybe we should match how we define nbanks in NOR. Was it a u8?
Why not.
>
> >
> >>> +{
> >>> + *first = DIV_ROUND_DOWN_ULL(start, nor->params->bank_size);
> >>> + *last = DIV_ROUND_DOWN_ULL(start + len - 1, nor->params->bank_size);
> >>> +}
> >>> +
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-03-28 8:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 11:35 [PATCH v4 0/8] mtd: spi-nor: read while write support Miquel Raynal
2023-02-01 11:35 ` [PATCH v4 1/8] mtd: spi-nor: Introduce the concept of bank Miquel Raynal
2023-03-17 3:36 ` Tudor Ambarus
2023-02-01 11:35 ` [PATCH v4 2/8] mtd: spi-nor: Add a macro to define more banks Miquel Raynal
2023-02-01 11:35 ` [PATCH v4 3/8] mtd: spi-nor: Reorder the preparation vs locking steps Miquel Raynal
2023-03-17 3:39 ` Tudor Ambarus
2023-03-17 3:51 ` Tudor Ambarus
2023-03-24 15:28 ` Miquel Raynal
2023-02-01 11:35 ` [PATCH v4 4/8] mtd: spi-nor: Separate preparation and locking Miquel Raynal
2023-02-01 11:36 ` [PATCH v4 5/8] mtd: spi-nor: Prepare the introduction of a new locking mechanism Miquel Raynal
2023-02-01 11:36 ` [PATCH v4 6/8] mtd: spi-nor: Add a RWW flag Miquel Raynal
2023-03-17 3:20 ` Tudor Ambarus
2023-02-01 11:36 ` [PATCH v4 7/8] mtd: spi-nor: Enhance locking to support reads while writes Miquel Raynal
2023-03-17 5:59 ` Tudor Ambarus
2023-03-24 17:41 ` Miquel Raynal
2023-03-27 9:29 ` Tudor Ambarus
2023-03-28 8:22 ` Miquel Raynal [this message]
2023-02-01 11:36 ` [PATCH v4 8/8] mtd: spi-nor: macronix: Add support for mx25uw51245g with RWW Miquel Raynal
2023-03-17 6:09 ` Tudor Ambarus
2023-03-17 7:43 ` liao jaime
2023-03-17 8:22 ` Tudor Ambarus
2023-03-17 4:13 ` [PATCH v4 0/8] mtd: spi-nor: read while write support Tudor Ambarus
2023-03-24 13:51 ` Miquel Raynal
2023-03-27 9:34 ` Tudor Ambarus
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=20230328102246.7d36675d@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=alvinzhou@mxic.com.tw \
--cc=jaimeliao.tw@gmail.com \
--cc=jaimeliao@mxic.com.tw \
--cc=juliensu@mxic.com.tw \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=monstr@monstr.eu \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=thomas.petazzoni@bootlin.com \
--cc=tudor.ambarus@linaro.org \
--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;
as well as URLs for NNTP newsgroup(s).