Skip to content

Commit 9d824c7

Browse files
Tvrtko Ursulinmairacanal
authored andcommitted
drm/v3d: Disable preemption while updating GPU stats
We forgot to disable preemption around the write_seqcount_begin/end() pair while updating GPU stats: [ ] WARNING: CPU: 2 PID: 12 at include/linux/seqlock.h:221 __seqprop_assert.isra.0+0x128/0x150 [v3d] [ ] Workqueue: v3d_bin drm_sched_run_job_work [gpu_sched] <...snip...> [ ] Call trace: [ ] __seqprop_assert.isra.0+0x128/0x150 [v3d] [ ] v3d_job_start_stats.isra.0+0x90/0x218 [v3d] [ ] v3d_bin_job_run+0x23c/0x388 [v3d] [ ] drm_sched_run_job_work+0x520/0x6d0 [gpu_sched] [ ] process_one_work+0x62c/0xb48 [ ] worker_thread+0x468/0x5b0 [ ] kthread+0x1c4/0x1e0 [ ] ret_from_fork+0x10/0x20 Fix it. Cc: Maíra Canal <[email protected]> Cc: [email protected] # v6.10+ Fixes: 6abe93b ("drm/v3d: Fix race-condition between sysfs/fdinfo and interrupt handler") Signed-off-by: Tvrtko Ursulin <[email protected]> Acked-by: Maíra Canal <[email protected]> Signed-off-by: Maíra Canal <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent b49420d commit 9d824c7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/gpu/drm/v3d/v3d_sched.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,17 @@ v3d_job_start_stats(struct v3d_job *job, enum v3d_queue queue)
134134
struct v3d_stats *local_stats = &file->stats[queue];
135135
u64 now = local_clock();
136136

137+
preempt_disable();
138+
137139
write_seqcount_begin(&local_stats->lock);
138140
local_stats->start_ns = now;
139141
write_seqcount_end(&local_stats->lock);
140142

141143
write_seqcount_begin(&global_stats->lock);
142144
global_stats->start_ns = now;
143145
write_seqcount_end(&global_stats->lock);
146+
147+
preempt_enable();
144148
}
145149

146150
static void
@@ -162,8 +166,10 @@ v3d_job_update_stats(struct v3d_job *job, enum v3d_queue queue)
162166
struct v3d_stats *local_stats = &file->stats[queue];
163167
u64 now = local_clock();
164168

169+
preempt_disable();
165170
v3d_stats_update(local_stats, now);
166171
v3d_stats_update(global_stats, now);
172+
preempt_enable();
167173
}
168174

169175
static struct dma_fence *v3d_bin_job_run(struct drm_sched_job *sched_job)

0 commit comments

Comments
 (0)