Re: [PATCH v3] sched/rt: Fix race in push_rt_task
From: Harshit Agarwal
Date: Tue Mar 04 2025 - 13:50:22 EST
Thanks Juri for pointing this out.
I can send the fix for deadline as well.
Is it okay if I do it in a separate patch?
From taking a quick look at the code, I can see that the same fix won’t
apply as is in case of deadline since it has two different callers for
find_lock_later_rq.
One is push_dl_task for which we can call pick_next_pushable_dl_task
and make sure it is at the head. This is where we have the bug.
Another one is dl_task_offline_migration which gets the task from
dl_task_timer which in turn gets it from sched_dl_entity.
I haven’t gone through the deadline code thoroughly but I think this race
shouldn’t exist for the offline task (2nd) case. If that is true then the fix
could be to check in push_dl_task if the task returned by find_lock_later_rq
is still at the head of the queue or not.
Let me know Steve and Juri if this plan sounds good. I will send the fix
accordingly.
Regards,
Harshit
> On Mar 4, 2025, at 8:18 AM, Juri Lelli <juri.lelli@xxxxxxxxxx> wrote:
>
> !-------------------------------------------------------------------|
> CAUTION: External Email
>
> |-------------------------------------------------------------------!
>
> On 04/03/25 10:30, Steven Rostedt wrote:
>> On Tue, 4 Mar 2025 09:15:55 +0000
>> Juri Lelli <juri.lelli@xxxxxxxxxx> wrote:
>>
>>> As usual, we have essentially the same in deadline.c, do you think we
>>> should/could implement the same fix proactively in there as well? Steve?
>>>
>>
>> Probably. It would be better if we could find a way to consolidate the
>> functionality so that when we fix a bug in one, the other gets fixed too.
>
> That would be nice indeed.
>
> Thanks,
> Juri
>