dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 06/10] drm/sched: Disallow initializing entities with un-initialized schedulers
Date: Thu, 03 Dec 2026 14:23:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-247957@kernel.org> (raw)
In-Reply-To: <20261203140128.6813-7-tvrtko.ursulin@igalia.com>

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

  reply	other threads:[~2026-12-03 14:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-247957@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tvrtko.ursulin@igalia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox