drm/i915: Use a dummy timeline name for a signaled fence
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 30 Mar 2017 11:16:14 +0000 (12:16 +0100)
committerJani Nikula <jani.nikula@intel.com>
Fri, 31 Mar 2017 10:40:07 +0000 (13:40 +0300)
commitecf8e89917d600fe846ebda911a9e690c6babfd0
tree42d6fe2f9a197451a953c5173c2ca6a958aaca6f
parent1383aeca92b72f4179420820c3a64dfb5909cc97
drm/i915: Use a dummy timeline name for a signaled fence

Michał Winiarski pointed out that the debugging infrastructure (such as
trace_dma_fence_release) likes to pretty print the timeline name, long
after we have freed the timeline. Our timelines currently live as part of
the GTT (due to the strict ordering we currently use through each) which
belong to the context. We aim to free the context and release its
hardware resources as soon as we able to (i.e. when the last
fence/request using it has been signaled and retired). As the
.get_timeline_name is purely a debug feature, rather than extending the
lifetime of the context, or splitting it into many different release
phases just to keep the name around, replace the timeline name with a
constant after the fence has been signaled. This avoids the potential
use-after-free.

Reported-by: Krzysztof Olinski <krzysztof.e.olinski@intel.com>
Fixes: 80b204bce8f2 ("drm/i915: Enable multiple timelines")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.10+
Link: http://patchwork.freedesktop.org/patch/msgid/20170330111614.29757-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
(cherry picked from commit 05506b5be081b728353f1612b05c8ff689772832)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/i915_gem_request.c