drm/i915/perf: fix perf stream opening lock
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 1 Mar 2018 11:06:13 +0000 (11:06 +0000)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 1 Mar 2018 14:32:37 +0000 (14:32 +0000)
commit41d3fdcd15d5ecf29cc73e8b79c2327ebb54b960
tree559c21a720b6b2cf5631f16b61ec8ff7f0d578ac
parent51951ae7ed0088cd1c6eb71f39217ac1b1aa9c5d
drm/i915/perf: fix perf stream opening lock

We're seeing on CI that some contexts don't have the programmed OA
period timer that directs the OA unit on how often to write reports.

The issue is that we're not holding the drm lock from when we edit the
context images down to when we set the exclusive_stream variable. This
leaves a window for the deferred context allocation to call
i915_oa_init_reg_state() that will not program the expected OA timer
value, because we haven't set the exclusive_stream yet.

v2: Drop need_lock from gen8_configure_all_contexts() (Matt)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Fixes: 701f8231a2f ("drm/i915/perf: prune OA configs")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102254
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103715
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103755
Link: https://patchwork.freedesktop.org/patch/msgid/20180301110613.1737-1-lionel.g.landwerlin@intel.com
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v4.14+
drivers/gpu/drm/i915/i915_perf.c