Skip to contentSkip to conversation

sched,x86: export percpu arch_freq_scale

PATCH Applied Phil Auld 3 participants 4 messages May 30, 2024 – Jun 4, 2024 x86

lore
Share & tools
lore

Phil Auld

author
#0 lore raw

PATCH 1/1 sched,x86: export percpu arch_freq_scale

Commit 7bc263840bc3 ("sched/topology: Consolidate and clean up access to a CPU's max compute capacity") removed rq->cpu_capacity_orig in favor of using arch_scale_freq_capacity() calls. Export the underlying percpu symbol on x86 so that external trace point helper modules can be made to work again.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Tony Luck <[email protected]>
Cc Qais Yousef <[email protected]>
---
 arch/x86/kernel/cpu/aperfmperf.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/aperfmperf.c +1 -0
index f9a8c7b7943f..b3fa61d45352 100644
@@ -345,6 +345,7 @@ static DECLARE_WORK(disable_freq_invariance_work,
 		    disable_freq_invariance_workfn);
 
 DEFINE_PER_CPU(unsigned long, arch_freq_scale) = SCHED_CAPACITY_SCALE;
+EXPORT_PER_CPU_SYMBOL_GPL(arch_freq_scale);
 
 static void scale_freq_tick(u64 acnt, u64 mcnt)
 {
Signature · 1 line
2.43.0
merge bot Applied
#1 lore raw

[tip: sched/urgent] sched/x86: Export 'percpu arch_freq_scale'

The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     d40605a6823577a6c40fad6fb1f10a40ea0389d7
Gitweb:        https://git.kernel.org/tip/d40605a6823577a6c40fad6fb1f10a40ea0389d7
Author:        Phil Auld <[email protected]>
AuthorDate:    Thu, 30 May 2024 14:15:48 -04:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Fri, 31 May 2024 11:48:42 +02:00

sched/x86: Export 'percpu arch_freq_scale'

Commit:

7bc263840bc3 ("sched/topology: Consolidate and clean up access to a CPU's max compute capacity")

removed rq->cpu_capacity_orig in favor of using arch_scale_freq_capacity() calls. Export the underlying percpu symbol on x86 so that external trace point helper modules can be made to work again.

---
 arch/x86/kernel/cpu/aperfmperf.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/aperfmperf.c +1 -0
index f9a8c7b..b3fa61d 100644
@@ -345,6 +345,7 @@ static DECLARE_WORK(disable_freq_invariance_work,
 		    disable_freq_invariance_workfn);
 
 DEFINE_PER_CPU(unsigned long, arch_freq_scale) = SCHED_CAPACITY_SCALE;
+EXPORT_PER_CPU_SYMBOL_GPL(arch_freq_scale);
 
 static void scale_freq_tick(u64 acnt, u64 mcnt)
 {
author
#2 lore raw

Re: [tip: sched/urgent] sched/x86: Export 'percpu arch_freq_scale'

Quoted 11 lines · On Fri, May 31, 2024 at 09:59:45AM -0000 tip-bot2 for Phil Auld wrote:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     d40605a6823577a6c40fad6fb1f10a40ea0389d7
Gitweb:        https://git.kernel.org/tip/d40605a6823577a6c40fad6fb1f10a40ea0389d7
Author:        Phil Auld <[email protected]>
AuthorDate:    Thu, 30 May 2024 14:15:48 -04:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Fri, 31 May 2024 11:48:42 +02:00

sched/x86: Export 'percpu arch_freq_scale'

Thanks Ingo!

Quoted 29 lines

Commit:

7bc263840bc3 ("sched/topology: Consolidate and clean up access to a CPU's max compute capacity")

removed rq->cpu_capacity_orig in favor of using arch_scale_freq_capacity() calls. Export the underlying percpu symbol on x86 so that external trace point helper modules can be made to work again.

---
 arch/x86/kernel/cpu/aperfmperf.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/aperfmperf.c +1 -0
index f9a8c7b..b3fa61d 100644
@@ -345,6 +345,7 @@ static DECLARE_WORK(disable_freq_invariance_work,
 		    disable_freq_invariance_workfn);
 
 DEFINE_PER_CPU(unsigned long, arch_freq_scale) = SCHED_CAPACITY_SCALE;
+EXPORT_PER_CPU_SYMBOL_GPL(arch_freq_scale);
 
 static void scale_freq_tick(u64 acnt, u64 mcnt)
 {
Reviewed-by on v1 1/1
#3 lore raw
In reply to Phil Auld
Quoted 5 lines · Phil Auld

Commit 7bc263840bc3 ("sched/topology: Consolidate and clean up access to a CPU's max compute capacity") removed rq->cpu_capacity_orig in favor of using arch_scale_freq_capacity() calls. Export the underlying percpu symbol on x86 so that external trace point helper modules can be made to work again.

To expand. The problem here is that arch_scale_cpu/freq_capacity() are defined in headers, but they rely on per cpu variables that are not exported for x86, but are exported for arm (and riscv at least) in drivers/base/arch_topology.c

One user is sched_tp to help create trace events to track when capacity changes. Not critical user, but this brings x86 inline with the rest of the code.

Quoted 18 lines
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Tony Luck <[email protected]>
Cc Qais Yousef <[email protected]>
---
 arch/x86/kernel/cpu/aperfmperf.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/aperfmperf.c +0 -0
index f9a8c7b7943f..b3fa61d45352 100644

arch/x86/kernel/cpu/aperfmperf.c static DECLARE_WORK(disable_freq_invariance_work, · line 348

Quoted 4 lines
arch/x86/kernel/cpu/aperfmperf.c +1 -0
@@ -345,6 +345,7 @@ static DECLARE_WORK(disable_freq_invariance_work,
 		    disable_freq_invariance_workfn);
 
 DEFINE_PER_CPU(unsigned long, arch_freq_scale) = SCHED_CAPACITY_SCALE;
+EXPORT_PER_CPU_SYMBOL_GPL(arch_freq_scale);

x86 uses the generic arch_scale_cpu_capacity() in sched/topology.h, so this should make arch_scale_freq_capacity() 'work' for x86 too.

Quoted 6 lines
arch/x86/kernel/cpu/aperfmperf.c +0 -0
 static void scale_freq_tick(u64 acnt, u64 mcnt)
 {
Signature · 1 line
2.43.0