Thread (8 messages) 8 messages, 2 authors, 2021-11-24

Re: AMD Pstate

From: Mike Lothian <hidden>
Date: 2021-11-23 10:47:48

Hi again

Do I need to enable something else for shedutil to work, I've tried
with and without shared_mem? Compiling a kernel with -j16 has the freq
stuck at 1GHz on all cores - ondemand works fine

That's on a AMD Ryzen 9 5900HX

Also compiling with Clang-13 gives the following warnings:

drivers/cpufreq/amd-pstate.c:257:6: warning: variable 'amd_des_perf'
is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

        if (target_perf < capacity)

            ^~~~~~~~~~~~~~~~~~~~~~

drivers/cpufreq/amd-pstate.c:272:40: note: uninitialized use occurs here

        amd_des_perf = clamp_t(unsigned long, amd_des_perf,

                                              ^~~~~~~~~~~~

./include/linux/minmax.h:124:60: note: expanded from macro 'clamp_t'

#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)

                                                           ^~~

./include/linux/minmax.h:112:48: note: expanded from macro 'max_t'

#define max_t(type, x, y)       __careful_cmp((type)(x), (type)(y), >)

                                                     ^

./include/linux/minmax.h:38:14: note: expanded from macro '__careful_cmp'

                __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))

                           ^

note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)

./include/linux/minmax.h:104:48: note: expanded from macro 'min_t'

#define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)

                                                     ^

./include/linux/minmax.h:38:14: note: expanded from macro '__careful_cmp'

                __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))

                           ^

./include/linux/minmax.h:31:25: note: expanded from macro '__cmp_once'

                typeof(x) unique_x = (x);               \

                                      ^

drivers/cpufreq/amd-pstate.c:257:2: note: remove the 'if' if its
condition is always true

        if (target_perf < capacity)

        ^~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/cpufreq/amd-pstate.c:249:56: note: initialize the variable
'amd_des_perf' to silence this warning

        unsigned long amd_max_perf, amd_min_perf, amd_des_perf,

                                                              ^

                                                               = 0

On Sun, 21 Nov 2021 at 10:37, Mike Lothian [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Hi

I'm not subscribed to the mailing list so apologies for emailing you directly

It looks like something isn't quite right with the kconfig selects

SCHED_MC_PRIO can't be enabled without CPU_SUP_INTEL



│ Symbol: X86_AMD_PSTATE [=y]

                                                              │
 │ Type  : bool

                                                               │
 │ Defined at drivers/cpufreq/Kconfig.x86:37

                                                               │
 │   Prompt: AMD Processor P-State driver

                                                               │
 │   Depends on: CPU_FREQ [=y] && X86 [=y]

                                                               │
 │   Location:

                                                               │
 │     Main menu

                                                               │
 │       -> Power management and ACPI options

                                                               │
 │         -> CPU Frequency scaling

                                                               │
 │           -> CPU Frequency scaling (CPU_FREQ [=y])

                                                               │
 │ Selects: ACPI_PROCESSOR [=y] && ACPI_CPPC_LIB [=n] &&
CPU_FREQ_GOV_SCHEDUTIL [=y]



│ Symbol: ACPI_CPPC_LIB [=n]

                                                              │
 │ Type  : bool

                                                               │
 │ Defined at drivers/acpi/Kconfig:268

                                                               │
 │   Depends on: ACPI [=y] && ACPI_PROCESSOR [=y]

                                                               │
 │ Selects: MAILBOX [=n] && PCC [=n]

                                                               │
 │ Selected by [n]:

                                                               │
 │   - X86_INTEL_PSTATE [=n] && CPU_FREQ [=y] && X86 [=y] && X86_64
[=y] && ACPI [=y] && SCHED_MC_PRIO [=n]
                                                                  │
 │   - X86_AMD_PSTATE [=y] && CPU_FREQ [=y] && X86 [=y] && X86_64 [=y]
&& ACPI [=y] && SCHED_MC_PRIO [=n]
                                                               │
 │   - ACPI_CPPC_CPUFREQ [=n] && CPU_FREQ [=y] && (ARM || ARM64) &&
ACPI_PROCESSOR [=y]



│ Symbol: SCHED_MC_PRIO [=n]

                                                              │
 │ Type  : bool

                                                               │
 │ Defined at arch/x86/Kconfig:1029

                                                               │
 │   Prompt: CPU core priorities scheduler support

                                                               │
 │   Depends on: SCHED_MC [=y] && CPU_SUP_INTEL [=n]

                                                               │
 │   Location:

                                                               │
 │     Main menu

                                                               │
 │       -> Processor type and features

                                                               │
 │ (1)     -> Multi-core scheduler support (SCHED_MC [=y])

                                                               │
 │ Selects: X86_INTEL_PSTATE [=n] && CPU_FREQ [=y]



I've used this patch to work around the issue:
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 95dd1ee01546..bdfcf155f48e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1028,8 +1028,8 @@ config SCHED_MC
config SCHED_MC_PRIO
       bool "CPU core priorities scheduler support"
-       depends on SCHED_MC && CPU_SUP_INTEL
-       select X86_INTEL_PSTATE
+       depends on SCHED_MC && CPU_SUP_AMD
+       select X86_AMD_PSTATE
       select CPU_FREQ
       default y
       help

Which gets things working here
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help