From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A84A0C433EF for ; Wed, 13 Apr 2022 05:00:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 30C0740903; Wed, 13 Apr 2022 05:00:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lXrBLzm-Bwrj; Wed, 13 Apr 2022 05:00:07 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id BDB9D408EB; Wed, 13 Apr 2022 05:00:06 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8B611C0033; Wed, 13 Apr 2022 05:00:06 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id CB8DBC002C for ; Wed, 13 Apr 2022 05:00:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id B0CE240169 for ; Wed, 13 Apr 2022 05:00:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZZh3e82eb0y1 for ; Wed, 13 Apr 2022 05:00:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by smtp2.osuosl.org (Postfix) with ESMTPS id BBDAE40105 for ; Wed, 13 Apr 2022 05:00:03 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 6C12F68B05; Wed, 13 Apr 2022 06:59:58 +0200 (CEST) Date: Wed, 13 Apr 2022 06:59:58 +0200 From: Christoph Hellwig To: Chao Gao Subject: Re: [PATCH] dma-direct: avoid redundant memory sync for swiotlb Message-ID: <20220413045958.GA31209@lst.de> References: <20220412113805.3210-1-chao.gao@intel.com> <20220413010157.GA10502@gao-cwp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220413010157.GA10502@gao-cwp> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: Kevin Tian , Wang Zhaoyang1 , linux-kernel@vger.kernel.org, Gao Liang , iommu@lists.linux-foundation.org, Robin Murphy , hch@lst.de X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Wed, Apr 13, 2022 at 09:02:02AM +0800, Chao Gao wrote: > dma_direct_sync_single_for_cpu() also calls arch_sync_dma_for_cpu_all() > and arch_dma_mark_clean() in some cases. if SWIOTLB does sync internally, > should these two functions be called by SWIOTLB? > > Personally, it might be better if swiotlb can just focus on bounce buffer > alloc/free. Adding more DMA coherence logic into swiotlb will make it > a little complicated. > > How about an open-coded version of dma_direct_sync_single_for_cpu > in dma_direct_unmap_page with swiotlb_sync_single_for_cpu replaced by > swiotlb_tbl_unmap_single? I don't think the swiotlb and non-coherent case ever fully worked. Before the merge of swiotlb into dma-direct they obviously were mutally exclusive, and even now all the cache maintainance is done on the physical address of the original data, not the swiotlb buffer. If we want to fix that properly all the arch dma calls will need to move into swiotlb, but that is a much bigger patch. So for now I'd be happy with the one liner presented here, but eventually the whole area could use an overhaul. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu