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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 9 Sep 2021 17:01:41 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Huang Rui <ray.huang@....com>
Cc:     "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Shuah Khan <skhan@...uxfoundation.org>,
        Borislav Petkov <bp@...e.de>, Ingo Molnar <mingo@...nel.org>,
        linux-pm@...r.kernel.org, Deepak Sharma <deepak.sharma@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Mario Limonciello <mario.limonciello@....com>,
        Nathan Fontenot <nathan.fontenot@....com>,
        Jinzhou Su <Jinzhou.Su@....com>,
        Xiaojian Du <Xiaojian.Du@....com>,
        linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH 04/19] cpufreq: amd: introduce a new amd pstate driver to
 support future processors

On Wed, Sep 08, 2021 at 10:59:46PM +0800, Huang Rui wrote:

> +struct amd_pstate_perf_funcs {
> +	int (*enable)(bool enable);
> +	int (*init_perf)(struct amd_cpudata *cpudata);
> +	void (*update_perf)(struct amd_cpudata *cpudata,
> +			    u32 min_perf, u32 des_perf,
> +			    u32 max_perf, bool fast_switch);
> +};

> +static int
> +amd_pstate_enable(struct amd_pstate_perf_funcs *funcs, bool enable)
> +{
> +	if (!funcs)
> +		return -EINVAL;
> +
> +	return funcs->enable(enable);
> +}

> +static int amd_pstate_init_perf(struct amd_cpudata *cpudata)
> +{
> +	struct amd_pstate_perf_funcs *funcs = cpufreq_get_driver_data();
> +
> +	if (!funcs)
> +		return -EINVAL;
> +
> +	return funcs->init_perf(cpudata);
> +}

> +static int
> +amd_pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
> +		       u32 des_perf, u32 max_perf, bool fast_switch)
> +{
> +	struct amd_pstate_perf_funcs *funcs = cpufreq_get_driver_data();
> +
> +	if (!funcs)
> +		return -EINVAL;
> +
> +	funcs->update_perf(cpudata, min_perf, des_perf,
> +			   max_perf, fast_switch);
> +
> +	return 0;
> +}

> +static struct amd_pstate_perf_funcs pstate_funcs = {
> +	.enable = pstate_enable,
> +	.init_perf = pstate_init_perf,
> +	.update_perf = pstate_update_perf,
> +};

> +static int __init amd_pstate_init(void)
> +{
> +	int ret;
> +	struct amd_pstate_perf_funcs *funcs;

> +
> +	funcs = &pstate_funcs;

What is the purpose of this seemingly pointless indirection? Showing off
how good AMD hardware is at doing retpolines or something?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ