Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759082AbZF2N6Z (ORCPT ); Mon, 29 Jun 2009 09:58:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751906AbZF2N6S (ORCPT ); Mon, 29 Jun 2009 09:58:18 -0400 Received: from wf-out-1314.google.com ([209.85.200.175]:49071 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307AbZF2N6R convert rfc822-to-8bit (ORCPT ); Mon, 29 Jun 2009 09:58:17 -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=fG0hjau72ERTWByH6Dee3ctfEVyKtjAyltnG7RERqEl9XgWifbjjGmcRVMpKs2er1D B3Aq72feiXCInRG4FGoo4Hm2Bjac3tL/PCWZb9vQ6tzNZ3Yl0SYa5yseFWzfczi4Pt5r lZzAqJ0sH24FYq22qrzpaPiNdPnSPIQ/EtZlk= MIME-Version: 1.0 In-Reply-To: <20090629123142.GL5139@amd.com> References: <1246199959-6548-1-git-send-email-tom.leiming@gmail.com> <200906281534.37148.arnd@arndb.de> <20090629123142.GL5139@amd.com> Date: Mon, 29 Jun 2009 21:51:34 +0800 Message-ID: Subject: Re: [PATCH][RFC] asm-generic:remove calling flush_write_buffers() in dma_sync_*_for_cpu From: Ming Lei To: Joerg Roedel Cc: Arnd Bergmann , fujita.tomonori@lab.ntt.co.jp, linux-kernel@vger.kernel.org, akpm@linux-foundation.org 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: 2058 Lines: 56 2009/6/29 Joerg Roedel : > On Sun, Jun 28, 2009 at 03:34:35PM +0000, Arnd Bergmann wrote: >> On Sunday 28 June 2009 14:39:19 tom.leiming@gmail.com wrote: >> > From: Ming Lei >> > >> > dma_sync_*_for_cpu() is introduced to make cpu access dma buffers safely when >> > dma transfer is over, it seems there is nothing to do with cpu write buffer, >> > so remove it. >> > >> > Signed-off-by: Ming Lei >> >> Right, this looks correct. On a related note, flush_write_buffers is >> architecture specific right now: only x86 and frv implement it at all, >> though and with slightly different semantics. > > This doen't look correct to me. The sync functions may do bounce buffering > which is all about copying data from one place in main memory to another. So we > need these flush_write_buffer() calls in the _for_cpu path too. IMHO, even we do not call flush_write_buffer(), CPU can read correct data from the dma buffer since write buffer can't affect cache, right? Thanks. > >> Maybe it would be more consistent to change the dma_map_* and >> dma_sync_*_for_device stuff there to wmb() to make it ?portable >> to other architectures. > > If we change it to wmb() it would be executed every time there even if the > processor doesn't require it. Other architectures could simply add a > flush_write_buffers() implemention if they want to adapt the common dma-mapping > implementation, no? > > ? ? ? ?Joerg > > -- > ? ? ? ? ? | Advanced Micro Devices GmbH > ?Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei M?nchen > ?System ? ?| > ?Research ?| Gesch?ftsf?hrer: Thomas M. McCoy, Giuliano Meroni > ?Center ? ?| Sitz: Dornach, Gemeinde Aschheim, Landkreis M?nchen > ? ? ? ? ? | Registergericht M?nchen, HRB Nr. 43632 > > -- Lei Ming -- 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/