diff options
author | Jon Hunter <jon-hunter@ti.com> | 2012-10-11 15:43:01 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-01-08 01:05:01 -0500 |
commit | 9743a3b62dee8c9d8af1319f8d1c1ff39130267d (patch) | |
tree | 48252c1a1ee909d59fe64e719520a8005576184d /drivers/block/z2ram.c | |
parent | 5ca7c109e8eee8d97267d3308548509bb80d8bf0 (diff) |
of: dma: fix protection of DMA controller data stored by DMA helpers
In the current implementation of the OF DMA helpers, read-copy-update (RCU)
linked lists are being used for storing and accessing the DMA controller data.
This part of implementation is based upon V2 of the DMA helpers by Nicolas [1].
During a recent review of RCU, it became apparent that the code is missing the
required rcu_read_lock()/unlock() calls as well as synchronisation calls before
freeing any memory protected by RCU.
Having looked into adding the appropriate RCU calls to protect the DMA data it
became apparent that with the current DMA helper implementation, using RCU is
not as attractive as it may have been before. The main reasons being that ...
1. We need to protect the DMA data around calls to the xlate function.
2. The of_dma_simple_xlate() function calls the DMA engine function
dma_request_channel() which employs a mutex and so could sleep.
3. The RCU read-side critical sections must not sleep and so we cannot hold
an RCU read lock around the xlate function.
Therefore, instead of using RCU, an alternative for this use-case is to employ
a simple spinlock inconjunction with a usage count variable to keep track of
how many current users of the DMA data structure there are. With this
implementation, the DMA data cannot be freed until all current users of the
DMA data are finished.
This patch is based upon the DMA helpers fix for potential deadlock [2].
[1] http://article.gmane.org/gmane.linux.ports.arm.omap/73622
[2] http://marc.info/?l=linux-arm-kernel&m=134859982520984&w=2
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/block/z2ram.c')
0 files changed, 0 insertions, 0 deletions