Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2924928pxa; Tue, 18 Aug 2020 01:30:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz6TRUvuGJ9WfOjRk2NsYJMubR1Wxszmnd4mOKWnhGly5NnO/NvKYmt/6MZg7jBPhikKO3 X-Received: by 2002:a05:6402:1bc5:: with SMTP id ch5mr18118252edb.364.1597739411629; Tue, 18 Aug 2020 01:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597739411; cv=none; d=google.com; s=arc-20160816; b=fZtzThm5XZ8RjJBK3U6EjRILLJgPthlwHJrWLk9TlxaDVVk9sm9iA938euJKfJ/ntt nsNHzai2lRySOoxPwKYqXnd+Rr4akTjoY2v1Jj7UG94pueW8IPF6EAdjzysrHqys3tRo oU/qct1OLMSSMm2z1DnKLs63McVHmgB/Beq5vbkhVgIkm429//ogD5OEWTfzYOo6A8BE iUBH8P94IzJ8LDCJU+S14fE4b4Vt22y2KhaQforQKD4rEc/z9T2TGrWMjej3ZoNojQom B1X+KoGXvSug8G1ZhB+IYUpxpU5LJTK5KJXh0bNQOlF9EXMSHx9NbTLCgk2VMJBzjan7 Ew9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gPFyLTIegbMbhCl/SHxbZho1NDgw4y9nB98xI43nArc=; b=Mn5Qj4kzU8W3cDcKdzeFPg74uQdSCH3hwKbiFjjbXiZcS8cflYwOcA1RQ2sH9oLizQ WwFNnx+4twu8zdikA8dod4t6/Reb/aGNAVD5mVpEIOzjn1PYtG+IIEv7ObknMxasuNue Tx5kDXu1dDHPDi5iUUhWAd3MV6XZh/IVueD+6Lr26MWRr+G92uLaEoY9jOIq36kWw7jk 66dMt2FuGf5/r+YdOuoXYSwznTXKbBk+710G7/GRhkjcfK0rpl/7rPDYK4XzR8q5rTAp OLrsT29279FiDPJp9uGRH0xEOVT5ngkhWR2eRhasSYtSqu9+AiDgVhFjztPl7L79NLDl px3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXk37qGM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si12619868ejj.626.2020.08.18.01.29.47; Tue, 18 Aug 2020 01:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXk37qGM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726336AbgHRI3A (ORCPT + 99 others); Tue, 18 Aug 2020 04:29:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:34474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726043AbgHRI3A (ORCPT ); Tue, 18 Aug 2020 04:29:00 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06C49206B5; Tue, 18 Aug 2020 08:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597739339; bh=gPFyLTIegbMbhCl/SHxbZho1NDgw4y9nB98xI43nArc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EXk37qGMQptQYYGyQs1hk7neeMhgMHNghUpk6hUZihonCozzdkwOKG/6057M2UhZO YMAVfOdBg7mFDBkFTd7Xa6ugS61m006dGMSQb6JbFBJj5oL4C+XIOVHwxPo7EKFFDA Vg8I8t7hE6jCa1Bu62ua4ap0lhEvXhFZ2im2dcc8= Date: Tue, 18 Aug 2020 09:28:53 +0100 From: Will Deacon To: Cho KyongHo Cc: joro@8bytes.org, catalin.marinas@arm.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com, robin.murphy@arm.com, janghyuck.kim@samsung.com, hyesoo.yu@samsung.com Subject: Re: [PATCH 1/2] dma-mapping: introduce relaxed version of dma sync Message-ID: <20200818082852.GA15145@willie-the-truck> References: <1597736591-20457-1-git-send-email-pullip.cho@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1597736591-20457-1-git-send-email-pullip.cho@samsung.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 18, 2020 at 04:43:10PM +0900, Cho KyongHo wrote: > Cache maintenance operations in the most of CPU architectures needs > memory barrier after the cache maintenance for the DMAs to view the > region of the memory correctly. The problem is that memory barrier is > very expensive and dma_[un]map_sg() and dma_sync_sg_for_{device|cpu}() > involves the memory barrier per every single cache sg entry. In some > CPU micro-architecture, a single memory barrier consumes more time than > cache clean on 4KiB. It becomes more serious if the number of CPU cores > are larger. Have you got higher-level performance data for this change? It's more likely that the DSB is what actually forces the prior cache maintenance to complete, so it's important to look at the bigger picture, not just the apparent relative cost of these instructions. Also, it's a miracle that non-coherent DMA even works, so I'm not sure that we should be complicating the implementation like this to try to make it "fast". Will