When dma zone memory used up, gckOS_AllocateNonPagedMemory() will try to
free non paged memory cache and allocate again. Such operation will cause
twice memory mutex request and cause gpu driver hang.
The solution is free the memory mutex at first before trying to free non
paged memory cache.
Date: Feb 27, 2014
Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Shawn Guo
(cherry picked from commit
79ed8edd23f990f6c1429154c2ee773c83bfd72e)
#if gcdUSE_NON_PAGED_MEMORY_CACHE
if(addr == gcvNULL)
{
+ MEMORY_UNLOCK(Os);
+ locked = gcvFALSE;
/*Free all cache and try again*/
_FreeAllNonPagedMemoryCache(Os);
+ MEMORY_LOCK(Os);
+ locked = gcvTRUE;
addr = dma_alloc_coherent(gcvNULL,
mdl->numPages * PAGE_SIZE,
&mdl->dmaHandle,