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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c14fedc0-26f6-d4be-8e8b-b1dbefdf50c7@wanadoo.fr>
Date:   Mon, 22 May 2023 19:24:23 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Fieah Lim <kweifat@...il.com>, srinivas.pandruvada@...ux.intel.com,
        lenb@...nel.org, rafael@...nel.org, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: intel_pstate: Avoid initializing variables
 prematurely

Le 20/05/2023 à 15:32, Fieah Lim a écrit :
> all_cpu_data struct is pretty large,
> we should avoid assigning it around when the function has a chance
> to bail out earlier before actually using it.
> 
> The same idea applies to the
> this_cpu of notify_hwp_interrupt
> and
> the hwp_cap of intel_pstate_hwp_boost_up,
> which are also initialized prematurely.
> I think it also qualifies as a micro-optimization.
> 
> While at it, tidy up all the cpu_data initialization,
> for the sake of consistency.
> 
> Signed-off-by: Fieah Lim <kweifat@...il.com>
> ---

[...]

> @@ -2638,9 +2643,7 @@ static int intel_cpufreq_cpu_offline(struct cpufreq_policy *policy)
>   
>   static int intel_pstate_cpu_online(struct cpufreq_policy *policy)
>   {
> -	struct cpudata *cpu = all_cpu_data[policy->cpu];
> -
> -	pr_debug("CPU %d going online\n", cpu->cpu);
> +	pr_debug("CPU %d going online\n", policy->cpu);

An answer has already been done, but just in case, this change does not 
look equivalent.

CJ

>   
>   	intel_pstate_init_acpi_perf_limits(policy);
>   
> @@ -2649,6 +2652,8 @@ static int intel_pstate_cpu_online(struct cpufreq_policy *policy)
>   		 * Re-enable HWP and clear the "suspended" flag to let "resume"
>   		 * know that it need not do that.
>   		 */
> +		struct cpudata *cpu = all_cpu_data[policy->cpu];
> +
>   		intel_pstate_hwp_reenable(cpu);
>   		cpu->suspended = false;
>   	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ