Re: [PATCH 0/2] spi: Add support for non-blocking synchronoustransfers

From: Balaji Rao
Date: Sat Feb 28 2009 - 17:13:18 EST


On Sat, Feb 28, 2009 at 12:33:50PM -0800, David Brownell wrote:
> Note that $SUBJECT concept is nonsense.
> Synchronous calls are by definition blocking ones...
>
>

FWIW, it is exactly this that we want to change.

> On Saturday 28 February 2009, Balaji Rao wrote:
> > During the course of development of an accelerometer driver, we saw the
> > necessity to execute spi transfers synchronously within an interrupt handler.
>
> This sounds like a bad design. How can you know that no other
> transfers are going on ... or are queued in front of the transfer
> you're requesting?
>
> You'd need to wait for all the other transfers to work their
> way through the transfer queue. There are *much* better things
> to do in interrupt handlers.
>

Please do look at the patches. We *don't* use a transfer queue.
Transfers requested through our proposed function should/will complete the
transfer when it returns without sleeping in between. (Which is the whole
point of this patch).

>
> > When using a workqueue instead, we observed a huge number of overruns
> > with very high cpu utlization, which is unacceptable.
>
> Sure, but at least part of that seems to be caused by some
> broken design assumptions.
>

No, it's not. Read below.

> Why are you even trying to touch SPI devices from hardirq
> context? That's never going to be OK; "can't-sleep" contexts
> don't mix with "must-sleep" calls.
>
>

Accelerometers can produce a huge amount of data and we need to quickly
read them to avoid overruns. Also, scheduling workers for this greatly
increases the number of context switches, unnecessarily.

> > This series adds a new interface for this and modifies no existing ones.
>
> NAK on these two patches.
>

Ok, it will be helpful if you please suggest an alternative keeping in
mind the huge amount of data produced by the accelerometer and the need
to read them quickly ?

Thanks,
Balaji
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/