[lvc-project] [PATCH] powercap: dtpm: Fix power limit distribution below the minimum power
Fedor Pchelkin
pchelkin at ispras.ru
Sat Oct 17 22:45:42 MSK 2026
On Tue, 06. Oct 18:15, Mikhail Dmitrichenko wrote:
> DTPM represents the devices supporting the power limitation as a tree
> of nodes: the leaves are the devices themselves, like CPU performance
> domains or devfreq devices, and the intermediate nodes group their
> children.
>
> When a power limit is set on an intermediate node, __set_power_limit_uw()
> distributes it among the children proportionally to their weights,
> which __dtpm_rebalance_weight() computes from the maximum power of the
> nodes only. So when the limit is close to the minimum power of the
> node, the share of a child having a high minimum power compared to its
> maximum power can be lower than its own minimum power.
>
> For example, with a parent having two children, the first one with a
> power range of 80-1200 and the second one with a range of 400-3000, the
> parent's range is 480-4200. A limit of 500 gives a share of about 143
> to the first child and 357 to the second one, below its minimum power
> of 400. As the second child can't go below its lowest performance
> state, the actual power of the children exceeds the parent's limit,
> while it could have been met by giving 400 to the second child and 100
> to the first one.
>
> Moreover, such a share is lower than the power of the lowest
> performance state of the child, so set_pd_power_limit() in the CPU and
> devfreq backends reads out of the bounds of the energy model table.
> This out-of-bounds access is addressed in the backends by [1], which
> is still needed, as the share can also be too low when the minimum
> power of a child is stale, e.g. right after a CPU of its performance
> domain is brought online.
>
> The power limit of a node is never lower than the sum of the minimum
> power of its children, so a distribution where every child gets at
> least its minimum power always exists. When the share of a child is
> below its minimum power, give it its minimum power and take the
> difference from the siblings, proportionally to their headroom above
> their own minimum power. The distribution is unchanged when every
> share is at least the child's minimum power.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Link: https://lore.kernel.org/linux-pm/20260612062536.9147-1-elazarl@gmail.com/ [1]
> Fixes: a20d0ef97abf ("powercap/drivers/dtpm: Add API for dynamic thermal power management")
> Cc: stable at vger.kernel.org
> Signed-off-by: Mikhail Dmitrichenko <mdmitrichenko at astralinux.ru>
Это теоретические выкладки, или же имеется возможность тестировать
изменения в данном драйвере?
More information about the lvc-project
mailing list