cpufreq: amd-pstate: Fix the dependence issue of AMD P-State
Subsystems (3)
PATCH 1/2 cpufreq: amd-pstate: Fix the dependence issue of AMD P-State
The AMD P-State driver is based on ACPI CPPC function, so ACPI should be dependence of this driver in the kernel config.
In file included from ../drivers/cpufreq/amd-pstate.c:40:0:../include/acpi/processor.h:226:2: error: unknown type name ‘phys_cpuid_t’
phys_cpuid_t phys_id; /* CPU hardware ID such as APIC ID for x86 */
^~~~~~~~~~~~../include/acpi/processor.h:355:1: error: unknown type name ‘phys_cpuid_t’; did you mean ‘phys_addr_t’?
phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
^~~~~~~~~~~~
phys_addr_t
CC drivers/rtc/rtc-rv3029c2.o../include/acpi/processor.h:356:1: error: unknown type name ‘phys_cpuid_t’; did you mean ‘phys_addr_t’?
phys_cpuid_t acpi_map_madt_entry(u32 acpi_id);
^~~~~~~~~~~~
phys_addr_t../include/acpi/processor.h:357:20: error: unknown type name ‘phys_cpuid_t’; did you mean ‘phys_addr_t’?
int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
^~~~~~~~~~~~
phys_addr_tSee https://lore.kernel.org/lkml/[email protected]/.
--- drivers/cpufreq/Kconfig.x86 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cpufreq/Kconfig.x86 +3 -3
@@ -36,9 +36,9 @@ config X86_PCC_CPUFREQ config X86_AMD_PSTATE tristate "AMD Processor P-State driver" - depends on X86 - select ACPI_PROCESSOR if ACPI - select ACPI_CPPC_LIB if X86_64 && ACPI + depends on X86 && ACPI + select ACPI_PROCESSOR + select ACPI_CPPC_LIB if X86_64 select CPU_FREQ_GOV_SCHEDUTIL if SMP help This driver adds a CPUFreq driver which utilizes a fine grain
Signature · 1 line
2.25.1
PATCH 2/2 x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
The init_freq_invariance_cppc function is implemented in smpboot and depends on CONFIG_SMP.
MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld: drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1
See https://lore.kernel.org/lkml/[email protected]/.
--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/topology.h +1 -1
@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif -#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppc#endif
Signature · 1 line
2.25.1
Borislav Petkov
maintainerRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 34 lines · Huang Rui
The
init_freq_invariance_cppcfunction is implemented in smpboot and depends onCONFIG_SMP.MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld:drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1See https://lore.kernel.org/lkml/[email protected]/.
Fixes 41ea667227ba ("x86, sched: Calculate frequency invariance for AMD systems")Reported-by kernel test robot <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Borislav Petkov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/topology.h +0
-0
arch/x86/include/asm/topology.h static inline void arch_set_max_freq_ratio(bool turbo_disabled) · line 227
Quoted 8 lines
arch/x86/include/asm/topology.h +1
-1@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif -#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppc#endif
Well, since that function is in smpboot.c then the logic should be that CPPC depends on functionality in smpboot.c for proper operation.
IOW, ACPI_CPPC_LIB should have "depends on CONFIG_SMP" in Kconfig, no?
Instead of adding more ifdeffery around...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 47 lines · Borislav Petkov
Quoted 34 lines · Huang Rui
The
init_freq_invariance_cppcfunction is implemented in smpboot and depends onCONFIG_SMP.MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld:drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1Fixes 41ea667227ba ("x86, sched: Calculate frequency invariance for AMD systems")Reported-by kernel test robot <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Borislav Petkov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/topology.h +0
-0arch/x86/include/asm/topology.h static inline void arch_set_max_freq_ratio(bool turbo_disabled) · line 227
Quoted 8 lines
arch/x86/include/asm/topology.h +1
-1@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif -#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppc#endif Well, since that function is in
smpboot.cthen the logic should be that CPPC depends on functionality insmpboot.cfor proper operation.
Quoted 4 lines
IOW,
ACPI_CPPC_LIBshould have "depends onCONFIG_SMP" inKconfig, no?Instead of adding more ifdeffery around...
Hmm, yes, that's fine. I will modify it in V2.
Thanks,
Ray
Re: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 48 lines · Huang Rui
Quoted 47 lines · Borislav Petkov
Quoted 34 lines · Huang Rui
The
init_freq_invariance_cppcfunction is implemented in smpboot and depends onCONFIG_SMP.MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld:drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1Fixes 41ea667227ba ("x86, sched: Calculate frequency invariance for AMD systems")Reported-by kernel test robot <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Borislav Petkov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/topology.h +0
-0arch/x86/include/asm/topology.h static inline void arch_set_max_freq_ratio(bool turbo_disabled) · line 227
Quoted 8 lines
arch/x86/include/asm/topology.h +1
-1@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif -#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppc#endif Well, since that function is in
smpboot.cthen the logic should be that CPPC depends on functionality insmpboot.cfor proper operation.
Quoted 7 lines
Quoted 4 lines
IOW,
ACPI_CPPC_LIBshould have "depends onCONFIG_SMP" inKconfig, no?Instead of adding more ifdeffery around...
Hmm, yes, that's fine. I will modify it in V2.
I just thought the CPPC function should be able to work on single core even SMP is disabled.
Thanks,
Ray
Borislav Petkov
maintainerRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 2 lines · Huang Rui
I just thought the CPPC function should be able to work on single core even SMP is disabled.
Why, because SMP=n is a real use case?!
FWIW, we were even speculating on removing SMP=n so how practical is using CPPC on SMP=n at all?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRafael J. Wysocki
maintainerRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 6 lines · Borislav Petkov
Quoted 2 lines · Huang Rui
I just thought the CPPC function should be able to work on single core even SMP is disabled.
Why, because SMP=n is a real use case?!
And why can't it be a real use case?
Quoted 2 lines
FWIW, we were even speculating on removing SMP=n so how practical is using CPPC on SMP=n at all?
The honest answer is that we don't know.
Moreover, AFAICS the requisite #ifdeffery is there already and the problem is that the init_freq_invariance_cppc() defined in smpboot.c is not exported to modules and the CPPC code is modular in this build.
Borislav Petkov
maintainerRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 1 line · Rafael J. Wysocki
And why can't it be a real use case?
You mean there's someone out there running SMP=n kernels on current hardware which has CPPC too? Yeah, right.
Quoted 5 lines
The honest answer is that we don't know.
Moreover, AFAICS the requisite #ifdeffery is there already and the problem is that the
init_freq_invariance_cppc()defined insmpboot.cis not exported to modules and the CPPC code is modular in this build.
Yah, I saw that. And that's why I'm saying CPPC should depend on SMP - because it needs that functionality which is defined there.
But if you really wanna support SMP=n, I don't care that much to debate this more - I just think it is silly.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRafael J. Wysocki
maintainerRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 7 lines · Borislav Petkov
Quoted 1 line · Rafael J. Wysocki
And why can't it be a real use case?
You mean there's someone out there running SMP=n kernels on current hardware which has CPPC too? Yeah, right.
Quoted 8 lines
Quoted 5 lines
The honest answer is that we don't know.
Moreover, AFAICS the requisite #ifdeffery is there already and the problem is that the
init_freq_invariance_cppc()defined insmpboot.cis not exported to modules and the CPPC code is modular in this build.Yah, I saw that. And that's why I'm saying CPPC should depend on SMP - because it needs that functionality which is defined there.
In fact, the CPPC code itself doesn't need that functionality.
The init_freq_invariance_cppc() call is in there, because amd_set_max_freq_ratio() depends on CPPC and it is pointless to run it when CPPC is not supported, not the other way around.
Quoted 2 lines
But if you really wanna support SMP=n, I don't care that much to debate this more - I just think it is silly.
Well, I just don't want to stop supporting SMP=n just because we can't possibly get our build dependencies right.
Rafael J. Wysocki
maintainerRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
In reply to Huang RuiQuoted 34 lines · Huang Rui
The
init_freq_invariance_cppcfunction is implemented in smpboot and depends onCONFIG_SMP.MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld:drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1See https://lore.kernel.org/lkml/[email protected]/.
Fixes 41ea667227ba ("x86, sched: Calculate frequency invariance for AMD systems")Reported-by kernel test robot <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Borislav Petkov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/topology.h +0
-0
arch/x86/include/asm/topology.h static inline void arch_set_max_freq_ratio(bool turbo_disabled) · line 226
Quoted 7 lines
arch/x86/include/asm/topology.h +1
-1@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif -#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppc
Why don't you check CONFIG_SMP instead of this symbol in cppc_acpi.c? That file depends on CONFIG_ACPI_CPPC_LIB anyway.
Rafael J. Wysocki
maintainerRe: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 39 lines · Rafael J. Wysocki
Quoted 37 lines · Huang Rui
The
init_freq_invariance_cppcfunction is implemented in smpboot and depends onCONFIG_SMP.MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld:drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1See https://lore.kernel.org/lkml/[email protected]/.
Fixes 41ea667227ba ("x86, sched: Calculate frequency invariance for AMD systems")Reported-by kernel test robot <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Borislav Petkov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/topology.h +0
-0@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif
Quoted 7 lines
arch/x86/include/asm/topology.h static inline void arch_set_max_freq_ratio(bool turbo_disabled) · line 226
Quoted 4 lines
arch/x86/include/asm/topology.h +1
-1-#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppcWhy don't you check
CONFIG_SMPinstead of this symbol incppc_acpi.c? That file depends onCONFIG_ACPI_CPPC_LIBanyway.
Scratch that, it needs to compile on non-x86 too.
The $subject patch is cleaner than all of the alternatives I have considered, so I'm going to apply it.
However, I'm not really happy with the dependencies between CPPC and smpboot.c going both ways.
Re: [PATCH 2/2] x86, sched: Fix the undefined reference building error of init_freq_invariance_cppc
Quoted 48 lines · Rafael J. Wysocki
Quoted 39 lines · Rafael J. Wysocki
Quoted 37 lines · Huang Rui
The
init_freq_invariance_cppcfunction is implemented in smpboot and depends onCONFIG_SMP.MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld:drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1Fixes 41ea667227ba ("x86, sched: Calculate frequency invariance for AMD systems")Reported-by kernel test robot <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Borislav Petkov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/topology.h +0
-0@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif Quoted 7 lines
arch/x86/include/asm/topology.h static inline void arch_set_max_freq_ratio(bool turbo_disabled) · line 226
Quoted 4 lines
arch/x86/include/asm/topology.h +1
-1-#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppcWhy don't you check
CONFIG_SMPinstead of this symbol incppc_acpi.c? That file depends onCONFIG_ACPI_CPPC_LIBanyway.
Quoted 7 lines
Scratch that, it needs to compile on non-x86 too.
The $subject patch is cleaner than all of the alternatives I have considered, so I'm going to apply it.
However, I'm not really happy with the dependencies between CPPC and
smpboot.cgoing both ways.
Thanks, for urgent fix for linux-next, I think we can use this patch at this moment.
Let me think out a better way to handle the dependencies next step. :-)
Thanks,
Ray
Rafael J. Wysocki
maintainerQuoted 39 lines · Huang Rui
The AMD P-State driver is based on ACPI CPPC function, so ACPI should be dependence of this driver in the kernel config.
In file included from
../drivers/cpufreq/amd-pstate.c:40:0:../include/acpi/processor.h:226:2: error: unknown type name ‘phys_cpuid_t’
phys_cpuid_tphys_id; /* CPU hardware ID such as APIC ID for x86 */
^~~~~~~~~~~~../include/acpi/processor.h:355:1: error: unknown type name ‘phys_cpuid_t’; did you mean ‘phys_addr_t’?
phys_cpuid_tacpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
^~~~~~~~~~~~
phys_addr_t
CCdrivers/rtc/rtc-rv3029c2.o../include/acpi/processor.h:356:1: error: unknown type name ‘phys_cpuid_t’; did you mean ‘phys_addr_t’?
phys_cpuid_tacpi_map_madt_entry(u32 acpi_id);
^~~~~~~~~~~~
phys_addr_t../include/acpi/processor.h:357:20: error: unknown type name ‘phys_cpuid_t’; did you mean ‘phys_addr_t’?int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id); ^~~~~~~~~~~~ phys_addr_tSee https://lore.kernel.org/lkml/[email protected]/.
Reported-by Randy Dunlap <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Huang Rui <[email protected]>--- drivers/cpufreq/Kconfig.x86 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/cpufreq/Kconfig.x86 +0
-0@@ -36,9 +36,9 @@ config X86_PCC_CPUFREQ config X86_AMD_PSTATE tristate "AMD Processor P-State driver"
drivers/cpufreq/Kconfig.x86 config X86_PCC_CPUFREQ
Quoted 10 lines
drivers/cpufreq/Kconfig.x86 +3
-4- depends on X86 - select ACPI_PROCESSOR if ACPI - select ACPI_CPPC_LIB if X86_64 && ACPI + depends on X86 && ACPI + select ACPI_PROCESSOR + select ACPI_CPPC_LIB if X86_64 select CPU_FREQ_GOV_SCHEDUTIL if SMP help This driver adds a CPUFreq driver which utilizes a fine grain --
Applied (under a modified subject), thanks!