From: Daniel Vetter <daniel@ffwll.ch>
To: "Goel, Akash" <akash.goel@intel.com>
Cc: "Vetter, Daniel" <daniel.vetter@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 5/7] drm/i915/vlv: Increase the utilization of stolen memory on VLV.
Date: Fri, 10 Jan 2014 10:26:52 +0100 [thread overview]
Message-ID: <20140110092652.GD4770@phenom.ffwll.local> (raw)
In-Reply-To: <8BF5CF93467D8C498F250C96583BC09CC25079@BGSMSX103.gar.corp.intel.com>
On Fri, Jan 10, 2014 at 08:40:34AM +0000, Goel, Akash wrote:
> >> For your usecase, have you tried to simply reduce the stolen area as
> >> much as possible? Our friendly competition on ARM SoCs seems to have
> >> mostly moved away from gfx reserved chunks towards more flexible
> >> approaches like CMA. Giving stolen back to the linux page allocator
> >> should be possible, but I haven't really looked into that yet all that
> >> much ...
>
> This is the first option we explored, as it would have made our task
> also simple. There is a Hw bug on BYT, due to which either the
> allocation of Stolen area can be completely disabled or the next
> allocation has to be of 64 MB only. But this limitation will not be
> present on upcoming platforms.
>
> >> - object_pin is the wrong place to change the backing storage since
> >> someone else could already have pinned the it (e.g. through dma-buf). We
> >> need to do this earlier before calling down into ->get_pages.
>
> We had an option to allocate the backing storage from stolen area, at
> the time when a GEM object is associated with a User created frame
> buffer (drm_mode_addfb2). But we often saw that pool of Frame buffer
> objects were getting created, but not all them were getting used. So we
> thought that it will be more optimal, if we reserve the stolen space
> when the object actually starts to gets used, i.e. when it is being
> mapped to GTT. In order to handle the dma-buf case (for User frame
> buffers) we can add a new check, so as not to consider using stolen area
> for such objects.
Correct purgeable semantics with shared objects is still an open for
shared buffers. An option would be to introduce the concept of weak/strong
userspace references to dma-buf/gem objects and allow a buffer to be
purged if there's no strong reference. A bit more work though.
> >> - If we allow opportunistical placement of objects into stolen memory I
> >> think we should also fully support purgeable objects so that we can
> >> dynamically scale to workloads. Or at least to be able to kick out stuff
> >> in case the kernel needs the contiguous memory for something more
> >> important. So if we couldn't find a suitable stolen block we'd scan
> >> through all objects with stolen memory backing and check whether any
> >> purgeable objects could be kicked out.
>
> Actually we didn't expected much value-add on having the
> purging/truncate logic for Frame buffer objects also allocated from
> stolen area. We saw that Frame buffer objects were being used as shared
> objects only & not as local objects. So the cacheing/purging logic in
> libdrm will not really apply to them, until unless the gem_madvise ioctl
> call is used to truncate the objects. But on our UFO (OGL & Media)
> drivers side, currently the gem_madvise ioctl call is not being used.
> So until the frame buffer object itself is destroyed, it cannot be
> purged before that. On Android side, as the 'swap' is disabled, the
> physical space of the GEM objects cannot be reclaimed by releasing the
> ref count on the underlying Physical pages (put_pages). The purging
> from the GEM shrinker side, will be really effective in relinquishing
> the backing physical space, only when the objects are marked as
> purgeable. We can try to add the support to purge/truncate logic for
> the stolen objects, in order to create room in stolen space for a new
> frame buffer.
Well the caching/purging will be interesting once we have use stolen in
general where it's useful, e.g. for accelarated media decode using large
page ptes.
> >> For upstream I think changing the personality of buffer objects behind
> >> userspace's back is a bit too frisky wrt breaking something. I prefer if
> >> userspace opts-in explicitly by passing a flag to the create ioctl
> >> stating that stolen memory is allowed/preferred for this allocation.
> >> Chris Wilson posted an rfc patch a while back to add a create2 ioctl
> >> (which at the same time also allows us to set the caching, tiling and
> >> any other object parameters).
>
> Yes, agree that is not cleanest of a solution, but we didn't had an
> option of introducing a new API/interface. But the change is limited
> only to User created frame buffer GEM objects. What new constraints we
> will be introducing if we go ahead with this design for Frame buffers.
> The mmap_gtt interface can still be used for these GEM objects.
It breaks pwrite/pread and cpu mmaps. Yes, we've had old userspace that
uses this on X-tiled buffers and breaking them isn't an option for
upstream really.
One thing I don't understand is why you can't use a new ioctl. You've
emphasised this point a few times by now, but I don't understand the
reasons for it ... Please elaborate.
Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-01-10 9:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 5:31 [PATCH 5/7] drm/i915/vlv: Increase the utilization of stolen memory on VLV akash.goel
2014-01-09 7:27 ` Daniel Vetter
2014-01-09 7:46 ` Daniel Vetter
[not found] ` <8BF5CF93467D8C498F250C96583BC09CC24C49@BGSMSX103.gar.corp.intel.com>
2014-01-09 8:53 ` Daniel Vetter
2014-01-10 8:40 ` Goel, Akash
2014-01-10 9:26 ` Daniel Vetter [this message]
2014-01-13 9:17 ` Goel, Akash
2014-01-09 9:48 ` Chris Wilson
2014-01-09 18:09 ` Goel, Akash
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=20140110092652.GD4770@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=akash.goel@intel.com \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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