]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
carma-fpga: fix race between data dumping and DMA callback
authorIra Snyder <iws@ovro.caltech.edu>
Thu, 26 Jan 2012 11:00:14 +0000 (11:00 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 27 Feb 2012 00:33:59 +0000 (11:33 +1100)
commit6c15d7afbb2f9e2d3114b513306dae736b56f535
tree17ad7aa4544ad1d83b50eb4929f77b7793b5f0f4
parent75ff85a81680e5779383aa6210a4f89ed76e40ec
carma-fpga: fix race between data dumping and DMA callback

When the system is under heavy load, we occasionally saw a problem where
the system would get a legitimate interrupt when they should be
disabled.

This was caused by the data_dma_cb() DMA callback unconditionally
re-enabling FPGA interrupts even when data dumping is disabled. When
data dumping was re-enabled, the irq handler would fire while a DMA was
in progress. The "BUG_ON(priv->inflight != NULL);" during the second
invocation of the DMA callback caused the system to crash.

To fix the issue, the priv->enabled boolean is moved under the
protection of the priv->lock spinlock. The DMA callback checks the
boolean to know whether to re-enable FPGA interrupts before it returns.

Now that it is fixed, the driver keeps FPGA interrupts disabled when it
expects that they are disabled, fixing the bug.

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
drivers/misc/carma/carma-fpga.c