Optimize spi_sync path
authorMark Brown <broonie@kernel.org>
Tue, 28 Jun 2022 10:30:13 +0000 (11:30 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 28 Jun 2022 10:30:13 +0000 (11:30 +0100)
commit152f2494ac16d17c111cf982d2ad75c6a82d9da8
treeebed1832afaefa093f7eff130052a59cf7f34bec
parent82295bc0d192d7e35e0568b18ca66da2c3058fd5
parentdc3029056b02414c29b6627e3dd7b16624725ae9
Optimize spi_sync path

Merge series from David Jander <david@protonic.nl>:

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.

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.