Skip to content

Commit 990d35e

Browse files
ashutoshxrodrigovivi
authored andcommitted
drm/xe/oa: Set stream->pollin in xe_oa_buffer_check_unlocked
We rely on stream->pollin to decide whether or not to block during poll/read calls. However, currently there are blocking read code paths which don't even set stream->pollin. The best place to consistently set stream->pollin for all code paths is therefore to set it in xe_oa_buffer_check_unlocked. Fixes: e936f88 ("drm/xe/oa/uapi: Expose OA stream fd") Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250115222029.3002103-1-ashutosh.dixit@intel.com (cherry picked from commit d3fedff) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 9f706fd commit 990d35e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/gpu/drm/xe/xe_oa.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ static bool xe_oa_buffer_check_unlocked(struct xe_oa_stream *stream)
237237
u32 tail, hw_tail, partial_report_size, available;
238238
int report_size = stream->oa_buffer.format->size;
239239
unsigned long flags;
240-
bool pollin;
241240

242241
spin_lock_irqsave(&stream->oa_buffer.ptr_lock, flags);
243242

@@ -282,22 +281,20 @@ static bool xe_oa_buffer_check_unlocked(struct xe_oa_stream *stream)
282281
stream->oa_buffer.tail = tail;
283282

284283
available = xe_oa_circ_diff(stream, stream->oa_buffer.tail, stream->oa_buffer.head);
285-
pollin = available >= stream->wait_num_reports * report_size;
284+
stream->pollin = available >= stream->wait_num_reports * report_size;
286285

287286
spin_unlock_irqrestore(&stream->oa_buffer.ptr_lock, flags);
288287

289-
return pollin;
288+
return stream->pollin;
290289
}
291290

292291
static enum hrtimer_restart xe_oa_poll_check_timer_cb(struct hrtimer *hrtimer)
293292
{
294293
struct xe_oa_stream *stream =
295294
container_of(hrtimer, typeof(*stream), poll_check_timer);
296295

297-
if (xe_oa_buffer_check_unlocked(stream)) {
298-
stream->pollin = true;
296+
if (xe_oa_buffer_check_unlocked(stream))
299297
wake_up(&stream->poll_wq);
300-
}
301298

302299
hrtimer_forward_now(hrtimer, ns_to_ktime(stream->poll_period_ns));
303300

0 commit comments

Comments
 (0)