public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Huang Rui <ray.huang@amd.com>
To: Mike Lothian <mike@fireburn.co.uk>
Cc: Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: AMD Pstate
Date: Tue, 23 Nov 2021 19:17:52 +0800	[thread overview]
Message-ID: <YZzN4Nc2tcclbVIO@hr-amd> (raw)
In-Reply-To: <CAHbf0-E5Zrs9-bWYMm8A-RQ7xd0DOCZopzZ2GjtH8xcFf4wVtA@mail.gmail.com>

On Tue, Nov 23, 2021 at 06:47:34PM +0800, Mike Lothian wrote:
> 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
> 

If you set the CONFIG_CPU_FREQ_GOV_SCHEDUTIL, then no more configurations.

Did you use the V4 version?

https://git.kernel.org/pub/scm/linux/kernel/git/rui/linux.git/log/?h=amd-pstate-dev-v4

> 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,
> 
>                                               ^~~~~~~~~~~~

Ah, miss one line. Thanks for the info. I will correct it.

Thanks,
Ray

> 
> ./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 <mike@fireburn.co.uk> wrote:
> >
> > 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

  reply	other threads:[~2021-11-23 11:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21 10:37 AMD Pstate Mike Lothian
2021-11-21 11:52 ` Huang Rui
2021-11-21 12:35   ` Huang Rui
2021-11-23 10:47 ` Mike Lothian
2021-11-23 11:17   ` Huang Rui [this message]
2021-11-23 11:22     ` Mike Lothian
2021-11-23 11:32       ` Huang Rui
2021-11-24  0:17         ` Mike Lothian
     [not found]           ` <YZ22dYQ8dgQTwqnh@amd.com>
     [not found]             ` <CAHbf0-FnFpkmZ2bkfS2S=Cw_RLbK1y7eSHySAFGVecs+t+-aVg@mail.gmail.com>
2021-11-26 10:50               ` Mike Lothian
2021-11-26 11:32                 ` Du, Xiaojian
2021-11-26 13:24                   ` Mike Lothian
2021-11-30 10:50                     ` Huang Rui
     [not found]                       ` <CAHbf0-EWVeD8xehHZc8ff-4vYbXC69z=kMf0_=RXJsHKG_2M7Q@mail.gmail.com>
2021-12-01  6:51                         ` Huang Rui
2021-12-03  1:08                           ` Mike Lothian
2021-12-03  3:27                             ` Huang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZzN4Nc2tcclbVIO@hr-amd \
    --to=ray.huang@amd.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=mike@fireburn.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox