[Intel-gfx] [PATCH] drm/i915: Extend debugfs/i915_drop_caches to call i915_gem_shrink_all()
Chris Wilson
chris at chris-wilson.co.uk
Fri Mar 10 13:34:24 UTC 2017
On Fri, Mar 10, 2017 at 01:06:51PM +0000, Tvrtko Ursulin wrote:
>
> On 08/03/2017 14:46, Chris Wilson wrote:
> >Sometimes we want to explicitly page out all available objects from igt,
> >i.e. call i915_gem_shrink_all() and check that subsequent operations
> >succeed. This adds DROP_SHRINK_ALL [0x8] to the set of flags for
>
> Not 0x20 ?
Never even spotted that I wrote a random number.
> >debugfs/i915_drop_caches.
> >
> >Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> >---
> > drivers/gpu/drm/i915/i915_debugfs.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> >index 3a2ef08ed3a1..d301119378e5 100644
> >--- a/drivers/gpu/drm/i915/i915_debugfs.c
> >+++ b/drivers/gpu/drm/i915/i915_debugfs.c
> >@@ -4210,11 +4210,13 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_ring_test_irq_fops,
> > #define DROP_RETIRE 0x4
> > #define DROP_ACTIVE 0x8
> > #define DROP_FREED 0x10
> >+#define DROP_SHRINK_ALL 0x20
> > #define DROP_ALL (DROP_UNBOUND | \
> > DROP_BOUND | \
> > DROP_RETIRE | \
> > DROP_ACTIVE | \
> >- DROP_FREED)
> >+ DROP_FREED | \
> >+ DROP_SHRINK_ALL)
> > static int
> > i915_drop_caches_get(void *data, u64 *val)
> > {
> >@@ -4255,6 +4257,9 @@ i915_drop_caches_set(void *data, u64 val)
> > if (val & DROP_UNBOUND)
> > i915_gem_shrink(dev_priv, LONG_MAX, I915_SHRINK_UNBOUND);
> >
> >+ if (val & DROP_SHRINK_ALL)
> >+ i915_gem_shrink_all(dev_priv);
> >+
>
> I don't see that DROP_ACTIVE is currently handled as in translated
> to I915_SHRINK_ACTIVE?
DROP_ACTIVE was just about doing a wait-for-idle.
> You want to allow multiple passes if DROP_BOUND | DROP_UNBOUND |
> DROP_SHRINK_ALL is given? It doesn't matter hugely, but if
> DROP_ACTIVE was handled it would be just a matter of passing in all
> three flags to the same effect. Like:
>
> flags |= val & DROP_BOUND ? I915_SHRINK_BOUND : 0;
> ... for all three flags..
>
> i915_gem_shrink(..., flags);
>
> ?
We are semi-stuck with the twisted hodge-podge interface we have. It
gets extended to cater to a new idea for igt and promptly deserted. At
some point we just throw it away and start afresh. Hindsight says an
interface closer to i915_gem_shrink, perhaps with some bits to cater
more closely to userspace wishes would be useful. It's debugfs, easy
come, almost easy go.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list