[Cbe-oss-dev] Context switching while page fault handling and warning

HyeonSeung Jang hs8848.jang at samsung.com
Wed Jun 14 10:30:24 EST 2006


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.
 
So I fixed the kernel codes like following:
 
Before:
 
static inline void restore_mfc_cntl(struct spu_state *csa, struct spu
*spu)
{
             struct spu_priv2 __iomem *priv2 = spu->priv2;
 
             /* Restore, Step 72:
              *    Restore the MFC_CNTL register for the CSA.
              */
             out_be64(&priv2->mfc_control_RW, csa-
>priv2.mfc_control_RW);
             eieio();
}
 
After:
 
static inline void restore_mfc_cntl(struct spu_state *csa, struct spu
*spu)
{
             struct spu_priv2 __iomem *priv2 = spu->priv2;
 
             /* Restore, Step 72:
              *    Restore the MFC_CNTL register for the CSA.
              */
             out_be64(&priv2->mfc_control_RW, csa-
>priv2.mfc_control_RW);
             eieio();
             if( (csa->priv2.mfc_control_RW &
MFC_CNTL_SUSPEND_DMA_QUEUE_MASK)) {
                           out_be64(&priv2->mfc_control_RW,
MFC_CNTL_RESTART_DMA_COMMAND);
                           eieio();
             }
}
 
It seems to work.
 
 
 
Now I have two questions :
 
1) My fix is correct ? or are there any side effects of it ?
 
2) Why there is following warning on mambo simulator? :
   'WARNING: 61392752237: SPE2: MFC_CMD_QUEUE channel count of 15 is
inconsistent with number of available DMA queue entries of 16'
 
 
Regards,
Jang.
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20060614/3aebfeef/attachment.htm>


More information about the cbe-oss-dev mailing list