[PATCH 1/2] drm/i915/pmu: Handle PCI unbind
Chris Wilson
chris at chris-wilson.co.uk
Fri Oct 16 09:38:53 UTC 2020
Quoting Tvrtko Ursulin (2020-10-16 10:30:50)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> Mark the device as closed and keep references to driver data alive to
> allow for safe driver unbind with active PMU clients. Perf core does not
> otherwise handle this case so we have to do it manually like this.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
> @@ -1167,7 +1196,13 @@ void i915_pmu_unregister(struct drm_i915_private *i915)
> if (!pmu->base.event_init)
> return;
>
> - drm_WARN_ON(&i915->drm, pmu->enable);
> + /*
> + * "Disconnect" the PMU callbacks - since all are atomic synchronize_rcu
> + * ensures all currently executing ones will have exited before we
> + * proceed with unregistration.
> + */
> + pmu->closed = true;
> + synchronize_rcu();
This reminds me of drm_dev_unplug. I think the argument that this
interoperates with the perf API using RCU (rather than SRCU) justifies
the distinction.
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the Intel-gfx-trybot
mailing list