Commit d16e137e authored by Lionel Landwerlin's avatar Lionel Landwerlin

drm/i915/perf: don't read head/tail pointers outside critical section

Reading or writing those fields should only happen under
stream->oa_buffer.ptr_lock.
Signed-off-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: d1df41eb ("drm/i915/perf: rework aging tail workaround")
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Acked-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200330091411.37357-1-lionel.g.landwerlin@intel.com
parent b28b34ac
......@@ -463,6 +463,7 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream)
u32 gtt_offset = i915_ggtt_offset(stream->oa_buffer.vma);
int report_size = stream->oa_buffer.format_size;
unsigned long flags;
bool pollin;
u32 hw_tail;
u64 now;
......@@ -532,10 +533,12 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream)
stream->oa_buffer.aging_timestamp = now;
}
pollin = OA_TAKEN(stream->oa_buffer.tail - gtt_offset,
stream->oa_buffer.head - gtt_offset) >= report_size;
spin_unlock_irqrestore(&stream->oa_buffer.ptr_lock, flags);
return OA_TAKEN(stream->oa_buffer.tail - gtt_offset,
stream->oa_buffer.head - gtt_offset) >= report_size;
return pollin;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment