From: Boris Brezillon <boris.brezillon@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: "Liviu Dudau" <liviu.dudau@arm.com>,
"Adrián Larumbe" <adrian.larumbe@collabora.com>,
dri-devel@lists.freedesktop.org,
"Lars-Ivar Hesselberg Simonsen" <lars-ivar.simonsen@arm.com>,
kernel@collabora.com
Subject: Re: [PATCH v1 4/4] drm/panthor: Relax check in panthor_sched_pre_reset()
Date: Wed, 12 Nov 2025 13:47:25 +0100 [thread overview]
Message-ID: <20251112134725.160734c4@fedora> (raw)
In-Reply-To: <717fea87-6927-484a-b373-cb1917185c0f@arm.com>
On Fri, 7 Nov 2025 16:40:53 +0000
Steven Price <steven.price@arm.com> wrote:
> On 31/10/2025 15:48, Boris Brezillon wrote:
> > A group can become runnable even after reset.in_progress has
> > been set to true and panthor_sched_suspend() has been called,
> > because the drm_sched queues are still running at that point,
> > and ::run_job() might call group_schedule_locked() which moves
> > the group to the runnable list. And that's fine, because we're
> > moving those groups to the stopped list anyway when we call
> > panthor_group_stop(), so just drop the misleading WARN_ON().
>
> If we've got another thread mutating the runnable list between
> panthor_sched_suspend() and list_for_each_entry_safe(), doesn't that
> make the list iterator unsafe? (_safe only protects against deleting the
> current item, not against concurrent access).
I'm not too sure actually. There's an
atomic_read(&sched->reset.in_progress) to check if we're about to reset
in group_schedule_locked() and cancel the insertion into the runnable
list in that case, meaning we're sure nothing new will be inserted after
we've set the in_progress=true in panthor_sched_pre_reset().
>
> It feels to me like we should be holding the sched mutex - at least
> while iterating. I agree the WARN_ON is unnecessary, and will need
> removing if we simply guard the iteration - the alternative is to
> recolour panthor_sched_suspend() to assume the lock is held (and take
> the lock in panthor_sched_pre_reset), but I suspect that's a more ugly
> change.
I'd rather ensure that nothing new is inserted in the runnable/idle
lists after sched->reset.in_progress is set to true. Note that
sched->reset.in_progress is set to true with the sched lock held,
meaning any path modifying the sched lists (must be done with the sched
lock held) should complete before we set this to true. As long as those
paths also skip the list insertion, or, for things happening in a work
context (thinking of the tick work here), as long as the work is not
rescheduled until we get a chance to disable this work, we should be
good, no?
next prev parent reply other threads:[~2025-11-12 12:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 15:48 [PATCH v1 0/4] drm/panthor: Misc fixes Boris Brezillon
2025-10-31 15:48 ` [PATCH v1 1/4] drm/panthor: Fix UAF on kernel BO VA nodes Boris Brezillon
2025-11-03 11:10 ` Liviu Dudau
2025-11-03 14:34 ` Liviu Dudau
2025-10-31 15:48 ` [PATCH v1 2/4] drm/panthor: Add support for atomic page table updates Boris Brezillon
2025-11-07 16:26 ` Steven Price
2025-11-07 17:14 ` Boris Brezillon
2025-10-31 15:48 ` [PATCH v1 3/4] drm/panthor: Make panthor_vm_[un]map_pages() more robust Boris Brezillon
2025-11-03 21:00 ` Akash Goel
2025-11-04 7:43 ` Boris Brezillon
2025-10-31 15:48 ` [PATCH v1 4/4] drm/panthor: Relax check in panthor_sched_pre_reset() Boris Brezillon
2025-11-07 16:40 ` Steven Price
2025-11-12 12:47 ` Boris Brezillon [this message]
2025-11-17 9:49 ` Steven Price
2025-11-17 10:26 ` Boris Brezillon
2025-11-17 11:07 ` Steven Price
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=20251112134725.160734c4@fedora \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=lars-ivar.simonsen@arm.com \
--cc=liviu.dudau@arm.com \
--cc=steven.price@arm.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 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.