Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933630AbcJUMxU (ORCPT ); Fri, 21 Oct 2016 08:53:20 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:35255 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932247AbcJUMxS (ORCPT ); Fri, 21 Oct 2016 08:53:18 -0400 Date: Fri, 21 Oct 2016 05:53:13 -0700 From: Christoph Hellwig To: Richard Weinberger Cc: Naga Sureshkumar Relli , "dwmw2@infradead.org" , "computersforpeace@gmail.com" , "dedekind1@gmail.com" , "adrian.hunter@intel.com" , "michal.simek@xilinx.com" , Punnaiah Choudary Kalluri , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: UBIFS with dma on 4.6 kernel is not working Message-ID: <20161021125313.GA16754@infradead.org> References: <519a83bf-1244-5151-b873-bb8e1f2db3c6@nod.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <519a83bf-1244-5151-b873-bb8e1f2db3c6@nod.at> User-Agent: Mutt/1.6.1 (2016-04-27) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 820 Lines: 16 On Fri, Oct 21, 2016 at 11:29:16AM +0200, Richard Weinberger wrote: > DMA to vmalloced memory not good, it may work by chance if you transfer > less than PAGE_SIZE. > Especially on ARM. DMA to vmalloc'ed or vmap memory is perfectly fine, you just have to be very careful. I would suggest to not expose the vmalloc address to the lower layers that do DMA, but instead expose the pages, either as an array or scatterlist. Either allocate the pages using the normal page allocator and then use vm_map_ram to generate a virtual address for them (that is what XFS does for it's large metadata objects for example). Or if you can't do that iterate over the vmalloc address in page size chunks and use vmalloc_to_page (we still also do that for one piece of legacy cruft in XFS, but I'd rather avoid that for new designs).