summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyeonSeung Jang <hs8848.jang@samsung.com>2006-10-04 15:26:13 (GMT)
committerPaul Mackerras <paulus@samba.org>2006-10-04 23:21:01 (GMT)
commit28347bce8a837258e737873a55d31f2f424a6ea6 (patch)
tree4d19e9abee0ad539ee4a1e1c6877f71e7617612e
parenta68cf983f635930ea35f9e96b27d96598550dea0 (diff)
downloadlinux-fsl-qoriq-28347bce8a837258e737873a55d31f2f424a6ea6.tar.xz
[POWERPC] spufs: fix context switch during page fault
For better explanation, I break down the page fault handling into steps: 1) There is a page fault caused by DMA operation initiated by SPU and DMA is suspended. 2) The interrupt handler 'spu_irq_class_1()/__spu_trap_data_map()' is called and it just wakes up the sleeping spe-manager thread. 3) by PPE scheduler, the corresponding bottom half, spu_irq_class_1_bottom() is called in process context and DMA is restarted. There can be a quite large time gap between 2) and 3) and I found the following problem: Between 2) and 3) If the context becomes unbound, 3) is not executed because when the spe-manager thread is awaken, the context is already saved. (This situation can happen, for example, when a high priority spe thread newly started in that time gap) But the actual problem is that the corresponding SPU context does not work even if it is bound again to a SPU. Besides I can see the following warning in mambo simulator when the context becomes unbound(in save_mfc_cmd()), i.e. when unbind() is called for the context after step 2) before 3) : 'WARNING: 61392752237: SPE2: MFC_CMD_QUEUE channel count of 15 is inconsistent with number of available DMA queue entries of 16' After I go through available documents, I found that the problem is because the suspended DMA is not restarted when it is bound again. Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 9d9d82d..0f782ca 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -1779,6 +1779,15 @@ static inline void restore_mfc_cntl(struct spu_state *csa, struct spu *spu)
*/
out_be64(&priv2->mfc_control_RW, csa->priv2.mfc_control_RW);
eieio();
+ /*
+ * FIXME: this is to restart a DMA that we were processing
+ * before the save. better remember the fault information
+ * in the csa instead.
+ */
+ if ((csa->priv2.mfc_control_RW & MFC_CNTL_SUSPEND_DMA_QUEUE_MASK)) {
+ out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND);
+ eieio();
+ }
}
static inline void enable_user_access(struct spu_state *csa, struct spu *spu)