-
Notifications
You must be signed in to change notification settings - Fork 105
[Deepin-Kernel-SIG] [Upstream] [linux 6.6-y] Fixes: sched/fair: Simplify Util_est #634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Deepin-Kernel-SIG] [Upstream] [linux 6.6-y] Fixes: sched/fair: Simplify Util_est #634
Conversation
mainline inclusion from mainline-v6.8-rc1 category: bugfix Save the frequency associated to the performance that has been used when initializing the capacity of CPUs. Also, cppc cpufreq driver can register an artificial energy model. In such case, it needs the frequency for this compute capacity. Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://lore.kernel.org/r/20231211104855.558096-7-vincent.guittot@linaro.org (cherry picked from commit 5477fa2) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
mainline inclusion from mainline-v6.8-rc1 category: bugfix Use the new capacity_ref_freq() method to set the ratio that is used by AMU for computing the arch_scale_freq_capacity(). This helps to keep everything aligned using the same reference for computing CPUs capacity. The default value of the ratio (stored in per_cpu(arch_max_freq_scale)) ensures that arch_scale_freq_capacity() returns max capacity until it is set to its correct value with the cpu capacity and capacity_ref_freq(). Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20231211104855.558096-8-vincent.guittot@linaro.org (cherry picked from commit 1f02300) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewer's Guide by SourceryThis pull request addresses CPU capacity scaling and frequency invariance, particularly for ARM64 architectures. It ensures proper initialization of CPU capacity and frequency, preventing incorrect scaling factors. The changes involve modifications to arch_topology.c and topology.c, including the introduction of a weak function for setting the maximum frequency ratio and adjustments to capacity scaling calculations. Sequence diagram for CPU capacity initialization with CPPCsequenceDiagram
participant TopologyInit as Topology Initialization
participant CPPC as CPPC Driver
participant CPU as CPU Core
TopologyInit->>CPPC: topology_init_cpu_capacity_cppc()
loop For each possible CPU
CPPC->>CPPC: Get perf_caps for CPU
alt perf_caps valid
CPPC->>CPU: raw_capacity[cpu] = perf_caps.highest_perf
CPPC->>CPU: per_cpu(capacity_freq_ref, cpu) = cppc_perf_to_khz()
else perf_caps invalid
CPPC->>CPPC: Handle error
end
end
loop For each possible CPU
CPPC->>CPU: freq_inv_set_max_ratio(cpu, per_cpu(capacity_freq_ref, cpu) * HZ_PER_KHZ)
CPPC->>CPU: capacity = div64_u64(capacity << SCHED_CAPACITY_SHIFT, capacity_scale)
CPPC->>CPU: topology_set_cpu_scale(cpu, capacity)
end
TopologyInit->>TopologyInit: schedule_work(&update_topology_flags_work)
Updated class diagram for arch_topologyclassDiagram
class arch_topology {
+DEFINE_PER_CPU_READ_MOSTLY(unsigned long, arch_max_freq_scale)
+DEFINE_PER_CPU(u64, arch_const_cycles_prev)
+DEFINE_PER_CPU(u64, arch_core_cycles_prev)
+cpumask_var_t amu_fie_cpus
+freq_inv_set_max_ratio(int cpu, u64 max_rate)
+amu_scale_freq_tick()
+amu_fie_setup(const struct cpumask *cpus)
}
note for arch_topology "Ensures proper initialization of CPU capacity and frequency, preventing incorrect scaling factors."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review代码审查意见:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @opsiff - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using more descriptive variable names to improve readability.
- It might be helpful to add comments explaining the purpose of key calculations, especially around frequency scaling.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MingcongBai The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
#572 (merged after merge v6.6.75 )cherry-pick the patches from a patchset and stopped at
cpufreq/cppc: Move and rename cppc_cpufreq_{perf_to_khz|khz_to_perf}()
it is not a break, it merged at 33e89c1 in v6.6.59.
and cause capacity_freq_ref always init with 1.
https://github.com/deepin-community/kernel/pull/572/files#diff-33c1494c40c04818625c02eab2e170d8a37345e5703e60def7335b2623ff35feR30
merged the next two patches to fix the sched problem :
Ensure that amu_scale_freq_tick() will return SCHED_CAPACITY_SCALE until
the CPU capacity and its associated frequency have been correctly
initialized.
static DEFINE_PER_CPU_READ_MOSTLY(unsigned long, arch_max_freq_scale) = 1UL << (2 * SCHED_CAPACITY_SHIFT);
Summary by Sourcery
Fixes CPU capacity initialization and scaling, ensuring correct frequency scaling by initializing CPU capacity and its associated frequency. It also ensures
amu_scale_freq_tick()returnsSCHED_CAPACITY_SCALEuntil the CPU capacity and its associated frequency have been correctly initialized.