Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5410870ybh; Wed, 7 Aug 2019 05:39:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGZtNimrHjnuAIHeNUVkfJLlaso/MYsZDfQZiNEqzgVNTvZObYwx1XkybW2Z9QCG0y36WG X-Received: by 2002:aa7:9afc:: with SMTP id y28mr8962250pfp.252.1565181592112; Wed, 07 Aug 2019 05:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565181592; cv=none; d=google.com; s=arc-20160816; b=in4JMtX3KFFXvgYAOxbXeBC5C8xA4uEYQtmKVgkq/aY7y3/ahAA0WvqiOVvgfnmvez jgM8qSR5v3+ncMxdqWkic4UwOg/KpXWCb1FFiXRNtX7bSeN1GYBgDtG4XJnRhXS5x1cY Gv/W6tI3nFaiDFR+Rv7u5VmJtvagOPJvofL8lIH98hratshSGQDhfmk3gUa4Yo1CM44/ ZjQZMYA2cIINK5Dfa4WbvYSMGWog5fnY+92qYngs1lT3u0GuAmr+pVdlMT9Ii9EIqIy5 SGtIIgCYnM2GRJGLuNt3gezsQHdQoXruU7UYviiTSpb8UOjzsvzXsHciUhnoH1jOW8Xx DoVA== 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; bh=2pmjumdKb1Ns6Fip5yFNc02AERT+1HbHD3Cnt8l+9hU=; b=VtvPcOK6odIup+Nk/MV4OkTHf69N6Rawm7JCkgkzkPHX/DUAxxsMDjHStri+fEJ1dn B13y/AKgX1zHKgxHXCxnCY0RTflZb0qkNQRTEPtvJb40sXsVQhkO/JPIWFsoV7kIRlEV ztRkQeI008yfrrdg8mAdniysDmPM39QXvsQG/eEnzj/T+kLdS9SV0WeckOFQL+kCm4+v LTWobjL79T47QPQmvFio8VQjbPb+DkthICBNRM/Mmw5MYyY4a7j9qk15l0Aw6O4FEFV8 Cted9MYcqLXW3LTW+lDJEWKqClYIYnzJHi426JWyefXlxamw2TKyVYBuilkicmGrY/q2 aWdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s38si50196405pgl.138.2019.08.07.05.39.36; Wed, 07 Aug 2019 05:39:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729714AbfHGMiN (ORCPT + 99 others); Wed, 7 Aug 2019 08:38:13 -0400 Received: from foss.arm.com ([217.140.110.172]:47614 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726773AbfHGMiN (ORCPT ); Wed, 7 Aug 2019 08:38:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3757F28; Wed, 7 Aug 2019 05:38:12 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 358E03F575; Wed, 7 Aug 2019 05:38:10 -0700 (PDT) Date: Wed, 7 Aug 2019 13:38:08 +0100 From: Mark Rutland To: Rob Clark Cc: Christoph Hellwig , Rob Clark , dri-devel , Catalin Marinas , Will Deacon , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Allison Randal , Greg Kroah-Hartman , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, LKML Subject: Re: [PATCH 1/2] drm: add cache support for arm64 Message-ID: <20190807123807.GD54191@lakrids.cambridge.arm.com> References: <20190805211451.20176-1-robdclark@gmail.com> <20190806084821.GA17129@lst.de> <20190806143457.GF475@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 06, 2019 at 09:31:55AM -0700, Rob Clark wrote: > On Tue, Aug 6, 2019 at 7:35 AM Mark Rutland wrote: > > > > On Tue, Aug 06, 2019 at 07:11:41AM -0700, Rob Clark wrote: > > > On Tue, Aug 6, 2019 at 1:48 AM Christoph Hellwig wrote: > > > > > > > > This goes in the wrong direction. drm_cflush_* are a bad API we need to > > > > get rid of, not add use of it. The reason for that is two-fold: > > > > > > > > a) it doesn't address how cache maintaince actually works in most > > > > platforms. When talking about a cache we three fundamental operations: > > > > > > > > 1) write back - this writes the content of the cache back to the > > > > backing memory > > > > 2) invalidate - this remove the content of the cache > > > > 3) write back + invalidate - do both of the above > > > > > > Agreed that drm_cflush_* isn't a great API. In this particular case > > > (IIUC), I need wb+inv so that there aren't dirty cache lines that drop > > > out to memory later, and so that I don't get a cache hit on > > > uncached/wc mmap'ing. > > > > Is there a cacheable alias lying around (e.g. the linear map), or are > > these addresses only mapped uncached/wc? > > > > If there's a cacheable alias, performing an invalidate isn't sufficient, > > since a CPU can allocate a new (clean) entry at any point in time (e.g. > > as a result of prefetching or arbitrary speculation). > > I *believe* that there are not alias mappings (that I don't control > myself) for pages coming from > shmem_file_setup()/shmem_read_mapping_page().. AFAICT, that's regular anonymous memory, so there will be a cacheable alias in the linear/direct map. > digging around at what dma_sync_sg_* does under the hood, it looks > like it is just arch_sync_dma_for_cpu/device(), so I guess that should > be sufficient for what I need. I don't think that's the case, per the example I gave above. Thanks, Mark.