From: David Lechner <dlechner@baylibre.com> To: Mark Brown <broonie@kernel.org> Cc: "David Lechner" <dlechner@baylibre.com>, "Martin Sperl" <kernel@martin.sperl.org>, "David Jander" <david@protonic.nl>, "Jonathan Cameron" <jic23@kernel.org>, "Michael Hennerich" <michael.hennerich@analog.com>, "Nuno Sá" <nuno.sa@analog.com>, "Alain Volmat" <alain.volmat@foss.st.com>, "Maxime Coquelin" <mcoquelin.stm32@gmail.com>, "Alexandre Torgue" <alexandre.torgue@foss.st.com>, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, "Julien Stephan" <jstephan@baylibre.com>, "Jonathan Cameron" <Jonathan.Cameron@huawei.com> Subject: [PATCH v2 0/5] spi: add support for pre-cooking messages Date: Mon, 19 Feb 2024 16:33:17 -0600 [thread overview] Message-ID: <20240219-mainline-spi-precook-message-v2-0-4a762c6701b9@baylibre.com> (raw) This is a follow-up to [1] where it was suggested to break down the proposed SPI offload support into smaller series. This takes on the first suggested task of introducing an API to "pre-cook" SPI messages. This idea was first discussed extensively in 2013 [2][3] and revisited more briefly 2022 [4]. The goal here is to be able to improve performance (higher throughput, and reduced CPU usage) by allowing peripheral drivers that use the same struct spi_message repeatedly to "pre-cook" the message once to avoid repeating the same validation, and possibly other operations each time the message is sent. This series includes __spi_validate() and the automatic splitting of xfers in the optimizations. Another frequently suggested optimization is doing DMA mapping only once. This is not included in this series, but can be added later (preferably by someone with a real use case for it). To show how this all works and get some real-world measurements, this series includes the core changes, optimization of a SPI controller driver, and optimization of an ADC driver. This test case was only able to take advantage of the single validation optimization, since it didn't require splitting transfers. With these changes, CPU usage of the threaded interrupt handler, which calls spi_sync(), was reduced from 83% to 73% while at the same time the sample rate (frequency of SPI xfers) was increased from 20kHz to 25kHz. [1]: https://lore.kernel.org/linux-spi/20240109-axi-spi-engine-series-3-v1-1-e42c6a986580@baylibre.com/T/ [2]: https://lore.kernel.org/linux-spi/E81F4810-48DD-41EE-B110-D0D848B8A510@martin.sperl.org/T/ [3]: https://lore.kernel.org/linux-spi/39DEC004-10A1-47EF-9D77-276188D2580C@martin.sperl.org/T/ [4]: https://lore.kernel.org/linux-spi/20220525163946.48ea40c9@erd992/T/ --- Changes in v2: - Removed pre_optimized parameter from __spi_optimize_message() - Added comment explaining purpose of pre_optimized flag - Fixed missing doc comment for @pre_optimized - Removed kernel doc inclusion (/** -> /*) from static members - Removed unrelated comment about calling spi_finalize_current_message() - Reworked IIO driver patch - Link to v1: https://lore.kernel.org/r/20240212-mainline-spi-precook-message-v1-0-a2373cd72d36@baylibre.com --- David Lechner (5): spi: add spi_optimize_message() APIs spi: move splitting transfers to spi_optimize_message() spi: stm32: move splitting transfers to optimize_message spi: axi-spi-engine: move message compile to optimize_message iio: adc: ad7380: use spi_optimize_message() drivers/iio/adc/ad7380.c | 36 +++++- drivers/spi/spi-axi-spi-engine.c | 40 +++--- drivers/spi/spi-stm32.c | 28 +++-- drivers/spi/spi.c | 259 ++++++++++++++++++++++++++++++++------- include/linux/spi/spi.h | 20 +++ 5 files changed, 297 insertions(+), 86 deletions(-) --- base-commit: 55072343f1df834879b8bae9e419cd5cbb5f3259 prerequisite-patch-id: 844c06b6caf25a2724e130dfa7999dc90dd26fde change-id: 20240208-mainline-spi-precook-message-189b2f08ba7f
WARNING: multiple messages have this Message-ID (diff)
From: David Lechner <dlechner@baylibre.com> To: Mark Brown <broonie@kernel.org> Cc: "David Lechner" <dlechner@baylibre.com>, "Martin Sperl" <kernel@martin.sperl.org>, "David Jander" <david@protonic.nl>, "Jonathan Cameron" <jic23@kernel.org>, "Michael Hennerich" <michael.hennerich@analog.com>, "Nuno Sá" <nuno.sa@analog.com>, "Alain Volmat" <alain.volmat@foss.st.com>, "Maxime Coquelin" <mcoquelin.stm32@gmail.com>, "Alexandre Torgue" <alexandre.torgue@foss.st.com>, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, "Julien Stephan" <jstephan@baylibre.com>, "Jonathan Cameron" <Jonathan.Cameron@huawei.com> Subject: [PATCH v2 0/5] spi: add support for pre-cooking messages Date: Mon, 19 Feb 2024 16:33:17 -0600 [thread overview] Message-ID: <20240219-mainline-spi-precook-message-v2-0-4a762c6701b9@baylibre.com> (raw) This is a follow-up to [1] where it was suggested to break down the proposed SPI offload support into smaller series. This takes on the first suggested task of introducing an API to "pre-cook" SPI messages. This idea was first discussed extensively in 2013 [2][3] and revisited more briefly 2022 [4]. The goal here is to be able to improve performance (higher throughput, and reduced CPU usage) by allowing peripheral drivers that use the same struct spi_message repeatedly to "pre-cook" the message once to avoid repeating the same validation, and possibly other operations each time the message is sent. This series includes __spi_validate() and the automatic splitting of xfers in the optimizations. Another frequently suggested optimization is doing DMA mapping only once. This is not included in this series, but can be added later (preferably by someone with a real use case for it). To show how this all works and get some real-world measurements, this series includes the core changes, optimization of a SPI controller driver, and optimization of an ADC driver. This test case was only able to take advantage of the single validation optimization, since it didn't require splitting transfers. With these changes, CPU usage of the threaded interrupt handler, which calls spi_sync(), was reduced from 83% to 73% while at the same time the sample rate (frequency of SPI xfers) was increased from 20kHz to 25kHz. [1]: https://lore.kernel.org/linux-spi/20240109-axi-spi-engine-series-3-v1-1-e42c6a986580@baylibre.com/T/ [2]: https://lore.kernel.org/linux-spi/E81F4810-48DD-41EE-B110-D0D848B8A510@martin.sperl.org/T/ [3]: https://lore.kernel.org/linux-spi/39DEC004-10A1-47EF-9D77-276188D2580C@martin.sperl.org/T/ [4]: https://lore.kernel.org/linux-spi/20220525163946.48ea40c9@erd992/T/ --- Changes in v2: - Removed pre_optimized parameter from __spi_optimize_message() - Added comment explaining purpose of pre_optimized flag - Fixed missing doc comment for @pre_optimized - Removed kernel doc inclusion (/** -> /*) from static members - Removed unrelated comment about calling spi_finalize_current_message() - Reworked IIO driver patch - Link to v1: https://lore.kernel.org/r/20240212-mainline-spi-precook-message-v1-0-a2373cd72d36@baylibre.com --- David Lechner (5): spi: add spi_optimize_message() APIs spi: move splitting transfers to spi_optimize_message() spi: stm32: move splitting transfers to optimize_message spi: axi-spi-engine: move message compile to optimize_message iio: adc: ad7380: use spi_optimize_message() drivers/iio/adc/ad7380.c | 36 +++++- drivers/spi/spi-axi-spi-engine.c | 40 +++--- drivers/spi/spi-stm32.c | 28 +++-- drivers/spi/spi.c | 259 ++++++++++++++++++++++++++++++++------- include/linux/spi/spi.h | 20 +++ 5 files changed, 297 insertions(+), 86 deletions(-) --- base-commit: 55072343f1df834879b8bae9e419cd5cbb5f3259 prerequisite-patch-id: 844c06b6caf25a2724e130dfa7999dc90dd26fde change-id: 20240208-mainline-spi-precook-message-189b2f08ba7f _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2024-02-19 22:34 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-19 22:33 David Lechner [this message] 2024-02-19 22:33 ` [PATCH v2 0/5] spi: add support for pre-cooking messages David Lechner 2024-02-19 22:33 ` [PATCH v2 1/5] spi: add spi_optimize_message() APIs David Lechner 2024-02-19 22:33 ` David Lechner 2024-02-20 10:50 ` Nuno Sá 2024-02-20 10:50 ` Nuno Sá 2024-02-24 16:36 ` Jonathan Cameron 2024-02-24 16:36 ` Jonathan Cameron 2024-02-24 18:15 ` Markus Elfring 2024-02-24 18:15 ` Markus Elfring 2024-02-24 20:09 ` Markus Elfring 2024-02-24 20:09 ` Markus Elfring 2024-02-26 13:48 ` Mark Brown 2024-02-26 13:48 ` Mark Brown 2024-02-19 22:33 ` [PATCH v2 2/5] spi: move splitting transfers to spi_optimize_message() David Lechner 2024-02-19 22:33 ` David Lechner 2024-02-20 10:52 ` Nuno Sá 2024-02-20 10:52 ` Nuno Sá 2024-02-19 22:33 ` [PATCH v2 3/5] spi: stm32: move splitting transfers to optimize_message David Lechner 2024-02-19 22:33 ` David Lechner 2024-02-24 16:45 ` Jonathan Cameron 2024-02-24 16:45 ` Jonathan Cameron 2024-02-19 22:33 ` [PATCH v2 4/5] spi: axi-spi-engine: move message compile " David Lechner 2024-02-19 22:33 ` David Lechner 2024-02-20 10:45 ` Nuno Sá 2024-02-20 10:45 ` Nuno Sá 2024-02-24 16:51 ` Jonathan Cameron 2024-02-24 16:51 ` Jonathan Cameron 2024-02-19 22:33 ` [PATCH v2 5/5] iio: adc: ad7380: use spi_optimize_message() David Lechner 2024-02-19 22:33 ` David Lechner 2024-02-20 10:41 ` Nuno Sá 2024-02-20 10:41 ` Nuno Sá 2024-02-24 16:57 ` Jonathan Cameron 2024-02-24 16:57 ` Jonathan Cameron 2024-02-27 16:36 ` David Lechner 2024-02-27 16:36 ` David Lechner 2024-02-26 19:16 ` (subset) [PATCH v2 0/5] spi: add support for pre-cooking messages Mark Brown 2024-02-26 19:16 ` 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=20240219-mainline-spi-precook-message-v2-0-4a762c6701b9@baylibre.com \ --to=dlechner@baylibre.com \ --cc=Jonathan.Cameron@huawei.com \ --cc=alain.volmat@foss.st.com \ --cc=alexandre.torgue@foss.st.com \ --cc=broonie@kernel.org \ --cc=david@protonic.nl \ --cc=jic23@kernel.org \ --cc=jstephan@baylibre.com \ --cc=kernel@martin.sperl.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-iio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-spi@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=mcoquelin.stm32@gmail.com \ --cc=michael.hennerich@analog.com \ --cc=nuno.sa@analog.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: linkBe 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.