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.

> 
> 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).

My idea was more to at least document the UB / race and make it
slightly less broken with a reasonable cost-benefit-ratio


P.

Reply via email to