All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Penny, Zheng" <penny.zheng@amd.com>
Cc: "Huang, Ray" <Ray.Huang@amd.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Orzel, Michal" <Michal.Orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v6 11/19] xen/x86: introduce "cpufreq=amd-cppc" xen cmdline and amd-cppc driver
Date: Mon, 4 Aug 2025 10:48:50 +0200	[thread overview]
Message-ID: <4df7c533-8d6e-4cf6-9ab2-90a00a31ebbb@suse.com> (raw)
In-Reply-To: <DM4PR12MB8451FD535917A84B3054C93CE123A@DM4PR12MB8451.namprd12.prod.outlook.com>

On 04.08.2025 10:09, Penny, Zheng wrote:
> [Public]
> 
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: Thursday, July 17, 2025 12:00 AM
>> To: Penny, Zheng <penny.zheng@amd.com>
>> Cc: Huang, Ray <Ray.Huang@amd.com>; Andrew Cooper
>> <andrew.cooper3@citrix.com>; Anthony PERARD <anthony.perard@vates.tech>;
>> Orzel, Michal <Michal.Orzel@amd.com>; Julien Grall <julien@xen.org>; Roger Pau
>> Monné <roger.pau@citrix.com>; Stefano Stabellini <sstabellini@kernel.org>; xen-
>> devel@lists.xenproject.org
>> Subject: Re: [PATCH v6 11/19] xen/x86: introduce "cpufreq=amd-cppc" xen cmdline
>> and amd-cppc driver
>>
>> On 11.07.2025 05:50, Penny Zheng wrote:
>>> --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
>>> +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
>>> @@ -128,12 +128,14 @@ static int __init cf_check
>>> cpufreq_driver_init(void)
>>>
>>>      if ( cpufreq_controller == FREQCTL_xen )
>>>      {
>>> +        unsigned int i = 0;
>>
>> Pointless initializer; both for() loops set i to 0. But also see further down.
>>
>>> @@ -157,9 +164,70 @@ static int __init cf_check
>>> cpufreq_driver_init(void)
>>>
>>>          case X86_VENDOR_AMD:
>>>          case X86_VENDOR_HYGON:
>>> -            ret = IS_ENABLED(CONFIG_AMD) ? powernow_register_driver() : -
>> ENODEV;
>>> +            if ( !IS_ENABLED(CONFIG_AMD) )
>>> +            {
>>> +                ret = -ENODEV;
>>> +                break;
>>> +            }
>>> +            ret = -ENOENT;
>>
>> The code structure is sufficiently different from the Intel counterpart for this to
>> perhaps better move ...
>>
>>> +            for ( i = 0; i < cpufreq_xen_cnt; i++ )
>>> +            {
>>> +                switch ( cpufreq_xen_opts[i] )
>>> +                {
>>> +                case CPUFREQ_xen:
>>> +                    ret = powernow_register_driver();
>>> +                    break;
>>> +
>>> +                case CPUFREQ_amd_cppc:
>>> +                    ret = amd_cppc_register_driver();
>>> +                    break;
>>> +
>>> +                case CPUFREQ_none:
>>> +                    ret = 0;
>>> +                    break;
>>> +
>>> +                default:
>>> +                    printk(XENLOG_WARNING
>>> +                           "Unsupported cpufreq driver for vendor AMD or Hygon\n");
>>> +                    break;
>>
>> ... here.
>>
> 
> Are we suggesting moving
> "
>         if ( !IS_ENABLED(CONFIG_AMD) )
>         {
>                 ret = -ENODEV;
>                 break;
>         }
> " here?

That's what I said, didn't I?

> In which case, When CONFIG_AMD=n and users doesn't provide "cpufreq=xxx", we will have cpufreq_xen_cnt initialized as 1 and cpufreq_xen_opts[0] = CPUFREQ_xen. powernow_register_driver() hence gets invoked. The thing is that we don't have stub for it and it is compiled under CONFIG_AMD
> I suggest to change to use #ifdef CONFIG_AMD code wrapping

Perhaps necessary, yes. As you know, we generally prefer IS_ENABLED() where possible,
but when not possible, #ifdef is certainly okay to use.

Jan


  parent reply	other threads:[~2025-08-04  8:49 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11  3:50 [PATCH v6 00/19] amd-cppc CPU Performance Scaling Driver Penny Zheng
2025-07-11  3:50 ` [PATCH v6 01/19] xen/amd: introduce amd_process_freq() to get processor frequency Penny Zheng
2025-07-11  3:50 ` [PATCH v6 02/19] tools: drop "has_num" condition check for cppc mode Penny Zheng
2025-07-11  6:42   ` Jan Beulich
2025-07-28 12:53   ` Anthony PERARD
2025-07-11  3:50 ` [PATCH v6 03/19] tools: optimize cpufreq average freq print Penny Zheng
2025-07-16 14:43   ` Jan Beulich
2025-07-28 13:03     ` Anthony PERARD
2025-07-11  3:50 ` [PATCH v6 04/19] x86/cpufreq: continue looping other than -EBUSY or successful return Penny Zheng
2025-07-16 14:47   ` Jan Beulich
2025-07-11  3:50 ` [PATCH v6 05/19] xen/cpufreq: refactor cmdline "cpufreq=xxx" Penny Zheng
2025-07-16 15:00   ` Jan Beulich
2025-08-04  5:47     ` Penny, Zheng
2025-08-04  7:19       ` Jan Beulich
2025-08-04  6:04     ` Penny, Zheng
2025-08-04  7:17       ` Jan Beulich
2025-07-11  3:50 ` [PATCH v6 06/19] xen/cpufreq: make _PSD info common Penny Zheng
2025-07-16 15:07   ` Jan Beulich
2025-07-11  3:50 ` [PATCH v6 07/19] cpufreq: rename "xen_cppc_para" to "xen_get_cppc_para" Penny Zheng
2025-07-16 15:10   ` Jan Beulich
2025-07-28 13:09   ` Anthony PERARD
2025-07-11  3:50 ` [PATCH v6 08/19] xen/cpufreq: rename cppc preset name to "XEN_SYSCTL_CPPC_SET_PRESET_ONDEMAND" Penny Zheng
2025-07-16 15:18   ` Jan Beulich
2025-07-11  3:50 ` [PATCH v6 09/19] xen/cpufreq: neglect unsupported-mode request from DOM0 Penny Zheng
2025-07-16 15:19   ` Jan Beulich
2025-07-11  3:50 ` [PATCH v6 10/19] xen/cpufreq: introduce new sub-hypercall to propagate CPPC data Penny Zheng
2025-07-16 15:39   ` Jan Beulich
2025-08-04  6:47     ` Penny, Zheng
2025-08-04  7:25       ` Jan Beulich
2025-07-11  3:50 ` [PATCH v6 11/19] xen/x86: introduce "cpufreq=amd-cppc" xen cmdline and amd-cppc driver Penny Zheng
2025-07-16 15:59   ` Jan Beulich
2025-08-04  8:09     ` Penny, Zheng
2025-08-04  8:48       ` Jan Beulich
2025-08-05  6:31         ` Penny, Zheng
2025-08-05  7:42           ` Jan Beulich
2025-08-04  8:48       ` Jan Beulich [this message]
2025-07-11  3:50 ` [PATCH v6 12/19] xen/cpufreq: implement amd-cppc driver for CPPC in passive mode Penny Zheng
2025-07-17 12:55   ` Jan Beulich
2025-08-11  8:23     ` Penny, Zheng
2025-07-11  3:51 ` [PATCH v6 13/19] xen/x86: implement amd-cppc-epp driver for CPPC in active mode Penny Zheng
2025-07-17 13:35   ` Jan Beulich
2025-08-12  7:40     ` Penny, Zheng
2025-07-11  3:51 ` [PATCH v6 14/19] xen/cpufreq: get performance policy from governor set via xenpm Penny Zheng
2025-07-23 15:44   ` Jan Beulich
2025-07-11  3:51 ` [PATCH v6 15/19] tools/cpufreq: introduce helper to deal with CPPC-related parameters Penny Zheng
2025-07-23 15:56   ` Jan Beulich
2025-08-12  9:56     ` Penny, Zheng
2025-08-12 10:11       ` Penny, Zheng
2025-07-11  3:51 ` [PATCH v6 16/19] xen/cpufreq: introduce GET_CPUFREQ_CPPC sub-op Penny Zheng
2025-07-24 13:31   ` Jan Beulich
2025-07-24 14:17     ` Jason Andryuk
2025-07-24 14:47       ` Jan Beulich
2025-08-12 10:15       ` Penny, Zheng
2025-07-11  3:51 ` [PATCH v6 17/19] xen/cpufreq: introduce helper cpufreq_in_cppc_passive_mode() Penny Zheng
2025-07-24 13:57   ` Jan Beulich
2025-07-11  3:51 ` [PATCH v6 18/19] xen/cpufreq: bypass governor-related para for amd-cppc-epp Penny Zheng
2025-07-24 14:09   ` Jan Beulich
2025-08-13  6:57     ` Penny, Zheng
2025-07-24 22:36   ` Jason Andryuk
2025-07-11  3:51 ` [PATCH v6 19/19] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver Penny Zheng
2025-07-24 14:44   ` Jan Beulich
2025-08-14  3:13     ` Penny, Zheng
2025-08-14  6:40       ` Jan Beulich
2025-08-14  7:34         ` Penny, Zheng
2025-08-14  8:29           ` Jan Beulich
2025-08-14  8:32             ` Penny, Zheng

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=4df7c533-8d6e-4cf6-9ab2-90a00a31ebbb@suse.com \
    --to=jbeulich@suse.com \
    --cc=Michal.Orzel@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=julien@xen.org \
    --cc=penny.zheng@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.