]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gem: Make caps.scheduler static
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 6 Aug 2019 12:42:59 +0000 (13:42 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 6 Aug 2019 14:00:14 +0000 (15:00 +0100)
We do not notify userspace when the scheduler capabilities are changed
(due to wedging the driver) and as such userspace will expect the caps
to be static and unchanging. Make it so, and so we only need to compute
our caps once during driver registration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190806124300.24945-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
drivers/gpu/drm/i915/gt/intel_reset.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_request.c

index 5ab7df53c2a07adcb41842962cda87b4b100a34c..edd21d14e64ffa729b3e6fc1189db3e9e5c419dd 100644 (file)
@@ -459,13 +459,7 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
        return NOTIFY_DONE;
 }
 
-/**
- * i915_gem_shrinker_register - Register the i915 shrinker
- * @i915: i915 device
- *
- * This function registers and sets up the i915 shrinker and OOM handler.
- */
-void i915_gem_shrinker_register(struct drm_i915_private *i915)
+void i915_gem_driver_register__shrinker(struct drm_i915_private *i915)
 {
        i915->mm.shrinker.scan_objects = i915_gem_shrinker_scan;
        i915->mm.shrinker.count_objects = i915_gem_shrinker_count;
@@ -480,13 +474,7 @@ void i915_gem_shrinker_register(struct drm_i915_private *i915)
        WARN_ON(register_vmap_purge_notifier(&i915->mm.vmap_notifier));
 }
 
-/**
- * i915_gem_shrinker_unregister - Unregisters the i915 shrinker
- * @i915: i915 device
- *
- * This function unregisters the i915 shrinker and OOM handler.
- */
-void i915_gem_shrinker_unregister(struct drm_i915_private *i915)
+void i915_gem_driver_unregister__shrinker(struct drm_i915_private *i915)
 {
        WARN_ON(unregister_vmap_purge_notifier(&i915->mm.vmap_notifier));
        WARN_ON(unregister_oom_notifier(&i915->mm.oom_notifier));
index 01857c12f12f1a4d2303ea69abe61bae2ca8a409..50aa7e95124ddd5d0e1840505ac3bd1c7b763742 100644 (file)
@@ -382,7 +382,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
 
 static void disable_retire_worker(struct drm_i915_private *i915)
 {
-       i915_gem_shrinker_unregister(i915);
+       i915_gem_driver_unregister__shrinker(i915);
 
        intel_gt_pm_get(&i915->gt);
 
@@ -398,7 +398,7 @@ static void restore_retire_worker(struct drm_i915_private *i915)
        igt_flush_test(i915, I915_WAIT_LOCKED);
        mutex_unlock(&i915->drm.struct_mutex);
 
-       i915_gem_shrinker_register(i915);
+       i915_gem_driver_register__shrinker(i915);
 }
 
 static void mmap_offset_lock(struct drm_i915_private *i915)
index 98c071fe532bf82433d3c24fa605437cae307d97..cdba6cd29327ad95787e2820ea75086f07bba89e 100644 (file)
@@ -757,11 +757,8 @@ static void __intel_gt_set_wedged(struct intel_gt *gt)
        if (!INTEL_INFO(gt->i915)->gpu_reset_clobbers_display)
                __intel_gt_reset(gt, ALL_ENGINES);
 
-       for_each_engine(engine, gt->i915, id) {
+       for_each_engine(engine, gt->i915, id)
                engine->submit_request = nop_submit_request;
-               engine->schedule = NULL;
-       }
-       gt->i915->caps.scheduler = 0;
 
        /*
         * Make sure no request can slip through without getting completed by
index 14ca719dcf3033e4b60f38320a67baafa1caaffe..ec61e8a7c818de10983b3227218c64ea8af15346 100644 (file)
@@ -1719,7 +1719,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 {
        struct drm_device *dev = &dev_priv->drm;
 
-       i915_gem_shrinker_register(dev_priv);
+       i915_gem_driver_register(dev_priv);
        i915_pmu_register(dev_priv);
 
        /*
@@ -1799,7 +1799,7 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
        i915_teardown_sysfs(dev_priv);
        drm_dev_unplug(&dev_priv->drm);
 
-       i915_gem_shrinker_unregister(dev_priv);
+       i915_gem_driver_unregister(dev_priv);
 }
 
 static void i915_welcome_messages(struct drm_i915_private *dev_priv)
index 7f0937948935e551b9ae3778562239eda8ed66fd..cb64dd9b6e643c1e8a409cb8520a12f9ff35574f 100644 (file)
@@ -2488,6 +2488,8 @@ static inline u32 i915_reset_engine_count(struct i915_gpu_error *error,
 void i915_gem_init_mmio(struct drm_i915_private *i915);
 int __must_check i915_gem_init(struct drm_i915_private *dev_priv);
 int __must_check i915_gem_init_hw(struct drm_i915_private *dev_priv);
+void i915_gem_driver_register(struct drm_i915_private *i915);
+void i915_gem_driver_unregister(struct drm_i915_private *i915);
 void i915_gem_driver_remove(struct drm_i915_private *dev_priv);
 void i915_gem_driver_release(struct drm_i915_private *dev_priv);
 int i915_gem_wait_for_idle(struct drm_i915_private *dev_priv,
@@ -2588,8 +2590,8 @@ unsigned long i915_gem_shrink(struct drm_i915_private *i915,
 #define I915_SHRINK_WRITEBACK  BIT(4)
 
 unsigned long i915_gem_shrink_all(struct drm_i915_private *i915);
-void i915_gem_shrinker_register(struct drm_i915_private *i915);
-void i915_gem_shrinker_unregister(struct drm_i915_private *i915);
+void i915_gem_driver_register__shrinker(struct drm_i915_private *i915);
+void i915_gem_driver_unregister__shrinker(struct drm_i915_private *i915);
 void i915_gem_shrinker_taints_mutex(struct drm_i915_private *i915,
                                    struct mutex *mutex);
 
index eb34f3e5a74d73d08c1ca840e7061e260054fa94..5ab1ddfef23c768a0fed32d9ee93e1fd25ed1094 100644 (file)
@@ -1249,8 +1249,6 @@ int i915_gem_init_hw(struct drm_i915_private *i915)
 
        intel_mocs_init(gt);
 
-       intel_engines_set_scheduler_caps(i915);
-
 out:
        intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
        return ret;
@@ -1599,6 +1597,17 @@ err_unlock:
        return ret;
 }
 
+void i915_gem_driver_register(struct drm_i915_private *i915)
+{
+       i915_gem_driver_register__shrinker(i915);
+       intel_engines_set_scheduler_caps(i915);
+}
+
+void i915_gem_driver_unregister(struct drm_i915_private *i915)
+{
+       i915_gem_driver_unregister__shrinker(i915);
+}
+
 void i915_gem_driver_remove(struct drm_i915_private *dev_priv)
 {
        GEM_BUG_ON(dev_priv->gt.awake);
index 8ac7d14ec8c95485778713f3e3adb277f55f6af1..81094f250bdb26bb047ea1b509a0ceba28ccc266 100644 (file)
@@ -1198,7 +1198,6 @@ struct i915_request *__i915_request_commit(struct i915_request *rq)
         */
        local_bh_disable();
        i915_sw_fence_commit(&rq->semaphore);
-       rcu_read_lock(); /* RCU serialisation for set-wedged protection */
        if (engine->schedule) {
                struct i915_sched_attr attr = rq->gem_context->sched;
 
@@ -1228,7 +1227,6 @@ struct i915_request *__i915_request_commit(struct i915_request *rq)
 
                engine->schedule(rq, &attr);
        }
-       rcu_read_unlock();
        i915_sw_fence_commit(&rq->submit);
        local_bh_enable(); /* Kick the execlists tasklet if just scheduled */