From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Mark Brown" <broonie@kernel.org>
Cc: <linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Dhruva Gole" <d-gole@ti.com>,
"Gregory CLEMENT" <gregory.clement@bootlin.com>,
"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>
Subject: Re: [PATCH] spi: spi-mem: add statistics support to ->exec_op() calls
Date: Wed, 14 Feb 2024 11:59:49 +0100 [thread overview]
Message-ID: <CZ4QZUSQXV4Q.3QRIRM4V0SYF8@bootlin.com> (raw)
In-Reply-To: <c5230e6b-b988-4fdb-a8d6-543c3e9cda23@linaro.org>
On Wed Feb 14, 2024 at 10:29 AM CET, Tudor Ambarus wrote:
> On 2/14/24 08:51, Théo Lebrun wrote:
> > On Wed Feb 14, 2024 at 9:00 AM CET, Tudor Ambarus wrote:
> >> On 2/13/24 15:00, Théo Lebrun wrote:
> >>> On Tue Feb 13, 2024 at 1:39 PM CET, Tudor Ambarus wrote:
> >>>>> /**
> >>>>> * spi_mem_exec_op() - Execute a memory operation
> >>>>> * @mem: the SPI memory
> >>>>> @@ -339,8 +383,12 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
> >>>>> * read path) and expect the core to use the regular SPI
> >>>>> * interface in other cases.
> >>>>> */
> >>>>> - if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP)
> >>>>> + if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP) {
> >>>>> + spi_mem_add_op_stats(ctlr->pcpu_statistics, op, ret);
> >>>>> + spi_mem_add_op_stats(mem->spi->pcpu_statistics, op, ret);
> >>>>> +
> >>>>
> >>>> Would be good to be able to opt out the statistics if one wants it.
> >>>>
> >>>> SPI NORs can write with a single write op maximum page_size bytes, which
> >>>> is typically 256 bytes. And since there are SPI NORs that can run at 400
> >>>> MHz, I guess some performance penalty shouldn't be excluded.
> >>>
> >>> I did my testing on a 40 MHz octal SPI NOR with most reads being much
> >>> bigger than 256 bytes, so I probably didn't have the fastest setup
> >>> indeed.
> >>
> >> yeah, reads are bigger, the entire flash can be read with a single read op.
> >>
> >>>
> >>> What shape would that take? A spi-mem DT prop? New field in the SPI
> >>> statistics sysfs directory?
> >>>
> >>
> >> I think I'd go with a sysfs entry, it provides flexibility. But I guess
> >> we can worry about this if we have some numbers, and I don't have, so
> >> you're fine even without the opt-out option.
> >
> > Some ftrace numbers:
> > - 48002 calls to spi_mem_add_op_stats();
> > - min 1.053000µs;
> > - avg 1.175652µs;
> > - max 16.272000µs.
> >
> > Platform is Mobileye EyeQ5. Cores are Imagine Technologies I6500-F. I
> > don't know the precision of our timer but we might be getting close to
> > what is measurable.
> >
> Thanks.
>
> I took a random SPI NOR flash [1], its page program typical time is 64µs
> according to its SFDP data. We'll have to add here the delay the
> software handling takes.
>
> If you want to play a bit more, you can write the entire flash then
> compare the ftrace numbers of spi_mem_add_op_stats() with spi_nor_write().
It is unclear to me why you are focusing on writes? Won't reads be much
faster in the common case, and therefore where stats overhead would
show the most? For cadence-qspi, only issuing command reads (reads below
8 bytes) would be a sort of pathological case.
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-02-14 10:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 13:51 Théo Lebrun
2024-02-12 11:13 ` Dhruva Gole
2024-02-12 13:35 ` Mark Brown
2024-02-12 14:22 ` Théo Lebrun
2024-02-13 4:54 ` Dhruva Gole
2024-02-13 12:39 ` Tudor Ambarus
2024-02-13 15:00 ` Théo Lebrun
2024-02-14 8:00 ` Tudor Ambarus
2024-02-14 8:51 ` Théo Lebrun
2024-02-14 9:29 ` Tudor Ambarus
2024-02-14 10:59 ` Théo Lebrun [this message]
2024-02-14 12:59 ` Tudor Ambarus
2024-02-13 15:28 ` Mark Brown
2024-02-14 7:42 ` 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=CZ4QZUSQXV4Q.3QRIRM4V0SYF8@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=broonie@kernel.org \
--cc=d-gole@ti.com \
--cc=gregory.clement@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=tawfik.bayouk@mobileye.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=tudor.ambarus@linaro.org \
--cc=vladimir.kondratiev@mobileye.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®