drm/i915: Use seqlock in engine stats
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 26 Apr 2018 07:47:16 +0000 (08:47 +0100)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 26 Apr 2018 09:10:05 +0000 (10:10 +0100)
commit741258cdd297e94b5f7167408b958b55795abaf8
treed38e3e74c075e4b22ba012f383e1bfc4ed924cd7
parentff047a87cfacf0a530960171a0779f5b19a3b1b8
drm/i915: Use seqlock in engine stats

We can convert engine stats from a spinlock to seqlock to ensure interrupt
processing is never even a tiny bit delayed by parallel readers.

There is a smidgen bit more cost on the write lock side, and an extremely
unlikely chance that readers will have to retry a few times in face of
heavy interrupt load. But it should be extremely unlikely given how
lightweight read side section is compared to the interrupt processing
side, and also compared to the rest of the code paths which can lead into
it. Furthermore, writer is the ones doing the real, latency sensitive
work, while readers are only informative.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180426074716.7352-1-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/intel_engine_cs.c
drivers/gpu/drm/i915/intel_ringbuffer.h