Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
98d5a5f
drm/sched: Fix outdated comments referencing thread
Mar 14, 2025
e79f9c1
drm/sched: Remove kthread header
Mar 14, 2025
64b8a4b
drm/scheduler: signal scheduled fence when kill job
May 15, 2025
4f39ea7
drm/sched: Store the drm client_id in drm_sched_fence
peppsac May 26, 2025
fdf8a3e
drm/sched: Add device name to the drm_sched_process_job event
peppsac May 26, 2025
de0c6e7
drm/sched: Cleanup gpu_scheduler trace events
peppsac May 26, 2025
39011f1
drm/sched: Trace dependencies for GPU jobs
peppsac May 26, 2025
44095dc
drm/sched: Add the drm_client_id to the drm_sched_run/exec_job events
peppsac May 26, 2025
0662b26
drm/sched: Cleanup event names
peppsac May 26, 2025
8aea46a
drm/sched: Remove a hole from struct drm_sched_job
Feb 21, 2025
5822e19
drm: Get rid of drm_sched_job.id
peppsac May 26, 2025
154987f
drm/doc: Document some tracepoints as uAPI
peppsac May 26, 2025
a43f658
Partial revert: bring back second parameter of __assign_str
ginkage Jun 8, 2025
c536247
drm/panthor: Fix build warning when DEBUG_FS is disabled
larunbe Apr 24, 2025
0b072a1
drm/panthor: Fix the user MMIO offset logic for emulators
bbrezillon Jun 6, 2025
4ffc3a2
drm/panthor: Add 64-bit and poll register accessors
Jun 6, 2025
3e73b3d
drm/panthor: Clean up 64-bit register definitions
Jun 6, 2025
e605a70
drm/scheduler: Include <linux/export.h>
tdz Jun 12, 2025
18994b8
drm/sched: De-clutter drm_sched_init
Jul 4, 2025
c971056
drm/sched: Consolidate drm_sched_rq_select_entity_rr
Jul 8, 2025
462d3c8
drm/sched: Avoid memory leaks with cancel_job() callback
Jul 10, 2025
1af87f1
drm/sched: Warn if pending_list is not empty
Jul 10, 2025
c13537a
drm/panthor: Wait for _READY register when powering on
Jun 30, 2025
9e72987
drm/panthor: Fix UAF in panthor_gem_create_with_handle() debugfs code
danvet Jul 9, 2025
98bebd8
drm/panthor: Remove dead VM flushing code
larunbe Jul 11, 2025
7d2b089
drm/sched: Rename DRM_GPU_SCHED_STAT_NOMINAL to DRM_GPU_SCHED_STAT_RESET
mairacanal Jul 14, 2025
72e0a50
drm/sched: Allow drivers to skip the reset and keep on running
mairacanal Jul 14, 2025
a67239b
drm/sched: Remove optimization that causes hang when killing dependen…
Jul 17, 2025
ca8d448
drm/sched: Avoid double re-lock on the job free path
Jul 16, 2025
1dace30
drm/panthor: Fix memory leak in panthor_ioctl_group_create()
thejh Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
exit:
adev->job_hang = false;
drm_dev_exit(idx);
return DRM_GPU_SCHED_STAT_NOMINAL;
return DRM_GPU_SCHED_STAT_RESET;
}

int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
Expand Down
18 changes: 6 additions & 12 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ TRACE_EVENT(amdgpu_cs_ioctl,
TP_PROTO(struct amdgpu_job *job),
TP_ARGS(job),
TP_STRUCT__entry(
__field(uint64_t, sched_job_id)
__string(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job))
__field(unsigned int, context)
__field(unsigned int, seqno)
Expand All @@ -177,23 +176,21 @@ TRACE_EVENT(amdgpu_cs_ioctl,
),

TP_fast_assign(
__entry->sched_job_id = job->base.id;
__assign_str(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job));
__entry->context = job->base.s_fence->finished.context;
__entry->seqno = job->base.s_fence->finished.seqno;
__assign_str(ring, to_amdgpu_ring(job->base.sched)->name);
__entry->num_ibs = job->num_ibs;
),
TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u",
__entry->sched_job_id, __get_str(timeline), __entry->context,
TP_printk("timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u",
__get_str(timeline), __entry->context,
__entry->seqno, __get_str(ring), __entry->num_ibs)
);

TRACE_EVENT(amdgpu_sched_run_job,
TP_PROTO(struct amdgpu_job *job),
TP_ARGS(job),
TP_STRUCT__entry(
__field(uint64_t, sched_job_id)
__string(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job))
__field(unsigned int, context)
__field(unsigned int, seqno)
Expand All @@ -202,15 +199,14 @@ TRACE_EVENT(amdgpu_sched_run_job,
),

TP_fast_assign(
__entry->sched_job_id = job->base.id;
__assign_str(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job));
__entry->context = job->base.s_fence->finished.context;
__entry->seqno = job->base.s_fence->finished.seqno;
__assign_str(ring, to_amdgpu_ring(job->base.sched)->name);
__entry->num_ibs = job->num_ibs;
),
TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u",
__entry->sched_job_id, __get_str(timeline), __entry->context,
TP_printk("timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u",
__get_str(timeline), __entry->context,
__entry->seqno, __get_str(ring), __entry->num_ibs)
);

Expand Down Expand Up @@ -519,21 +515,19 @@ TRACE_EVENT(amdgpu_ib_pipe_sync,
TP_ARGS(sched_job, fence),
TP_STRUCT__entry(
__string(ring, sched_job->base.sched->name)
__field(uint64_t, id)
__field(struct dma_fence *, fence)
__field(uint64_t, ctx)
__field(unsigned, seqno)
),

TP_fast_assign(
__assign_str(ring, sched_job->base.sched->name);
__entry->id = sched_job->base.id;
__entry->fence = fence;
__entry->ctx = fence->context;
__entry->seqno = fence->seqno;
),
TP_printk("job ring=%s, id=%llu, need pipe sync to fence=%p, context=%llu, seq=%u",
__get_str(ring), __entry->id,
TP_printk("job ring=%s need pipe sync to fence=%p, context=%llu, seq=%u",
__get_str(ring),
__entry->fence, __entry->ctx,
__entry->seqno)
);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,

ret = drm_sched_job_init(&submit->sched_job,
&ctx->sched_entity[args->pipe],
1, submit->ctx);
1, submit->ctx, file->client_id);
if (ret)
goto err_submit_put;

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/etnaviv/etnaviv_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job
drm_sched_resubmit_jobs(&gpu->sched);

drm_sched_start(&gpu->sched, 0);
return DRM_GPU_SCHED_STAT_NOMINAL;
return DRM_GPU_SCHED_STAT_RESET;

out_no_timeout:
list_add(&sched_job->list, &sched_job->sched->pending_list);
return DRM_GPU_SCHED_STAT_NOMINAL;
return DRM_GPU_SCHED_STAT_RESET;
}

static void etnaviv_sched_free_job(struct drm_sched_job *sched_job)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/lima/lima_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)

err = lima_sched_task_init(
submit->task, submit->ctx->context + submit->pipe,
bos, submit->nr_bos, vm);
bos, submit->nr_bos, vm, file->client_id);
if (err)
goto err_out1;

Expand Down
8 changes: 5 additions & 3 deletions drivers/gpu/drm/lima/lima_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ static inline struct lima_sched_pipe *to_lima_pipe(struct drm_gpu_scheduler *sch
int lima_sched_task_init(struct lima_sched_task *task,
struct lima_sched_context *context,
struct lima_bo **bos, int num_bos,
struct lima_vm *vm)
struct lima_vm *vm,
u64 drm_client_id)
{
int err, i;

Expand All @@ -123,7 +124,8 @@ int lima_sched_task_init(struct lima_sched_task *task,
for (i = 0; i < num_bos; i++)
drm_gem_object_get(&bos[i]->base.base);

err = drm_sched_job_init(&task->base, &context->base, 1, vm);
err = drm_sched_job_init(&task->base, &context->base, 1, vm,
drm_client_id);
if (err) {
kfree(task->bos);
return err;
Expand Down Expand Up @@ -439,7 +441,7 @@ static enum drm_gpu_sched_stat lima_sched_timedout_job(struct drm_sched_job *job
drm_sched_resubmit_jobs(&pipe->base);
drm_sched_start(&pipe->base, 0);

return DRM_GPU_SCHED_STAT_NOMINAL;
return DRM_GPU_SCHED_STAT_RESET;
}

static void lima_sched_free_job(struct drm_sched_job *job)
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/lima/lima_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ struct lima_sched_pipe {
int lima_sched_task_init(struct lima_sched_task *task,
struct lima_sched_context *context,
struct lima_bo **bos, int num_bos,
struct lima_vm *vm);
struct lima_vm *vm,
u64 drm_client_id);
void lima_sched_task_fini(struct lima_sched_task *task);

int lima_sched_context_init(struct lima_sched_pipe *pipe,
Expand Down
6 changes: 2 additions & 4 deletions drivers/gpu/drm/lima/lima_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ DECLARE_EVENT_CLASS(lima_task,
TP_PROTO(struct lima_sched_task *task),
TP_ARGS(task),
TP_STRUCT__entry(
__field(uint64_t, task_id)
__field(unsigned int, context)
__field(unsigned int, seqno)
__string(pipe, task->base.sched->name)
),

TP_fast_assign(
__entry->task_id = task->base.id;
__entry->context = task->base.s_fence->finished.context;
__entry->seqno = task->base.s_fence->finished.seqno;
__assign_str(pipe, task->base.sched->name);
),

TP_printk("task=%llu, context=%u seqno=%u pipe=%s",
__entry->task_id, __entry->context, __entry->seqno,
TP_printk("context=%u seqno=%u pipe=%s",
__entry->context, __entry->seqno,
__get_str(pipe))
);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/panfrost/panfrost_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,

ret = drm_sched_job_init(&job->base,
&file_priv->sched_entity[slot],
1, NULL);
1, NULL, file->client_id);
if (ret)
goto out_put_job;

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panfrost/panfrost_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ static enum drm_gpu_sched_stat panfrost_job_timedout(struct drm_sched_job
* spurious. Bail out.
*/
if (dma_fence_is_signaled(job->done_fence))
return DRM_GPU_SCHED_STAT_NOMINAL;
return DRM_GPU_SCHED_STAT_RESET;

dev_err(pfdev->dev, "gpu sched timeout, js=%d, config=0x%x, status=0x%x, head=0x%x, tail=0x%x, sched_job=%p",
js,
Expand All @@ -733,7 +733,7 @@ static enum drm_gpu_sched_stat panfrost_job_timedout(struct drm_sched_job
atomic_set(&pfdev->reset.pending, 1);
panfrost_reset(pfdev, sched_job);

return DRM_GPU_SCHED_STAT_NOMINAL;
return DRM_GPU_SCHED_STAT_RESET;
}

static void panfrost_reset_work(struct work_struct *work)
Expand Down
89 changes: 89 additions & 0 deletions drivers/gpu/drm/panthor/panthor_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,24 @@ struct panthor_file {
/** @ptdev: Device attached to this file. */
struct panthor_device *ptdev;

/** @user_mmio: User MMIO related fields. */
struct {
/**
* @offset: Offset used for user MMIO mappings.
*
* This offset should not be used to check the type of mapping
* except in panthor_mmap(). After that point, MMIO mapping
* offsets have been adjusted to match
* DRM_PANTHOR_USER_MMIO_OFFSET and that macro should be used
* instead.
* Make sure this rule is followed at all times, because
* userspace is in control of the offset, and can change the
* value behind our back. Otherwise it can lead to erroneous
* branching happening in kernel space.
*/
u64 offset;
} user_mmio;

/** @vms: VM pool attached to this file. */
struct panthor_vm_pool *vms;

Expand Down Expand Up @@ -439,4 +457,75 @@ static int panthor_request_ ## __name ## _irq(struct panthor_device *ptdev, \

extern struct workqueue_struct *panthor_cleanup_wq;

static inline void gpu_write(struct panthor_device *ptdev, u32 reg, u32 data)
{
writel(data, ptdev->iomem + reg);
}

static inline u32 gpu_read(struct panthor_device *ptdev, u32 reg)
{
return readl(ptdev->iomem + reg);
}

static inline u32 gpu_read_relaxed(struct panthor_device *ptdev, u32 reg)
{
return readl_relaxed(ptdev->iomem + reg);
}

static inline void gpu_write64(struct panthor_device *ptdev, u32 reg, u64 data)
{
gpu_write(ptdev, reg, lower_32_bits(data));
gpu_write(ptdev, reg + 4, upper_32_bits(data));
}

static inline u64 gpu_read64(struct panthor_device *ptdev, u32 reg)
{
return (gpu_read(ptdev, reg) | ((u64)gpu_read(ptdev, reg + 4) << 32));
}

static inline u64 gpu_read64_relaxed(struct panthor_device *ptdev, u32 reg)
{
return (gpu_read_relaxed(ptdev, reg) |
((u64)gpu_read_relaxed(ptdev, reg + 4) << 32));
}

static inline u64 gpu_read64_counter(struct panthor_device *ptdev, u32 reg)
{
u32 lo, hi1, hi2;
do {
hi1 = gpu_read(ptdev, reg + 4);
lo = gpu_read(ptdev, reg);
hi2 = gpu_read(ptdev, reg + 4);
} while (hi1 != hi2);
return lo | ((u64)hi2 << 32);
}

#define gpu_read_poll_timeout(dev, reg, val, cond, delay_us, timeout_us) \
read_poll_timeout(gpu_read, val, cond, delay_us, timeout_us, false, \
dev, reg)

#define gpu_read_poll_timeout_atomic(dev, reg, val, cond, delay_us, \
timeout_us) \
read_poll_timeout_atomic(gpu_read, val, cond, delay_us, timeout_us, \
false, dev, reg)

#define gpu_read64_poll_timeout(dev, reg, val, cond, delay_us, timeout_us) \
read_poll_timeout(gpu_read64, val, cond, delay_us, timeout_us, false, \
dev, reg)

#define gpu_read64_poll_timeout_atomic(dev, reg, val, cond, delay_us, \
timeout_us) \
read_poll_timeout_atomic(gpu_read64, val, cond, delay_us, timeout_us, \
false, dev, reg)

#define gpu_read_relaxed_poll_timeout_atomic(dev, reg, val, cond, delay_us, \
timeout_us) \
read_poll_timeout_atomic(gpu_read_relaxed, val, cond, delay_us, \
timeout_us, false, dev, reg)

#define gpu_read64_relaxed_poll_timeout(dev, reg, val, cond, delay_us, \
timeout_us) \
read_poll_timeout(gpu_read64_relaxed, val, cond, delay_us, timeout_us, \
false, dev, reg)

#endif
Loading
Loading