On Tue, Jun 21, 2022 at 8:16 AM David Jander <david@xxxxxxxxxxx> wrote: > > There are only a few drivers that do not call > spi_finalize_current_message() in the context of transfer_one_message(), > and even for those cases the completion ctlr->cur_msg_completion is not > needed always. The calls to complete() and wait_for_completion() each > take a spin-lock, which is costly. This patch makes it possible to avoid > those calls in the big majority of cases, by introducing two flags that > with the help of ordering via barriers can avoid using the completion > safely. In case of a race with the context calling > spi_finalize_current_message(), the scheme errs on the safe side and takes > the completion. > The impact of this patch is worth the effort: On a i.MX8MM SoC, the time > the SPI bus is idle between two consecutive calls to spi_sync(), is > reduced from 19.6us to 16.8us... roughly 15%. ... > + smp_wmb(); /* make these available to spi_finalize_current_message */ spi_finalize_current_message() ... > + smp_mb(); /* see spi_finalize_current_message()... */ Be consistent with capitalization of one-liner comments, see below. ... > + smp_mb(); /* See __spi_pump_transfer_message()... */ ^^^ This comment (and any other) applies to the entire series where it makes sense. -- With Best Regards, Andy Shevchenko