* [PATCH v2 00/10] drm/sched: Entity handling cleanups
@ 2026-12-03 14:01 Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 01/10] drm/amdgpu/vcn3: Fail job submission if VCN0 decode is disabled under SR-IOV Tvrtko Ursulin
` (10 more replies)
0 siblings, 11 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Christian König,
Danilo Krummrich, Matthew Brost, Philipp Stanner,
Maíra Canal, Lucas Stach, Russell King, Christian Gmeiner,
Rob Clark, linux-arm-msm, freedreno, etnaviv, amd-gfx
Stricter rules around entity initialization, removing the single scheduler
special case which fixes the priority override for amdgpu single IP instance
entities and addressing of fence_seq FIXME by pulling the entity->lock up from
drm_sched_entity_select_rq().
In the last round sashiko complained about the first patch breaking legacy v3d
but Maíra has confirmed that is an unused path so no problem to make it
stricter. Lets see what sashiko finds in this round.
v2:
* New patches in the series:
* Fix amdgpu VCN potential usage of un-initialized schedulers.
* Make entaviv and msm check drm_sched_entity_init return value.
* Mark drm_sched_entity_init as __must_check.
* Clamp priority levels against all schedulers in drm_sched_entity_init().
Cc: Christian König <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Philipp Stanner <phasta@kernel.org>
Cc: Maíra Canal <mcanal@igalia.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Rob Clark <robin.clark@oss.qualcomm.com>
Cc: Dmitry Baryshkov <lumag@kernel.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: etnaviv@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Tvrtko Ursulin (10):
drm/amdgpu/vcn3: Fail job submission if VCN0 decode is disabled under
SR-IOV
drm/etnaviv: Release context id on failure
drm/etnaviv: Check drm_sched_entity_init() return value
drm/msm: Check drm_sched_entity_init() return value
drm/sched: Mark drm_sched_entity_init() as __must_check
drm/sched: Disallow initializing entities with un-initialized
schedulers
drm/sched: Clamp priority againsts all provided schedulers
drm/sched: Ignore stopped entity attempt to change its run-queue
drm/sched: Remove the single scheduler special case
drm/sched: Address the fence_seq fixme
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 ++
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 26 ++++---
drivers/gpu/drm/msm/msm_submitqueue.c | 9 ++-
drivers/gpu/drm/scheduler/sched_entity.c | 89 +++++++++++++++---------
drivers/gpu/drm/scheduler/sched_fence.c | 6 +-
drivers/gpu/drm/scheduler/sched_main.c | 7 +-
include/drm/gpu_scheduler.h | 59 +++++++++-------
7 files changed, 129 insertions(+), 71 deletions(-)
--
2.56.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 01/10] drm/amdgpu/vcn3: Fail job submission if VCN0 decode is disabled under SR-IOV
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 02/10] drm/etnaviv: Release context id on failure Tvrtko Ursulin
` (9 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Peng Ju Zhou, Monk Liu, Alex Deucher,
Ruijing Dong, Christian König, Benjamin Cheng, Yinjie Yao,
Philip Yang, stable
So far vcn_v3_0_limit_sched() handles the harvested config and fails AV1
decoding job submissions when ring is not available, but under SR-IOV ring
and it's scheduler can also be disabled in vcn_v3_0_hw_init() via the
amdgpu_vcn_is_disabled_vcn() check.
In this case sched.ready is set to false, and vcn_v3_0_limit_sched()
calls drm_sched_entity_modify_sched() with an un-ready scheduler, which
makes drm_sched_entity_select_rq() null-ify entity->rq and the following
job submission would trigger a null pointer dereference.
Fix it by repeating the same amdgpu_vcn_is_disabled_vcn() check inside
vcn_v3_0_limit_sched().
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Fixes: 564e3dcf7962 ("drm/amd/amdgpu: Recovery vcn instance iterate.")
Cc: Peng Ju Zhou <PengJu.Zhou@amd.com>
Cc: Monk Liu <monk.liu@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Ruijing Dong <ruijing.dong@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Benjamin Cheng <benjamin.cheng@amd.com>
Cc: Yinjie Yao <yinjie.yao@amd.com>
Cc: Philip Yang <Philip.Yang@amd.com>
Cc: <stable@vger.kernel.org> # v5.15+
---
I am not entirely sure whether this is the right Fixes: target, but it
appears to have added sched->ready = false for the decode ring so I
*think* it may just as well be first time NULL pointer deref became
possible.
Compile tested only.
---
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index 2f7d5d562cb4..4f2cb70cb55e 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -1902,6 +1902,10 @@ static int vcn_v3_0_limit_sched(struct amdgpu_cs_parser *p,
if (p->adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0)
return -EINVAL;
+ /* likewise if VCN0 decode is disabled (e.g. SR-IOV) */
+ if (amdgpu_vcn_is_disabled_vcn(p->adev, VCN_DECODE_RING, 0))
+ return -EINVAL;
+
/* wait for all jobs to finish before switching to instance 0 */
fence = amdgpu_ctx_get_fence(p->ctx, job->base.entity, ~0ull);
if (fence) {
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 02/10] drm/etnaviv: Release context id on failure
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 01/10] drm/amdgpu/vcn3: Fail job submission if VCN0 decode is disabled under SR-IOV Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:18 ` sashiko-bot
2026-12-03 14:01 ` [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value Tvrtko Ursulin
` (8 subsequent siblings)
10 siblings, 1 reply; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Lucas Stach, Russell King,
Christian Gmeiner, etnaviv
Cleanup on the etnaviv_open() failure path looks incomplete in that the
context id is left allocated. Fix it by adding proper onion unwind.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: etnaviv@lists.freedesktop.org
---
Compile tested only.
And as I cannot see that these ids are used anywhere I am not marking
this as a fix.
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index ec1352c1b09f..7bd7aef723c3 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -79,7 +79,7 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
priv->cmdbuf_suballoc);
if (!ctx->mmu) {
ret = -ENOMEM;
- goto out_free;
+ goto out_id;
}
for (i = 0; i < ETNA_MAX_PIPES; i++) {
@@ -98,6 +98,8 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
return 0;
+out_id:
+ xa_erase(&priv->active_contexts, ctx->id);
out_free:
kfree(ctx);
return ret;
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 01/10] drm/amdgpu/vcn3: Fail job submission if VCN0 decode is disabled under SR-IOV Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 02/10] drm/etnaviv: Release context id on failure Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:19 ` sashiko-bot
2026-12-03 14:24 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 04/10] drm/msm: " Tvrtko Ursulin
` (7 subsequent siblings)
10 siblings, 2 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Lucas Stach, Russell King,
Christian Gmeiner, etnaviv
Start checking drm_sched_entity_init() return value in preparation of
making that API a bit stricter.
No functional change intended as the failure path should never trigger in
this driver.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: etnaviv@lists.freedesktop.org
---
Compile tested only.
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 7bd7aef723c3..53003c31d7f9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -83,21 +83,29 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
}
for (i = 0; i < ETNA_MAX_PIPES; i++) {
- struct etnaviv_gpu *gpu = priv->gpu[i];
struct drm_gpu_scheduler *sched;
- if (gpu) {
- sched = &gpu->sched;
- drm_sched_entity_init(&ctx->sched_entity[i],
- DRM_SCHED_PRIORITY_NORMAL, &sched,
- 1, NULL);
- }
+ if (!priv->gpu[i])
+ continue;
+
+ sched = &priv->gpu[i]->sched;
+ ret = drm_sched_entity_init(&ctx->sched_entity[i],
+ DRM_SCHED_PRIORITY_NORMAL,
+ &sched, 1, NULL);
+ if (ret)
+ goto out_entity;
}
file->driver_priv = ctx;
return 0;
+out_entity:
+ while (i--) {
+ if (priv->gpu[i])
+ drm_sched_entity_destroy(&ctx->sched_entity[i]);
+ }
+ etnaviv_iommu_context_put(ctx->mmu);
out_id:
xa_erase(&priv->active_contexts, ctx->id);
out_free:
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 04/10] drm/msm: Check drm_sched_entity_init() return value
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (2 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:23 ` sashiko-bot
2026-12-03 14:24 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 05/10] drm/sched: Mark drm_sched_entity_init() as __must_check Tvrtko Ursulin
` (6 subsequent siblings)
10 siblings, 2 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Rob Clark, Dmitry Baryshkov,
linux-arm-msm, freedreno
Start checking drm_sched_entity_init() return value in preparation of
making that API a bit stricter.
No functional change intended as the failure path should never trigger in
this driver given drm_sched_init() happens before and it's failure is
always fatal.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Rob Clark <robin.clark@oss.qualcomm.com>
Cc: Dmitry Baryshkov <lumag@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
---
Compile tested only.
---
drivers/gpu/drm/msm/msm_submitqueue.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
index 8d550d281704..16852cf0c081 100644
--- a/drivers/gpu/drm/msm/msm_submitqueue.c
+++ b/drivers/gpu/drm/msm/msm_submitqueue.c
@@ -227,8 +227,13 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_context *ctx,
queue->entity = &queue->_vm_bind_entity[0];
- drm_sched_entity_init(queue->entity, DRM_SCHED_PRIORITY_KERNEL,
- &sched, 1, NULL);
+ ret = drm_sched_entity_init(queue->entity,
+ DRM_SCHED_PRIORITY_KERNEL,
+ &sched, 1, NULL);
+ if (ret) {
+ kfree(queue);
+ return ret;
+ }
} else {
queue->ring_nr = ring_nr;
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 05/10] drm/sched: Mark drm_sched_entity_init() as __must_check
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (3 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 04/10] drm/msm: " Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers Tvrtko Ursulin
` (5 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Christian König, Matthew Brost,
Danilo Krummrich, Philipp Stanner
Mark drm_sched_entity_init() as __must_check as preparation to make the
API a bit stricter in what input combinations it accepts.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Philipp Stanner <phasta@kernel.org>
---
include/drm/gpu_scheduler.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 3b0978fa8cf0..23ec446595ae 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -718,11 +718,11 @@ static inline bool drm_sched_invalidate_job(struct drm_sched_job *s_job,
/* Entities */
-int drm_sched_entity_init(struct drm_sched_entity *entity,
- enum drm_sched_priority priority,
- struct drm_gpu_scheduler **sched_list,
- unsigned int num_sched_list,
- atomic_t *guilty);
+int __must_check drm_sched_entity_init(struct drm_sched_entity *entity,
+ enum drm_sched_priority priority,
+ struct drm_gpu_scheduler **sched_list,
+ unsigned int num_sched_list,
+ atomic_t *guilty);
long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout);
void drm_sched_entity_kill(struct drm_sched_entity *entity);
void drm_sched_entity_fini(struct drm_sched_entity *entity);
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (4 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 05/10] drm/sched: Mark drm_sched_entity_init() as __must_check Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:23 ` sashiko-bot
2026-12-05 4:20 ` Sidong Yang
2026-12-03 14:01 ` [PATCH v2 07/10] drm/sched: Clamp priority againsts all provided schedulers Tvrtko Ursulin
` (4 subsequent siblings)
10 siblings, 2 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Christian König,
Danilo Krummrich, Matthew Brost, Philipp Stanner
Simplify the code and theoretical runtime combinations by disallowing
initializing entities with un-initialized schedulers.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Philipp Stanner <phasta@kernel.org>
---
I do not *think* any of the drivers relies on this inverted initialization
order but it needs more eyes for sure.
---
drivers/gpu/drm/scheduler/sched_entity.c | 36 ++++++++++++++++--------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 03e68b4102d5..69bcefdf2c55 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -90,6 +90,19 @@ ktime_t drm_sched_entity_stats_job_add_gpu_time(struct drm_sched_job *job)
return duration;
}
+static bool drm_sched_list_is_initialized(struct drm_gpu_scheduler **sched_list,
+ unsigned int num_sched_list)
+{
+ unsigned int i;
+
+ for (i = 0; i < num_sched_list; i++) {
+ if (!sched_list[i] || !sched_list[i]->sched_rq)
+ return false;
+ }
+
+ return true;
+}
+
/**
* drm_sched_entity_init - Init a context entity used by scheduler when
* submit to HW ring.
@@ -119,7 +132,10 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
unsigned int num_sched_list,
atomic_t *guilty)
{
- if (!entity || !sched_list || !num_sched_list || !sched_list[0])
+ if (!entity || !sched_list || !num_sched_list)
+ return -EINVAL;
+
+ if (!drm_sched_list_is_initialized(sched_list, num_sched_list))
return -EINVAL;
memset(entity, 0, sizeof(struct drm_sched_entity));
@@ -135,13 +151,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
RB_CLEAR_NODE(&entity->rb_tree_node);
- if (!sched_list[0]->sched_rq) {
- /* Since every entry covered by num_sched_list
- * should be non-NULL and therefore we warn drivers
- * not to do this and to fix their DRM calling order.
- */
- pr_warn("%s: called with uninitialized scheduler\n", __func__);
- } else if (priority >= sched_list[0]->num_user_rqs) {
+ if (priority >= sched_list[0]->num_user_rqs) {
/*
* The "priority" of an entity cannot exceed the number of
* run-queues of a scheduler. Protect against num_rqs being 0,
@@ -158,8 +168,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
entity->priority = priority;
entity->rq_priority = drm_sched_policy == DRM_SCHED_POLICY_FAIR ?
DRM_SCHED_PRIORITY_KERNEL : priority;
- if (sched_list[0]->sched_rq)
- entity->rq = sched_list[0]->sched_rq[entity->rq_priority];
+ entity->rq = sched_list[0]->sched_rq[entity->rq_priority];
init_completion(&entity->entity_idle);
@@ -192,7 +201,12 @@ void drm_sched_entity_modify_sched(struct drm_sched_entity *entity,
struct drm_gpu_scheduler **sched_list,
unsigned int num_sched_list)
{
- WARN_ON(!num_sched_list || !sched_list);
+ if (WARN_ON(!num_sched_list || !sched_list))
+ return;
+
+ if (WARN_ON_ONCE(!drm_sched_list_is_initialized(sched_list,
+ num_sched_list)))
+ return;
spin_lock(&entity->lock);
entity->sched_list = sched_list;
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 07/10] drm/sched: Clamp priority againsts all provided schedulers
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (5 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 08/10] drm/sched: Ignore stopped entity attempt to change its run-queue Tvrtko Ursulin
` (3 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Christian König,
Danilo Krummrich, Matthew Brost, Philipp Stanner
Currently the priority is only clamped against the first scheduler in the
provided list at drm_sched_entity_init() time. Now that we are ensuring
all schedulers have been initialized lets expand the clamp against all and
by doing so make this check more robust.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Philipp Stanner <phasta@kernel.org>
---
drivers/gpu/drm/scheduler/sched_entity.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 69bcefdf2c55..ac15247f462a 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -132,6 +132,8 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
unsigned int num_sched_list,
atomic_t *guilty)
{
+ unsigned int i;
+
if (!entity || !sched_list || !num_sched_list)
return -EINVAL;
@@ -151,17 +153,20 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
RB_CLEAR_NODE(&entity->rb_tree_node);
- if (priority >= sched_list[0]->num_user_rqs) {
+ for (i = 0; i < num_sched_list; i++) {
+ if (priority < sched_list[i]->num_user_rqs)
+ continue;
+
/*
* The "priority" of an entity cannot exceed the number of
* run-queues of a scheduler. Protect against num_rqs being 0,
* by converting to signed. Choose the lowest priority
* available.
*/
- dev_err(sched_list[0]->dev, "entity with out-of-bounds priority:%u num_user_rqs:%u\n",
- priority, sched_list[0]->num_user_rqs);
+ dev_err(sched_list[i]->dev, "entity with out-of-bounds priority:%u num_user_rqs:%u\n",
+ priority, sched_list[i]->num_user_rqs);
priority = max_t(s32,
- (s32)sched_list[0]->num_user_rqs - 1,
+ (s32)sched_list[i]->num_user_rqs - 1,
(s32)DRM_SCHED_PRIORITY_KERNEL);
}
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 08/10] drm/sched: Ignore stopped entity attempt to change its run-queue
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (6 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 07/10] drm/sched: Clamp priority againsts all provided schedulers Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 09/10] drm/sched: Remove the single scheduler special case Tvrtko Ursulin
` (2 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Christian König,
Danilo Krummrich, Matthew Brost, Philipp Stanner
Jobs submitted to a stopped entity do not go anywhere due how they are
handled in drm_sched_rq_add_entity() so there is no point to allow them
to change their run-queue. We can simply bail out early which makes
entity->stopped a clearer boundary than it currently is.
This is completely safe because it is always guaranteed entity->rq is
valid if drm_sched_entity_init() succeeded.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Philipp Stanner <phasta@kernel.org>
---
drivers/gpu/drm/scheduler/sched_entity.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index ac15247f462a..cdc55906c413 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -605,13 +605,16 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
return;
spin_lock(&entity->lock);
+
+ /* Cannot submit to stopped entity anyway so bail out early. */
+ if (entity->stopped)
+ goto out;
+
fence = entity->last_scheduled;
/* stay on the same engine if the previous job hasn't finished */
- if (fence && !dma_fence_is_signaled(fence)) {
- spin_unlock(&entity->lock);
- return;
- }
+ if (fence && !dma_fence_is_signaled(fence))
+ goto out;
sched = drm_sched_pick_best(entity->sched_list, entity->num_sched_list);
rq = sched ? sched->sched_rq[entity->rq_priority] : NULL;
@@ -623,6 +626,7 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
if (entity->num_sched_list == 1)
entity->sched_list = NULL;
+out:
spin_unlock(&entity->lock);
}
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 09/10] drm/sched: Remove the single scheduler special case
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (7 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 08/10] drm/sched: Ignore stopped entity attempt to change its run-queue Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:31 ` sashiko-bot
2026-12-03 14:01 ` [PATCH v2 10/10] drm/sched: Address the fence_seq fixme Tvrtko Ursulin
2026-12-03 19:29 ` [PATCH v2 00/10] drm/sched: Entity handling cleanups Maíra Canal
10 siblings, 1 reply; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Christian König, Alex Deucher,
Luben Tuikov, Matthew Brost, Simona Vetter, Danilo Krummrich,
Philipp Stanner, Cc: Tomeu Vizoso, Sidong Yang, amd-gfx
Long time ago in commit
b3ac17667f11 ("drm/scheduler: rework entity creation")
a change was made which prevented priority changes for entities with only
one assigned scheduler.
That commit reduced drm_sched_entity_set_priority() to simply update the
entities priority, but the run queue selection logic in
drm_sched_entity_select_rq() was never able to actually change the
originally assigned run queue.
In practice that only affected amdgpu, being the only driver which can do
dynamic priority changes, and it appears it was attempted to rectify this
in commit
2316a86bde49 ("drm/amdgpu: change hw sched list on ctx priority override")
.
A few unresolved problems however remained:
The above only fixed drm_sched_entity_set_priority()
if drm_sched_entity_modify_sched() was called first which was not
documented anywhere.
Secondly, that only worked if drm_sched_entity_modify_sched() is actually
called, which in amdgpu's case is true only for gfx and compute. Priority
changes for other engines, which have only one scheduler assigned such as
jpeg and video decode still did not work.
(Note that this was also noticed in 981b04d96856 ("drm/sched: improve docs
around drm_sched_entity").)
Completely different set of non-obvious confusion was that, whereas
drm_sched_entity_init() was not keeping the passed in list of schedulers
(courtesy of commit
8c23056bdc7a ("drm/scheduler: do not keep a copy of sched list")
), drm_sched_entity_modify_sched() was disagreeing with that and
would simply assign the single item list. That incosistency appears to
have been semi-silently fixed in commit
ac4eb83ab255 ("drm/sched: select new rq even if there is only one v3")
.
What was also not documented is why it was important to not keep the list
of schedulers when there is only one scheduler given. This was in fact due
many of the callers passing in a stack container for this case. For the
multiple schedulers on the other hand amdgpu and rocket are the only such
callers and there the container is not on the stack but correctly follows
the lifetime requirement. Keeping a stack backed list in the entity would
obviously be undefined behaviour if the list was kept.
Having said that, amdgpu however did only stop passing in stack backed
container for the more than one scheduler case in commit
977f7e1068be ("drm/amdgpu: allocate entities on demand")
. Until then dereferencing freed stack from drm_sched_entity_select_rq()
was a possibility.
In order to untangle all this lets make this area behave consistently and
store the single scheduler case directly in the entity. We can do that
easily by creating an union between the current pointer to a list of
schedulers, and a new pointer to the single scheduler.
This allows removal of the special cases which artificially cleared
entity->sched_list for a single scheduler case and fixes the amdgpu
dynamic priority changes for the single IP instances.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Fixes: b3ac17667f11 ("drm/scheduler: rework entity creation")
References: 8c23056bdc7a ("drm/scheduler: do not keep a copy of sched list")
References: 977f7e1068be ("drm/amdgpu: allocate entities on demand")
References: 2316a86bde49 ("drm/amdgpu: change hw sched list on ctx priority override")
References: ac4eb83ab255 ("drm/sched: select new rq even if there is only one v3")
References: 981b04d96856 ("drm/sched: improve docs around drm_sched_entity")
References: 77a6809f1dc3 ("drm/sched: Remove FIFO and RR and simplify to a single run queue")
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Luben Tuikov <ltuikov89@gmail.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Philipp Stanner <phasta@kernel.org>
Cc: Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Cc: Sidong Yang <sidong.yang@furiosa.ai>
Cc: amd-gfx@lists.freedesktop.org
---
drivers/gpu/drm/scheduler/sched_entity.c | 30 ++++++++++-------
include/drm/gpu_scheduler.h | 42 ++++++++++++++----------
2 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index cdc55906c413..599dd4ff589b 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -115,7 +115,9 @@ static bool drm_sched_list_is_initialized(struct drm_gpu_scheduler **sched_list,
* @guilty: atomic_t set to 1 when a job on this queue
* is found to be guilty causing a timeout
*
- * Note that the &sched_list must have at least one element to schedule the entity.
+ * Note that the &sched_list must have exactly one element to schedule the
+ * entity. Callers which pass more than one scheduler on the @sched_list must
+ * ensure the list remains valid for the lifetime of the entity.
*
* For changing @priority later on at runtime see
* drm_sched_entity_set_priority(). For changing the set of schedulers
@@ -150,7 +152,10 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
entity->guilty = guilty;
entity->last_user = current->group_leader;
entity->num_sched_list = num_sched_list;
- entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
+ if (num_sched_list == 1)
+ entity->sched = sched_list[0];
+ else
+ entity->sched_list = sched_list;
RB_CLEAR_NODE(&entity->rb_tree_node);
for (i = 0; i < num_sched_list; i++) {
@@ -197,6 +202,9 @@ EXPORT_SYMBOL(drm_sched_entity_init);
* existing entity->sched_list
* @num_sched_list: number of drm sched in sched_list
*
+ * Callers which pass more than one scheduler on the @sched_list must
+ * ensure the list remains valid for the lifetime of the entity.
+ *
* Note that this must be called under the same common lock for @entity as
* drm_sched_job_arm() and drm_sched_entity_push_job(), or the driver needs to
* guarantee through some other means that this is never called while new jobs
@@ -214,7 +222,10 @@ void drm_sched_entity_modify_sched(struct drm_sched_entity *entity,
return;
spin_lock(&entity->lock);
- entity->sched_list = sched_list;
+ if (num_sched_list == 1)
+ entity->sched = sched_list[0];
+ else
+ entity->sched_list = sched_list;
entity->num_sched_list = num_sched_list;
spin_unlock(&entity->lock);
}
@@ -596,10 +607,6 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
struct drm_gpu_scheduler *sched;
struct drm_sched_rq *rq;
- /* single possible engine and already selected */
- if (!entity->sched_list)
- return;
-
/* queue non-empty, stay on the same engine */
if (spsc_queue_count(&entity->job_queue))
return;
@@ -616,16 +623,17 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
if (fence && !dma_fence_is_signaled(fence))
goto out;
- sched = drm_sched_pick_best(entity->sched_list, entity->num_sched_list);
+ if (entity->num_sched_list == 1)
+ sched = entity->sched;
+ else
+ sched = drm_sched_pick_best(entity->sched_list,
+ entity->num_sched_list);
rq = sched ? sched->sched_rq[entity->rq_priority] : NULL;
if (rq != entity->rq) {
drm_sched_rq_remove_entity(entity->rq, entity);
entity->rq = rq;
}
- if (entity->num_sched_list == 1)
- entity->sched_list = NULL;
-
out:
spin_unlock(&entity->lock);
}
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 23ec446595ae..3978ccecbd15 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -121,23 +121,31 @@ struct drm_sched_entity {
*/
struct drm_sched_entity_stats *stats;
- /**
- * @sched_list:
- *
- * A list of schedulers (struct drm_gpu_scheduler). Jobs from this entity can
- * be scheduled on any scheduler on this list.
- *
- * This can be modified by calling drm_sched_entity_modify_sched().
- * Locking is entirely up to the driver, see the above function for more
- * details.
- *
- * This will be set to NULL if &num_sched_list equals 1 and @rq has been
- * set already.
- *
- * FIXME: This means priority changes through
- * drm_sched_entity_set_priority() will be lost henceforth in this case.
- */
- struct drm_gpu_scheduler **sched_list;
+ union {
+ /**
+ * @sched_list:
+ *
+ * A list of schedulers (struct drm_gpu_scheduler). Jobs from
+ * this entity can be scheduled on any scheduler on this list.
+ *
+ * This can be modified by calling
+ * drm_sched_entity_modify_sched(). Locking is entirely up to
+ * the driver, see the above function for more details.
+ */
+ struct drm_gpu_scheduler **sched_list;
+
+ /**
+ * @sched:
+ *
+ * A single struct drm_gpu_scheduler jobs from this entity will
+ * be scheduled on.
+ *
+ * This can be modified by calling
+ * drm_sched_entity_modify_sched(). Locking is entirely up to
+ * the driver, see the above function for more details.
+ */
+ struct drm_gpu_scheduler *sched;
+ };
/**
* @num_sched_list:
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 10/10] drm/sched: Address the fence_seq fixme
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (8 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 09/10] drm/sched: Remove the single scheduler special case Tvrtko Ursulin
@ 2026-12-03 14:01 ` Tvrtko Ursulin
2026-12-03 14:30 ` sashiko-bot
2026-12-03 19:29 ` [PATCH v2 00/10] drm/sched: Entity handling cleanups Maíra Canal
10 siblings, 1 reply; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:01 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Tvrtko Ursulin, Christian König,
Danilo Krummrich, Matthew Brost, Philipp Stanner
Address a FIXME against struct drm_sched_entity->fence_seq which
documented this field does not need to be atomic_t.
Indeed now that most of the flow is guarded with entity->lock we can pull
out the lock a step up, to drm_sched_job_arm(), which also simplifies
drm_sched_entity_select_rq() and convert the field to a standard unsigned
long.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Philipp Stanner <phasta@kernel.org>
---
drivers/gpu/drm/scheduler/sched_entity.c | 12 ++++--------
drivers/gpu/drm/scheduler/sched_fence.c | 6 ++++--
drivers/gpu/drm/scheduler/sched_main.c | 7 ++++++-
include/drm/gpu_scheduler.h | 7 ++-----
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 599dd4ff589b..bc5141c85fbc 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -188,7 +188,6 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
spin_lock_init(&entity->lock);
spsc_queue_init(&entity->job_queue);
- atomic_set(&entity->fence_seq, 0);
entity->fence_context = dma_fence_context_alloc(2);
return 0;
@@ -607,21 +606,21 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
struct drm_gpu_scheduler *sched;
struct drm_sched_rq *rq;
+ lockdep_assert_held(&entity->lock);
+
/* queue non-empty, stay on the same engine */
if (spsc_queue_count(&entity->job_queue))
return;
- spin_lock(&entity->lock);
-
/* Cannot submit to stopped entity anyway so bail out early. */
if (entity->stopped)
- goto out;
+ return;
fence = entity->last_scheduled;
/* stay on the same engine if the previous job hasn't finished */
if (fence && !dma_fence_is_signaled(fence))
- goto out;
+ return;
if (entity->num_sched_list == 1)
sched = entity->sched;
@@ -633,9 +632,6 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
drm_sched_rq_remove_entity(entity->rq, entity);
entity->rq = rq;
}
-
-out:
- spin_unlock(&entity->lock);
}
/**
diff --git a/drivers/gpu/drm/scheduler/sched_fence.c b/drivers/gpu/drm/scheduler/sched_fence.c
index 94ba0cf4fe02..9f938f5a7e55 100644
--- a/drivers/gpu/drm/scheduler/sched_fence.c
+++ b/drivers/gpu/drm/scheduler/sched_fence.c
@@ -224,10 +224,12 @@ struct drm_sched_fence *drm_sched_fence_alloc(void *owner,
void drm_sched_fence_init(struct drm_sched_fence *fence,
struct drm_sched_entity *entity)
{
- unsigned seq;
+ unsigned long seq;
+
+ lockdep_assert_held(&entity->lock);
fence->sched = entity->rq->sched;
- seq = atomic_inc_return(&entity->fence_seq);
+ seq = ++entity->fence_seq;
dma_fence_init(&fence->scheduled, &drm_sched_fence_ops_scheduled,
&fence->lock, entity->fence_context, seq, 0);
dma_fence_init(&fence->finished, &drm_sched_fence_ops_finished,
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 34bedb02d798..604b2f66ce97 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -646,6 +646,9 @@ void drm_sched_job_arm(struct drm_sched_job *job)
struct drm_sched_entity *entity = job->entity;
BUG_ON(!entity);
+
+ spin_lock(&entity->lock);
+
drm_sched_entity_select_rq(entity);
sched = entity->rq->sched;
@@ -653,7 +656,9 @@ void drm_sched_job_arm(struct drm_sched_job *job)
job->s_priority = entity->priority;
job->entity_stats = drm_sched_entity_stats_get(entity->stats);
- drm_sched_fence_init(job->s_fence, job->entity);
+ drm_sched_fence_init(job->s_fence, entity);
+
+ spin_unlock(&entity->lock);
}
EXPORT_SYMBOL(drm_sched_job_arm);
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 3978ccecbd15..748a93f5a0a4 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -101,7 +101,7 @@ struct drm_sched_entity {
*
* Lock protecting the run-queue (@rq) to which this entity belongs,
* @priority, @last_scheduled and the list of schedulers (@sched_list,
- * @num_sched_list), @rr_ts and @stopped.
+ * @num_sched_list), @rr_ts, @stopped and @fence_seq.
*/
spinlock_t lock;
@@ -184,11 +184,8 @@ struct drm_sched_entity {
*
* A linearly increasing seqno incremented with each new
* &drm_sched_fence which is part of the entity.
- *
- * FIXME: Callers of drm_sched_job_arm() need to ensure correct locking,
- * this doesn't need to be atomic.
*/
- atomic_t fence_seq;
+ unsigned long fence_seq;
/**
* @fence_context:
--
2.56.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2 02/10] drm/etnaviv: Release context id on failure
2026-12-03 14:01 ` [PATCH v2 02/10] drm/etnaviv: Release context id on failure Tvrtko Ursulin
@ 2026-12-03 14:18 ` sashiko-bot
0 siblings, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-12-03 14:18 UTC (permalink / raw)
To: Tvrtko Ursulin, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/etnaviv: missing Fixes trailer for etnaviv_open() XArray
leak fix
--
commit 5c40c43dfcc5cb8de64c961ddd4b379057974735
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> drm/etnaviv: Release context id on failure
>
> Cleanup on the etnaviv_open() failure path looks incomplete in that the
> context id is left allocated. Fix it by adding proper onion unwind.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: etnaviv@lists.freedesktop.org
[Severity: Low]
Even though the context ids are unused, leaving them in
priv->active_contexts leaks XArray slots and xa_node slab memory (and a
dangling ctx pointer) until etnaviv_unbind().
On IOMMUv2, etnaviv_iommuv2_context_alloc() fails once 512 contexts are
open, so repeated failed opens can leak unbounded kernel memory without
memory pressure.
Since this fixes a memory leak introduced when xa_alloc_cyclic() was added
to etnaviv_open(), should this include:
Fixes: d306788b6e1b ("drm/etnaviv: allocate unique ID per drm_file")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203140128.6813-1-tvrtko.ursulin@igalia.com?part=2
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value
2026-12-03 14:01 ` [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value Tvrtko Ursulin
@ 2026-12-03 14:19 ` sashiko-bot
2026-12-03 14:24 ` Tvrtko Ursulin
1 sibling, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-12-03 14:19 UTC (permalink / raw)
To: Tvrtko Ursulin, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/etnaviv: inaccurate commit message and missing Fixes tag
--
commit 1bcc1945503d97a4e3b2616be71622735bd4fe37
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> drm/etnaviv: Check drm_sched_entity_init() return value
>
> Start checking drm_sched_entity_init() return value in preparation of
> making that API a bit stricter.
>
> No functional change intended as the failure path should never trigger in
> this driver.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: etnaviv@lists.freedesktop.org
[Severity: Low]
Is the commit message accurate that the failure path can never trigger in
this driver?
Since commit fd177135f0e6 ("drm/sched: Account entity GPU time"),
drm_sched_entity_init() allocates entity->stats via
drm_sched_entity_stats_new() and can return -ENOMEM even with valid
arguments.
Without checking the return value, etnaviv_open() succeeds with a NULL
entity->rq, causing a NULL pointer dereference in drm_sched_entity_flush()
when etnaviv_postclose() calls drm_sched_entity_destroy().
Since this fixes a reachable bug, should the commit message be updated and
include:
Fixes: fd177135f0e6 ("drm/sched: Account entity GPU time")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203140128.6813-1-tvrtko.ursulin@igalia.com?part=3
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 04/10] drm/msm: Check drm_sched_entity_init() return value
2026-12-03 14:01 ` [PATCH v2 04/10] drm/msm: " Tvrtko Ursulin
@ 2026-12-03 14:23 ` sashiko-bot
2026-12-03 14:24 ` Tvrtko Ursulin
1 sibling, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-12-03 14:23 UTC (permalink / raw)
To: Tvrtko Ursulin, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/msm: inaccurate commit message and missing Fixes tag
--
commit 21999ea1c8eea57d5acd6db9fdbfa393532b555c
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> drm/msm: Check drm_sched_entity_init() return value
>
> Start checking drm_sched_entity_init() return value in preparation of
> making that API a bit stricter.
>
> No functional change intended as the failure path should never trigger in
> this driver given drm_sched_init() happens before and it's failure is
> always fatal.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Rob Clark <robin.clark@oss.qualcomm.com>
> Cc: Dmitry Baryshkov <lumag@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
[Severity: Low]
Is the "no functional change intended" claim accurate here?
drm_sched_entity_init() allocates entity->stats via
drm_sched_entity_stats_new() and returns -ENOMEM on allocation failure even
when drm_sched_init() succeeded. Previously, ignoring that error left
queue->entity zeroed while still registering the queue, leading to a NULL
pointer dereference in drm_sched_entity_stats_put() on teardown.
Since this fixes a reachable allocation-failure crash, should the commit
message be updated and include:
Fixes: 92395af63a99 ("drm/msm: Add VM_BIND submitqueue")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203140128.6813-1-tvrtko.ursulin@igalia.com?part=4
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers
2026-12-03 14:01 ` [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers Tvrtko Ursulin
@ 2026-12-03 14:23 ` sashiko-bot
2026-12-05 4:20 ` Sidong Yang
1 sibling, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-12-03 14:23 UTC (permalink / raw)
To: Tvrtko Ursulin, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/sched: drm_sched_entity_init() breaks v3d_open() on V3D 3.3
--
commit c97e2213d0d6c3fa3066c68d77008ddc604e5ff1
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
drm/sched: Disallow initializing entities with un-initialized schedulers
This commit rejects uninitialized schedulers in drm_sched_entity_init() and
drm_sched_entity_modify_sched() by checking that every scheduler in
sched_list has a non-NULL sched_rq.
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index 03e68b4102d50..69bcefdf2c55a 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -90,6 +90,19 @@ ktime_t drm_sched_entity_stats_job_add_gpu_time(struct drm_sched_job *job)
> return duration;
> }
>
> +static bool drm_sched_list_is_initialized(struct drm_gpu_scheduler **sched_list,
> + unsigned int num_sched_list)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < num_sched_list; i++) {
> + if (!sched_list[i] || !sched_list[i]->sched_rq)
> + return false;
> + }
> +
> + return true;
> +}
> +
> /**
> * drm_sched_entity_init - Init a context entity used by scheduler when
> * submit to HW ring.
> @@ -119,7 +132,10 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
> unsigned int num_sched_list,
> atomic_t *guilty)
> {
> - if (!entity || !sched_list || !num_sched_list || !sched_list[0])
> + if (!entity || !sched_list || !num_sched_list)
> + return -EINVAL;
> +
> + if (!drm_sched_list_is_initialized(sched_list, num_sched_list))
> return -EINVAL;
[Severity: High]
Does returning -EINVAL here break v3d_open() on V3D 3.3?
On V3D 3.3 (brcm,7268-v3d), v3d_has_csd() is false, so v3d_sched_init() in
drivers/gpu/drm/v3d/v3d_sched.c skips initializing the V3D_CSD and
V3D_CACHE_CLEAN schedulers and leaves their sched_rq NULL.
v3d_open() in drivers/gpu/drm/v3d/v3d_drv.c still calls
drm_sched_entity_init() for all V3D_MAX_QUEUES, so every open() of the V3D
device node now fails with -EINVAL.
v3d_open() (and v3d_postclose(), which calls drm_sched_entity_destroy() for
all queues) would need to skip V3D_CSD and V3D_CACHE_CLEAN when
!v3d_has_csd(v3d) before enforcing this check.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203140128.6813-1-tvrtko.ursulin@igalia.com?part=6
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value
2026-12-03 14:01 ` [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value Tvrtko Ursulin
2026-12-03 14:19 ` sashiko-bot
@ 2026-12-03 14:24 ` Tvrtko Ursulin
1 sibling, 0 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:24 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Lucas Stach, Russell King, Christian Gmeiner, etnaviv
On 03/12/2026 14:01, Tvrtko Ursulin wrote:
> Start checking drm_sched_entity_init() return value in preparation of
> making that API a bit stricter.
>
> No functional change intended as the failure path should never trigger in
> this driver.
Sashiko raised a good point, it can still fail on memory allocation
failures. Need to rewrite the commit message and add the below tags.
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: etnaviv@lists.freedesktop.org
Fixes: fd177135f0e6 ("drm/sched: Account entity GPU time")
Cc: <stable@vger.kernel.org> # v7.2+
Regards,
Tvrtko
> ---
> Compile tested only.
> ---
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 22 +++++++++++++++-------
> 1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 7bd7aef723c3..53003c31d7f9 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -83,21 +83,29 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
> }
>
> for (i = 0; i < ETNA_MAX_PIPES; i++) {
> - struct etnaviv_gpu *gpu = priv->gpu[i];
> struct drm_gpu_scheduler *sched;
>
> - if (gpu) {
> - sched = &gpu->sched;
> - drm_sched_entity_init(&ctx->sched_entity[i],
> - DRM_SCHED_PRIORITY_NORMAL, &sched,
> - 1, NULL);
> - }
> + if (!priv->gpu[i])
> + continue;
> +
> + sched = &priv->gpu[i]->sched;
> + ret = drm_sched_entity_init(&ctx->sched_entity[i],
> + DRM_SCHED_PRIORITY_NORMAL,
> + &sched, 1, NULL);
> + if (ret)
> + goto out_entity;
> }
>
> file->driver_priv = ctx;
>
> return 0;
>
> +out_entity:
> + while (i--) {
> + if (priv->gpu[i])
> + drm_sched_entity_destroy(&ctx->sched_entity[i]);
> + }
> + etnaviv_iommu_context_put(ctx->mmu);
> out_id:
> xa_erase(&priv->active_contexts, ctx->id);
> out_free:
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 04/10] drm/msm: Check drm_sched_entity_init() return value
2026-12-03 14:01 ` [PATCH v2 04/10] drm/msm: " Tvrtko Ursulin
2026-12-03 14:23 ` sashiko-bot
@ 2026-12-03 14:24 ` Tvrtko Ursulin
1 sibling, 0 replies; 21+ messages in thread
From: Tvrtko Ursulin @ 2026-12-03 14:24 UTC (permalink / raw)
To: dri-devel
Cc: kernel-dev, Rob Clark, Dmitry Baryshkov, linux-arm-msm, freedreno
On 03/12/2026 14:01, Tvrtko Ursulin wrote:
> Start checking drm_sched_entity_init() return value in preparation of
> making that API a bit stricter.
>
> No functional change intended as the failure path should never trigger in
> this driver given drm_sched_init() happens before and it's failure is
> always fatal.
Sashiko raised a good point, it can still fail on memory allocation
failures. Need to rewrite the commit message and add the below tags
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Rob Clark <robin.clark@oss.qualcomm.com>
> Cc: Dmitry Baryshkov <lumag@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
Fixes: fd177135f0e6 ("drm/sched: Account entity GPU time")
Cc: <stable@vger.kernel.org> # v7.2+
Regards,
Tvrtko
> ---
> Compile tested only.
> ---
> drivers/gpu/drm/msm/msm_submitqueue.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
> index 8d550d281704..16852cf0c081 100644
> --- a/drivers/gpu/drm/msm/msm_submitqueue.c
> +++ b/drivers/gpu/drm/msm/msm_submitqueue.c
> @@ -227,8 +227,13 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_context *ctx,
>
> queue->entity = &queue->_vm_bind_entity[0];
>
> - drm_sched_entity_init(queue->entity, DRM_SCHED_PRIORITY_KERNEL,
> - &sched, 1, NULL);
> + ret = drm_sched_entity_init(queue->entity,
> + DRM_SCHED_PRIORITY_KERNEL,
> + &sched, 1, NULL);
> + if (ret) {
> + kfree(queue);
> + return ret;
> + }
> } else {
> queue->ring_nr = ring_nr;
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 10/10] drm/sched: Address the fence_seq fixme
2026-12-03 14:01 ` [PATCH v2 10/10] drm/sched: Address the fence_seq fixme Tvrtko Ursulin
@ 2026-12-03 14:30 ` sashiko-bot
0 siblings, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-12-03 14:30 UTC (permalink / raw)
To: Tvrtko Ursulin, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/sched: unconditional entity->lock in drm_sched_job_arm()
regresses hot path
--
commit e186c89420ee185250eb89c11064089f96c74447
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
drm/sched: Address the fence_seq fixme
This commit moves entity->lock acquisition from drm_sched_entity_select_rq()
up into drm_sched_job_arm() and converts entity->fence_seq from atomic_t to
unsigned long.
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 85a49e2198370..9c0d8c1d2395d 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -646,6 +646,9 @@ void drm_sched_job_arm(struct drm_sched_job *job)
> struct drm_sched_entity *entity = job->entity;
>
> BUG_ON(!entity);
> +
> + spin_lock(&entity->lock);
> +
> drm_sched_entity_select_rq(entity);
> sched = entity->rq->sched;
>
> @@ -653,7 +656,9 @@ void drm_sched_job_arm(struct drm_sched_job *job)
> job->s_priority = entity->priority;
> job->entity_stats = drm_sched_entity_stats_get(entity->stats);
>
> - drm_sched_fence_init(job->s_fence, job->entity);
> + drm_sched_fence_init(job->s_fence, entity);
> +
> + spin_unlock(&entity->lock);
> }
> EXPORT_SYMBOL(drm_sched_job_arm);
[Severity: Medium]
Does taking entity->lock unconditionally in drm_sched_job_arm() regress the
submission hot path on busy entities?
Previously, drm_sched_entity_select_rq() returned before acquiring
entity->lock whenever spsc_queue_count(&entity->job_queue) was non-zero,
leaving drm_sched_job_arm() lockless on pipelined workloads with only a
producer-local atomic_inc_return(&entity->fence_seq).
Now every job submission acquires entity->lock here (in addition to
drm_sched_entity_push_job()) and holds it across drm_sched_entity_stats_get()
and both dma_fence_init() calls in drm_sched_fence_init().
Because the scheduler worker acquires entity->lock in
drm_sched_entity_pop_job() and nests rq->lock in drm_sched_rq_pop_entity(),
this trades an uncontended atomic increment for cross-CPU spinlock contention
and stalls submitters behind rq->lock.
Since callers already serialize drm_sched_job_arm() and
drm_sched_entity_push_job() per entity, fence_seq can be converted without
widening entity->lock across the non-empty queue fast path and fence init.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203140128.6813-1-tvrtko.ursulin@igalia.com?part=10
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 09/10] drm/sched: Remove the single scheduler special case
2026-12-03 14:01 ` [PATCH v2 09/10] drm/sched: Remove the single scheduler special case Tvrtko Ursulin
@ 2026-12-03 14:31 ` sashiko-bot
0 siblings, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-12-03 14:31 UTC (permalink / raw)
To: Tvrtko Ursulin, dri-devel; +Cc: amd-gfx
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/sched: contradictory sched_list count in
drm_sched_entity_init() doc
--
commit 2a2c1e952ba97527448ca31cea515eb052a0d67c
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
drm/sched: Remove the single scheduler special case
This commit replaces the single-scheduler special case in struct
drm_sched_entity with a union holding either a single scheduler pointer or
a scheduler list, allowing dynamic priority changes on single-scheduler
entities.
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index cdc55906c4131..599dd4ff589b4 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -115,7 +115,9 @@ static bool drm_sched_list_is_initialized(struct drm_gpu_scheduler **sched_list,
> * @guilty: atomic_t set to 1 when a job on this queue
> * is found to be guilty causing a timeout
> *
> - * Note that the &sched_list must have at least one element to schedule the entity.
> + * Note that the &sched_list must have exactly one element to schedule the
> + * entity. Callers which pass more than one scheduler on the @sched_list must
> + * ensure the list remains valid for the lifetime of the entity.
> *
> * For changing @priority later on at runtime see
> * drm_sched_entity_set_priority(). For changing the set of schedulers
[Severity: Low]
Should this still say "at least one element" rather than "exactly one
element"? drm_sched_entity_init() accepts any non-zero num_sched_list,
and the very next sentence describes callers passing more than one
scheduler.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203140128.6813-1-tvrtko.ursulin@igalia.com?part=9
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 00/10] drm/sched: Entity handling cleanups
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
` (9 preceding siblings ...)
2026-12-03 14:01 ` [PATCH v2 10/10] drm/sched: Address the fence_seq fixme Tvrtko Ursulin
@ 2026-12-03 19:29 ` Maíra Canal
10 siblings, 0 replies; 21+ messages in thread
From: Maíra Canal @ 2026-12-03 19:29 UTC (permalink / raw)
To: Tvrtko Ursulin, dri-devel
Cc: kernel-dev, Christian König, Danilo Krummrich, Matthew Brost,
Philipp Stanner, Lucas Stach, Russell King, Christian Gmeiner,
Rob Clark, linux-arm-msm, freedreno, etnaviv, amd-gfx
Hi Tvrtko,
On 03/12/26 11:01, Tvrtko Ursulin wrote:
> Stricter rules around entity initialization, removing the single scheduler
> special case which fixes the priority override for amdgpu single IP instance
> entities and addressing of fence_seq FIXME by pulling the entity->lock up from
> drm_sched_entity_select_rq().
>
> In the last round sashiko complained about the first patch breaking legacy v3d
> but Maíra has confirmed that is an unused path so no problem to make it
> stricter. Lets see what sashiko finds in this round.
Just to let you know, I already submitted a series to remove V3D < 4.2
[1]. I'm just waiting for DT maintainers feedback.
Thank you for the series!
[1]
https://lore.kernel.org/dri-devel/20261122-v3d-remove-33-41-v1-0-52152b454ad8@igalia.com/T/
Best regards,
- Maíra
>
> v2:
> * New patches in the series:
> * Fix amdgpu VCN potential usage of un-initialized schedulers.
> * Make entaviv and msm check drm_sched_entity_init return value.
> * Mark drm_sched_entity_init as __must_check.
> * Clamp priority levels against all schedulers in drm_sched_entity_init().
>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> Cc: Maíra Canal <mcanal@igalia.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: Rob Clark <robin.clark@oss.qualcomm.com>
> Cc: Dmitry Baryshkov <lumag@kernel.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: etnaviv@lists.freedesktop.org
> Cc: amd-gfx@lists.freedesktop.org
>
> Tvrtko Ursulin (10):
> drm/amdgpu/vcn3: Fail job submission if VCN0 decode is disabled under
> SR-IOV
> drm/etnaviv: Release context id on failure
> drm/etnaviv: Check drm_sched_entity_init() return value
> drm/msm: Check drm_sched_entity_init() return value
> drm/sched: Mark drm_sched_entity_init() as __must_check
> drm/sched: Disallow initializing entities with un-initialized
> schedulers
> drm/sched: Clamp priority againsts all provided schedulers
> drm/sched: Ignore stopped entity attempt to change its run-queue
> drm/sched: Remove the single scheduler special case
> drm/sched: Address the fence_seq fixme
>
> drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 ++
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 26 ++++---
> drivers/gpu/drm/msm/msm_submitqueue.c | 9 ++-
> drivers/gpu/drm/scheduler/sched_entity.c | 89 +++++++++++++++---------
> drivers/gpu/drm/scheduler/sched_fence.c | 6 +-
> drivers/gpu/drm/scheduler/sched_main.c | 7 +-
> include/drm/gpu_scheduler.h | 59 +++++++++-------
> 7 files changed, 129 insertions(+), 71 deletions(-)
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers
2026-12-03 14:01 ` [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers Tvrtko Ursulin
2026-12-03 14:23 ` sashiko-bot
@ 2026-12-05 4:20 ` Sidong Yang
1 sibling, 0 replies; 21+ messages in thread
From: Sidong Yang @ 2026-12-05 4:20 UTC (permalink / raw)
To: Tvrtko Ursulin
Cc: dri-devel, kernel-dev, Christian König, Danilo Krummrich,
Matthew Brost, Philipp Stanner, Tomeu Vizoso
On Thu, Dec 03, 2026 at 02:01:24PM +0000, Tvrtko Ursulin wrote:
> I do not *think* any of the drivers relies on this inverted initialization
> order but it needs more eyes for sure.
accel/rocket can hit this while it probes: rocket_probe() increments
num_cores before drm_sched_init() runs for that core, and
rocket_job_open() lists num_cores schedulers. An open() in that window
succeeds today and returns -EINVAL with this patch.
I reproduced it on a ROCK 5B+ by polling open() while the module loads,
with only this patch's check backported to a 7.2 kernel.
This is for rocket to fix. I'll send a patch.
Thanks,
Sidong
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2026-12-05 4:20 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 14:01 [PATCH v2 00/10] drm/sched: Entity handling cleanups Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 01/10] drm/amdgpu/vcn3: Fail job submission if VCN0 decode is disabled under SR-IOV Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 02/10] drm/etnaviv: Release context id on failure Tvrtko Ursulin
2026-12-03 14:18 ` sashiko-bot
2026-12-03 14:01 ` [PATCH v2 03/10] drm/etnaviv: Check drm_sched_entity_init() return value Tvrtko Ursulin
2026-12-03 14:19 ` sashiko-bot
2026-12-03 14:24 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 04/10] drm/msm: " Tvrtko Ursulin
2026-12-03 14:23 ` sashiko-bot
2026-12-03 14:24 ` Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 05/10] drm/sched: Mark drm_sched_entity_init() as __must_check Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers Tvrtko Ursulin
2026-12-03 14:23 ` sashiko-bot
2026-12-05 4:20 ` Sidong Yang
2026-12-03 14:01 ` [PATCH v2 07/10] drm/sched: Clamp priority againsts all provided schedulers Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 08/10] drm/sched: Ignore stopped entity attempt to change its run-queue Tvrtko Ursulin
2026-12-03 14:01 ` [PATCH v2 09/10] drm/sched: Remove the single scheduler special case Tvrtko Ursulin
2026-12-03 14:31 ` sashiko-bot
2026-12-03 14:01 ` [PATCH v2 10/10] drm/sched: Address the fence_seq fixme Tvrtko Ursulin
2026-12-03 14:30 ` sashiko-bot
2026-12-03 19:29 ` [PATCH v2 00/10] drm/sched: Entity handling cleanups Maíra Canal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.