Repository navigation
scheduler: guard against subdivision underflow on domain clear - #4088
Conversation
In some situations the domain clear routine might encounter a case, when the number of clients is decremented and 0, as such, a subsequent subdivision will result in an integer underflow. Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
| if (atomic_read(&sch->domain->num_clients)) { | ||
| count = atomic_sub(&sch->domain->num_clients, 1); |
There was a problem hiding this comment.
What happens if num_clients changes here between reading and subtracting. @lgirdwood @plbossart what do you think ?
There was a problem hiding this comment.
What happens if num_clients changes here between reading and subtracting. @lgirdwood @plbossart what do you think ?
We hold the domain->lock during these checks so that should not happen.
BTW, we are kind of mess in this client/task management, I am working on refining them, please see the PR here: #4089
There was a problem hiding this comment.
ok, this is fine with the locks held.
keyonjie
left a comment
There was a problem hiding this comment.
Nice observation @slawblauciak , we are somewhat mess in this client/task management part, better to do a thorough cleanup here, please see my PR #4089.
|
@keyonjie @slawblauciak can we use this in TGL 12 and integrate this alongside the cleanup in v1.8 ? |
Yeah, the plan is to use it with TGL 12 for sure. Not certain about Keyon's change yet. |
|
@keyonjie lets clean up for v1.8 if things are messy today. |
sounds good. |
In some situations the domain clear routine might encounter
a case, when the number of clients is decremented and 0,
as such, a subsequent subdivision will result in an integer underflow.
Signed-off-by: Slawomir Blauciak slawomir.blauciak@linux.intel.com
Fixes #3950
Fixes #3949
Fixes #3947