From aefd086f54d47a4d24c51ea5614223733c2f860e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Tue, 12 Oct 2010 17:30:48 +0800 Subject: [PATCH] dma: fix sleep in atomic bug dma_alloc_coherent use GFP_ATOMIC, fix this bug: BUG: sleeping function called from invalid context at mm/page_alloc.c:1939 in_atomic(): 1, irqs_disabled(): 0, pid: 44, name: mmcqd 2 locks held by mmcqd/44: #0: (&host->lock){......}, at: [] rk2818_sdmmc_request+0x38/0x7c #1: (&rk2818_dma[i].lock){......}, at: [] rk28_dma_request+0x28/0x108 [] (unwind_backtrace+0x0/0xdc) from [] (dump_stack+0x18/0x1c) [] (dump_stack+0x18/0x1c) from [] (__might_sleep+0x124/0x144) [] (__might_sleep+0x124/0x144) from [] (__alloc_pages_nodemask+0xb8/0x5ac) [] (__alloc_pages_nodemask+0xb8/0x5ac) from [] (__dma_alloc+0x150/0x3e0) [] (__dma_alloc+0x150/0x3e0) from [] (dma_alloc_coherent+0x58/0x64) [] (dma_alloc_coherent+0x58/0x64) from [] (rk28_dma_request+0x78/0x108) [] (rk28_dma_request+0x78/0x108) from [] (request_dma+0x7c/0xa8) [] (request_dma+0x7c/0xa8) from [] (rk2818_sdmmc_start_request+0x25c/0x38c) [] (rk2818_sdmmc_start_request+0x25c/0x38c) from [] (rk2818_sdmmc_request+0x58/0x7c) [] (rk2818_sdmmc_request+0x58/0x7c) from [] (mmc_wait_for_req+0x150/0x16c) [] (mmc_wait_for_req+0x150/0x16c) from [] (mmc_blk_issue_rq+0x234/0x4b8) [] (mmc_blk_issue_rq+0x234/0x4b8) from [] (mmc_queue_thread+0x100/0x104) [] (mmc_queue_thread+0x100/0x104) from [] (kthread+0x84/0x8c) [] (kthread+0x84/0x8c) from [] (kernel_thread_exit+0x0/0x8) --- arch/arm/mach-rk2818/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-rk2818/dma.c b/arch/arm/mach-rk2818/dma.c index 81b945c03c4c..ca05cfc77000 100644 --- a/arch/arm/mach-rk2818/dma.c +++ b/arch/arm/mach-rk2818/dma.c @@ -506,7 +506,7 @@ static int rk28_dma_request(unsigned int dma_ch, dma_t *dma_t) /*channel 0 and 1 support llp, but others does not*/ if (dma_ch < RK28_DMA_CH2) { - rk28dma->dma_llp_vir = (struct rk28_dma_llp *)dma_alloc_coherent(NULL, RK28_MAX_DMA_LLPS*sizeof(struct rk28_dma_llp), &rk28dma->dma_llp_phy, GFP_KERNEL); + rk28dma->dma_llp_vir = (struct rk28_dma_llp *)dma_alloc_coherent(NULL, RK28_MAX_DMA_LLPS*sizeof(struct rk28_dma_llp), &rk28dma->dma_llp_phy, GFP_ATOMIC); if (!rk28dma->dma_llp_vir) { printk(KERN_ERR "dma_request: no dma space can be allocated for llp by virtual channel %d\n", dma_ch); return -ENOMEM; -- 2.34.1