All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] [PATCH 0/3] Optimize spi_sync path
@ 2022-05-25 14:29 David Jander
  2022-05-25 14:29 ` [RFC] [PATCH 1/3] drivers: spi: API: spi_finalize_current_message -> spi_finalize_message David Jander
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: David Jander @ 2022-05-25 14:29 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, Andrew Lunn, Marc Kleine-Budde, David Jander

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


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

end of thread, other threads:[~2022-07-15  9:03 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 14:29 [RFC] [PATCH 0/3] Optimize spi_sync path David Jander
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

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.