* [PATCH 2/3] drm/i915: Make object/vma allocation caches global
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
@ 2019-02-27 23:09 ` Chris Wilson
2019-02-28 7:52 ` Tvrtko Ursulin
2019-02-27 23:09 ` [PATCH 3/3] drm/i915: Remove second level open-coded rcu work Chris Wilson
` (8 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2019-02-27 23:09 UTC (permalink / raw)
To: intel-gfx
As our allocations are not device specific, we can move our slab caches
to a global scope.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/gvt/dmabuf.c | 2 +-
drivers/gpu/drm/i915/i915_drv.h | 6 ---
drivers/gpu/drm/i915/i915_gem.c | 47 ++-----------------
drivers/gpu/drm/i915/i915_gem_context.c | 35 +++++++++++++-
drivers/gpu/drm/i915/i915_gem_context.h | 8 ++++
drivers/gpu/drm/i915/i915_gem_dmabuf.c | 2 +-
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 +-
drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
drivers/gpu/drm/i915/i915_gem_internal.c | 2 +-
drivers/gpu/drm/i915/i915_gem_object.c | 34 ++++++++++++++
drivers/gpu/drm/i915/i915_gem_object.h | 8 +++-
drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +-
drivers/gpu/drm/i915/i915_globals.c | 29 +++++++++++-
drivers/gpu/drm/i915/i915_vma.c | 43 ++++++++++++++---
drivers/gpu/drm/i915/i915_vma.h | 7 +++
.../gpu/drm/i915/selftests/huge_gem_object.c | 2 +-
drivers/gpu/drm/i915/selftests/huge_pages.c | 4 +-
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +-
.../gpu/drm/i915/selftests/mock_gem_device.c | 15 ------
20 files changed, 170 insertions(+), 86 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index 3e7e2b80c857..f27edf17b4ab 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -153,7 +153,7 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct drm_device *dev,
struct drm_i915_private *dev_priv = to_i915(dev);
struct drm_i915_gem_object *obj;
- obj = i915_gem_object_alloc(dev_priv);
+ obj = i915_gem_object_alloc();
if (obj == NULL)
return NULL;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f16016b330b3..35516089a3ff 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1470,10 +1470,6 @@ struct intel_cdclk_state {
struct drm_i915_private {
struct drm_device drm;
- struct kmem_cache *objects;
- struct kmem_cache *vmas;
- struct kmem_cache *luts;
-
const struct intel_device_info __info; /* Use INTEL_INFO() to access. */
struct intel_runtime_info __runtime; /* Use RUNTIME_INFO() to access. */
struct intel_driver_caps caps;
@@ -2802,8 +2798,6 @@ void i915_gem_load_init_fences(struct drm_i915_private *dev_priv);
int i915_gem_freeze(struct drm_i915_private *dev_priv);
int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
-void *i915_gem_object_alloc(struct drm_i915_private *dev_priv);
-void i915_gem_object_free(struct drm_i915_gem_object *obj);
void i915_gem_object_init(struct drm_i915_gem_object *obj,
const struct drm_i915_gem_object_ops *ops);
struct drm_i915_gem_object *
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 713ed6fbdcc8..8ded7e1756c9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -624,17 +624,6 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
return 0;
}
-void *i915_gem_object_alloc(struct drm_i915_private *dev_priv)
-{
- return kmem_cache_zalloc(dev_priv->objects, GFP_KERNEL);
-}
-
-void i915_gem_object_free(struct drm_i915_gem_object *obj)
-{
- struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
- kmem_cache_free(dev_priv->objects, obj);
-}
-
static int
i915_gem_create(struct drm_file *file,
struct drm_i915_private *dev_priv,
@@ -2895,10 +2884,6 @@ static void shrink_caches(struct drm_i915_private *i915)
* filled slabs to prioritise allocating from the mostly full slabs,
* with the aim of reducing fragmentation.
*/
- kmem_cache_shrink(i915->luts);
- kmem_cache_shrink(i915->vmas);
- kmem_cache_shrink(i915->objects);
-
i915_globals_park();
}
@@ -3094,7 +3079,7 @@ void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
list_del(&lut->obj_link);
list_del(&lut->ctx_link);
- kmem_cache_free(i915->luts, lut);
+ i915_lut_handle_free(lut);
__i915_gem_object_release_unless_active(obj);
}
@@ -4199,7 +4184,7 @@ i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size)
if (overflows_type(size, obj->base.size))
return ERR_PTR(-E2BIG);
- obj = i915_gem_object_alloc(dev_priv);
+ obj = i915_gem_object_alloc();
if (obj == NULL)
return ERR_PTR(-ENOMEM);
@@ -5223,19 +5208,7 @@ static void i915_gem_init__mm(struct drm_i915_private *i915)
int i915_gem_init_early(struct drm_i915_private *dev_priv)
{
- int err = -ENOMEM;
-
- dev_priv->objects = KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN);
- if (!dev_priv->objects)
- goto err_out;
-
- dev_priv->vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN);
- if (!dev_priv->vmas)
- goto err_objects;
-
- dev_priv->luts = KMEM_CACHE(i915_lut_handle, 0);
- if (!dev_priv->luts)
- goto err_vmas;
+ int err;
INIT_LIST_HEAD(&dev_priv->gt.active_rings);
INIT_LIST_HEAD(&dev_priv->gt.closed_vma);
@@ -5260,13 +5233,6 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
DRM_NOTE("Unable to create a private tmpfs mount, hugepage support will be disabled(%d).\n", err);
return 0;
-
-err_vmas:
- kmem_cache_destroy(dev_priv->vmas);
-err_objects:
- kmem_cache_destroy(dev_priv->objects);
-err_out:
- return err;
}
void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
@@ -5278,13 +5244,6 @@ void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
cleanup_srcu_struct(&dev_priv->gpu_error.reset_backoff_srcu);
- kmem_cache_destroy(dev_priv->luts);
- kmem_cache_destroy(dev_priv->vmas);
- kmem_cache_destroy(dev_priv->objects);
-
- /* And ensure that our DESTROY_BY_RCU slabs are truly destroyed */
- rcu_barrier();
-
i915_gemfs_fini(dev_priv);
}
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 0b4a3c79be74..d266ba3f7210 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -94,6 +94,20 @@
#define ALL_L3_SLICES(dev) (1 << NUM_L3_SLICES(dev)) - 1
+static struct i915_global_context {
+ struct kmem_cache *slab_luts;
+} global;
+
+struct i915_lut_handle *i915_lut_handle_alloc(void)
+{
+ return kmem_cache_alloc(global.slab_luts, GFP_KERNEL);
+}
+
+void i915_lut_handle_free(struct i915_lut_handle *lut)
+{
+ return kmem_cache_free(global.slab_luts, lut);
+}
+
static void lut_close(struct i915_gem_context *ctx)
{
struct i915_lut_handle *lut, *ln;
@@ -102,7 +116,7 @@ static void lut_close(struct i915_gem_context *ctx)
list_for_each_entry_safe(lut, ln, &ctx->handles_list, ctx_link) {
list_del(&lut->obj_link);
- kmem_cache_free(ctx->i915->luts, lut);
+ i915_lut_handle_free(lut);
}
rcu_read_lock();
@@ -1408,3 +1422,22 @@ int __i915_gem_context_pin_hw_id(struct i915_gem_context *ctx)
#include "selftests/mock_context.c"
#include "selftests/i915_gem_context.c"
#endif
+
+int __init i915_global_context_init(void)
+{
+ global.slab_luts = KMEM_CACHE(i915_lut_handle, 0);
+ if (!global.slab_luts)
+ return -ENOMEM;
+
+ return 0;
+}
+
+void i915_global_context_shrink(void)
+{
+ kmem_cache_shrink(global.slab_luts);
+}
+
+void i915_global_context_exit(void)
+{
+ kmem_cache_destroy(global.slab_luts);
+}
diff --git a/drivers/gpu/drm/i915/i915_gem_context.h b/drivers/gpu/drm/i915/i915_gem_context.h
index dc6c58f38cfa..be63666ffaac 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.h
+++ b/drivers/gpu/drm/i915/i915_gem_context.h
@@ -32,6 +32,7 @@
#include "i915_gem.h"
#include "i915_scheduler.h"
#include "intel_device_info.h"
+#include "intel_ringbuffer.h"
struct pid;
@@ -407,4 +408,11 @@ void intel_context_init(struct intel_context *ce,
struct i915_gem_context *ctx,
struct intel_engine_cs *engine);
+struct i915_lut_handle *i915_lut_handle_alloc(void);
+void i915_lut_handle_free(struct i915_lut_handle *lut);
+
+int i915_global_context_init(void);
+void i915_global_context_shrink(void);
+void i915_global_context_exit(void);
+
#endif /* !__I915_GEM_CONTEXT_H__ */
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 02f7298bfe57..33181678990e 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -300,7 +300,7 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
get_dma_buf(dma_buf);
- obj = i915_gem_object_alloc(to_i915(dev));
+ obj = i915_gem_object_alloc();
if (obj == NULL) {
ret = -ENOMEM;
goto fail_detach;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 48b23c6a024e..07c0af316f86 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -854,7 +854,7 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
goto err_obj;
}
- lut = kmem_cache_alloc(eb->i915->luts, GFP_KERNEL);
+ lut = i915_lut_handle_alloc();
if (unlikely(!lut)) {
err = -ENOMEM;
goto err_obj;
@@ -862,7 +862,7 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
err = radix_tree_insert(handles_vma, handle, vma);
if (unlikely(err)) {
- kmem_cache_free(eb->i915->luts, lut);
+ i915_lut_handle_free(lut);
goto err_obj;
}
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 39671caab76b..7e79691664e5 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1913,7 +1913,7 @@ static struct i915_vma *pd_vma_create(struct gen6_hw_ppgtt *ppgtt, int size)
GEM_BUG_ON(!IS_ALIGNED(size, I915_GTT_PAGE_SIZE));
GEM_BUG_ON(size > ggtt->vm.total);
- vma = kmem_cache_zalloc(i915->vmas, GFP_KERNEL);
+ vma = i915_vma_alloc();
if (!vma)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
index fddde1033e74..ab627ed1269c 100644
--- a/drivers/gpu/drm/i915/i915_gem_internal.c
+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
@@ -193,7 +193,7 @@ i915_gem_object_create_internal(struct drm_i915_private *i915,
if (overflows_type(size, obj->base.size))
return ERR_PTR(-E2BIG);
- obj = i915_gem_object_alloc(i915);
+ obj = i915_gem_object_alloc();
if (!obj)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/gpu/drm/i915/i915_gem_object.c b/drivers/gpu/drm/i915/i915_gem_object.c
index aab8cdd80e6d..4aeb8c3b87e4 100644
--- a/drivers/gpu/drm/i915/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/i915_gem_object.c
@@ -25,6 +25,20 @@
#include "i915_drv.h"
#include "i915_gem_object.h"
+static struct i915_global_object {
+ struct kmem_cache *slab_objects;
+} global;
+
+struct drm_i915_gem_object *i915_gem_object_alloc(void)
+{
+ return kmem_cache_zalloc(global.slab_objects, GFP_KERNEL);
+}
+
+void i915_gem_object_free(struct drm_i915_gem_object *obj)
+{
+ return kmem_cache_free(global.slab_objects, obj);
+}
+
/**
* Mark up the object's coherency levels for a given cache_level
* @obj: #drm_i915_gem_object
@@ -46,3 +60,23 @@ void i915_gem_object_set_cache_coherency(struct drm_i915_gem_object *obj,
obj->cache_dirty =
!(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_WRITE);
}
+
+int __init i915_global_objects_init(void)
+{
+ global.slab_objects =
+ KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN);
+ if (!global.slab_objects)
+ return -ENOMEM;
+
+ return 0;
+}
+
+void i915_global_objects_shrink(void)
+{
+ kmem_cache_shrink(global.slab_objects);
+}
+
+void i915_global_objects_exit(void)
+{
+ kmem_cache_destroy(global.slab_objects);
+}
diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
index fab040331cdb..0eaa2b3aeb62 100644
--- a/drivers/gpu/drm/i915/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/i915_gem_object.h
@@ -304,6 +304,9 @@ to_intel_bo(struct drm_gem_object *gem)
return container_of(gem, struct drm_i915_gem_object, base);
}
+struct drm_i915_gem_object *i915_gem_object_alloc(void);
+void i915_gem_object_free(struct drm_i915_gem_object *obj);
+
/**
* i915_gem_object_lookup_rcu - look up a temporary GEM object from its handle
* @filp: DRM file private date
@@ -499,5 +502,8 @@ void i915_gem_object_set_cache_coherency(struct drm_i915_gem_object *obj,
unsigned int cache_level);
void i915_gem_object_flush_if_display(struct drm_i915_gem_object *obj);
-#endif
+int i915_global_objects_init(void);
+void i915_global_objects_shrink(void);
+void i915_global_objects_exit(void);
+#endif
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 74a9661479ca..0a8082cfc761 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -565,7 +565,7 @@ _i915_gem_object_create_stolen(struct drm_i915_private *dev_priv,
struct drm_i915_gem_object *obj;
unsigned int cache_level;
- obj = i915_gem_object_alloc(dev_priv);
+ obj = i915_gem_object_alloc();
if (obj == NULL)
return NULL;
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 1d3f9a31ad61..ad0087127144 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -795,7 +795,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev,
return -ENODEV;
}
- obj = i915_gem_object_alloc(dev_priv);
+ obj = i915_gem_object_alloc();
if (obj == NULL)
return -ENOMEM;
diff --git a/drivers/gpu/drm/i915/i915_globals.c b/drivers/gpu/drm/i915/i915_globals.c
index 7fd1b3945a04..cfd0bc462f58 100644
--- a/drivers/gpu/drm/i915/i915_globals.c
+++ b/drivers/gpu/drm/i915/i915_globals.c
@@ -8,9 +8,12 @@
#include <linux/workqueue.h>
#include "i915_active.h"
+#include "i915_gem_context.h"
+#include "i915_gem_object.h"
#include "i915_globals.h"
#include "i915_request.h"
#include "i915_scheduler.h"
+#include "i915_vma.h"
int __init i915_globals_init(void)
{
@@ -20,18 +23,36 @@ int __init i915_globals_init(void)
if (err)
return err;
- err = i915_global_request_init();
+ err = i915_global_context_init();
if (err)
goto err_active;
+ err = i915_global_objects_init();
+ if (err)
+ goto err_context;
+
+ err = i915_global_request_init();
+ if (err)
+ goto err_objects;
+
err = i915_global_scheduler_init();
if (err)
goto err_request;
+ err = i915_global_vma_init();
+ if (err)
+ goto err_scheduler;
+
return 0;
+err_scheduler:
+ i915_global_scheduler_exit();
err_request:
i915_global_request_exit();
+err_objects:
+ i915_global_objects_exit();
+err_context:
+ i915_global_context_exit();
err_active:
i915_global_active_exit();
return err;
@@ -45,8 +66,11 @@ static void i915_globals_shrink(void)
* with the aim of reducing fragmentation.
*/
i915_global_active_shrink();
+ i915_global_context_shrink();
+ i915_global_objects_shrink();
i915_global_request_shrink();
i915_global_scheduler_shrink();
+ i915_global_vma_shrink();
}
static atomic_t active;
@@ -104,8 +128,11 @@ void __exit i915_globals_exit(void)
rcu_barrier();
flush_scheduled_work();
+ i915_global_vma_exit();
i915_global_scheduler_exit();
i915_global_request_exit();
+ i915_global_objects_exit();
+ i915_global_context_exit();
i915_global_active_exit();
/* And ensure that our DESTROY_BY_RCU slabs are truly destroyed */
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index b713bed20c38..757a33998bbf 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -30,6 +30,20 @@
#include <drm/drm_gem.h>
+static struct i915_global_vma {
+ struct kmem_cache *slab_vmas;
+} global;
+
+struct i915_vma *i915_vma_alloc(void)
+{
+ return kmem_cache_zalloc(global.slab_vmas, GFP_KERNEL);
+}
+
+void i915_vma_free(struct i915_vma *vma)
+{
+ return kmem_cache_free(global.slab_vmas, vma);
+}
+
#if IS_ENABLED(CONFIG_DRM_I915_ERRLOG_GEM) && IS_ENABLED(CONFIG_DRM_DEBUG_MM)
#include <linux/stackdepot.h>
@@ -115,7 +129,7 @@ vma_create(struct drm_i915_gem_object *obj,
/* The aliasing_ppgtt should never be used directly! */
GEM_BUG_ON(vm == &vm->i915->mm.aliasing_ppgtt->vm);
- vma = kmem_cache_zalloc(vm->i915->vmas, GFP_KERNEL);
+ vma = i915_vma_alloc();
if (vma == NULL)
return ERR_PTR(-ENOMEM);
@@ -190,7 +204,7 @@ vma_create(struct drm_i915_gem_object *obj,
cmp = i915_vma_compare(pos, vm, view);
if (cmp == 0) {
spin_unlock(&obj->vma.lock);
- kmem_cache_free(vm->i915->vmas, vma);
+ i915_vma_free(vma);
return pos;
}
@@ -222,7 +236,7 @@ vma_create(struct drm_i915_gem_object *obj,
return vma;
err_vma:
- kmem_cache_free(vm->i915->vmas, vma);
+ i915_vma_free(vma);
return ERR_PTR(-E2BIG);
}
@@ -803,8 +817,6 @@ void i915_vma_reopen(struct i915_vma *vma)
static void __i915_vma_destroy(struct i915_vma *vma)
{
- struct drm_i915_private *i915 = vma->vm->i915;
-
GEM_BUG_ON(vma->node.allocated);
GEM_BUG_ON(vma->fence);
@@ -825,7 +837,7 @@ static void __i915_vma_destroy(struct i915_vma *vma)
i915_active_fini(&vma->active);
- kmem_cache_free(i915->vmas, vma);
+ i915_vma_free(vma);
}
void i915_vma_destroy(struct i915_vma *vma)
@@ -1041,3 +1053,22 @@ int i915_vma_unbind(struct i915_vma *vma)
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
#include "selftests/i915_vma.c"
#endif
+
+int __init i915_global_vma_init(void)
+{
+ global.slab_vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN);
+ if (!global.slab_vmas)
+ return -ENOMEM;
+
+ return 0;
+}
+
+void i915_global_vma_shrink(void)
+{
+ kmem_cache_shrink(global.slab_vmas);
+}
+
+void i915_global_vma_exit(void)
+{
+ kmem_cache_destroy(global.slab_vmas);
+}
diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
index 7c742027f866..37f93358aa3c 100644
--- a/drivers/gpu/drm/i915/i915_vma.h
+++ b/drivers/gpu/drm/i915/i915_vma.h
@@ -440,4 +440,11 @@ void i915_vma_parked(struct drm_i915_private *i915);
list_for_each_entry(V, &(OBJ)->vma.list, obj_link) \
for_each_until(!i915_vma_is_ggtt(V))
+struct i915_vma *i915_vma_alloc(void);
+void i915_vma_free(struct i915_vma *vma);
+
+int i915_global_vma_init(void);
+void i915_global_vma_shrink(void);
+void i915_global_vma_exit(void);
+
#endif
diff --git a/drivers/gpu/drm/i915/selftests/huge_gem_object.c b/drivers/gpu/drm/i915/selftests/huge_gem_object.c
index 391f3d9ffdf1..419fd4d6a8f0 100644
--- a/drivers/gpu/drm/i915/selftests/huge_gem_object.c
+++ b/drivers/gpu/drm/i915/selftests/huge_gem_object.c
@@ -122,7 +122,7 @@ huge_gem_object(struct drm_i915_private *i915,
if (overflows_type(dma_size, obj->base.size))
return ERR_PTR(-E2BIG);
- obj = i915_gem_object_alloc(i915);
+ obj = i915_gem_object_alloc();
if (!obj)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
index 40607ba7dda6..4b9ded4ca0f5 100644
--- a/drivers/gpu/drm/i915/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
@@ -171,7 +171,7 @@ huge_pages_object(struct drm_i915_private *i915,
if (overflows_type(size, obj->base.size))
return ERR_PTR(-E2BIG);
- obj = i915_gem_object_alloc(i915);
+ obj = i915_gem_object_alloc();
if (!obj)
return ERR_PTR(-ENOMEM);
@@ -320,7 +320,7 @@ fake_huge_pages_object(struct drm_i915_private *i915, u64 size, bool single)
if (overflows_type(size, obj->base.size))
return ERR_PTR(-E2BIG);
- obj = i915_gem_object_alloc(i915);
+ obj = i915_gem_object_alloc();
if (!obj)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 488994d4ec19..826fd51c331e 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -120,7 +120,7 @@ fake_dma_object(struct drm_i915_private *i915, u64 size)
if (overflows_type(size, obj->base.size))
return ERR_PTR(-E2BIG);
- obj = i915_gem_object_alloc(i915);
+ obj = i915_gem_object_alloc();
if (!obj)
goto err;
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 5a98caba6d69..c27616efc4f8 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -79,9 +79,6 @@ static void mock_device_release(struct drm_device *dev)
destroy_workqueue(i915->wq);
- kmem_cache_destroy(i915->vmas);
- kmem_cache_destroy(i915->objects);
-
i915_gemfs_fini(i915);
drm_mode_config_cleanup(&i915->drm);
@@ -200,14 +197,6 @@ struct drm_i915_private *mock_gem_device(void)
i915->gt.awake = true;
- i915->objects = KMEM_CACHE(mock_object, SLAB_HWCACHE_ALIGN);
- if (!i915->objects)
- goto err_wq;
-
- i915->vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN);
- if (!i915->vmas)
- goto err_objects;
-
i915_timelines_init(i915);
INIT_LIST_HEAD(&i915->gt.active_rings);
@@ -237,10 +226,6 @@ struct drm_i915_private *mock_gem_device(void)
err_unlock:
mutex_unlock(&i915->drm.struct_mutex);
i915_timelines_fini(i915);
- kmem_cache_destroy(i915->vmas);
-err_objects:
- kmem_cache_destroy(i915->objects);
-err_wq:
destroy_workqueue(i915->wq);
err_drv:
drm_mode_config_cleanup(&i915->drm);
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 2/3] drm/i915: Make object/vma allocation caches global
2019-02-27 23:09 ` [PATCH 2/3] drm/i915: Make object/vma " Chris Wilson
@ 2019-02-28 7:52 ` Tvrtko Ursulin
0 siblings, 0 replies; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-02-28 7:52 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 27/02/2019 23:09, Chris Wilson wrote:
> As our allocations are not device specific, we can move our slab caches
> to a global scope.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/gvt/dmabuf.c | 2 +-
> drivers/gpu/drm/i915/i915_drv.h | 6 ---
> drivers/gpu/drm/i915/i915_gem.c | 47 ++-----------------
> drivers/gpu/drm/i915/i915_gem_context.c | 35 +++++++++++++-
> drivers/gpu/drm/i915/i915_gem_context.h | 8 ++++
> drivers/gpu/drm/i915/i915_gem_dmabuf.c | 2 +-
> drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 +-
> drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
> drivers/gpu/drm/i915/i915_gem_internal.c | 2 +-
> drivers/gpu/drm/i915/i915_gem_object.c | 34 ++++++++++++++
> drivers/gpu/drm/i915/i915_gem_object.h | 8 +++-
> drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
> drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +-
> drivers/gpu/drm/i915/i915_globals.c | 29 +++++++++++-
> drivers/gpu/drm/i915/i915_vma.c | 43 ++++++++++++++---
> drivers/gpu/drm/i915/i915_vma.h | 7 +++
> .../gpu/drm/i915/selftests/huge_gem_object.c | 2 +-
> drivers/gpu/drm/i915/selftests/huge_pages.c | 4 +-
> drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +-
> .../gpu/drm/i915/selftests/mock_gem_device.c | 15 ------
> 20 files changed, 170 insertions(+), 86 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index 3e7e2b80c857..f27edf17b4ab 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -153,7 +153,7 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct drm_device *dev,
> struct drm_i915_private *dev_priv = to_i915(dev);
> struct drm_i915_gem_object *obj;
>
> - obj = i915_gem_object_alloc(dev_priv);
> + obj = i915_gem_object_alloc();
> if (obj == NULL)
> return NULL;
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f16016b330b3..35516089a3ff 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1470,10 +1470,6 @@ struct intel_cdclk_state {
> struct drm_i915_private {
> struct drm_device drm;
>
> - struct kmem_cache *objects;
> - struct kmem_cache *vmas;
> - struct kmem_cache *luts;
> -
> const struct intel_device_info __info; /* Use INTEL_INFO() to access. */
> struct intel_runtime_info __runtime; /* Use RUNTIME_INFO() to access. */
> struct intel_driver_caps caps;
> @@ -2802,8 +2798,6 @@ void i915_gem_load_init_fences(struct drm_i915_private *dev_priv);
> int i915_gem_freeze(struct drm_i915_private *dev_priv);
> int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
>
> -void *i915_gem_object_alloc(struct drm_i915_private *dev_priv);
> -void i915_gem_object_free(struct drm_i915_gem_object *obj);
> void i915_gem_object_init(struct drm_i915_gem_object *obj,
> const struct drm_i915_gem_object_ops *ops);
> struct drm_i915_gem_object *
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 713ed6fbdcc8..8ded7e1756c9 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -624,17 +624,6 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
> return 0;
> }
>
> -void *i915_gem_object_alloc(struct drm_i915_private *dev_priv)
> -{
> - return kmem_cache_zalloc(dev_priv->objects, GFP_KERNEL);
> -}
> -
> -void i915_gem_object_free(struct drm_i915_gem_object *obj)
> -{
> - struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
> - kmem_cache_free(dev_priv->objects, obj);
> -}
> -
> static int
> i915_gem_create(struct drm_file *file,
> struct drm_i915_private *dev_priv,
> @@ -2895,10 +2884,6 @@ static void shrink_caches(struct drm_i915_private *i915)
> * filled slabs to prioritise allocating from the mostly full slabs,
> * with the aim of reducing fragmentation.
> */
> - kmem_cache_shrink(i915->luts);
> - kmem_cache_shrink(i915->vmas);
> - kmem_cache_shrink(i915->objects);
> -
> i915_globals_park();
> }
>
> @@ -3094,7 +3079,7 @@ void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
> list_del(&lut->obj_link);
> list_del(&lut->ctx_link);
>
> - kmem_cache_free(i915->luts, lut);
> + i915_lut_handle_free(lut);
> __i915_gem_object_release_unless_active(obj);
> }
>
> @@ -4199,7 +4184,7 @@ i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size)
> if (overflows_type(size, obj->base.size))
> return ERR_PTR(-E2BIG);
>
> - obj = i915_gem_object_alloc(dev_priv);
> + obj = i915_gem_object_alloc();
> if (obj == NULL)
> return ERR_PTR(-ENOMEM);
>
> @@ -5223,19 +5208,7 @@ static void i915_gem_init__mm(struct drm_i915_private *i915)
>
> int i915_gem_init_early(struct drm_i915_private *dev_priv)
> {
> - int err = -ENOMEM;
> -
> - dev_priv->objects = KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN);
> - if (!dev_priv->objects)
> - goto err_out;
> -
> - dev_priv->vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN);
> - if (!dev_priv->vmas)
> - goto err_objects;
> -
> - dev_priv->luts = KMEM_CACHE(i915_lut_handle, 0);
> - if (!dev_priv->luts)
> - goto err_vmas;
> + int err;
>
> INIT_LIST_HEAD(&dev_priv->gt.active_rings);
> INIT_LIST_HEAD(&dev_priv->gt.closed_vma);
> @@ -5260,13 +5233,6 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
> DRM_NOTE("Unable to create a private tmpfs mount, hugepage support will be disabled(%d).\n", err);
>
> return 0;
> -
> -err_vmas:
> - kmem_cache_destroy(dev_priv->vmas);
> -err_objects:
> - kmem_cache_destroy(dev_priv->objects);
> -err_out:
> - return err;
> }
>
> void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
> @@ -5278,13 +5244,6 @@ void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
>
> cleanup_srcu_struct(&dev_priv->gpu_error.reset_backoff_srcu);
>
> - kmem_cache_destroy(dev_priv->luts);
> - kmem_cache_destroy(dev_priv->vmas);
> - kmem_cache_destroy(dev_priv->objects);
> -
> - /* And ensure that our DESTROY_BY_RCU slabs are truly destroyed */
> - rcu_barrier();
> -
> i915_gemfs_fini(dev_priv);
> }
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 0b4a3c79be74..d266ba3f7210 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -94,6 +94,20 @@
>
> #define ALL_L3_SLICES(dev) (1 << NUM_L3_SLICES(dev)) - 1
>
> +static struct i915_global_context {
> + struct kmem_cache *slab_luts;
> +} global;
> +
> +struct i915_lut_handle *i915_lut_handle_alloc(void)
> +{
> + return kmem_cache_alloc(global.slab_luts, GFP_KERNEL);
> +}
> +
> +void i915_lut_handle_free(struct i915_lut_handle *lut)
> +{
> + return kmem_cache_free(global.slab_luts, lut);
> +}
> +
> static void lut_close(struct i915_gem_context *ctx)
> {
> struct i915_lut_handle *lut, *ln;
> @@ -102,7 +116,7 @@ static void lut_close(struct i915_gem_context *ctx)
>
> list_for_each_entry_safe(lut, ln, &ctx->handles_list, ctx_link) {
> list_del(&lut->obj_link);
> - kmem_cache_free(ctx->i915->luts, lut);
> + i915_lut_handle_free(lut);
> }
>
> rcu_read_lock();
> @@ -1408,3 +1422,22 @@ int __i915_gem_context_pin_hw_id(struct i915_gem_context *ctx)
> #include "selftests/mock_context.c"
> #include "selftests/i915_gem_context.c"
> #endif
> +
> +int __init i915_global_context_init(void)
> +{
> + global.slab_luts = KMEM_CACHE(i915_lut_handle, 0);
> + if (!global.slab_luts)
> + return -ENOMEM;
> +
> + return 0;
> +}
> +
> +void i915_global_context_shrink(void)
> +{
> + kmem_cache_shrink(global.slab_luts);
> +}
> +
> +void i915_global_context_exit(void)
> +{
> + kmem_cache_destroy(global.slab_luts);
> +}
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.h b/drivers/gpu/drm/i915/i915_gem_context.h
> index dc6c58f38cfa..be63666ffaac 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.h
> +++ b/drivers/gpu/drm/i915/i915_gem_context.h
> @@ -32,6 +32,7 @@
> #include "i915_gem.h"
> #include "i915_scheduler.h"
> #include "intel_device_info.h"
> +#include "intel_ringbuffer.h"
>
> struct pid;
>
> @@ -407,4 +408,11 @@ void intel_context_init(struct intel_context *ce,
> struct i915_gem_context *ctx,
> struct intel_engine_cs *engine);
>
> +struct i915_lut_handle *i915_lut_handle_alloc(void);
> +void i915_lut_handle_free(struct i915_lut_handle *lut);
> +
> +int i915_global_context_init(void);
> +void i915_global_context_shrink(void);
> +void i915_global_context_exit(void);
> +
> #endif /* !__I915_GEM_CONTEXT_H__ */
> diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
> index 02f7298bfe57..33181678990e 100644
> --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
> +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
> @@ -300,7 +300,7 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
>
> get_dma_buf(dma_buf);
>
> - obj = i915_gem_object_alloc(to_i915(dev));
> + obj = i915_gem_object_alloc();
> if (obj == NULL) {
> ret = -ENOMEM;
> goto fail_detach;
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 48b23c6a024e..07c0af316f86 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -854,7 +854,7 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
> goto err_obj;
> }
>
> - lut = kmem_cache_alloc(eb->i915->luts, GFP_KERNEL);
> + lut = i915_lut_handle_alloc();
> if (unlikely(!lut)) {
> err = -ENOMEM;
> goto err_obj;
> @@ -862,7 +862,7 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
>
> err = radix_tree_insert(handles_vma, handle, vma);
> if (unlikely(err)) {
> - kmem_cache_free(eb->i915->luts, lut);
> + i915_lut_handle_free(lut);
> goto err_obj;
> }
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 39671caab76b..7e79691664e5 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1913,7 +1913,7 @@ static struct i915_vma *pd_vma_create(struct gen6_hw_ppgtt *ppgtt, int size)
> GEM_BUG_ON(!IS_ALIGNED(size, I915_GTT_PAGE_SIZE));
> GEM_BUG_ON(size > ggtt->vm.total);
>
> - vma = kmem_cache_zalloc(i915->vmas, GFP_KERNEL);
> + vma = i915_vma_alloc();
> if (!vma)
> return ERR_PTR(-ENOMEM);
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c b/drivers/gpu/drm/i915/i915_gem_internal.c
> index fddde1033e74..ab627ed1269c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_internal.c
> +++ b/drivers/gpu/drm/i915/i915_gem_internal.c
> @@ -193,7 +193,7 @@ i915_gem_object_create_internal(struct drm_i915_private *i915,
> if (overflows_type(size, obj->base.size))
> return ERR_PTR(-E2BIG);
>
> - obj = i915_gem_object_alloc(i915);
> + obj = i915_gem_object_alloc();
> if (!obj)
> return ERR_PTR(-ENOMEM);
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_object.c b/drivers/gpu/drm/i915/i915_gem_object.c
> index aab8cdd80e6d..4aeb8c3b87e4 100644
> --- a/drivers/gpu/drm/i915/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/i915_gem_object.c
> @@ -25,6 +25,20 @@
> #include "i915_drv.h"
> #include "i915_gem_object.h"
>
> +static struct i915_global_object {
> + struct kmem_cache *slab_objects;
> +} global;
> +
> +struct drm_i915_gem_object *i915_gem_object_alloc(void)
> +{
> + return kmem_cache_zalloc(global.slab_objects, GFP_KERNEL);
> +}
> +
> +void i915_gem_object_free(struct drm_i915_gem_object *obj)
> +{
> + return kmem_cache_free(global.slab_objects, obj);
> +}
> +
> /**
> * Mark up the object's coherency levels for a given cache_level
> * @obj: #drm_i915_gem_object
> @@ -46,3 +60,23 @@ void i915_gem_object_set_cache_coherency(struct drm_i915_gem_object *obj,
> obj->cache_dirty =
> !(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_WRITE);
> }
> +
> +int __init i915_global_objects_init(void)
> +{
> + global.slab_objects =
> + KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN);
> + if (!global.slab_objects)
> + return -ENOMEM;
> +
> + return 0;
> +}
> +
> +void i915_global_objects_shrink(void)
> +{
> + kmem_cache_shrink(global.slab_objects);
> +}
> +
> +void i915_global_objects_exit(void)
> +{
> + kmem_cache_destroy(global.slab_objects);
> +}
> diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
> index fab040331cdb..0eaa2b3aeb62 100644
> --- a/drivers/gpu/drm/i915/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/i915_gem_object.h
> @@ -304,6 +304,9 @@ to_intel_bo(struct drm_gem_object *gem)
> return container_of(gem, struct drm_i915_gem_object, base);
> }
>
> +struct drm_i915_gem_object *i915_gem_object_alloc(void);
> +void i915_gem_object_free(struct drm_i915_gem_object *obj);
> +
> /**
> * i915_gem_object_lookup_rcu - look up a temporary GEM object from its handle
> * @filp: DRM file private date
> @@ -499,5 +502,8 @@ void i915_gem_object_set_cache_coherency(struct drm_i915_gem_object *obj,
> unsigned int cache_level);
> void i915_gem_object_flush_if_display(struct drm_i915_gem_object *obj);
>
> -#endif
> +int i915_global_objects_init(void);
> +void i915_global_objects_shrink(void);
> +void i915_global_objects_exit(void);
>
> +#endif
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 74a9661479ca..0a8082cfc761 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -565,7 +565,7 @@ _i915_gem_object_create_stolen(struct drm_i915_private *dev_priv,
> struct drm_i915_gem_object *obj;
> unsigned int cache_level;
>
> - obj = i915_gem_object_alloc(dev_priv);
> + obj = i915_gem_object_alloc();
> if (obj == NULL)
> return NULL;
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
> index 1d3f9a31ad61..ad0087127144 100644
> --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
> @@ -795,7 +795,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev,
> return -ENODEV;
> }
>
> - obj = i915_gem_object_alloc(dev_priv);
> + obj = i915_gem_object_alloc();
> if (obj == NULL)
> return -ENOMEM;
>
> diff --git a/drivers/gpu/drm/i915/i915_globals.c b/drivers/gpu/drm/i915/i915_globals.c
> index 7fd1b3945a04..cfd0bc462f58 100644
> --- a/drivers/gpu/drm/i915/i915_globals.c
> +++ b/drivers/gpu/drm/i915/i915_globals.c
> @@ -8,9 +8,12 @@
> #include <linux/workqueue.h>
>
> #include "i915_active.h"
> +#include "i915_gem_context.h"
> +#include "i915_gem_object.h"
> #include "i915_globals.h"
> #include "i915_request.h"
> #include "i915_scheduler.h"
> +#include "i915_vma.h"
>
> int __init i915_globals_init(void)
> {
> @@ -20,18 +23,36 @@ int __init i915_globals_init(void)
> if (err)
> return err;
>
> - err = i915_global_request_init();
> + err = i915_global_context_init();
> if (err)
> goto err_active;
>
> + err = i915_global_objects_init();
> + if (err)
> + goto err_context;
> +
> + err = i915_global_request_init();
> + if (err)
> + goto err_objects;
> +
> err = i915_global_scheduler_init();
> if (err)
> goto err_request;
>
> + err = i915_global_vma_init();
> + if (err)
> + goto err_scheduler;
> +
> return 0;
>
> +err_scheduler:
> + i915_global_scheduler_exit();
> err_request:
> i915_global_request_exit();
> +err_objects:
> + i915_global_objects_exit();
> +err_context:
> + i915_global_context_exit();
> err_active:
> i915_global_active_exit();
> return err;
> @@ -45,8 +66,11 @@ static void i915_globals_shrink(void)
> * with the aim of reducing fragmentation.
> */
> i915_global_active_shrink();
> + i915_global_context_shrink();
> + i915_global_objects_shrink();
> i915_global_request_shrink();
> i915_global_scheduler_shrink();
> + i915_global_vma_shrink();
> }
>
> static atomic_t active;
> @@ -104,8 +128,11 @@ void __exit i915_globals_exit(void)
> rcu_barrier();
> flush_scheduled_work();
>
> + i915_global_vma_exit();
> i915_global_scheduler_exit();
> i915_global_request_exit();
> + i915_global_objects_exit();
> + i915_global_context_exit();
> i915_global_active_exit();
>
> /* And ensure that our DESTROY_BY_RCU slabs are truly destroyed */
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index b713bed20c38..757a33998bbf 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -30,6 +30,20 @@
>
> #include <drm/drm_gem.h>
>
> +static struct i915_global_vma {
> + struct kmem_cache *slab_vmas;
> +} global;
> +
> +struct i915_vma *i915_vma_alloc(void)
> +{
> + return kmem_cache_zalloc(global.slab_vmas, GFP_KERNEL);
> +}
> +
> +void i915_vma_free(struct i915_vma *vma)
> +{
> + return kmem_cache_free(global.slab_vmas, vma);
> +}
> +
> #if IS_ENABLED(CONFIG_DRM_I915_ERRLOG_GEM) && IS_ENABLED(CONFIG_DRM_DEBUG_MM)
>
> #include <linux/stackdepot.h>
> @@ -115,7 +129,7 @@ vma_create(struct drm_i915_gem_object *obj,
> /* The aliasing_ppgtt should never be used directly! */
> GEM_BUG_ON(vm == &vm->i915->mm.aliasing_ppgtt->vm);
>
> - vma = kmem_cache_zalloc(vm->i915->vmas, GFP_KERNEL);
> + vma = i915_vma_alloc();
> if (vma == NULL)
> return ERR_PTR(-ENOMEM);
>
> @@ -190,7 +204,7 @@ vma_create(struct drm_i915_gem_object *obj,
> cmp = i915_vma_compare(pos, vm, view);
> if (cmp == 0) {
> spin_unlock(&obj->vma.lock);
> - kmem_cache_free(vm->i915->vmas, vma);
> + i915_vma_free(vma);
> return pos;
> }
>
> @@ -222,7 +236,7 @@ vma_create(struct drm_i915_gem_object *obj,
> return vma;
>
> err_vma:
> - kmem_cache_free(vm->i915->vmas, vma);
> + i915_vma_free(vma);
> return ERR_PTR(-E2BIG);
> }
>
> @@ -803,8 +817,6 @@ void i915_vma_reopen(struct i915_vma *vma)
>
> static void __i915_vma_destroy(struct i915_vma *vma)
> {
> - struct drm_i915_private *i915 = vma->vm->i915;
> -
> GEM_BUG_ON(vma->node.allocated);
> GEM_BUG_ON(vma->fence);
>
> @@ -825,7 +837,7 @@ static void __i915_vma_destroy(struct i915_vma *vma)
>
> i915_active_fini(&vma->active);
>
> - kmem_cache_free(i915->vmas, vma);
> + i915_vma_free(vma);
> }
>
> void i915_vma_destroy(struct i915_vma *vma)
> @@ -1041,3 +1053,22 @@ int i915_vma_unbind(struct i915_vma *vma)
> #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
> #include "selftests/i915_vma.c"
> #endif
> +
> +int __init i915_global_vma_init(void)
> +{
> + global.slab_vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN);
> + if (!global.slab_vmas)
> + return -ENOMEM;
> +
> + return 0;
> +}
> +
> +void i915_global_vma_shrink(void)
> +{
> + kmem_cache_shrink(global.slab_vmas);
> +}
> +
> +void i915_global_vma_exit(void)
> +{
> + kmem_cache_destroy(global.slab_vmas);
> +}
> diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
> index 7c742027f866..37f93358aa3c 100644
> --- a/drivers/gpu/drm/i915/i915_vma.h
> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -440,4 +440,11 @@ void i915_vma_parked(struct drm_i915_private *i915);
> list_for_each_entry(V, &(OBJ)->vma.list, obj_link) \
> for_each_until(!i915_vma_is_ggtt(V))
>
> +struct i915_vma *i915_vma_alloc(void);
> +void i915_vma_free(struct i915_vma *vma);
> +
> +int i915_global_vma_init(void);
> +void i915_global_vma_shrink(void);
> +void i915_global_vma_exit(void);
> +
> #endif
> diff --git a/drivers/gpu/drm/i915/selftests/huge_gem_object.c b/drivers/gpu/drm/i915/selftests/huge_gem_object.c
> index 391f3d9ffdf1..419fd4d6a8f0 100644
> --- a/drivers/gpu/drm/i915/selftests/huge_gem_object.c
> +++ b/drivers/gpu/drm/i915/selftests/huge_gem_object.c
> @@ -122,7 +122,7 @@ huge_gem_object(struct drm_i915_private *i915,
> if (overflows_type(dma_size, obj->base.size))
> return ERR_PTR(-E2BIG);
>
> - obj = i915_gem_object_alloc(i915);
> + obj = i915_gem_object_alloc();
> if (!obj)
> return ERR_PTR(-ENOMEM);
>
> diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
> index 40607ba7dda6..4b9ded4ca0f5 100644
> --- a/drivers/gpu/drm/i915/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
> @@ -171,7 +171,7 @@ huge_pages_object(struct drm_i915_private *i915,
> if (overflows_type(size, obj->base.size))
> return ERR_PTR(-E2BIG);
>
> - obj = i915_gem_object_alloc(i915);
> + obj = i915_gem_object_alloc();
> if (!obj)
> return ERR_PTR(-ENOMEM);
>
> @@ -320,7 +320,7 @@ fake_huge_pages_object(struct drm_i915_private *i915, u64 size, bool single)
> if (overflows_type(size, obj->base.size))
> return ERR_PTR(-E2BIG);
>
> - obj = i915_gem_object_alloc(i915);
> + obj = i915_gem_object_alloc();
> if (!obj)
> return ERR_PTR(-ENOMEM);
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index 488994d4ec19..826fd51c331e 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -120,7 +120,7 @@ fake_dma_object(struct drm_i915_private *i915, u64 size)
> if (overflows_type(size, obj->base.size))
> return ERR_PTR(-E2BIG);
>
> - obj = i915_gem_object_alloc(i915);
> + obj = i915_gem_object_alloc();
> if (!obj)
> goto err;
>
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index 5a98caba6d69..c27616efc4f8 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -79,9 +79,6 @@ static void mock_device_release(struct drm_device *dev)
>
> destroy_workqueue(i915->wq);
>
> - kmem_cache_destroy(i915->vmas);
> - kmem_cache_destroy(i915->objects);
> -
> i915_gemfs_fini(i915);
>
> drm_mode_config_cleanup(&i915->drm);
> @@ -200,14 +197,6 @@ struct drm_i915_private *mock_gem_device(void)
>
> i915->gt.awake = true;
>
> - i915->objects = KMEM_CACHE(mock_object, SLAB_HWCACHE_ALIGN);
> - if (!i915->objects)
> - goto err_wq;
> -
> - i915->vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN);
> - if (!i915->vmas)
> - goto err_objects;
> -
> i915_timelines_init(i915);
>
> INIT_LIST_HEAD(&i915->gt.active_rings);
> @@ -237,10 +226,6 @@ struct drm_i915_private *mock_gem_device(void)
> err_unlock:
> mutex_unlock(&i915->drm.struct_mutex);
> i915_timelines_fini(i915);
> - kmem_cache_destroy(i915->vmas);
> -err_objects:
> - kmem_cache_destroy(i915->objects);
> -err_wq:
> destroy_workqueue(i915->wq);
> err_drv:
> drm_mode_config_cleanup(&i915->drm);
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 3/3] drm/i915: Remove second level open-coded rcu work
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
2019-02-27 23:09 ` [PATCH 2/3] drm/i915: Make object/vma " Chris Wilson
@ 2019-02-27 23:09 ` Chris Wilson
2019-02-28 7:56 ` Tvrtko Ursulin
2019-02-28 8:29 ` [PATCH] " Chris Wilson
2019-02-28 0:22 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Make request allocation caches global Patchwork
` (7 subsequent siblings)
9 siblings, 2 replies; 19+ messages in thread
From: Chris Wilson @ 2019-02-27 23:09 UTC (permalink / raw)
To: intel-gfx
We currently use a worker queued from an rcu callback to determine when
a how grace period has elapsed while we remained idle. We use this idle
delay to infer that we will be idle for a while and this is a suitable
point at which we can trim our global memory caches.
Since we wrote that, this mechanism now exists as rcu_work, and having
converted the idle shrinkers over to using that, we can remove our own
variant.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem.c | 91 +++++----------------------------
1 file changed, 12 insertions(+), 79 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8ded7e1756c9..8cf3429594d5 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -101,7 +101,7 @@ static void i915_gem_info_remove_obj(struct drm_i915_private *dev_priv,
spin_unlock(&dev_priv->mm.object_stat_lock);
}
-static u32 __i915_gem_park(struct drm_i915_private *i915)
+static void __i915_gem_park(struct drm_i915_private *i915)
{
intel_wakeref_t wakeref;
@@ -112,7 +112,7 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
GEM_BUG_ON(!list_empty(&i915->gt.active_rings));
if (!i915->gt.awake)
- return I915_EPOCH_INVALID;
+ return;
GEM_BUG_ON(i915->gt.epoch == I915_EPOCH_INVALID);
@@ -143,7 +143,15 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
- return i915->gt.epoch;
+ /*
+ * When we are idle, it is an opportune time to reap our caches.
+ * However, we have many objects that utilise RCU and the ordered
+ * i915->wq that this work is executing on. To try and flush any
+ * pending frees now we are idle, we first wait for an RCU grace
+ * period, and then queue a task (that will run last on the wq) to
+ * shrink and re-optimize the caches.
+ */
+ i915_globals_park();
}
void i915_gem_park(struct drm_i915_private *i915)
@@ -2877,62 +2885,6 @@ i915_gem_retire_work_handler(struct work_struct *work)
round_jiffies_up_relative(HZ));
}
-static void shrink_caches(struct drm_i915_private *i915)
-{
- /*
- * kmem_cache_shrink() discards empty slabs and reorders partially
- * filled slabs to prioritise allocating from the mostly full slabs,
- * with the aim of reducing fragmentation.
- */
- i915_globals_park();
-}
-
-struct sleep_rcu_work {
- union {
- struct rcu_head rcu;
- struct work_struct work;
- };
- struct drm_i915_private *i915;
- unsigned int epoch;
-};
-
-static inline bool
-same_epoch(struct drm_i915_private *i915, unsigned int epoch)
-{
- /*
- * There is a small chance that the epoch wrapped since we started
- * sleeping. If we assume that epoch is at least a u32, then it will
- * take at least 2^32 * 100ms for it to wrap, or about 326 years.
- */
- return epoch == READ_ONCE(i915->gt.epoch);
-}
-
-static void __sleep_work(struct work_struct *work)
-{
- struct sleep_rcu_work *s = container_of(work, typeof(*s), work);
- struct drm_i915_private *i915 = s->i915;
- unsigned int epoch = s->epoch;
-
- kfree(s);
- if (same_epoch(i915, epoch))
- shrink_caches(i915);
-}
-
-static void __sleep_rcu(struct rcu_head *rcu)
-{
- struct sleep_rcu_work *s = container_of(rcu, typeof(*s), rcu);
- struct drm_i915_private *i915 = s->i915;
-
- destroy_rcu_head(&s->rcu);
-
- if (same_epoch(i915, s->epoch)) {
- INIT_WORK(&s->work, __sleep_work);
- queue_work(i915->wq, &s->work);
- } else {
- kfree(s);
- }
-}
-
static inline bool
new_requests_since_last_retire(const struct drm_i915_private *i915)
{
@@ -2961,7 +2913,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
{
struct drm_i915_private *dev_priv =
container_of(work, typeof(*dev_priv), gt.idle_work.work);
- unsigned int epoch = I915_EPOCH_INVALID;
bool rearm_hangcheck;
if (!READ_ONCE(dev_priv->gt.awake))
@@ -3016,7 +2967,7 @@ i915_gem_idle_work_handler(struct work_struct *work)
if (new_requests_since_last_retire(dev_priv))
goto out_unlock;
- epoch = __i915_gem_park(dev_priv);
+ __i915_gem_park(dev_priv);
assert_kernel_context_is_current(dev_priv);
@@ -3029,24 +2980,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
GEM_BUG_ON(!dev_priv->gt.awake);
i915_queue_hangcheck(dev_priv);
}
-
- /*
- * When we are idle, it is an opportune time to reap our caches.
- * However, we have many objects that utilise RCU and the ordered
- * i915->wq that this work is executing on. To try and flush any
- * pending frees now we are idle, we first wait for an RCU grace
- * period, and then queue a task (that will run last on the wq) to
- * shrink and re-optimize the caches.
- */
- if (same_epoch(dev_priv, epoch)) {
- struct sleep_rcu_work *s = kmalloc(sizeof(*s), GFP_KERNEL);
- if (s) {
- init_rcu_head(&s->rcu);
- s->i915 = dev_priv;
- s->epoch = epoch;
- call_rcu(&s->rcu, __sleep_rcu);
- }
- }
}
void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] drm/i915: Remove second level open-coded rcu work
2019-02-27 23:09 ` [PATCH 3/3] drm/i915: Remove second level open-coded rcu work Chris Wilson
@ 2019-02-28 7:56 ` Tvrtko Ursulin
2019-02-28 8:03 ` Chris Wilson
2019-02-28 8:29 ` [PATCH] " Chris Wilson
1 sibling, 1 reply; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-02-28 7:56 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 27/02/2019 23:09, Chris Wilson wrote:
> We currently use a worker queued from an rcu callback to determine when
> a how grace period has elapsed while we remained idle. We use this idle
> delay to infer that we will be idle for a while and this is a suitable
> point at which we can trim our global memory caches.
>
> Since we wrote that, this mechanism now exists as rcu_work, and having
> converted the idle shrinkers over to using that, we can remove our own
> variant.
By the look of it gt.epoch can be completely ripped out.
Regards,
Tvrtko
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 91 +++++----------------------------
> 1 file changed, 12 insertions(+), 79 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 8ded7e1756c9..8cf3429594d5 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -101,7 +101,7 @@ static void i915_gem_info_remove_obj(struct drm_i915_private *dev_priv,
> spin_unlock(&dev_priv->mm.object_stat_lock);
> }
>
> -static u32 __i915_gem_park(struct drm_i915_private *i915)
> +static void __i915_gem_park(struct drm_i915_private *i915)
> {
> intel_wakeref_t wakeref;
>
> @@ -112,7 +112,7 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
> GEM_BUG_ON(!list_empty(&i915->gt.active_rings));
>
> if (!i915->gt.awake)
> - return I915_EPOCH_INVALID;
> + return;
>
> GEM_BUG_ON(i915->gt.epoch == I915_EPOCH_INVALID);
>
> @@ -143,7 +143,15 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
>
> intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
>
> - return i915->gt.epoch;
> + /*
> + * When we are idle, it is an opportune time to reap our caches.
> + * However, we have many objects that utilise RCU and the ordered
> + * i915->wq that this work is executing on. To try and flush any
> + * pending frees now we are idle, we first wait for an RCU grace
> + * period, and then queue a task (that will run last on the wq) to
> + * shrink and re-optimize the caches.
> + */
> + i915_globals_park();
> }
>
> void i915_gem_park(struct drm_i915_private *i915)
> @@ -2877,62 +2885,6 @@ i915_gem_retire_work_handler(struct work_struct *work)
> round_jiffies_up_relative(HZ));
> }
>
> -static void shrink_caches(struct drm_i915_private *i915)
> -{
> - /*
> - * kmem_cache_shrink() discards empty slabs and reorders partially
> - * filled slabs to prioritise allocating from the mostly full slabs,
> - * with the aim of reducing fragmentation.
> - */
> - i915_globals_park();
> -}
> -
> -struct sleep_rcu_work {
> - union {
> - struct rcu_head rcu;
> - struct work_struct work;
> - };
> - struct drm_i915_private *i915;
> - unsigned int epoch;
> -};
> -
> -static inline bool
> -same_epoch(struct drm_i915_private *i915, unsigned int epoch)
> -{
> - /*
> - * There is a small chance that the epoch wrapped since we started
> - * sleeping. If we assume that epoch is at least a u32, then it will
> - * take at least 2^32 * 100ms for it to wrap, or about 326 years.
> - */
> - return epoch == READ_ONCE(i915->gt.epoch);
> -}
> -
> -static void __sleep_work(struct work_struct *work)
> -{
> - struct sleep_rcu_work *s = container_of(work, typeof(*s), work);
> - struct drm_i915_private *i915 = s->i915;
> - unsigned int epoch = s->epoch;
> -
> - kfree(s);
> - if (same_epoch(i915, epoch))
> - shrink_caches(i915);
> -}
> -
> -static void __sleep_rcu(struct rcu_head *rcu)
> -{
> - struct sleep_rcu_work *s = container_of(rcu, typeof(*s), rcu);
> - struct drm_i915_private *i915 = s->i915;
> -
> - destroy_rcu_head(&s->rcu);
> -
> - if (same_epoch(i915, s->epoch)) {
> - INIT_WORK(&s->work, __sleep_work);
> - queue_work(i915->wq, &s->work);
> - } else {
> - kfree(s);
> - }
> -}
> -
> static inline bool
> new_requests_since_last_retire(const struct drm_i915_private *i915)
> {
> @@ -2961,7 +2913,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
> {
> struct drm_i915_private *dev_priv =
> container_of(work, typeof(*dev_priv), gt.idle_work.work);
> - unsigned int epoch = I915_EPOCH_INVALID;
> bool rearm_hangcheck;
>
> if (!READ_ONCE(dev_priv->gt.awake))
> @@ -3016,7 +2967,7 @@ i915_gem_idle_work_handler(struct work_struct *work)
> if (new_requests_since_last_retire(dev_priv))
> goto out_unlock;
>
> - epoch = __i915_gem_park(dev_priv);
> + __i915_gem_park(dev_priv);
>
> assert_kernel_context_is_current(dev_priv);
>
> @@ -3029,24 +2980,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
> GEM_BUG_ON(!dev_priv->gt.awake);
> i915_queue_hangcheck(dev_priv);
> }
> -
> - /*
> - * When we are idle, it is an opportune time to reap our caches.
> - * However, we have many objects that utilise RCU and the ordered
> - * i915->wq that this work is executing on. To try and flush any
> - * pending frees now we are idle, we first wait for an RCU grace
> - * period, and then queue a task (that will run last on the wq) to
> - * shrink and re-optimize the caches.
> - */
> - if (same_epoch(dev_priv, epoch)) {
> - struct sleep_rcu_work *s = kmalloc(sizeof(*s), GFP_KERNEL);
> - if (s) {
> - init_rcu_head(&s->rcu);
> - s->i915 = dev_priv;
> - s->epoch = epoch;
> - call_rcu(&s->rcu, __sleep_rcu);
> - }
> - }
> }
>
> void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] drm/i915: Remove second level open-coded rcu work
2019-02-28 7:56 ` Tvrtko Ursulin
@ 2019-02-28 8:03 ` Chris Wilson
0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-02-28 8:03 UTC (permalink / raw)
To: Tvrtko Ursulin, intel-gfx
Quoting Tvrtko Ursulin (2019-02-28 07:56:20)
>
> On 27/02/2019 23:09, Chris Wilson wrote:
> > We currently use a worker queued from an rcu callback to determine when
> > a how grace period has elapsed while we remained idle. We use this idle
> > delay to infer that we will be idle for a while and this is a suitable
> > point at which we can trim our global memory caches.
> >
> > Since we wrote that, this mechanism now exists as rcu_work, and having
> > converted the idle shrinkers over to using that, we can remove our own
> > variant.
>
> By the look of it gt.epoch can be completely ripped out.
Yup, my first thought was that I remember some trickery involving epoch
and mock, but that too looks like it has evaporated.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH] drm/i915: Remove second level open-coded rcu work
2019-02-27 23:09 ` [PATCH 3/3] drm/i915: Remove second level open-coded rcu work Chris Wilson
2019-02-28 7:56 ` Tvrtko Ursulin
@ 2019-02-28 8:29 ` Chris Wilson
2019-02-28 9:38 ` Tvrtko Ursulin
1 sibling, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2019-02-28 8:29 UTC (permalink / raw)
To: intel-gfx
We currently use a worker queued from an rcu callback to determine when
a how grace period has elapsed while we remained idle. We use this idle
delay to infer that we will be idle for a while and this is a suitable
point at which we can trim our global memory caches.
Since we wrote that, this mechanism now exists as rcu_work, and having
converted the idle shrinkers over to using that, we can remove our own
variant.
v2: Say goodby to gt.epoch as well.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 6 +-
drivers/gpu/drm/i915/i915_drv.h | 6 --
drivers/gpu/drm/i915/i915_gem.c | 96 ++++-------------------------
3 files changed, 14 insertions(+), 94 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 545091a5180b..298371aad445 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2655,8 +2655,7 @@ static int i915_runtime_pm_status(struct seq_file *m, void *unused)
seq_printf(m, "Runtime power status: %s\n",
enableddisabled(!dev_priv->power_domains.wakeref));
- seq_printf(m, "GPU idle: %s (epoch %u)\n",
- yesno(!dev_priv->gt.awake), dev_priv->gt.epoch);
+ seq_printf(m, "GPU idle: %s\n", yesno(!dev_priv->gt.awake));
seq_printf(m, "IRQs disabled: %s\n",
yesno(!intel_irqs_enabled(dev_priv)));
#ifdef CONFIG_PM
@@ -3092,8 +3091,7 @@ static int i915_engine_info(struct seq_file *m, void *unused)
wakeref = intel_runtime_pm_get(dev_priv);
- seq_printf(m, "GT awake? %s (epoch %u)\n",
- yesno(dev_priv->gt.awake), dev_priv->gt.epoch);
+ seq_printf(m, "GT awake? %s\n", yesno(dev_priv->gt.awake));
seq_printf(m, "Global active requests: %d\n",
dev_priv->gt.active_requests);
seq_printf(m, "CS timestamp frequency: %u kHz\n",
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 35516089a3ff..453af7438e67 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2005,12 +2005,6 @@ struct drm_i915_private {
*/
intel_wakeref_t awake;
- /**
- * The number of times we have woken up.
- */
- unsigned int epoch;
-#define I915_EPOCH_INVALID 0
-
/**
* We leave the user IRQ off as much as possible,
* but this means that requests will finish and never
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8ded7e1756c9..b4c6132a3a7a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -101,7 +101,7 @@ static void i915_gem_info_remove_obj(struct drm_i915_private *dev_priv,
spin_unlock(&dev_priv->mm.object_stat_lock);
}
-static u32 __i915_gem_park(struct drm_i915_private *i915)
+static void __i915_gem_park(struct drm_i915_private *i915)
{
intel_wakeref_t wakeref;
@@ -112,9 +112,7 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
GEM_BUG_ON(!list_empty(&i915->gt.active_rings));
if (!i915->gt.awake)
- return I915_EPOCH_INVALID;
-
- GEM_BUG_ON(i915->gt.epoch == I915_EPOCH_INVALID);
+ return;
/*
* Be paranoid and flush a concurrent interrupt to make sure
@@ -143,7 +141,15 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
- return i915->gt.epoch;
+ /*
+ * When we are idle, it is an opportune time to reap our caches.
+ * However, we have many objects that utilise RCU and the ordered
+ * i915->wq that this work is executing on. To try and flush any
+ * pending frees now we are idle, we first wait for an RCU grace
+ * period, and then queue a task (that will run last on the wq) to
+ * shrink and re-optimize the caches.
+ */
+ i915_globals_park();
}
void i915_gem_park(struct drm_i915_private *i915)
@@ -185,9 +191,6 @@ void i915_gem_unpark(struct drm_i915_private *i915)
i915->gt.awake = intel_display_power_get(i915, POWER_DOMAIN_GT_IRQ);
GEM_BUG_ON(!i915->gt.awake);
- if (unlikely(++i915->gt.epoch == 0)) /* keep 0 as invalid */
- i915->gt.epoch = 1;
-
i915_globals_unpark();
intel_enable_gt_powersave(i915);
@@ -2877,62 +2880,6 @@ i915_gem_retire_work_handler(struct work_struct *work)
round_jiffies_up_relative(HZ));
}
-static void shrink_caches(struct drm_i915_private *i915)
-{
- /*
- * kmem_cache_shrink() discards empty slabs and reorders partially
- * filled slabs to prioritise allocating from the mostly full slabs,
- * with the aim of reducing fragmentation.
- */
- i915_globals_park();
-}
-
-struct sleep_rcu_work {
- union {
- struct rcu_head rcu;
- struct work_struct work;
- };
- struct drm_i915_private *i915;
- unsigned int epoch;
-};
-
-static inline bool
-same_epoch(struct drm_i915_private *i915, unsigned int epoch)
-{
- /*
- * There is a small chance that the epoch wrapped since we started
- * sleeping. If we assume that epoch is at least a u32, then it will
- * take at least 2^32 * 100ms for it to wrap, or about 326 years.
- */
- return epoch == READ_ONCE(i915->gt.epoch);
-}
-
-static void __sleep_work(struct work_struct *work)
-{
- struct sleep_rcu_work *s = container_of(work, typeof(*s), work);
- struct drm_i915_private *i915 = s->i915;
- unsigned int epoch = s->epoch;
-
- kfree(s);
- if (same_epoch(i915, epoch))
- shrink_caches(i915);
-}
-
-static void __sleep_rcu(struct rcu_head *rcu)
-{
- struct sleep_rcu_work *s = container_of(rcu, typeof(*s), rcu);
- struct drm_i915_private *i915 = s->i915;
-
- destroy_rcu_head(&s->rcu);
-
- if (same_epoch(i915, s->epoch)) {
- INIT_WORK(&s->work, __sleep_work);
- queue_work(i915->wq, &s->work);
- } else {
- kfree(s);
- }
-}
-
static inline bool
new_requests_since_last_retire(const struct drm_i915_private *i915)
{
@@ -2961,7 +2908,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
{
struct drm_i915_private *dev_priv =
container_of(work, typeof(*dev_priv), gt.idle_work.work);
- unsigned int epoch = I915_EPOCH_INVALID;
bool rearm_hangcheck;
if (!READ_ONCE(dev_priv->gt.awake))
@@ -3016,7 +2962,7 @@ i915_gem_idle_work_handler(struct work_struct *work)
if (new_requests_since_last_retire(dev_priv))
goto out_unlock;
- epoch = __i915_gem_park(dev_priv);
+ __i915_gem_park(dev_priv);
assert_kernel_context_is_current(dev_priv);
@@ -3029,24 +2975,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
GEM_BUG_ON(!dev_priv->gt.awake);
i915_queue_hangcheck(dev_priv);
}
-
- /*
- * When we are idle, it is an opportune time to reap our caches.
- * However, we have many objects that utilise RCU and the ordered
- * i915->wq that this work is executing on. To try and flush any
- * pending frees now we are idle, we first wait for an RCU grace
- * period, and then queue a task (that will run last on the wq) to
- * shrink and re-optimize the caches.
- */
- if (same_epoch(dev_priv, epoch)) {
- struct sleep_rcu_work *s = kmalloc(sizeof(*s), GFP_KERNEL);
- if (s) {
- init_rcu_head(&s->rcu);
- s->i915 = dev_priv;
- s->epoch = epoch;
- call_rcu(&s->rcu, __sleep_rcu);
- }
- }
}
void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH] drm/i915: Remove second level open-coded rcu work
2019-02-28 8:29 ` [PATCH] " Chris Wilson
@ 2019-02-28 9:38 ` Tvrtko Ursulin
2019-02-28 9:43 ` Chris Wilson
0 siblings, 1 reply; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-02-28 9:38 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 28/02/2019 08:29, Chris Wilson wrote:
> We currently use a worker queued from an rcu callback to determine when
> a how grace period has elapsed while we remained idle. We use this idle
> delay to infer that we will be idle for a while and this is a suitable
> point at which we can trim our global memory caches.
>
> Since we wrote that, this mechanism now exists as rcu_work, and having
> converted the idle shrinkers over to using that, we can remove our own
> variant.
>
> v2: Say goodby to gt.epoch as well.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 6 +-
> drivers/gpu/drm/i915/i915_drv.h | 6 --
> drivers/gpu/drm/i915/i915_gem.c | 96 ++++-------------------------
> 3 files changed, 14 insertions(+), 94 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 545091a5180b..298371aad445 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2655,8 +2655,7 @@ static int i915_runtime_pm_status(struct seq_file *m, void *unused)
> seq_printf(m, "Runtime power status: %s\n",
> enableddisabled(!dev_priv->power_domains.wakeref));
>
> - seq_printf(m, "GPU idle: %s (epoch %u)\n",
> - yesno(!dev_priv->gt.awake), dev_priv->gt.epoch);
> + seq_printf(m, "GPU idle: %s\n", yesno(!dev_priv->gt.awake));
> seq_printf(m, "IRQs disabled: %s\n",
> yesno(!intel_irqs_enabled(dev_priv)));
> #ifdef CONFIG_PM
> @@ -3092,8 +3091,7 @@ static int i915_engine_info(struct seq_file *m, void *unused)
>
> wakeref = intel_runtime_pm_get(dev_priv);
>
> - seq_printf(m, "GT awake? %s (epoch %u)\n",
> - yesno(dev_priv->gt.awake), dev_priv->gt.epoch);
> + seq_printf(m, "GT awake? %s\n", yesno(dev_priv->gt.awake));
> seq_printf(m, "Global active requests: %d\n",
> dev_priv->gt.active_requests);
> seq_printf(m, "CS timestamp frequency: %u kHz\n",
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 35516089a3ff..453af7438e67 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2005,12 +2005,6 @@ struct drm_i915_private {
> */
> intel_wakeref_t awake;
>
> - /**
> - * The number of times we have woken up.
> - */
> - unsigned int epoch;
> -#define I915_EPOCH_INVALID 0
> -
> /**
> * We leave the user IRQ off as much as possible,
> * but this means that requests will finish and never
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 8ded7e1756c9..b4c6132a3a7a 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -101,7 +101,7 @@ static void i915_gem_info_remove_obj(struct drm_i915_private *dev_priv,
> spin_unlock(&dev_priv->mm.object_stat_lock);
> }
>
> -static u32 __i915_gem_park(struct drm_i915_private *i915)
> +static void __i915_gem_park(struct drm_i915_private *i915)
> {
> intel_wakeref_t wakeref;
>
> @@ -112,9 +112,7 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
> GEM_BUG_ON(!list_empty(&i915->gt.active_rings));
>
> if (!i915->gt.awake)
> - return I915_EPOCH_INVALID;
> -
> - GEM_BUG_ON(i915->gt.epoch == I915_EPOCH_INVALID);
> + return;
>
> /*
> * Be paranoid and flush a concurrent interrupt to make sure
> @@ -143,7 +141,15 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
>
> intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
>
> - return i915->gt.epoch;
> + /*
> + * When we are idle, it is an opportune time to reap our caches.
> + * However, we have many objects that utilise RCU and the ordered
> + * i915->wq that this work is executing on. To try and flush any
> + * pending frees now we are idle, we first wait for an RCU grace
> + * period, and then queue a task (that will run last on the wq) to
> + * shrink and re-optimize the caches.
> + */
> + i915_globals_park();
I think this comment would be better placed in i915_globals_park.
> }
>
> void i915_gem_park(struct drm_i915_private *i915)
> @@ -185,9 +191,6 @@ void i915_gem_unpark(struct drm_i915_private *i915)
> i915->gt.awake = intel_display_power_get(i915, POWER_DOMAIN_GT_IRQ);
> GEM_BUG_ON(!i915->gt.awake);
>
> - if (unlikely(++i915->gt.epoch == 0)) /* keep 0 as invalid */
> - i915->gt.epoch = 1;
> -
> i915_globals_unpark();
>
> intel_enable_gt_powersave(i915);
> @@ -2877,62 +2880,6 @@ i915_gem_retire_work_handler(struct work_struct *work)
> round_jiffies_up_relative(HZ));
> }
>
> -static void shrink_caches(struct drm_i915_private *i915)
> -{
> - /*
> - * kmem_cache_shrink() discards empty slabs and reorders partially
> - * filled slabs to prioritise allocating from the mostly full slabs,
> - * with the aim of reducing fragmentation.
> - */
> - i915_globals_park();
> -}
> -
> -struct sleep_rcu_work {
> - union {
> - struct rcu_head rcu;
> - struct work_struct work;
> - };
> - struct drm_i915_private *i915;
> - unsigned int epoch;
> -};
> -
> -static inline bool
> -same_epoch(struct drm_i915_private *i915, unsigned int epoch)
> -{
> - /*
> - * There is a small chance that the epoch wrapped since we started
> - * sleeping. If we assume that epoch is at least a u32, then it will
> - * take at least 2^32 * 100ms for it to wrap, or about 326 years.
> - */
> - return epoch == READ_ONCE(i915->gt.epoch);
> -}
> -
> -static void __sleep_work(struct work_struct *work)
> -{
> - struct sleep_rcu_work *s = container_of(work, typeof(*s), work);
> - struct drm_i915_private *i915 = s->i915;
> - unsigned int epoch = s->epoch;
> -
> - kfree(s);
> - if (same_epoch(i915, epoch))
> - shrink_caches(i915);
> -}
> -
> -static void __sleep_rcu(struct rcu_head *rcu)
> -{
> - struct sleep_rcu_work *s = container_of(rcu, typeof(*s), rcu);
> - struct drm_i915_private *i915 = s->i915;
> -
> - destroy_rcu_head(&s->rcu);
> -
> - if (same_epoch(i915, s->epoch)) {
> - INIT_WORK(&s->work, __sleep_work);
> - queue_work(i915->wq, &s->work);
> - } else {
> - kfree(s);
> - }
> -}
> -
> static inline bool
> new_requests_since_last_retire(const struct drm_i915_private *i915)
> {
> @@ -2961,7 +2908,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
> {
> struct drm_i915_private *dev_priv =
> container_of(work, typeof(*dev_priv), gt.idle_work.work);
> - unsigned int epoch = I915_EPOCH_INVALID;
> bool rearm_hangcheck;
>
> if (!READ_ONCE(dev_priv->gt.awake))
> @@ -3016,7 +2962,7 @@ i915_gem_idle_work_handler(struct work_struct *work)
> if (new_requests_since_last_retire(dev_priv))
> goto out_unlock;
>
> - epoch = __i915_gem_park(dev_priv);
> + __i915_gem_park(dev_priv);
>
> assert_kernel_context_is_current(dev_priv);
>
> @@ -3029,24 +2975,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
> GEM_BUG_ON(!dev_priv->gt.awake);
> i915_queue_hangcheck(dev_priv);
> }
> -
> - /*
> - * When we are idle, it is an opportune time to reap our caches.
> - * However, we have many objects that utilise RCU and the ordered
> - * i915->wq that this work is executing on. To try and flush any
> - * pending frees now we are idle, we first wait for an RCU grace
> - * period, and then queue a task (that will run last on the wq) to
> - * shrink and re-optimize the caches.
> - */
> - if (same_epoch(dev_priv, epoch)) {
> - struct sleep_rcu_work *s = kmalloc(sizeof(*s), GFP_KERNEL);
> - if (s) {
> - init_rcu_head(&s->rcu);
> - s->i915 = dev_priv;
> - s->epoch = epoch;
> - call_rcu(&s->rcu, __sleep_rcu);
> - }
> - }
> }
>
> void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
>
Either way:
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] drm/i915: Remove second level open-coded rcu work
2019-02-28 9:38 ` Tvrtko Ursulin
@ 2019-02-28 9:43 ` Chris Wilson
2019-02-28 9:55 ` Tvrtko Ursulin
0 siblings, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2019-02-28 9:43 UTC (permalink / raw)
To: Tvrtko Ursulin, intel-gfx
Quoting Tvrtko Ursulin (2019-02-28 09:38:36)
>
> On 28/02/2019 08:29, Chris Wilson wrote:
> > @@ -143,7 +141,15 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
> >
> > intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
> >
> > - return i915->gt.epoch;
> > + /*
> > + * When we are idle, it is an opportune time to reap our caches.
> > + * However, we have many objects that utilise RCU and the ordered
> > + * i915->wq that this work is executing on. To try and flush any
> > + * pending frees now we are idle, we first wait for an RCU grace
> > + * period, and then queue a task (that will run last on the wq) to
> > + * shrink and re-optimize the caches.
> > + */
> > + i915_globals_park();
>
> I think this comment would be better placed in i915_globals_park.
In i915_globals_park(), we have
/*
* Defer shrinking the global slab caches (and other work) until
* after a RCU grace period has completed with no activity. This
* is to try and reduce the latency impact on the consumers caused
* by us shrinking the caches the same time as they are trying to
* allocate, with the assumption being that if we idle long enough
* for an RCU grace period to elapse since the last use, it is likely
* to be longer until we need the caches again.
*/
Yeah, the old comment is a bit too verbose now, but I think it's still
worth having a comment there to explain what's about to be done and why
we call it now.
/* Tell the world we are idle and reap the benefits! */
Too subtle?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] drm/i915: Remove second level open-coded rcu work
2019-02-28 9:43 ` Chris Wilson
@ 2019-02-28 9:55 ` Tvrtko Ursulin
2019-02-28 10:01 ` Chris Wilson
0 siblings, 1 reply; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-02-28 9:55 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 28/02/2019 09:43, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-02-28 09:38:36)
>>
>> On 28/02/2019 08:29, Chris Wilson wrote:
>>> @@ -143,7 +141,15 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
>>>
>>> intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
>>>
>>> - return i915->gt.epoch;
>>> + /*
>>> + * When we are idle, it is an opportune time to reap our caches.
>>> + * However, we have many objects that utilise RCU and the ordered
>>> + * i915->wq that this work is executing on. To try and flush any
>>> + * pending frees now we are idle, we first wait for an RCU grace
>>> + * period, and then queue a task (that will run last on the wq) to
>>> + * shrink and re-optimize the caches.
>>> + */
>>> + i915_globals_park();
>>
>> I think this comment would be better placed in i915_globals_park.
>
> In i915_globals_park(), we have
>
> /*
> * Defer shrinking the global slab caches (and other work) until
> * after a RCU grace period has completed with no activity. This
> * is to try and reduce the latency impact on the consumers caused
> * by us shrinking the caches the same time as they are trying to
> * allocate, with the assumption being that if we idle long enough
> * for an RCU grace period to elapse since the last use, it is likely
> * to be longer until we need the caches again.
> */
>
> Yeah, the old comment is a bit too verbose now, but I think it's still
> worth having a comment there to explain what's about to be done and why
> we call it now.
>
> /* Tell the world we are idle and reap the benefits! */
>
> Too subtle?
Maybe even no comment needed (gasp!). When I looks at the function I see:
__i915_gem_park(...)
{
...
intel_engines_park(i915);
i915_timelines_park(i915);
i915_pmu_gt_parked(i915);
i915_vma_parked(i915);
...
i915_globals_park();
...
}
So it seems pretty obvious different components are parked from here. :)
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] drm/i915: Remove second level open-coded rcu work
2019-02-28 9:55 ` Tvrtko Ursulin
@ 2019-02-28 10:01 ` Chris Wilson
0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-02-28 10:01 UTC (permalink / raw)
To: Tvrtko Ursulin, intel-gfx
Quoting Tvrtko Ursulin (2019-02-28 09:55:46)
>
> On 28/02/2019 09:43, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2019-02-28 09:38:36)
> >>
> >> On 28/02/2019 08:29, Chris Wilson wrote:
> >>> @@ -143,7 +141,15 @@ static u32 __i915_gem_park(struct drm_i915_private *i915)
> >>>
> >>> intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
> >>>
> >>> - return i915->gt.epoch;
> >>> + /*
> >>> + * When we are idle, it is an opportune time to reap our caches.
> >>> + * However, we have many objects that utilise RCU and the ordered
> >>> + * i915->wq that this work is executing on. To try and flush any
> >>> + * pending frees now we are idle, we first wait for an RCU grace
> >>> + * period, and then queue a task (that will run last on the wq) to
> >>> + * shrink and re-optimize the caches.
> >>> + */
> >>> + i915_globals_park();
> >>
> >> I think this comment would be better placed in i915_globals_park.
> >
> > In i915_globals_park(), we have
> >
> > /*
> > * Defer shrinking the global slab caches (and other work) until
> > * after a RCU grace period has completed with no activity. This
> > * is to try and reduce the latency impact on the consumers caused
> > * by us shrinking the caches the same time as they are trying to
> > * allocate, with the assumption being that if we idle long enough
> > * for an RCU grace period to elapse since the last use, it is likely
> > * to be longer until we need the caches again.
> > */
> >
> > Yeah, the old comment is a bit too verbose now, but I think it's still
> > worth having a comment there to explain what's about to be done and why
> > we call it now.
> >
> > /* Tell the world we are idle and reap the benefits! */
> >
> > Too subtle?
>
> Maybe even no comment needed (gasp!). When I looks at the function I see:
>
> __i915_gem_park(...)
> {
> ...
> intel_engines_park(i915);
> i915_timelines_park(i915);
>
> i915_pmu_gt_parked(i915);
> i915_vma_parked(i915);
> ...
> i915_globals_park();
> ...
> }
>
> So it seems pretty obvious different components are parked from here. :)
No comment. ;)
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Make request allocation caches global
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
2019-02-27 23:09 ` [PATCH 2/3] drm/i915: Make object/vma " Chris Wilson
2019-02-27 23:09 ` [PATCH 3/3] drm/i915: Remove second level open-coded rcu work Chris Wilson
@ 2019-02-28 0:22 ` Patchwork
2019-02-28 0:23 ` ✗ Fi.CI.SPARSE: " Patchwork
` (6 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-02-28 0:22 UTC (permalink / raw)
To: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm/i915: Make request allocation caches global
URL : https://patchwork.freedesktop.org/series/57319/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
158b026641f1 drm/i915: Make request allocation caches global
-:162: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#162:
new file mode 100644
-:167: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#167: FILE: drivers/gpu/drm/i915/i915_globals.c:1:
+/*
-:286: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#286: FILE: drivers/gpu/drm/i915/i915_globals.h:1:
+/*
-:627: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'plist' - possible side-effects?
#627: FILE: drivers/gpu/drm/i915/i915_scheduler.h:93:
+#define priolist_for_each_request(it, plist, idx) \
+ for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
+ list_for_each_entry(it, &(plist)->requests[idx], sched.link)
-:627: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'idx' - possible side-effects?
#627: FILE: drivers/gpu/drm/i915/i915_scheduler.h:93:
+#define priolist_for_each_request(it, plist, idx) \
+ for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
+ list_for_each_entry(it, &(plist)->requests[idx], sched.link)
-:631: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'plist' - possible side-effects?
#631: FILE: drivers/gpu/drm/i915/i915_scheduler.h:97:
+#define priolist_for_each_request_consume(it, n, plist, idx) \
+ for (; (idx = ffs((plist)->used)); (plist)->used &= ~BIT(idx - 1)) \
+ list_for_each_entry_safe(it, n, \
+ &(plist)->requests[idx - 1], \
+ sched.link)
-:631: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'idx' - possible side-effects?
#631: FILE: drivers/gpu/drm/i915/i915_scheduler.h:97:
+#define priolist_for_each_request_consume(it, n, plist, idx) \
+ for (; (idx = ffs((plist)->used)); (plist)->used &= ~BIT(idx - 1)) \
+ list_for_each_entry_safe(it, n, \
+ &(plist)->requests[idx - 1], \
+ sched.link)
total: 0 errors, 3 warnings, 4 checks, 800 lines checked
8e4c2b2cab40 drm/i915: Make object/vma allocation caches global
dc80371b25d6 drm/i915: Remove second level open-coded rcu work
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm/i915: Make request allocation caches global
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
` (2 preceding siblings ...)
2019-02-28 0:22 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Make request allocation caches global Patchwork
@ 2019-02-28 0:23 ` Patchwork
2019-02-28 0:50 ` ✓ Fi.CI.BAT: success " Patchwork
` (5 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-02-28 0:23 UTC (permalink / raw)
To: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm/i915: Make request allocation caches global
URL : https://patchwork.freedesktop.org/series/57319/
State : warning
== Summary ==
$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915: Make request allocation caches global
-drivers/gpu/drm/i915/selftests/../i915_drv.h:3581:16: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_drv.h:3578:16: warning: expression using sizeof(void)
Commit: drm/i915: Make object/vma allocation caches global
-drivers/gpu/drm/i915/selftests/../i915_drv.h:3578:16: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_drv.h:3572:16: warning: expression using sizeof(void)
+./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
Commit: drm/i915: Remove second level open-coded rcu work
Okay!
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Make request allocation caches global
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
` (3 preceding siblings ...)
2019-02-28 0:23 ` ✗ Fi.CI.SPARSE: " Patchwork
@ 2019-02-28 0:50 ` Patchwork
2019-02-28 4:24 ` ✗ Fi.CI.IGT: failure " Patchwork
` (4 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-02-28 0:50 UTC (permalink / raw)
To: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm/i915: Make request allocation caches global
URL : https://patchwork.freedesktop.org/series/57319/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5668 -> Patchwork_12323
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/57319/revisions/1/
Known issues
------------
Here are the changes found in Patchwork_12323 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_basic@basic-bsd2:
- fi-kbl-7500u: NOTRUN -> SKIP [fdo#109271] +9
* igt@i915_selftest@live_execlists:
- fi-apl-guc: NOTRUN -> INCOMPLETE [fdo#103927] / [fdo#109720]
* igt@i915_selftest@live_hangcheck:
- fi-icl-u3: PASS -> INCOMPLETE [fdo#108569]
* igt@kms_chamelium@dp-crc-fast:
- fi-kbl-7500u: NOTRUN -> DMESG-WARN [fdo#103841]
* igt@kms_psr@primary_page_flip:
- fi-apl-guc: NOTRUN -> SKIP [fdo#109271] +40
* igt@runner@aborted:
- fi-kbl-7500u: NOTRUN -> FAIL [fdo#103841]
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s3:
- fi-apl-guc: DMESG-WARN -> PASS
[fdo#103841]: https://bugs.freedesktop.org/show_bug.cgi?id=103841
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
Participating hosts (42 -> 37)
------------------------------
Additional (1): fi-kbl-7500u
Missing (6): fi-kbl-7567u fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y
Build changes
-------------
* Linux: CI_DRM_5668 -> Patchwork_12323
CI_DRM_5668: f31df5b814fb600861b577e2bc2cdb75c8c3e323 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4861: 017d8461ae509b2d8ef5f585de8ad908081d28a0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12323: dc80371b25d677c5518b69a50b91f26b64482ce1 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
dc80371b25d6 drm/i915: Remove second level open-coded rcu work
8e4c2b2cab40 drm/i915: Make object/vma allocation caches global
158b026641f1 drm/i915: Make request allocation caches global
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12323/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✗ Fi.CI.IGT: failure for series starting with [1/3] drm/i915: Make request allocation caches global
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
` (4 preceding siblings ...)
2019-02-28 0:50 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2019-02-28 4:24 ` Patchwork
2019-02-28 7:47 ` [PATCH 1/3] " Tvrtko Ursulin
` (3 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-02-28 4:24 UTC (permalink / raw)
To: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm/i915: Make request allocation caches global
URL : https://patchwork.freedesktop.org/series/57319/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_5668_full -> Patchwork_12323_full
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_12323_full absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_12323_full, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_12323_full:
### IGT changes ###
#### Possible regressions ####
* igt@kms_flip@2x-flip-vs-suspend-interruptible:
- shard-hsw: PASS -> DMESG-WARN
Known issues
------------
Here are the changes found in Patchwork_12323_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_isolation@vcs0-clean:
- shard-iclb: NOTRUN -> SKIP [fdo#109281]
* igt@gem_exec_big:
- shard-apl: NOTRUN -> SKIP [fdo#109271] +37
* igt@gem_mocs_settings@mocs-rc6-vebox:
- shard-iclb: NOTRUN -> SKIP [fdo#109287]
* igt@gem_mocs_settings@mocs-settings-bsd2:
- shard-iclb: NOTRUN -> SKIP [fdo#109276] / [fdo#109287]
* igt@gem_pwrite@huge-cpu-forwards:
- shard-iclb: NOTRUN -> SKIP [fdo#109290] +1
* igt@gen3_render_mixed_blits:
- shard-iclb: NOTRUN -> SKIP [fdo#109289] +1
* igt@i915_hangman@error-state-capture-bsd2:
- shard-iclb: NOTRUN -> SKIP [fdo#109276] +6
* igt@i915_pm_lpsp@non-edp:
- shard-iclb: NOTRUN -> SKIP [fdo#109301]
* igt@i915_pm_rpm@basic-pci-d3-state:
- shard-iclb: PASS -> INCOMPLETE [fdo#108840]
* igt@i915_pm_rpm@gem-mmap-gtt:
- shard-kbl: PASS -> DMESG-WARN [fdo#103558] / [fdo#105602] +24
* igt@i915_pm_rpm@reg-read-ioctl:
- shard-iclb: PASS -> DMESG-WARN [fdo#107724] +1
* igt@i915_selftest@live_contexts:
- shard-iclb: NOTRUN -> DMESG-FAIL [fdo#108569]
* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-skl: NOTRUN -> FAIL [fdo#106641]
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
- shard-apl: NOTRUN -> DMESG-WARN [fdo#107956]
* igt@kms_busy@extended-modeset-hang-oldfb-render-f:
- shard-skl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +8
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
- shard-kbl: PASS -> DMESG-WARN [fdo#107956]
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-f:
- shard-hsw: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1
* igt@kms_chamelium@vga-frame-dump:
- shard-iclb: NOTRUN -> SKIP [fdo#109284] +1
* igt@kms_color@pipe-a-degamma:
- shard-apl: PASS -> FAIL [fdo#104782] / [fdo#108145]
* igt@kms_cursor_crc@cursor-256x256-sliding:
- shard-iclb: NOTRUN -> FAIL [fdo#103232] +1
* igt@kms_cursor_crc@cursor-512x170-random:
- shard-iclb: NOTRUN -> SKIP [fdo#109279] +1
* igt@kms_cursor_crc@cursor-64x21-sliding:
- shard-apl: PASS -> FAIL [fdo#103232] +2
* igt@kms_cursor_crc@cursor-alpha-opaque:
- shard-apl: PASS -> FAIL [fdo#109350]
* igt@kms_flip@2x-flip-vs-panning-vs-hang-interruptible:
- shard-iclb: NOTRUN -> SKIP [fdo#109274] +1
* igt@kms_flip@2x-modeset-vs-vblank-race:
- shard-glk: PASS -> FAIL [fdo#103060]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-apl: PASS -> FAIL [fdo#103167]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
- shard-glk: PASS -> FAIL [fdo#103167] +1
* igt@kms_frontbuffer_tracking@fbc-1p-rte:
- shard-apl: PASS -> FAIL [fdo#103167] / [fdo#105682]
* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-blt:
- shard-skl: NOTRUN -> SKIP [fdo#109271] +116
* igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-blt:
- shard-hsw: NOTRUN -> SKIP [fdo#109271] +27
- shard-iclb: PASS -> FAIL [fdo#103167] +3
* igt@kms_frontbuffer_tracking@psr-2p-scndscrn-spr-indfb-draw-mmap-gtt:
- shard-iclb: NOTRUN -> SKIP [fdo#109280] +10
* igt@kms_plane@pixel-format-pipe-c-planes-source-clamping:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#106885] +1
* igt@kms_plane@plane-position-covered-pipe-c-planes:
- shard-glk: PASS -> FAIL [fdo#103166]
* igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
- shard-skl: NOTRUN -> FAIL [fdo#107815] / [fdo#108145]
* igt@kms_plane_alpha_blend@pipe-b-alpha-basic:
- shard-apl: NOTRUN -> FAIL [fdo#108145] +1
* igt@kms_plane_multiple@atomic-pipe-c-tiling-none:
- shard-iclb: PASS -> FAIL [fdo#103166] +1
* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: PASS -> FAIL [fdo#103166] +2
* igt@kms_psr@no_drrs:
- shard-iclb: PASS -> FAIL [fdo#108341]
* igt@kms_psr@psr2_cursor_plane_onoff:
- shard-iclb: NOTRUN -> SKIP [fdo#109441]
* igt@kms_rotation_crc@multiplane-rotation:
- shard-glk: PASS -> DMESG-FAIL [fdo#105763] / [fdo#106538]
* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-kbl: PASS -> FAIL [fdo#109016]
* igt@kms_sysfs_edid_timing:
- shard-iclb: PASS -> FAIL [fdo#100047]
* igt@kms_universal_plane@cursor-fb-leak-pipe-f:
- shard-apl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1
* igt@kms_universal_plane@universal-plane-gen9-features-pipe-d:
- shard-iclb: NOTRUN -> SKIP [fdo#109278] +2
* igt@prime_vgem@basic-fence-flip:
- shard-kbl: PASS -> FAIL [fdo#104008]
#### Possible fixes ####
* igt@gem_exec_big:
- shard-hsw: TIMEOUT [fdo#107937] -> PASS
* igt@gem_exec_suspend@basic-s3:
- shard-hsw: DMESG-WARN -> PASS
* igt@gem_softpin@noreloc-s3:
- shard-iclb: INCOMPLETE [fdo#107713] -> PASS
* igt@i915_pm_rpm@dpms-mode-unset-lpsp:
- shard-skl: INCOMPLETE [fdo#107807] -> PASS
* igt@i915_pm_rpm@gem-idle:
- shard-iclb: DMESG-WARN [fdo#107724] -> PASS +2
* igt@kms_atomic_transition@plane-all-modeset-transition-fencing:
- shard-apl: INCOMPLETE [fdo#103927] -> PASS
* igt@kms_busy@extended-modeset-hang-newfb-render-a:
- shard-iclb: DMESG-WARN [fdo#107956] -> PASS
* igt@kms_busy@extended-modeset-hang-newfb-render-c:
- shard-hsw: DMESG-WARN [fdo#107956] -> PASS
* igt@kms_cursor_crc@cursor-64x21-random:
- shard-apl: FAIL [fdo#103232] -> PASS +1
* igt@kms_cursor_crc@cursor-64x64-onscreen:
- shard-skl: FAIL [fdo#103232] -> PASS
* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-glk: FAIL [fdo#105363] -> PASS
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-mmap-cpu:
- shard-glk: FAIL [fdo#103167] -> PASS
* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-onoff:
- shard-iclb: FAIL [fdo#103167] -> PASS
* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-pwrite:
- shard-skl: FAIL [fdo#103167] -> PASS
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b-frame-sequence:
- shard-skl: FAIL [fdo#103191] / [fdo#107362] -> PASS
* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-skl: INCOMPLETE [fdo#104108] -> PASS
* igt@kms_plane@plane-position-covered-pipe-b-planes:
- shard-iclb: FAIL [fdo#103166] -> PASS
* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: FAIL [fdo#107815] / [fdo#108145] -> PASS
* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: FAIL [fdo#107815] -> PASS
* igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
- shard-kbl: DMESG-FAIL [fdo#105763] -> PASS
* igt@kms_setmode@basic:
- shard-apl: FAIL [fdo#99912] -> PASS
#### Warnings ####
* igt@i915_pm_rpm@modeset-non-lpsp-stress-no-wait:
- shard-iclb: INCOMPLETE [fdo#108840] -> SKIP [fdo#109308]
* igt@i915_pm_rpm@modeset-pc8-residency-stress:
- shard-skl: INCOMPLETE [fdo#107807] -> SKIP [fdo#109271]
* igt@kms_cursor_crc@cursor-128x128-suspend:
- shard-iclb: FAIL [fdo#103232] -> INCOMPLETE [fdo#107713]
* igt@kms_cursor_crc@cursor-64x64-sliding:
- shard-kbl: FAIL [fdo#103232] -> DMESG-FAIL [fdo#103232] / [fdo#103558] / [fdo#105602]
* igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
- shard-kbl: FAIL [fdo#108145] / [fdo#108590] -> DMESG-FAIL [fdo#103558] / [fdo#105602] / [fdo#108145]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104008]: https://bugs.freedesktop.org/show_bug.cgi?id=104008
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#106885]: https://bugs.freedesktop.org/show_bug.cgi?id=106885
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
[fdo#107937]: https://bugs.freedesktop.org/show_bug.cgi?id=107937
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109281]: https://bugs.freedesktop.org/show_bug.cgi?id=109281
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109287]: https://bugs.freedesktop.org/show_bug.cgi?id=109287
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109290]: https://bugs.freedesktop.org/show_bug.cgi?id=109290
[fdo#109301]: https://bugs.freedesktop.org/show_bug.cgi?id=109301
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109350]: https://bugs.freedesktop.org/show_bug.cgi?id=109350
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (7 -> 7)
------------------------------
No changes in participating hosts
Build changes
-------------
* Linux: CI_DRM_5668 -> Patchwork_12323
CI_DRM_5668: f31df5b814fb600861b577e2bc2cdb75c8c3e323 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4861: 017d8461ae509b2d8ef5f585de8ad908081d28a0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12323: dc80371b25d677c5518b69a50b91f26b64482ce1 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12323/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] drm/i915: Make request allocation caches global
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
` (5 preceding siblings ...)
2019-02-28 4:24 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2019-02-28 7:47 ` Tvrtko Ursulin
2019-02-28 9:00 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Make request allocation caches global (rev2) Patchwork
` (2 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-02-28 7:47 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 27/02/2019 23:09, Chris Wilson wrote:
> As kmem_caches share the same properties (size, allocation/free behaviour)
> for all potential devices, we can use global caches. While this
> potential has worse fragmentation behaviour (one can argue that
> different devices would have different activity lifetimes, but you can
> also argue that activity is temporal across the system) it is the
> default behaviour of the system at large to amalgamate matching caches.
>
> The benefit for us is much reduced pointer dancing along the frequent
> allocation paths.
>
> v2: Defer shrinking until after a global grace period for futureproofing
> multiple consumers of the slab caches, similar to the current strategy
> for avoiding shrinking too early.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/Makefile | 1 +
> drivers/gpu/drm/i915/i915_active.c | 7 +-
> drivers/gpu/drm/i915/i915_active.h | 1 +
> drivers/gpu/drm/i915/i915_drv.h | 3 -
> drivers/gpu/drm/i915/i915_gem.c | 34 +-----
> drivers/gpu/drm/i915/i915_globals.c | 113 ++++++++++++++++++
> drivers/gpu/drm/i915/i915_globals.h | 15 +++
> drivers/gpu/drm/i915/i915_pci.c | 8 +-
> drivers/gpu/drm/i915/i915_request.c | 53 ++++++--
> drivers/gpu/drm/i915/i915_request.h | 10 ++
> drivers/gpu/drm/i915/i915_scheduler.c | 66 +++++++---
> drivers/gpu/drm/i915/i915_scheduler.h | 34 +++++-
> drivers/gpu/drm/i915/intel_guc_submission.c | 3 +-
> drivers/gpu/drm/i915/intel_lrc.c | 6 +-
> drivers/gpu/drm/i915/intel_ringbuffer.h | 17 ---
> drivers/gpu/drm/i915/selftests/mock_engine.c | 45 ++++---
> .../gpu/drm/i915/selftests/mock_gem_device.c | 26 ----
> drivers/gpu/drm/i915/selftests/mock_request.c | 12 +-
> drivers/gpu/drm/i915/selftests/mock_request.h | 7 --
> 19 files changed, 312 insertions(+), 149 deletions(-)
> create mode 100644 drivers/gpu/drm/i915/i915_globals.c
> create mode 100644 drivers/gpu/drm/i915/i915_globals.h
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 1787e1299b1b..a1d834068765 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -77,6 +77,7 @@ i915-y += \
> i915_gem_tiling.o \
> i915_gem_userptr.o \
> i915_gemfs.o \
> + i915_globals.o \
> i915_query.o \
> i915_request.o \
> i915_scheduler.o \
> diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
> index db7bb5bd5add..d9f6471ac16c 100644
> --- a/drivers/gpu/drm/i915/i915_active.c
> +++ b/drivers/gpu/drm/i915/i915_active.c
> @@ -294,7 +294,12 @@ int __init i915_global_active_init(void)
> return 0;
> }
>
> -void __exit i915_global_active_exit(void)
> +void i915_global_active_shrink(void)
> +{
> + kmem_cache_shrink(global.slab_cache);
> +}
> +
> +void i915_global_active_exit(void)
> {
> kmem_cache_destroy(global.slab_cache);
> }
> diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h
> index 12b5c1d287d1..5fbd9102384b 100644
> --- a/drivers/gpu/drm/i915/i915_active.h
> +++ b/drivers/gpu/drm/i915/i915_active.h
> @@ -420,6 +420,7 @@ static inline void i915_active_fini(struct i915_active *ref) { }
> #endif
>
> int i915_global_active_init(void);
> +void i915_global_active_shrink(void);
> void i915_global_active_exit(void);
>
> #endif /* _I915_ACTIVE_H_ */
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index cc09caf3870e..f16016b330b3 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1473,9 +1473,6 @@ struct drm_i915_private {
> struct kmem_cache *objects;
> struct kmem_cache *vmas;
> struct kmem_cache *luts;
> - struct kmem_cache *requests;
> - struct kmem_cache *dependencies;
> - struct kmem_cache *priorities;
>
> const struct intel_device_info __info; /* Use INTEL_INFO() to access. */
> struct intel_runtime_info __runtime; /* Use RUNTIME_INFO() to access. */
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 2b261524cfa4..713ed6fbdcc8 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -42,6 +42,7 @@
> #include "i915_drv.h"
> #include "i915_gem_clflush.h"
> #include "i915_gemfs.h"
> +#include "i915_globals.h"
> #include "i915_reset.h"
> #include "i915_trace.h"
> #include "i915_vgpu.h"
> @@ -187,6 +188,8 @@ void i915_gem_unpark(struct drm_i915_private *i915)
> if (unlikely(++i915->gt.epoch == 0)) /* keep 0 as invalid */
> i915->gt.epoch = 1;
>
> + i915_globals_unpark();
> +
> intel_enable_gt_powersave(i915);
> i915_update_gfx_val(i915);
> if (INTEL_GEN(i915) >= 6)
> @@ -2892,12 +2895,11 @@ static void shrink_caches(struct drm_i915_private *i915)
> * filled slabs to prioritise allocating from the mostly full slabs,
> * with the aim of reducing fragmentation.
> */
> - kmem_cache_shrink(i915->priorities);
> - kmem_cache_shrink(i915->dependencies);
> - kmem_cache_shrink(i915->requests);
> kmem_cache_shrink(i915->luts);
> kmem_cache_shrink(i915->vmas);
> kmem_cache_shrink(i915->objects);
> +
> + i915_globals_park();
> }
>
> struct sleep_rcu_work {
> @@ -5235,23 +5237,6 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
> if (!dev_priv->luts)
> goto err_vmas;
>
> - dev_priv->requests = KMEM_CACHE(i915_request,
> - SLAB_HWCACHE_ALIGN |
> - SLAB_RECLAIM_ACCOUNT |
> - SLAB_TYPESAFE_BY_RCU);
> - if (!dev_priv->requests)
> - goto err_luts;
> -
> - dev_priv->dependencies = KMEM_CACHE(i915_dependency,
> - SLAB_HWCACHE_ALIGN |
> - SLAB_RECLAIM_ACCOUNT);
> - if (!dev_priv->dependencies)
> - goto err_requests;
> -
> - dev_priv->priorities = KMEM_CACHE(i915_priolist, SLAB_HWCACHE_ALIGN);
> - if (!dev_priv->priorities)
> - goto err_dependencies;
> -
> INIT_LIST_HEAD(&dev_priv->gt.active_rings);
> INIT_LIST_HEAD(&dev_priv->gt.closed_vma);
>
> @@ -5276,12 +5261,6 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
>
> return 0;
>
> -err_dependencies:
> - kmem_cache_destroy(dev_priv->dependencies);
> -err_requests:
> - kmem_cache_destroy(dev_priv->requests);
> -err_luts:
> - kmem_cache_destroy(dev_priv->luts);
> err_vmas:
> kmem_cache_destroy(dev_priv->vmas);
> err_objects:
> @@ -5299,9 +5278,6 @@ void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)
>
> cleanup_srcu_struct(&dev_priv->gpu_error.reset_backoff_srcu);
>
> - kmem_cache_destroy(dev_priv->priorities);
> - kmem_cache_destroy(dev_priv->dependencies);
> - kmem_cache_destroy(dev_priv->requests);
> kmem_cache_destroy(dev_priv->luts);
> kmem_cache_destroy(dev_priv->vmas);
> kmem_cache_destroy(dev_priv->objects);
> diff --git a/drivers/gpu/drm/i915/i915_globals.c b/drivers/gpu/drm/i915/i915_globals.c
> new file mode 100644
> index 000000000000..7fd1b3945a04
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/i915_globals.c
> @@ -0,0 +1,113 @@
> +/*
> + * SPDX-License-Identifier: MIT
> + *
> + * Copyright © 2019 Intel Corporation
> + */
> +
> +#include <linux/slab.h>
> +#include <linux/workqueue.h>
> +
> +#include "i915_active.h"
> +#include "i915_globals.h"
> +#include "i915_request.h"
> +#include "i915_scheduler.h"
> +
> +int __init i915_globals_init(void)
> +{
> + int err;
> +
> + err = i915_global_active_init();
> + if (err)
> + return err;
> +
> + err = i915_global_request_init();
> + if (err)
> + goto err_active;
> +
> + err = i915_global_scheduler_init();
> + if (err)
> + goto err_request;
> +
> + return 0;
> +
> +err_request:
> + i915_global_request_exit();
> +err_active:
> + i915_global_active_exit();
> + return err;
> +}
> +
> +static void i915_globals_shrink(void)
> +{
> + /*
> + * kmem_cache_shrink() discards empty slabs and reorders partially
> + * filled slabs to prioritise allocating from the mostly full slabs,
> + * with the aim of reducing fragmentation.
> + */
> + i915_global_active_shrink();
> + i915_global_request_shrink();
> + i915_global_scheduler_shrink();
> +}
> +
> +static atomic_t active;
> +static atomic_t epoch;
> +struct park_work {
> + struct rcu_work work;
> + int epoch;
> +};
> +
> +static void __i915_globals_park(struct work_struct *work)
> +{
> + struct park_work *wrk = container_of(work, typeof(*wrk), work.work);
> +
> + /* Confirm nothing woke up in the last grace period */
> + if (wrk->epoch == atomic_read(&epoch))
> + i915_globals_shrink();
> +
> + kfree(wrk);
> +}
> +
> +void i915_globals_park(void)
> +{
> + struct park_work *wrk;
> +
> + /*
> + * Defer shrinking the global slab caches (and other work) until
> + * after a RCU grace period has completed with no activity. This
> + * is to try and reduce the latency impact on the consumers caused
> + * by us shrinking the caches the same time as they are trying to
> + * allocate, with the assumption being that if we idle long enough
> + * for an RCU grace period to elapse since the last use, it is likely
> + * to be longer until we need the caches again.
> + */
> + if (!atomic_dec_and_test(&active))
> + return;
> +
> + wrk = kmalloc(sizeof(*wrk), GFP_KERNEL);
> + if (!wrk)
> + return;
> +
> + wrk->epoch = atomic_inc_return(&epoch);
> + INIT_RCU_WORK(&wrk->work, __i915_globals_park);
> + queue_rcu_work(system_wq, &wrk->work);
> +}
> +
> +void i915_globals_unpark(void)
> +{
> + atomic_inc(&epoch);
> + atomic_inc(&active);
> +}
> +
> +void __exit i915_globals_exit(void)
> +{
> + /* Flush any residual park_work */
> + rcu_barrier();
> + flush_scheduled_work();
> +
> + i915_global_scheduler_exit();
> + i915_global_request_exit();
> + i915_global_active_exit();
> +
> + /* And ensure that our DESTROY_BY_RCU slabs are truly destroyed */
> + rcu_barrier();
> +}
> diff --git a/drivers/gpu/drm/i915/i915_globals.h b/drivers/gpu/drm/i915/i915_globals.h
> new file mode 100644
> index 000000000000..e468f0413a73
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/i915_globals.h
> @@ -0,0 +1,15 @@
> +/*
> + * SPDX-License-Identifier: MIT
> + *
> + * Copyright © 2019 Intel Corporation
> + */
> +
> +#ifndef _I915_GLOBALS_H_
> +#define _I915_GLOBALS_H_
> +
> +int i915_globals_init(void);
> +void i915_globals_park(void);
> +void i915_globals_unpark(void);
> +void i915_globals_exit(void);
> +
> +#endif /* _I915_GLOBALS_H_ */
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index c4d6b8da9b03..a9211c370cd1 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -28,8 +28,8 @@
>
> #include <drm/drm_drv.h>
>
> -#include "i915_active.h"
> #include "i915_drv.h"
> +#include "i915_globals.h"
> #include "i915_selftest.h"
>
> #define PLATFORM(x) .platform = (x), .platform_mask = BIT(x)
> @@ -802,7 +802,9 @@ static int __init i915_init(void)
> bool use_kms = true;
> int err;
>
> - i915_global_active_init();
> + err = i915_globals_init();
> + if (err)
> + return err;
>
> err = i915_mock_selftests();
> if (err)
> @@ -835,7 +837,7 @@ static void __exit i915_exit(void)
> return;
>
> pci_unregister_driver(&i915_pci_driver);
> - i915_global_active_exit();
> + i915_globals_exit();
> }
>
> module_init(i915_init);
> diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
> index 935db5548f80..a011bf4be48e 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -32,6 +32,11 @@
> #include "i915_active.h"
> #include "i915_reset.h"
>
> +static struct i915_global_request {
> + struct kmem_cache *slab_requests;
> + struct kmem_cache *slab_dependencies;
> +} global;
> +
> static const char *i915_fence_get_driver_name(struct dma_fence *fence)
> {
> return "i915";
> @@ -86,7 +91,7 @@ static void i915_fence_release(struct dma_fence *fence)
> */
> i915_sw_fence_fini(&rq->submit);
>
> - kmem_cache_free(rq->i915->requests, rq);
> + kmem_cache_free(global.slab_requests, rq);
> }
>
> const struct dma_fence_ops i915_fence_ops = {
> @@ -292,7 +297,7 @@ static void i915_request_retire(struct i915_request *request)
>
> unreserve_gt(request->i915);
>
> - i915_sched_node_fini(request->i915, &request->sched);
> + i915_sched_node_fini(&request->sched);
> i915_request_put(request);
> }
>
> @@ -491,7 +496,7 @@ i915_request_alloc_slow(struct intel_context *ce)
> ring_retire_requests(ring);
>
> out:
> - return kmem_cache_alloc(ce->gem_context->i915->requests, GFP_KERNEL);
> + return kmem_cache_alloc(global.slab_requests, GFP_KERNEL);
> }
>
> static int add_timeline_barrier(struct i915_request *rq)
> @@ -579,7 +584,7 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
> *
> * Do not use kmem_cache_zalloc() here!
> */
> - rq = kmem_cache_alloc(i915->requests,
> + rq = kmem_cache_alloc(global.slab_requests,
> GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
> if (unlikely(!rq)) {
> rq = i915_request_alloc_slow(ce);
> @@ -666,7 +671,7 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
> GEM_BUG_ON(!list_empty(&rq->sched.signalers_list));
> GEM_BUG_ON(!list_empty(&rq->sched.waiters_list));
>
> - kmem_cache_free(i915->requests, rq);
> + kmem_cache_free(global.slab_requests, rq);
> err_unreserve:
> unreserve_gt(i915);
> intel_context_unpin(ce);
> @@ -685,9 +690,7 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from)
> return 0;
>
> if (to->engine->schedule) {
> - ret = i915_sched_node_add_dependency(to->i915,
> - &to->sched,
> - &from->sched);
> + ret = i915_sched_node_add_dependency(&to->sched, &from->sched);
> if (ret < 0)
> return ret;
> }
> @@ -1175,3 +1178,37 @@ void i915_retire_requests(struct drm_i915_private *i915)
> #include "selftests/mock_request.c"
> #include "selftests/i915_request.c"
> #endif
> +
> +int __init i915_global_request_init(void)
> +{
> + global.slab_requests = KMEM_CACHE(i915_request,
> + SLAB_HWCACHE_ALIGN |
> + SLAB_RECLAIM_ACCOUNT |
> + SLAB_TYPESAFE_BY_RCU);
> + if (!global.slab_requests)
> + return -ENOMEM;
> +
> + global.slab_dependencies = KMEM_CACHE(i915_dependency,
> + SLAB_HWCACHE_ALIGN |
> + SLAB_RECLAIM_ACCOUNT);
> + if (!global.slab_dependencies)
> + goto err_requests;
> +
> + return 0;
> +
> +err_requests:
> + kmem_cache_destroy(global.slab_requests);
> + return -ENOMEM;
> +}
> +
> +void i915_global_request_shrink(void)
> +{
> + kmem_cache_shrink(global.slab_dependencies);
> + kmem_cache_shrink(global.slab_requests);
> +}
> +
> +void i915_global_request_exit(void)
> +{
> + kmem_cache_destroy(global.slab_dependencies);
> + kmem_cache_destroy(global.slab_requests);
> +}
> diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
> index 1e127c1c53fa..be3ded6bcf56 100644
> --- a/drivers/gpu/drm/i915/i915_request.h
> +++ b/drivers/gpu/drm/i915/i915_request.h
> @@ -29,6 +29,7 @@
>
> #include "i915_gem.h"
> #include "i915_scheduler.h"
> +#include "i915_selftest.h"
> #include "i915_sw_fence.h"
>
> #include <uapi/drm/i915_drm.h>
> @@ -196,6 +197,11 @@ struct i915_request {
> struct drm_i915_file_private *file_priv;
> /** file_priv list entry for this request */
> struct list_head client_link;
> +
> + I915_SELFTEST_DECLARE(struct {
> + struct list_head link;
> + unsigned long delay;
> + } mock;)
> };
>
> #define I915_FENCE_GFP (GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN)
> @@ -371,4 +377,8 @@ static inline void i915_request_mark_complete(struct i915_request *rq)
>
> void i915_retire_requests(struct drm_i915_private *i915);
>
> +int i915_global_request_init(void);
> +void i915_global_request_shrink(void);
> +void i915_global_request_exit(void);
> +
> #endif /* I915_REQUEST_H */
> diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
> index 38efefd22dce..0dd720593f9c 100644
> --- a/drivers/gpu/drm/i915/i915_scheduler.c
> +++ b/drivers/gpu/drm/i915/i915_scheduler.c
> @@ -10,6 +10,11 @@
> #include "i915_request.h"
> #include "i915_scheduler.h"
>
> +static struct i915_global_scheduler {
> + struct kmem_cache *slab_dependencies;
> + struct kmem_cache *slab_priorities;
> +} global;
> +
> static DEFINE_SPINLOCK(schedule_lock);
>
> static const struct i915_request *
> @@ -37,16 +42,15 @@ void i915_sched_node_init(struct i915_sched_node *node)
> }
>
> static struct i915_dependency *
> -i915_dependency_alloc(struct drm_i915_private *i915)
> +i915_dependency_alloc(void)
> {
> - return kmem_cache_alloc(i915->dependencies, GFP_KERNEL);
> + return kmem_cache_alloc(global.slab_dependencies, GFP_KERNEL);
> }
>
> static void
> -i915_dependency_free(struct drm_i915_private *i915,
> - struct i915_dependency *dep)
> +i915_dependency_free(struct i915_dependency *dep)
> {
> - kmem_cache_free(i915->dependencies, dep);
> + kmem_cache_free(global.slab_dependencies, dep);
> }
>
> bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
> @@ -73,25 +77,23 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
> return ret;
> }
>
> -int i915_sched_node_add_dependency(struct drm_i915_private *i915,
> - struct i915_sched_node *node,
> +int i915_sched_node_add_dependency(struct i915_sched_node *node,
> struct i915_sched_node *signal)
> {
> struct i915_dependency *dep;
>
> - dep = i915_dependency_alloc(i915);
> + dep = i915_dependency_alloc();
> if (!dep)
> return -ENOMEM;
>
> if (!__i915_sched_node_add_dependency(node, signal, dep,
> I915_DEPENDENCY_ALLOC))
> - i915_dependency_free(i915, dep);
> + i915_dependency_free(dep);
>
> return 0;
> }
>
> -void i915_sched_node_fini(struct drm_i915_private *i915,
> - struct i915_sched_node *node)
> +void i915_sched_node_fini(struct i915_sched_node *node)
> {
> struct i915_dependency *dep, *tmp;
>
> @@ -111,7 +113,7 @@ void i915_sched_node_fini(struct drm_i915_private *i915,
>
> list_del(&dep->wait_link);
> if (dep->flags & I915_DEPENDENCY_ALLOC)
> - i915_dependency_free(i915, dep);
> + i915_dependency_free(dep);
> }
>
> /* Remove ourselves from everyone who depends upon us */
> @@ -121,7 +123,7 @@ void i915_sched_node_fini(struct drm_i915_private *i915,
>
> list_del(&dep->signal_link);
> if (dep->flags & I915_DEPENDENCY_ALLOC)
> - i915_dependency_free(i915, dep);
> + i915_dependency_free(dep);
> }
>
> spin_unlock(&schedule_lock);
> @@ -198,7 +200,7 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
> if (prio == I915_PRIORITY_NORMAL) {
> p = &execlists->default_priolist;
> } else {
> - p = kmem_cache_alloc(engine->i915->priorities, GFP_ATOMIC);
> + p = kmem_cache_alloc(global.slab_priorities, GFP_ATOMIC);
> /* Convert an allocation failure to a priority bump */
> if (unlikely(!p)) {
> prio = I915_PRIORITY_NORMAL; /* recurses just once */
> @@ -424,3 +426,39 @@ void i915_schedule_bump_priority(struct i915_request *rq, unsigned int bump)
>
> spin_unlock_bh(&schedule_lock);
> }
> +
> +void __i915_priolist_free(struct i915_priolist *p)
> +{
> + kmem_cache_free(global.slab_priorities, p);
> +}
> +
> +int __init i915_global_scheduler_init(void)
> +{
> + global.slab_dependencies = KMEM_CACHE(i915_dependency,
> + SLAB_HWCACHE_ALIGN);
> + if (!global.slab_dependencies)
> + return -ENOMEM;
> +
> + global.slab_priorities = KMEM_CACHE(i915_priolist,
> + SLAB_HWCACHE_ALIGN);
> + if (!global.slab_priorities)
> + goto err_priorities;
> +
> + return 0;
> +
> +err_priorities:
> + kmem_cache_destroy(global.slab_priorities);
> + return -ENOMEM;
> +}
> +
> +void i915_global_scheduler_shrink(void)
> +{
> + kmem_cache_shrink(global.slab_dependencies);
> + kmem_cache_shrink(global.slab_priorities);
> +}
> +
> +void i915_global_scheduler_exit(void)
> +{
> + kmem_cache_destroy(global.slab_dependencies);
> + kmem_cache_destroy(global.slab_priorities);
> +}
> diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h
> index dbe9cb7ecd82..4153c6a607b0 100644
> --- a/drivers/gpu/drm/i915/i915_scheduler.h
> +++ b/drivers/gpu/drm/i915/i915_scheduler.h
> @@ -83,6 +83,23 @@ struct i915_dependency {
> #define I915_DEPENDENCY_ALLOC BIT(0)
> };
>
> +struct i915_priolist {
> + struct list_head requests[I915_PRIORITY_COUNT];
> + struct rb_node node;
> + unsigned long used;
> + int priority;
> +};
> +
> +#define priolist_for_each_request(it, plist, idx) \
> + for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
> + list_for_each_entry(it, &(plist)->requests[idx], sched.link)
> +
> +#define priolist_for_each_request_consume(it, n, plist, idx) \
> + for (; (idx = ffs((plist)->used)); (plist)->used &= ~BIT(idx - 1)) \
> + list_for_each_entry_safe(it, n, \
> + &(plist)->requests[idx - 1], \
> + sched.link)
> +
> void i915_sched_node_init(struct i915_sched_node *node);
>
> bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
> @@ -90,12 +107,10 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
> struct i915_dependency *dep,
> unsigned long flags);
>
> -int i915_sched_node_add_dependency(struct drm_i915_private *i915,
> - struct i915_sched_node *node,
> +int i915_sched_node_add_dependency(struct i915_sched_node *node,
> struct i915_sched_node *signal);
>
> -void i915_sched_node_fini(struct drm_i915_private *i915,
> - struct i915_sched_node *node);
> +void i915_sched_node_fini(struct i915_sched_node *node);
>
> void i915_schedule(struct i915_request *request,
> const struct i915_sched_attr *attr);
> @@ -105,4 +120,15 @@ void i915_schedule_bump_priority(struct i915_request *rq, unsigned int bump);
> struct list_head *
> i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio);
>
> +void __i915_priolist_free(struct i915_priolist *p);
> +static inline void i915_priolist_free(struct i915_priolist *p)
> +{
> + if (p->priority != I915_PRIORITY_NORMAL)
> + __i915_priolist_free(p);
> +}
> +
> +int i915_global_scheduler_init(void);
> +void i915_global_scheduler_shrink(void);
> +void i915_global_scheduler_exit(void);
> +
> #endif /* _I915_SCHEDULER_H_ */
> diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
> index 20cbceeabeae..4366db7978a8 100644
> --- a/drivers/gpu/drm/i915/intel_guc_submission.c
> +++ b/drivers/gpu/drm/i915/intel_guc_submission.c
> @@ -781,8 +781,7 @@ static bool __guc_dequeue(struct intel_engine_cs *engine)
> }
>
> rb_erase_cached(&p->node, &execlists->queue);
> - if (p->priority != I915_PRIORITY_NORMAL)
> - kmem_cache_free(engine->i915->priorities, p);
> + i915_priolist_free(p);
> }
> done:
> execlists->queue_priority_hint =
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index c4f4966b0f4f..f63655632733 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -781,8 +781,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
> }
>
> rb_erase_cached(&p->node, &execlists->queue);
> - if (p->priority != I915_PRIORITY_NORMAL)
> - kmem_cache_free(engine->i915->priorities, p);
> + i915_priolist_free(p);
> }
>
> done:
> @@ -935,8 +934,7 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine)
> }
>
> rb_erase_cached(&p->node, &execlists->queue);
> - if (p->priority != I915_PRIORITY_NORMAL)
> - kmem_cache_free(engine->i915->priorities, p);
> + i915_priolist_free(p);
> }
>
> /* Remaining _unready_ requests will be nop'ed when submitted */
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index de8dba7565b0..5284f243931a 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -187,23 +187,6 @@ enum intel_engine_id {
> #define _VECS(n) (VECS + (n))
> };
>
> -struct i915_priolist {
> - struct list_head requests[I915_PRIORITY_COUNT];
> - struct rb_node node;
> - unsigned long used;
> - int priority;
> -};
> -
> -#define priolist_for_each_request(it, plist, idx) \
> - for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
> - list_for_each_entry(it, &(plist)->requests[idx], sched.link)
> -
> -#define priolist_for_each_request_consume(it, n, plist, idx) \
> - for (; (idx = ffs((plist)->used)); (plist)->used &= ~BIT(idx - 1)) \
> - list_for_each_entry_safe(it, n, \
> - &(plist)->requests[idx - 1], \
> - sched.link)
> -
> struct st_preempt_hang {
> struct completion completion;
> unsigned int count;
> diff --git a/drivers/gpu/drm/i915/selftests/mock_engine.c b/drivers/gpu/drm/i915/selftests/mock_engine.c
> index 6f3fb803c747..ec1ae948954c 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_engine.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_engine.c
> @@ -76,26 +76,26 @@ static void mock_ring_free(struct intel_ring *base)
> kfree(ring);
> }
>
> -static struct mock_request *first_request(struct mock_engine *engine)
> +static struct i915_request *first_request(struct mock_engine *engine)
> {
> return list_first_entry_or_null(&engine->hw_queue,
> - struct mock_request,
> - link);
> + struct i915_request,
> + mock.link);
> }
>
> -static void advance(struct mock_request *request)
> +static void advance(struct i915_request *request)
> {
> - list_del_init(&request->link);
> - i915_request_mark_complete(&request->base);
> - GEM_BUG_ON(!i915_request_completed(&request->base));
> + list_del_init(&request->mock.link);
> + i915_request_mark_complete(request);
> + GEM_BUG_ON(!i915_request_completed(request));
>
> - intel_engine_queue_breadcrumbs(request->base.engine);
> + intel_engine_queue_breadcrumbs(request->engine);
> }
>
> static void hw_delay_complete(struct timer_list *t)
> {
> struct mock_engine *engine = from_timer(engine, t, hw_delay);
> - struct mock_request *request;
> + struct i915_request *request;
> unsigned long flags;
>
> spin_lock_irqsave(&engine->hw_lock, flags);
> @@ -110,8 +110,9 @@ static void hw_delay_complete(struct timer_list *t)
> * requeue the timer for the next delayed request.
> */
> while ((request = first_request(engine))) {
> - if (request->delay) {
> - mod_timer(&engine->hw_delay, jiffies + request->delay);
> + if (request->mock.delay) {
> + mod_timer(&engine->hw_delay,
> + jiffies + request->mock.delay);
> break;
> }
>
> @@ -169,10 +170,8 @@ mock_context_pin(struct intel_engine_cs *engine,
>
> static int mock_request_alloc(struct i915_request *request)
> {
> - struct mock_request *mock = container_of(request, typeof(*mock), base);
> -
> - INIT_LIST_HEAD(&mock->link);
> - mock->delay = 0;
> + INIT_LIST_HEAD(&request->mock.link);
> + request->mock.delay = 0;
>
> return 0;
> }
> @@ -190,7 +189,6 @@ static u32 *mock_emit_breadcrumb(struct i915_request *request, u32 *cs)
>
> static void mock_submit_request(struct i915_request *request)
> {
> - struct mock_request *mock = container_of(request, typeof(*mock), base);
> struct mock_engine *engine =
> container_of(request->engine, typeof(*engine), base);
> unsigned long flags;
> @@ -198,12 +196,13 @@ static void mock_submit_request(struct i915_request *request)
> i915_request_submit(request);
>
> spin_lock_irqsave(&engine->hw_lock, flags);
> - list_add_tail(&mock->link, &engine->hw_queue);
> - if (mock->link.prev == &engine->hw_queue) {
> - if (mock->delay)
> - mod_timer(&engine->hw_delay, jiffies + mock->delay);
> + list_add_tail(&request->mock.link, &engine->hw_queue);
> + if (list_is_first(&request->mock.link, &engine->hw_queue)) {
> + if (request->mock.delay)
> + mod_timer(&engine->hw_delay,
> + jiffies + request->mock.delay);
> else
> - advance(mock);
> + advance(request);
> }
> spin_unlock_irqrestore(&engine->hw_lock, flags);
> }
> @@ -263,12 +262,12 @@ void mock_engine_flush(struct intel_engine_cs *engine)
> {
> struct mock_engine *mock =
> container_of(engine, typeof(*mock), base);
> - struct mock_request *request, *rn;
> + struct i915_request *request, *rn;
>
> del_timer_sync(&mock->hw_delay);
>
> spin_lock_irq(&mock->hw_lock);
> - list_for_each_entry_safe(request, rn, &mock->hw_queue, link)
> + list_for_each_entry_safe(request, rn, &mock->hw_queue, mock.link)
> advance(request);
> spin_unlock_irq(&mock->hw_lock);
> }
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index fc516a2970f4..5a98caba6d69 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -79,9 +79,6 @@ static void mock_device_release(struct drm_device *dev)
>
> destroy_workqueue(i915->wq);
>
> - kmem_cache_destroy(i915->priorities);
> - kmem_cache_destroy(i915->dependencies);
> - kmem_cache_destroy(i915->requests);
> kmem_cache_destroy(i915->vmas);
> kmem_cache_destroy(i915->objects);
>
> @@ -211,23 +208,6 @@ struct drm_i915_private *mock_gem_device(void)
> if (!i915->vmas)
> goto err_objects;
>
> - i915->requests = KMEM_CACHE(mock_request,
> - SLAB_HWCACHE_ALIGN |
> - SLAB_RECLAIM_ACCOUNT |
> - SLAB_TYPESAFE_BY_RCU);
> - if (!i915->requests)
> - goto err_vmas;
> -
> - i915->dependencies = KMEM_CACHE(i915_dependency,
> - SLAB_HWCACHE_ALIGN |
> - SLAB_RECLAIM_ACCOUNT);
> - if (!i915->dependencies)
> - goto err_requests;
> -
> - i915->priorities = KMEM_CACHE(i915_priolist, SLAB_HWCACHE_ALIGN);
> - if (!i915->priorities)
> - goto err_dependencies;
> -
> i915_timelines_init(i915);
>
> INIT_LIST_HEAD(&i915->gt.active_rings);
> @@ -257,12 +237,6 @@ struct drm_i915_private *mock_gem_device(void)
> err_unlock:
> mutex_unlock(&i915->drm.struct_mutex);
> i915_timelines_fini(i915);
> - kmem_cache_destroy(i915->priorities);
> -err_dependencies:
> - kmem_cache_destroy(i915->dependencies);
> -err_requests:
> - kmem_cache_destroy(i915->requests);
> -err_vmas:
> kmem_cache_destroy(i915->vmas);
> err_objects:
> kmem_cache_destroy(i915->objects);
> diff --git a/drivers/gpu/drm/i915/selftests/mock_request.c b/drivers/gpu/drm/i915/selftests/mock_request.c
> index 0dc29e242597..d1a7c9608712 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_request.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_request.c
> @@ -31,29 +31,25 @@ mock_request(struct intel_engine_cs *engine,
> unsigned long delay)
> {
> struct i915_request *request;
> - struct mock_request *mock;
>
> /* NB the i915->requests slab cache is enlarged to fit mock_request */
> request = i915_request_alloc(engine, context);
> if (IS_ERR(request))
> return NULL;
>
> - mock = container_of(request, typeof(*mock), base);
> - mock->delay = delay;
> -
> - return &mock->base;
> + request->mock.delay = delay;
> + return request;
> }
>
> bool mock_cancel_request(struct i915_request *request)
> {
> - struct mock_request *mock = container_of(request, typeof(*mock), base);
> struct mock_engine *engine =
> container_of(request->engine, typeof(*engine), base);
> bool was_queued;
>
> spin_lock_irq(&engine->hw_lock);
> - was_queued = !list_empty(&mock->link);
> - list_del_init(&mock->link);
> + was_queued = !list_empty(&request->mock.link);
> + list_del_init(&request->mock.link);
> spin_unlock_irq(&engine->hw_lock);
>
> if (was_queued)
> diff --git a/drivers/gpu/drm/i915/selftests/mock_request.h b/drivers/gpu/drm/i915/selftests/mock_request.h
> index 995fb728380c..4acf0211df20 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_request.h
> +++ b/drivers/gpu/drm/i915/selftests/mock_request.h
> @@ -29,13 +29,6 @@
>
> #include "../i915_request.h"
>
> -struct mock_request {
> - struct i915_request base;
> -
> - struct list_head link;
> - unsigned long delay;
> -};
> -
> struct i915_request *
> mock_request(struct intel_engine_cs *engine,
> struct i915_gem_context *context,
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Make request allocation caches global (rev2)
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
` (6 preceding siblings ...)
2019-02-28 7:47 ` [PATCH 1/3] " Tvrtko Ursulin
@ 2019-02-28 9:00 ` Patchwork
2019-02-28 9:02 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-02-28 9:20 ` ✗ Fi.CI.BAT: failure " Patchwork
9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-02-28 9:00 UTC (permalink / raw)
To: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm/i915: Make request allocation caches global (rev2)
URL : https://patchwork.freedesktop.org/series/57319/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
8a14917577db drm/i915: Make request allocation caches global
-:163: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#163:
new file mode 100644
-:168: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#168: FILE: drivers/gpu/drm/i915/i915_globals.c:1:
+/*
-:287: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#287: FILE: drivers/gpu/drm/i915/i915_globals.h:1:
+/*
-:628: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'plist' - possible side-effects?
#628: FILE: drivers/gpu/drm/i915/i915_scheduler.h:93:
+#define priolist_for_each_request(it, plist, idx) \
+ for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
+ list_for_each_entry(it, &(plist)->requests[idx], sched.link)
-:628: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'idx' - possible side-effects?
#628: FILE: drivers/gpu/drm/i915/i915_scheduler.h:93:
+#define priolist_for_each_request(it, plist, idx) \
+ for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
+ list_for_each_entry(it, &(plist)->requests[idx], sched.link)
-:632: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'plist' - possible side-effects?
#632: FILE: drivers/gpu/drm/i915/i915_scheduler.h:97:
+#define priolist_for_each_request_consume(it, n, plist, idx) \
+ for (; (idx = ffs((plist)->used)); (plist)->used &= ~BIT(idx - 1)) \
+ list_for_each_entry_safe(it, n, \
+ &(plist)->requests[idx - 1], \
+ sched.link)
-:632: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'idx' - possible side-effects?
#632: FILE: drivers/gpu/drm/i915/i915_scheduler.h:97:
+#define priolist_for_each_request_consume(it, n, plist, idx) \
+ for (; (idx = ffs((plist)->used)); (plist)->used &= ~BIT(idx - 1)) \
+ list_for_each_entry_safe(it, n, \
+ &(plist)->requests[idx - 1], \
+ sched.link)
total: 0 errors, 3 warnings, 4 checks, 800 lines checked
c7f4192bde9d drm/i915: Make object/vma allocation caches global
da8c64327422 drm/i915: Remove second level open-coded rcu work
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm/i915: Make request allocation caches global (rev2)
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
` (7 preceding siblings ...)
2019-02-28 9:00 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Make request allocation caches global (rev2) Patchwork
@ 2019-02-28 9:02 ` Patchwork
2019-02-28 9:20 ` ✗ Fi.CI.BAT: failure " Patchwork
9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-02-28 9:02 UTC (permalink / raw)
To: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm/i915: Make request allocation caches global (rev2)
URL : https://patchwork.freedesktop.org/series/57319/
State : warning
== Summary ==
$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915: Make request allocation caches global
-drivers/gpu/drm/i915/selftests/../i915_drv.h:3581:16: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_drv.h:3578:16: warning: expression using sizeof(void)
Commit: drm/i915: Make object/vma allocation caches global
-drivers/gpu/drm/i915/selftests/../i915_drv.h:3578:16: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_drv.h:3572:16: warning: expression using sizeof(void)
+./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
Commit: drm/i915: Remove second level open-coded rcu work
-drivers/gpu/drm/i915/selftests/../i915_drv.h:3572:16: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/selftests/../i915_drv.h:3566:16: warning: expression using sizeof(void)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915: Make request allocation caches global (rev2)
2019-02-27 23:09 [PATCH 1/3] drm/i915: Make request allocation caches global Chris Wilson
` (8 preceding siblings ...)
2019-02-28 9:02 ` ✗ Fi.CI.SPARSE: " Patchwork
@ 2019-02-28 9:20 ` Patchwork
9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-02-28 9:20 UTC (permalink / raw)
To: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm/i915: Make request allocation caches global (rev2)
URL : https://patchwork.freedesktop.org/series/57319/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_5670 -> Patchwork_12325
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_12325 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_12325, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/57319/revisions/2/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_12325:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live_coherency:
- fi-bxt-j4205: PASS -> DMESG-WARN
* igt@runner@aborted:
- fi-bxt-j4205: NOTRUN -> FAIL
Known issues
------------
Here are the changes found in Patchwork_12325 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@cs-sdma:
- fi-kbl-7560u: NOTRUN -> SKIP [fdo#109271] +17
* igt@i915_pm_backlight@basic-brightness:
- fi-hsw-4770r: NOTRUN -> SKIP [fdo#109271] / [fdo#109527]
* igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]
* igt@kms_busy@basic-flip-b:
- fi-gdg-551: PASS -> FAIL [fdo#103182]
* igt@kms_busy@basic-flip-c:
- fi-blb-e6850: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
* igt@kms_chamelium@vga-edid-read:
- fi-hsw-4770r: NOTRUN -> SKIP [fdo#109271] +44
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-c:
- fi-blb-e6850: NOTRUN -> SKIP [fdo#109271] +48
* igt@runner@aborted:
- fi-apl-guc: NOTRUN -> FAIL [fdo#108622] / [fdo#109720]
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: INCOMPLETE [fdo#107718] -> PASS
* igt@i915_pm_rpm@module-reload:
- fi-kbl-7560u: DMESG-WARN -> PASS
* igt@i915_selftest@live_gem:
- fi-skl-gvtdvm: DMESG-WARN -> PASS
[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109527]: https://bugs.freedesktop.org/show_bug.cgi?id=109527
[fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
Participating hosts (41 -> 38)
------------------------------
Additional (1): fi-hsw-4770r
Missing (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u
Build changes
-------------
* Linux: CI_DRM_5670 -> Patchwork_12325
CI_DRM_5670: 45d954a25f73ab879a280db0217db7f8c45a2da0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4862: 21e45c99dc2e0439bb48703a559814de002f4ff2 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12325: da8c6432742278157d37fbe6443eb63c5f489477 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
da8c64327422 drm/i915: Remove second level open-coded rcu work
c7f4192bde9d drm/i915: Make object/vma allocation caches global
8a14917577db drm/i915: Make request allocation caches global
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12325/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread