Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4315344ybh; Tue, 6 Aug 2019 09:34:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyv+QcFREIY5H/IXQ2Jpzh+OXLEQPpv/mrvBDHj1a9If/QI12ajigiSXoBRWxsyVWitwFn4 X-Received: by 2002:a63:1:: with SMTP id 1mr3790734pga.162.1565109256585; Tue, 06 Aug 2019 09:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565109256; cv=none; d=google.com; s=arc-20160816; b=gZGsWIUvnrFw4NWHb6dMcnGZksh4vQzVmhTIXcOU9VNKEsy8K0+t9QIGmdPuYqJJkn tAHIwXBHIZwP5f+rdg7QWzyJvEeWZwYW6fKd3P93dInbfzHZRDfouYb+VJgxsykmMKxA AitZONY24mSx3p6AGvNy7DaiornlWsSKhXRxJ5lQ/uRcQSkLTopztVdbN1aXFX7lwzVB 1msfLm6kdEaldlJfCbwZTE+x+IBA1w+crHeoJ3Gu+dQpyUwm0ALUUMXgor4jgJL1+1a0 AJFSaC+gM4Ss+88Ev3tvWmPkEuf9DYVp6mEz5CxjzKAVc0EqGBEPmnhiSn2hrlzJQjbT Z9zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qJV0VVyb7OBSwrj4NQkfWBYcw+e0SGu2TpYvncrxquQ=; b=ZIiht3Cg4U0igQ4ag7WiI4vkF9aOofPkxNYmNjV2mvwzTOJ4DqlTCTqvPf7VXJCc7q deIWX7K3phW3A5aQTWAZ/2bfpUKco/6oKaqHcUD5yjSOBVWL3HAnaHKHv6MTdxp8c/xq F7cyznWbfUY2b6ryi8NNjuBUx6ILde/xMlhyjAYq9qeE7xvxIldUU0vQbyTCsClVtEcz 91wVfNRmxdgWOCo01WVlU1/XbbTJQ7ZIjynouvgGlGgopHbHSC9G7fDG/T89OyqOOZwB q3d8w4EmMi2cXG6+0ItMYwVX+7LOkJEamJrcHe4H7/pJ/wMLgdV5j15RDmCxGPkPEBzQ 75vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PaNovIOO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si15055159pjr.31.2019.08.06.09.34.00; Tue, 06 Aug 2019 09:34:16 -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; dkim=pass header.i=@chromium.org header.s=google header.b=PaNovIOO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387643AbfHFQcH (ORCPT + 99 others); Tue, 6 Aug 2019 12:32:07 -0400 Received: from mail-ua1-f66.google.com ([209.85.222.66]:39015 "EHLO mail-ua1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731659AbfHFQcG (ORCPT ); Tue, 6 Aug 2019 12:32:06 -0400 Received: by mail-ua1-f66.google.com with SMTP id j8so33860109uan.6 for ; Tue, 06 Aug 2019 09:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qJV0VVyb7OBSwrj4NQkfWBYcw+e0SGu2TpYvncrxquQ=; b=PaNovIOOce5SiqO4ZfKl84Pa4yv0mSqVy5C30RPobTjNSM7clsyNQbQ/vhelfWggU9 NgsFUrCfnnyuoAdH13iul7qyQW+rfYTpPfBbokbf4T3tjfWMbJTP7PDBLdM2atX1U17L kqJ0ZreL5023LO6c/T/0E/lD7i0AsyjbuCbI0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qJV0VVyb7OBSwrj4NQkfWBYcw+e0SGu2TpYvncrxquQ=; b=Br25eRa4EmpfraGiMKIsZQS0ojq7PvqUaUqZ432HCApB3f/nQ2vSp7ZFWBZr35l2DD CuyRLlLOl6zzS1fAFu/hwWciWA0pwQvZ8H12rrHl0PFGxxeA8pRY7mzMcR33kbrHIIhj flj8yVMVwZThzFXgbwl8BJEBzmmegcqyTh+mIf3DI6daHdQR999E3aEmgScoO/ITItXx 47Zw92AoAhaW5oyDjWlf9b/7RP020QAwWqxTbMJsJIP9DmhlgO12fkrV4sYASK5AWl1T XY9Sq974xmfzMWQAQbwzPnrB8ftzE5bQLB6np5BPy4kj0DV0ejGTv42hGIYnCKEfVYG7 9Pqw== X-Gm-Message-State: APjAAAVQoGY/sAdIYOGd0MXKJQuBWzviuiLGpJOJ3Pw8AFyL++uxnnnN 6okzv8Wycb98PBL2tP5NcY67f2z9EygchGZtXxgZKA== X-Received: by 2002:ab0:66d2:: with SMTP id d18mr1393892uaq.101.1565109125884; Tue, 06 Aug 2019 09:32:05 -0700 (PDT) MIME-Version: 1.0 References: <20190805211451.20176-1-robdclark@gmail.com> <20190806084821.GA17129@lst.de> <20190806143457.GF475@lakrids.cambridge.arm.com> In-Reply-To: <20190806143457.GF475@lakrids.cambridge.arm.com> From: Rob Clark Date: Tue, 6 Aug 2019 09:31:55 -0700 Message-ID: Subject: Re: [PATCH 1/2] drm: add cache support for arm64 To: Mark Rutland 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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().. 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. There are a few buffers that I vmap for use on kernel side, but like the userspace mmap's, the vmaps are also writecombine. BR, -R