From: David Jander <david@protonic.nl>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Marc Kleine-Budde <mkl@pengutronix.de>,
David Jander <david@protonic.nl>
Subject: [RFC] [PATCH 0/3] Optimize spi_sync path
Date: Wed, 25 May 2022 16:29:25 +0200 [thread overview]
Message-ID: <20220525142928.2335378-1-david@protonic.nl> (raw)
These patches optimize the spi_sync call for the common case that the
worker thread is idle and the queue is empty. It also opens the
possibility to potentially further optimize the async path also, since
it doesn't need to take into account the direct sync path anymore.
As an example for the performance gain, on an i.MX8MM SoC with a SPI CAN
controller attached (MCP2518FD), the time the interrupt line stays
active (which corresponds roughly with the time it takes to send 3
relatively short consecutive spi_sync messages) is reduced from 98us to
only 72us by this patch.
Unfortunately though, this optimization requires a small and hopefully
innocuous API change. This change is contained in the first patch, and
it replaces the function spi_finalize_current_message() with
spi_finalize_message(), which takes the message instead of its
controller as argument. Without this change, it is not possible to avoid
touching the controller message queue, which is what this is all about.
A note about message ordering:
This patch series should not change the behavior of message ordering when
coming from the same context. This means that if a client driver issues
one or more spi_async() messages immediately followed by a spi_sync()
message in the same context, it can still rely on these messages being
sent out in the order they were fired.
David Jander (3):
drivers: spi: API: spi_finalize_current_message ->
spi_finalize_message
drivers: spi: spi.c: Move ctlr->cur_msg_prepared to struct spi_message
drivers: spi: spi.c: Don't use the message queue if possible in
spi_sync
Documentation/spi/spi-summary.rst | 4 +-
.../media/pci/netup_unidvb/netup_unidvb_spi.c | 2 +-
drivers/media/usb/msi2500/msi2500.c | 2 +-
drivers/spi/spi-amd.c | 2 +-
drivers/spi/spi-ar934x.c | 2 +-
drivers/spi/spi-axi-spi-engine.c | 2 +-
drivers/spi/spi-bcm63xx-hsspi.c | 2 +-
drivers/spi/spi-bcm63xx.c | 2 +-
drivers/spi/spi-cavium.c | 2 +-
drivers/spi/spi-falcon.c | 2 +-
drivers/spi/spi-fsi.c | 2 +-
drivers/spi/spi-fsl-dspi.c | 2 +-
drivers/spi/spi-fsl-espi.c | 2 +-
drivers/spi/spi-fsl-spi.c | 2 +-
drivers/spi/spi-mpc512x-psc.c | 2 +-
drivers/spi/spi-mt7621.c | 2 +-
drivers/spi/spi-mtk-nor.c | 2 +-
drivers/spi/spi-mux.c | 2 +-
drivers/spi/spi-mxs.c | 2 +-
drivers/spi/spi-omap-100k.c | 2 +-
drivers/spi/spi-pic32-sqi.c | 2 +-
drivers/spi/spi-pl022.c | 4 +-
drivers/spi/spi-sc18is602.c | 2 +-
drivers/spi/spi-sh-hspi.c | 2 +-
drivers/spi/spi-tegra114.c | 2 +-
drivers/spi/spi-tegra20-sflash.c | 2 +-
drivers/spi/spi-tegra210-quad.c | 2 +-
drivers/spi/spi-ti-qspi.c | 2 +-
drivers/spi/spi-xcomm.c | 2 +-
drivers/spi/spi.c | 269 ++++++++++--------
drivers/staging/greybus/spilib.c | 2 +-
include/linux/spi/spi.h | 21 +-
32 files changed, 206 insertions(+), 148 deletions(-)
--
2.32.0
next reply other threads:[~2022-05-25 14:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 14:29 David Jander [this message]
2022-05-25 14:29 ` [RFC] [PATCH 1/3] drivers: spi: API: spi_finalize_current_message -> spi_finalize_message David Jander
2022-05-25 14:29 ` [RFC] [PATCH 2/3] drivers: spi: spi.c: Move ctlr->cur_msg_prepared to struct spi_message David Jander
2022-05-25 14:29 ` [RFC] [PATCH 3/3] drivers: spi: spi.c: Don't use the message queue if possible in spi_sync David Jander
2022-05-25 14:46 ` David Jander
2022-06-07 18:30 ` Mark Brown
2022-06-08 7:54 ` David Jander
2022-06-08 11:29 ` Mark Brown
2022-06-09 15:34 ` David Jander
2022-06-09 16:31 ` Mark Brown
2022-06-10 7:27 ` David Jander
2022-06-10 13:41 ` Mark Brown
2022-06-10 18:17 ` Mark Brown
2022-06-13 9:05 ` David Jander
2022-06-13 11:56 ` Mark Brown
2022-07-15 7:47 ` Thomas Kopp
2022-07-15 9:02 ` Thomas Kopp
2022-06-08 13:43 ` Andy Shevchenko
2022-06-08 14:55 ` David Jander
2022-05-30 12:06 ` [RFC] [PATCH 0/3] Optimize spi_sync path Mark Brown
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=20220525142928.2335378-1-david@protonic.nl \
--to=david@protonic.nl \
--cc=andrew@lunn.ch \
--cc=broonie@kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mkl@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.