drm/i915/gt: Drop atomic for engine->fw_active tracking
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 15 Jan 2021 14:23:27 +0000 (14:23 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 15 Jan 2021 21:30:22 +0000 (21:30 +0000)
Since schedule-in/out is now entirely serialised by the tasklet bitlock,
we do not need to worry about concurrent in/out operations and so reduce
the atomic operations to plain instructions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210115142331.24458-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/gt/intel_engine_types.h
drivers/gpu/drm/i915/gt/intel_execlists_submission.c

index 3fe44cd..ba8f8a8 100644 (file)
@@ -1676,7 +1676,7 @@ void intel_engine_dump(struct intel_engine_cs *engine,
                           ktime_to_ms(intel_engine_get_busy_time(engine,
                                                                  &dummy)));
        drm_printf(m, "\tForcewake: %x domains, %d active\n",
-                  engine->fw_domain, atomic_read(&engine->fw_active));
+                  engine->fw_domain, READ_ONCE(engine->fw_active));
 
        rcu_read_lock();
        rq = READ_ONCE(engine->heartbeat.systole);
index df62e79..75c9093 100644 (file)
@@ -319,7 +319,7 @@ struct intel_engine_cs {
         * as possible.
         */
        enum forcewake_domains fw_domain;
-       atomic_t fw_active;
+       unsigned int fw_active;
 
        unsigned long context_tag;
 
index 269492b..bb8303a 100644 (file)
@@ -538,7 +538,7 @@ __execlists_schedule_in(struct i915_request *rq)
        ce->lrc.ccid |= engine->execlists.ccid;
 
        __intel_gt_pm_get(engine->gt);
-       if (engine->fw_domain && !atomic_fetch_inc(&engine->fw_active))
+       if (engine->fw_domain && !engine->fw_active++)
                intel_uncore_forcewake_get(engine->uncore, engine->fw_domain);
        execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
        intel_engine_context_in(engine);
@@ -645,7 +645,7 @@ static void __execlists_schedule_out(struct i915_request * const rq,
        lrc_update_runtime(ce);
        intel_engine_context_out(engine);
        execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
-       if (engine->fw_domain && !atomic_dec_return(&engine->fw_active))
+       if (engine->fw_domain && !--engine->fw_active)
                intel_uncore_forcewake_put(engine->uncore, engine->fw_domain);
        intel_gt_pm_put_async(engine->gt);