spi: unoptimize message when queuing it fails
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 1 replyIn review
- v22 patches 1 replySuperseded
- v114 patches 5 repliesSuperseded
Changes in v3 from the cover letter
- Rebased on spi/for-7.5.
- Patch 2: include drivers/spi/tests unconditionally from drivers/spi/Makefile instead of adding a second conditional line, as you suggested.
- Patch 2: add the test to the existing drivers/spi/.kunitconfig, which also runs the DMA tests, instead of adding a new one.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | spi: unoptimize message when queuing it failsdrivers/ | +7 | 0 replies | |
| 2/2 | spi: add KUnit tests for message optimize state on queue errorsdrivers/ drivers/ drivers/ +2 more | +278 | 0 replies |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | David Lechner |
|---|---|
| 1/2 | R-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/2] spi: unoptimize message when queuing it fails
From: Joseph CT Chan <[email protected]>
Hi Mark,
spi_async() and spi_sync() optimize a message before they queue it. If queuing fails, the message is never finalized, so the split transfers and the controller's optimize state leak and the message stays marked as optimized. This happens with -EBUSY while another device holds spi_bus_lock() (for example mmc_spi), with a stopped queue, and with an error from a legacy transfer() callback. Patch 1 unoptimizes the message on those error paths, and patch 2 adds KUnit tests for them.
Tested with KUnit using --kunitconfig=drivers/spi on ARCH=um and on x86_64 under QEMU: the 7 new cases and the 4 existing DMA cases pass with patch 1, and the 3 queue error cases fail without it. Not tested on hardware.
Changes in v3:
- Rebased on spi/for-7.5.
- Patch 2: include drivers/spi/tests unconditionally from drivers/spi/Makefile instead of adding a second conditional line, as you suggested.
- Patch 2: add the test to the existing drivers/spi/.kunitconfig, which also runs the DMA tests, instead of adding a new one.
Changes in v2:
- Split out of the v1 14-patch series, as David suggested.
- Patch 1: added David's Reviewed-by.
- Patch 2: inject errors through the fake controller's transfer() callback instead of mem_ops, use designated initializers, and trim the comments.
- Moved the AI assistance note from an Assisted-by tag into the commit message.
v2: https://lore.kernel.org/linux-spi/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
Walkthrough of the bug and the tests:
https://gist.github.com/joectchan/9a14b5e6facb75058ebc5a6ff1757131
Please consider this patch series for the next merge window.
Thanks,
Joseph
Joseph CT Chan (2):
spi: unoptimize message when queuing it fails
spi: add KUnit tests for message optimize state on queue errors
drivers/spi/.kunitconfig | 1 + drivers/spi/Kconfig | 13 ++ drivers/spi/Makefile | 2 +- drivers/spi/spi.c | 7 + drivers/spi/tests/Makefile | 1 + drivers/spi/tests/spi-core-kunit.c | 262 +++++++++++++++++++++++++++++ 6 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 drivers/spi/tests/spi-core-kunit.c
base-commit: 281521f809f6a6ff406d082293faf1ed3bbfd949
Signature · 1 line
2.56.0.506.g506a7eabc5-goog