On Sun, Jan 02, 2011 at 01:42:31AM -0800, Dan Williams wrote:
The device_prep/submit/terminate/pause/resume interface is really what
I was referring to - the behaviour of these needs to be really well
defined otherwise there will be problems.
Ok, that means error checking on the dmaengine_submit() result in slave
DMA drivers should be removed - which makes things simpler.
I was initially thinking more of the case where we have:
tasklet->callback->attempted submission of next tx buffer,
submission failure->terminate_all->tasklet_disable
As tasklet_disable() will wait for the tasklet to finish running, this
results in deadlock. This is exactly what could happen with the PL011
UART driver's usage of the DMA engine API. However, as a result of your
comments, I've removed the terminate_all calls in those failure paths as
they're entirely unnecessary. So that problem is solved.
However, that is not the only place where this can happen:
CPU0 CPU1
takes slave driver spinlock
tasklet
callback
spins on slave driver spinlock
terminate_all
tasklet_disable
That also leads to deadlock - and again is something still to be solved
between the PL011 UART driver and PL08x DMA driver.
This scenario also applies if you do similar things in the DMA engine
driver. Most DMA engine drivers take a spinlock within their tasklet.
CPU0 CPU1
terminate_all
tasklet
takes DMA engine driver spinlock
spins on DMA engine driver spinlock
tasklet_disable
So... beware of DMA engine drivers which use tasklet_disable() in their
terminate_all path! (Maybe this should be a no-no.)
I think you mean "submit must succeed if prep succeeds".
Ok, so that's something else which needs fixing in PL08x.
--