Skip to content
  • Alexander Kochetkov's avatar
    dmaengine: pl330: fix descriptor allocation fail · e5887103
    Alexander Kochetkov authored
    
    
    If two concurrent threads call pl330_get_desc() when DMAC descriptor
    pool is empty it is possible that allocation for one of threads will fail
    with message:
    
    kernel: dma-pl330 20078000.dma-controller: pl330_get_desc:2469 ALERT!
    
    Here how that can happen. Thread A calls pl330_get_desc() to get
    descriptor. If DMAC descriptor pool is empty pl330_get_desc() allocates
    new descriptor on shared pool using add_desc() and then get newly
    allocated descriptor using pluck_desc(). At the same time thread B calls
    pluck_desc() and take newly allocated descriptor. In that case descriptor
    allocation for thread A will fail.
    
    Using on-stack pool for new descriptor allow avoid the issue described.
    The patch modify pl330_get_desc() to use on-stack pool for allocation
    new descriptors.
    
    Signed-off-by: default avatarAlexander Kochetkov <al.kochet@gmail.com>
    Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
    e5887103