Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7058120ybh; Thu, 8 Aug 2019 09:33:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxQSWnYrjTZGMm6tzC59PyvA2gbePkI8buhr7sxVGhPKYTERR/GJ+IwWXrLR6/3DIDeq7U X-Received: by 2002:a65:6415:: with SMTP id a21mr12729534pgv.98.1565282026425; Thu, 08 Aug 2019 09:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565282026; cv=none; d=google.com; s=arc-20160816; b=Jl3a0ftTb8U5Jxg3/kuO+jgfeoqoKe41MtchXQYFmzJvb5WwZ18aj84TXgDM0aMetE wwuNszr/6SZkKk4I0ykAvGxeS/aTHPd2ZGrKoBhDm055SlUV5TzM0CHdhG9X/qiSt9el spb8amBX30wOeNmGqExJiXFmXzuFUUcAYVCAMoc/6qwTtZ1humtAb2AsvsYjSMTuRfX8 9+hA52Cc7+coS13DP32YfkkY+s1uUJFcLGO+zwLByzFCYumKZG/Irx7+WSqN6VuRKOv3 tIPCEdhfNuInZpeQtTZnc3RoJ1izN/Z7flvOt4KvWVXjWw450d3VxdEaVvwZoC/a3Rsb 5A3Q== 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=erfhL7VDoeVN6LjjmIrSkztKG2I43YnuXIQ5QoKPdbc=; b=inysKQLtVFean/XP6swxthT8yr5F7V4Sq9sQLM0kW9W1FDGG3KWglZ5mWxcmAAGpJu R2hOOqSigi/G86Yu6239SS0cOXGdXBBM2yWTFSrxHAc27lL9vRKJykgLv1VomplNzSod dIhblbbQ9N7nxGd4QRBRVK8UWHXPbjbCIOSTsiA9sP+rhRERSGuTmM8WAwjeR48cdM25 uydHylnGe7MXgackPBHhep3SKDgDhkVto2ZmDhwcP0vPuoC52xePqEORPq9xcOgEi99l Cju4GuDBdVNlwczQu2a8XFu0OUOssutkJw9g6hdmEJfO8ZkRIZj4RkTFovbmUlnFBg0W 2eqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kV+NV+qW; 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 j70si51336628pgd.500.2019.08.08.09.33.30; Thu, 08 Aug 2019 09:33:46 -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=kV+NV+qW; 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 S2389823AbfHHQcf (ORCPT + 99 others); Thu, 8 Aug 2019 12:32:35 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:44027 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbfHHQcc (ORCPT ); Thu, 8 Aug 2019 12:32:32 -0400 Received: by mail-ot1-f67.google.com with SMTP id j11so20619973otp.10 for ; Thu, 08 Aug 2019 09:32:32 -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=erfhL7VDoeVN6LjjmIrSkztKG2I43YnuXIQ5QoKPdbc=; b=kV+NV+qW/5qJZ2Z48xBPFEZ6LJYAXKY5/LhYbls4LmwDokugWNdTa16wJmKp0yXodN iVYJzFf9wKMlE++n5p9Whx3JnTaCk53pROAM7OZ8x0kFxKIh5rsaR/LnSEl93Lnc1C2A Hfwb5Y/I4iLfY0pVARlG0U/1rzE7/uJK5ZkZY= 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=erfhL7VDoeVN6LjjmIrSkztKG2I43YnuXIQ5QoKPdbc=; b=QKcKMbqjfUSoceLHFuwVQVH6JdwS3nr2iApR9satzPFr9VIyBRFTtledowltWT28Ls dpgHbax9wxCbYQ1bRsGtTa/6lI0JiQBQX3BhLs+kjubZXhOH0esKDN1f9RUgJX1+5tZc 2hIr71K9DTj7lFwx8GhK+2UPfcfSrysjlRWbNCQKN7+bEZI5x0ylNGk3XGrPkwOSEXSP 7Kw6RcQs5kECb4fZ5HYNJMbZXewfLp2Ig0K0g5Ou5xRK2jPOR7ETQMZkRhBEaC62eu5Z E9zQia5qFWEAvsKNXgk9lbxHgG9fLmhowhILCDpFN/70L2tzEHGyRWOs3LF8s94qmIlL b1HQ== X-Gm-Message-State: APjAAAV3ncTykO7w7BZUXnvfaXD0jy7o7rtoevpvnsBtjlNvL6Oc5/M2 jdTokhSEryujhs1D8xVPLyu+NPe+gtTd9n8JvzG5ZA== X-Received: by 2002:a6b:90c1:: with SMTP id s184mr15573418iod.244.1565281952009; Thu, 08 Aug 2019 09:32:32 -0700 (PDT) MIME-Version: 1.0 References: <20190805211451.20176-1-robdclark@gmail.com> <20190806084821.GA17129@lst.de> <20190806155044.GC25050@lst.de> <20190807062545.GF6627@lst.de> <20190808100031.GA32658@lst.de> In-Reply-To: <20190808100031.GA32658@lst.de> From: Rob Clark Date: Thu, 8 Aug 2019 09:32:21 -0700 Message-ID: Subject: Re: [PATCH 1/2] drm: add cache support for arm64 To: Christoph Hellwig Cc: 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 Thu, Aug 8, 2019 at 3:00 AM Christoph Hellwig wrote: > > On Wed, Aug 07, 2019 at 09:09:53AM -0700, Rob Clark wrote: > > > > (Eventually I'd like to support pages passed in from userspace.. but > > > > that is down the road.) > > > > > > Eww. Please talk to the iommu list before starting on that. > > > > This is more of a long term goal, we can't do it until we have > > per-context/process pagetables, ofc. > > > > Getting a bit off topic, but I'm curious about what problems you are > > concerned about. Userspace can shoot it's own foot, but if it is not > > sharing GPU pagetables with other processes, it can't shoot other's > > feet. (I'm guessing you are concerned about non-page-aligned > > mappings?) > > Maybe I misunderstood what you mean above, I though you mean messing > with page cachability attributes for userspace pages. If what you are > looking into is just "standard" SVM I only hope that our APIs for that > which currently are a mess are in shape by then, as all users currently > have their own crufty and at least slightly buggy versions of that. But > at least it is an issue that is being worked on. ahh, ok.. and no, we wouldn't be remapping 'malloc' memory as writecombine. We'd have to wire up better support for cached buffers. Currently we use WC for basically all GEM buffers allocated from kernel, since that is a good choice for most GPU workloads.. ie. CPU isn't reading back from GPU buffers in most cases. I'm told cached buffers are useful for compute workloads where there is more back and forth between GPU and CPU, but we haven't really crossed that bridge yet. Compute workloads is also were the SVM interest is. > > > So back to the question, I'd like to understand your use case (and > > > maybe hear from the other drm folks if that is common): > > > > > > - you allocate pages from shmem (why shmem, btw? if this is done by > > > other drm drivers how do they guarantee addressability without an > > > iommu?) > > > > shmem for swappable pages. I don't unpin and let things get swapped > > out yet, but I'm told it starts to become important when you have 50 > > browser tabs open ;-) > > Yes, but at that point the swapping can use the kernel linear mapping > and we are going into aliasing problems that can disturb the cache. So > as-is this is going to problematic without new hooks into shmemfs. > My expectation is that we'd treat the pages as cached when handing them back to shmemfs, and wb+inv when we take them back again from shmemfs and re-pin. I think this works out to be basically the same scenario as having to wb+inv when we first get the pages from shmemfs. > > > - then the memory is either mapped to userspace or vmapped (or even > > > both, althrough the lack of aliasing you mentioned would speak > > > against it) as writecombine (aka arm v6+ normal uncached). Does > > > the mapping live on until the memory is freed? > > > > (side note, *most* of the drm/msm supported devices are armv8, the > > exceptions are 8060 and 8064 which are armv7.. I don't think drm/msm > > will ever have to deal w/ armv6) > > Well, the point was that starting from v6 the kernels dma uncached > really is write combine. So that applied to v7 and v8 as well. ahh, gotcha BR, -R