drm/xe/oa: Ensure that polled read returns latest data
authorUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Wed, 12 Feb 2025 01:02:55 +0000 (17:02 -0800)
committerUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Fri, 21 Feb 2025 19:45:29 +0000 (11:45 -0800)
In polled mode, user calls poll() for read data to be available before
performing a read(). In the duration between these 2 calls, there may be
new data available in the OA buffer. To ensure user reads all available
data, check for latest data in the OA buffer in polled read.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250212010255.1423343-1-umesh.nerlige.ramappa@intel.com
drivers/gpu/drm/xe/xe_oa.c

index d89e6cabf5a56e2c2c6053109bfd889958bc177b..2c5a24a13e87a7c545a6b022d2518e1965d2538b 100644 (file)
@@ -548,6 +548,7 @@ static ssize_t xe_oa_read(struct file *file, char __user *buf,
                        mutex_unlock(&stream->stream_lock);
                } while (!offset && !ret);
        } else {
+               xe_oa_buffer_check_unlocked(stream);
                mutex_lock(&stream->stream_lock);
                ret = __xe_oa_read(stream, buf, count, &offset);
                mutex_unlock(&stream->stream_lock);