drm/xe/eustall: Add support to read() and poll() EU stall data
authorHarish Chegondi <harish.chegondi@intel.com>
Wed, 26 Feb 2025 01:47:08 +0000 (17:47 -0800)
committerAshutosh Dixit <ashutosh.dixit@intel.com>
Wed, 26 Feb 2025 19:31:01 +0000 (11:31 -0800)
commit760edec9396851935c20914f5ffdff94dd9d8f8c
tree34edd680172df372596ac50a07b0922df3ed6620
parent9a0b11d4cf3b4324378c322b7043962e648681ed
drm/xe/eustall: Add support to read() and poll() EU stall data

Implement the EU stall sampling APIs to read() and poll() EU stall data.
A work function periodically polls the EU stall data buffer write pointer
registers to look for any new data and caches the write pointer. The read
function compares the cached read and write pointers and copies any new
data to the user space.

v11: Used gt->eu_stall->stream_lock instead of stream->buf_lock.
     Removed read and write offsets from trace and added read size.
     Moved workqueue from struct xe_eu_stall_data_stream to
     struct xe_eu_stall_gt.
v10: Used cancel_delayed_work_sync() instead of flush_delayed_work()
     Replaced per xecore lock with a lock for all the xecore buffers
     Code movement and optimizations as per review feedback
v9:  New patch split from the previous patch.
     Used *_delayed_work functions instead of hrtimer
     Addressed the review feedback in read and poll functions

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/369dee85a3b6bd2c08aeae89ca55e66a9a0242d2.1740533885.git.harish.chegondi@intel.com
drivers/gpu/drm/xe/xe_eu_stall.c
drivers/gpu/drm/xe/xe_trace.h