Re: [PATCH 1/2] drm/sched: Guard sched->ready with ACCESS_ONCE()

From: Danilo Krummrich

Date: Mon Jul 06 2026 - 07:38:43 EST


On Mon Jul 6, 2026 at 10:44 AM CEST, Philipp Stanner wrote:
> On Mon, 2026-06-29 at 14:09 +0200, Danilo Krummrich wrote:
>> > + WRITE_ONCE(sched->ready, false);
>>
>> Don't we need smp_store_release() here and
>>
>> > + return READ_ONCE(sched->ready);
>> smp_load_acquire() here?
>
> Maybe. Not sure what the precise access rules would be. To really get
> correctness, all counter-parties you found in amdgpu would have to
> remove their layering violations anyways, which is beyond my scope.

Fair enough, let's get it right in the core infrastructure then.

>> Also, what about drm_sched_init()? It also seems that this is accessed from
>> amdgpu without the drm_sched_wqueue_ready() helper about a million times. :)
>>
>> $ grep -Rin "sched\.ready" drivers/gpu/drm/amd | wc
>> $     119     544   10320
>>
>> There may be false positives, but from a quick glance at least most of them seem
>> to actually come from the scheduler.
>
> Correct.
>
> Your ordering comment hints at me that you would rather see the ready-
> flag be left as is, if it can't be made right 100% (which it can't).

No, the change makes sense. Getting it right in the core infrastructure is the
right thing to do, even if you don't want to fix up amdgpu.