Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753687AbZIHNFQ (ORCPT ); Tue, 8 Sep 2009 09:05:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753293AbZIHNFP (ORCPT ); Tue, 8 Sep 2009 09:05:15 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:35482 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752540AbZIHNFN convert rfc822-to-8bit (ORCPT ); Tue, 8 Sep 2009 09:05:13 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=w4P7YuJ0hidVCZKUGLD1OYmOgTNKK/eWad4LFsVNL9hLhugEEiSnBQe/73YhIHhFka jIF2nL6nqrfddGW9g6UA+oTeao8h358z+GCD5FL5ONZDl2IEUohQmtny7ld66OmWq8ZB cKZ46AYTWSaLH0F9AUI3i/fmEEbh5bu8MqDBQ= MIME-Version: 1.0 In-Reply-To: <20090903083600.GA7235@n2100.arm.linux.org.uk> References: <200908061208.22131.laurent.pinchart@ideasonboard.com> <20090901132824.GN19719@n2100.arm.linux.org.uk> <200909011543.48439.laurent.pinchart@ideasonboard.com> <20090902151044.GG30183@localhost> <20090903083600.GA7235@n2100.arm.linux.org.uk> Date: Tue, 8 Sep 2009 09:05:14 -0400 Message-ID: Subject: Re: How to efficiently handle DMA and cache on ARMv7 ? (was "Is get_user_pages() enough to prevent pages from being swapped out ?") From: Steven Walter To: Russell King - ARM Linux Cc: Imre Deak , ext Laurent Pinchart , David Xiao , Ben Dooks , Hugh Dickins , Robin Holt , "linux-kernel@vger.kernel.org" , v4l2_linux , "linux-arm-kernel@lists.arm.linux.org.uk" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1887 Lines: 42 On Thu, Sep 3, 2009 at 4:36 AM, Russell King - ARM Linux wrote: > On Wed, Sep 02, 2009 at 06:10:44PM +0300, Imre Deak wrote: >> To my understanding buffers returned by dma_alloc_*, kmalloc, vmalloc >> are ok: > > For dma_map_*, the only pages/addresses which are valid to pass are > those returned by get_free_pages() or kmalloc. ?Everything else is > not permitted. > > Use of vmalloc'd and dma_alloc_* pages with the dma_map_* APIs is invalid > use of the DMA API. ?See the notes in the DMA-mapping.txt document > against "dma_map_single". Actually, DMA-mapping.txt seems to explicitly say that it's allowed to use pages allocated by vmalloc: "It is possible to DMA to the _underlying_ memory mapped into a vmalloc() area, but this requires walking page tables to get the physical addresses, and then translating each of those pages back to a kernel address using something like __va()." >> For user mappings I think you'd have to do an additional flush for >> the direct mapping, while the user mapping is flushed in dma_map_*. > > I will not accept a patch which adds flushing of anything other than > the kernel direct mapping in the dma_map_* functions, so please find > a different approach. What's the concern here? Just the performance overhead of the checks and additional flushes? It seems much more desirable for the dma_map_* API to take care of potential cache aliases than to require every driver to manage it for itself. After all, part of the purpose of the DMA API is to manage the cache maintenance around DMAs in an architecture-independent way. -- -Steven Walter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/