Re: [PATCH V1] spi: core: wake kworker only when there is a message in the queue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 30.11.2018, at 15:55, kernel@xxxxxxxxxxxxxxxx wrote:
> 
> From: Martin Sperl <kernel@xxxxxxxxxxxxxxxx>
> 
> Right now the worker thread running spi_pump_message is always woken
> during spi_finalize_current_message.
> 
...
> For spi_sync transfers in a tight loop (say 40k messages/s) this
> avoids the penalty of waking the worker thread 40k times/s.
> On a rasperry pi 3 with 4 cores the results in 32% of a single core
> only to find out that there is nothing in the queue and it can go back
> to sleep.
Note that this also can be observed with can controllers connected to
the spi bus where during high CAN-bus load 20-30k spi_sync messages/s are 
processed resulting in the kthread of spi0 conduming 30% CPU of a 
single core.

> 
> With this patch applied the spi-worker is not even woken one!
> 
Further testing with mixed spi_sync and spi_async shows that spi_async
is no longer working properly.

This seems to be related to shutdown code getting triggered in the
next loop of _spi_pump_message, which is not called with this patch
in place.

More investigation and probably a more inversive patch is needed
to solve this problem for real.

While reading the code it seems as if controller teardown and
here ctlr->unprepare_transfer_hardware and pm_runtime_* are 
possibly called way more often than necessary - i.e. whenever
the queue is empty.

Maybe deferring this a few jiffies is all that is needed
and would be an improvement as well…

Martin






[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux