lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99b90797-50ef-46e9-87a8-5a02b24d4aa6@amd.com>
Date: Thu, 25 Sep 2025 11:35:47 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
 Linux PM <linux-pm@...r.kernel.org>
Cc: Shawn Guo <shawnguo@...nel.org>, Qais Yousef <qyousef@...alina.io>,
 LKML <linux-kernel@...r.kernel.org>, Viresh Kumar <viresh.kumar@...aro.org>,
 Prashanth Prakash <pprakash@...eaurora.org>,
 Pierre Gondois <pierre.gondois@....com>,
 Linux ACPI <linux-acpi@...r.kernel.org>
Subject: Re: [PATCH v1 3/4] ACPI: CPPC: Replace CPUFREQ_ETERNAL with
 CPPC-specific symbol



On 9/25/2025 10:46 AM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> Instead of using CPUFREQ_ETERNAL for signaling error conditions in
> cppc_get_transition_latency(), introduce CPPC_NO_DATA specifically
> for this purpose and update all of the callers of this function to
> use it.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>   drivers/acpi/cppc_acpi.c       |    6 +++---
>   drivers/cpufreq/amd-pstate.c   |    4 ++--
>   drivers/cpufreq/cppc_cpufreq.c |    2 +-
>   include/acpi/cppc_acpi.h       |    4 +++-
>   include/linux/cpufreq.h        |    3 ---
>   5 files changed, 9 insertions(+), 10 deletions(-)
> 
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1897,16 +1897,16 @@ unsigned int cppc_get_transition_latency
>   
>   	cpc_desc = per_cpu(cpc_desc_ptr, cpu_num);
>   	if (!cpc_desc)
> -		return CPUFREQ_ETERNAL;
> +		return CPPC_NO_DATA;
>   
>   	desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF];
>   	if (CPC_IN_SYSTEM_MEMORY(desired_reg) || CPC_IN_SYSTEM_IO(desired_reg))
>   		return 0;
>   	else if (!CPC_IN_PCC(desired_reg))
> -		return CPUFREQ_ETERNAL;
> +		return CPPC_NO_DATA;
>   
>   	if (pcc_ss_id < 0)
> -		return CPUFREQ_ETERNAL;
> +		return CPPC_NO_DATA;
>   
>   	pcc_ss_data = pcc_data[pcc_ss_id];
>   	if (pcc_ss_data->pcc_mpar)
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -875,7 +875,7 @@ static u32 amd_pstate_get_transition_del
>   	u32 transition_delay_ns;
>   
>   	transition_delay_ns = cppc_get_transition_latency(cpu);
> -	if (transition_delay_ns == CPUFREQ_ETERNAL) {
> +	if (transition_delay_ns == CPPC_NO_DATA) {
>   		if (cpu_feature_enabled(X86_FEATURE_AMD_FAST_CPPC))
>   			return AMD_PSTATE_FAST_CPPC_TRANSITION_DELAY;
>   		else
> @@ -894,7 +894,7 @@ static u32 amd_pstate_get_transition_lat
>   	u32 transition_latency;
>   
>   	transition_latency = cppc_get_transition_latency(cpu);
> -	if (transition_latency  == CPUFREQ_ETERNAL)
> +	if (transition_latency  == CPPC_NO_DATA)
>   		return AMD_PSTATE_TRANSITION_LATENCY;
>   
>   	return transition_latency;
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -312,7 +312,7 @@ static unsigned int get_transition_laten
>   {
>   	unsigned int transition_latency_ns = cppc_get_transition_latency(cpu);
>   
> -	if (transition_latency_ns == CPUFREQ_ETERNAL)
> +	if (transition_latency_ns == CPPC_NO_DATA)
>   		return CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS / NSEC_PER_USEC;
>   
>   	return transition_latency_ns / NSEC_PER_USEC;
> --- a/include/acpi/cppc_acpi.h
> +++ b/include/acpi/cppc_acpi.h
> @@ -41,6 +41,8 @@
>   
>   #define CPPC_ENERGY_PERF_MAX	(0xFF)
>   
> +#define CPPC_NO_DATA	(unsigned int)(-1)
> +

Would it be cleaner to just change all the functions that can return 
CPPC_NO_DATA to int instead of unsigned int and instead use -ENODATA?

>   /* Each register has the folowing format. */
>   struct cpc_reg {
>   	u8 descriptor;
> @@ -218,7 +220,7 @@ static inline bool cppc_allow_fast_switc
>   }
>   static inline unsigned int cppc_get_transition_latency(int cpu)
>   {
> -	return CPUFREQ_ETERNAL;
> +	return CPPC_NO_DATA;
>   }
>   static inline bool cpc_ffh_supported(void)
>   {
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ