From mboxrd@z Thu Jan 1 00:00:00 1970 From: andreas.herrmann@calxeda.com (Andreas Herrmann) Date: Fri, 31 Jan 2014 09:46:23 +0100 Subject: iommu/arm-smmu: Regression (sleeping function called from invalid context) In-Reply-To: <20140130235552.GL13543@alberich> References: <20140130235552.GL13543@alberich> Message-ID: <20140131084623.GN13543@alberich> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Jan 31, 2014 at 12:55:52AM +0100, Andreas Herrmann wrote: > Hi Will, > > Seems that commit a44a9791e778d9ccda50d5534028ed4057a9a45b > (iommu/arm-smmu: use mutex instead of spinlock for locking page tables) > introduced a regression. > > At least I've hit > > BUG: scheduling while atomic: ksoftirqd/0/3/0x00000100 >... > BUG: sleeping function called from invalid context at mm/page_alloc.c:2679 > in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0 > CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.13.0-00016-g6e90346 #413 > [] (unwind_backtrace+0x0/0xf8) from [] (show_stack+0x10/0x14) > [] (show_stack+0x10/0x14) from [] (dump_stack+0x74/0xa8) > [] (dump_stack+0x74/0xa8) from [] (__alloc_pages_nodemask+0x174/0x930) > [] (__alloc_pages_nodemask+0x174/0x930) from [] (arm_smmu_handle_mapping+0x470/0x66c) > [] (arm_smmu_handle_mapping+0x470/0x66c) from [] (iommu_map+0xf0/0x148) > [] (iommu_map+0xf0/0x148) from [] (__map_sg_chunk+0x198/0x2d4) >... > Maybe that was the reason why the offending commit was introduced(?). > > I think with the current code "atomic allocations" should be used when > IO page tables are created. With below patch I've not triggered above > errors. I think allocating memory with GFP_KERNEL in this dma-mapping path doesn't seem to be a good idea. What if the DMA operation for which we modify IO page tables was triggered to free pages (page cache, swap)? Andreas