Re: Null pointer crash at find_idlest_group on db845c w/ linus/master
From: Valentin Schneider
Date: Wed Dec 04 2019 - 05:41:17 EST
On 04/12/2019 10:09, Vincent Guittot wrote:
> Now, we test that a group has at least one allowed CPU for the task so we
> could skip the local group with the correct/wrong p->cpus_ptr
>
> The path is used for fork/exec ibut also for wakeup path for b.L when the task doesn't fit in the CPUs
>
> So we can probably imagine a scenario where we change task affinity while
> sleeping. If the wakeup happens on a CPU that belongs to the group that is not
> allowed, we can imagine that we skip the local_group
>
Shoot, I think you're right. If it is the local group that is NULL, then
we most likely splat on:
if (local->sgc->max_capacity >= idlest->sgc->max_capacity)
return NULL;
We don't splat before because we just use local_sgs, which is uninitialized
but on the stack.
Also; does it really have to involve an affinity "race"? AFAIU affinity
could have been changed a while back, but the waking CPU isn't allowed
so we skip the local_group (in simpler cases where each CPU is a group).