public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Rob Clark <robdclark@gmail.com>
Cc: Eric Anholt <eric@anholt.net>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Rob Clark <robdclark@chromium.org>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Emil Velikov <emil.velikov@collabora.com>,
	Eric Biggers <ebiggers@google.com>,
	Deepak Sharma <deepak.sharma@amd.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] drm/vgem: use normal cached mmap'ings
Date: Fri, 19 Jul 2019 11:13:14 +0200	[thread overview]
Message-ID: <20190719091314.GH15868@phenom.ffwll.local> (raw)
In-Reply-To: <CAF6AEGsrJu8r+t35zWxbq8KXFSoyPSJ_3+MjTii00Pb=YOMxHQ@mail.gmail.com>

On Tue, Jul 16, 2019 at 05:13:10PM -0700, Rob Clark wrote:
> On Tue, Jul 16, 2019 at 4:39 PM Eric Anholt <eric@anholt.net> wrote:
> >
> > Rob Clark <robdclark@gmail.com> writes:
> >
> > > From: Rob Clark <robdclark@chromium.org>
> > >
> > > Since there is no real device associated with VGEM, it is impossible to
> > > end up with appropriate dev->dma_ops, meaning that we have no way to
> > > invalidate the shmem pages allocated by VGEM.  So, at least on platforms
> > > without drm_cflush_pages(), we end up with corruption when cache lines
> > > from previous usage of VGEM bo pages get evicted to memory.
> > >
> > > The only sane option is to use cached mappings.
> >
> > This may be an improvement, but...
> >
> > pin/unpin is only on attaching/closing the dma-buf, right?  So, great,
> > you flushed the cached map once after exporting the vgem dma-buf to the
> > actual GPU device, but from then on you still have no interface for
> > getting coherent access through VGEM's mapping again, which still
> > exists.
> 
> In *theory* one would detach before doing further CPU access to
> buffer, and then re-attach when passing back to GPU.
> 
> Ofc that isn't how actual drivers do things.  But maybe it is enough
> for vgem to serve it's purpose (ie. test code).
> 
> > I feel like this is papering over something that's really just broken,
> > and we should stop providing VGEM just because someone wants to write
> > dma-buf test code without driver-specific BO alloc ioctl code.
> 
> yup, it is vgem that is fundamentally broken (or maybe more
> specifically doesn't fit in w/ dma-mappings view of how to do cache
> maint), and I'm just papering over it because people and CI systems
> want to be able to use it to do some dma-buf tests ;-)
> 
> I'm kinda wondering, at least for arm/dt based systems, if there is a
> way (other than in early boot) that we can inject a vgem device node
> into the dtb.  That isn't a thing drivers should normally do, but (if
> possible) since vgem is really just test infrastructure, it could be a
> way to make dma-mapping happily think vgem is a real device.

Or we just extend drm_cflush_pages with the cflushing we need (at least
for those arms where this is possible, let's ignore the others) and accept
for a few more years that dma-api doesn't fit?

Note this would need to be a full copypasta of what the arch code has
(since just exporting the function was shot down before), but I really
don't care about the resulting wailing if we do this.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2019-07-19  9:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 21:37 [PATCH v3 1/3] drm/gem: don't force writecombine mmap'ing Rob Clark
2019-07-16 21:37 ` [PATCH v3 2/3] drm: plumb attaching dev thru to prime_pin/unpin Rob Clark
2019-07-17  6:59   ` Koenig, Christian
2019-07-16 21:37 ` [PATCH v3 3/3] drm/vgem: use normal cached mmap'ings Rob Clark
2019-07-16 23:39   ` Eric Anholt
2019-07-17  0:13     ` Rob Clark
2019-07-19  9:13       ` Daniel Vetter [this message]
2019-07-16 23:21 ` [Intel-gfx] [PATCH v3 1/3] drm/gem: don't force writecombine mmap'ing Eric Anholt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190719091314.GH15868@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=chris@chris-wilson.co.uk \
    --cc=deepak.sharma@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ebiggers@google.com \
    --cc=emil.velikov@collabora.com \
    --cc=eric@anholt.net \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@chromium.org \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox