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]
Message-ID: <20201208124344.GX2414@hirez.programming.kicks-ass.net>
Date:   Tue, 8 Dec 2020 13:43:44 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:     Linux PM <linux-pm@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        Doug Smythies <dsmythies@...us.net>,
        Giovanni Gherdovich <ggherdovich@...e.com>
Subject: Re: [PATCH v1 4/4] cpufreq: intel_pstate: Implement the
 ->adjust_perf() callback

On Mon, Dec 07, 2020 at 05:38:58PM +0100, Rafael J. Wysocki wrote:

> +static void intel_cpufreq_adjust_perf(unsigned int cpunum,
> +				      unsigned long min_perf,
> +				      unsigned long target_perf,
> +				      unsigned long capacity)
> +{
> +	struct cpudata *cpu = all_cpu_data[cpunum];
> +	int old_pstate = cpu->pstate.current_pstate;
> +	int cap_pstate, min_pstate, max_pstate, target_pstate;
> +
> +	update_turbo_state();
> +	cap_pstate = global.turbo_disabled ? cpu->pstate.max_pstate :
> +					     cpu->pstate.turbo_pstate;
> +
> +	/* Optimization: Avoid unnecessary divisions. */
> +
> +	target_pstate = cap_pstate;
> +	if (target_perf < capacity)
> +		target_pstate = DIV_ROUND_UP(cap_pstate * target_perf, capacity);
> +
> +	min_pstate = cap_pstate;
> +	if (min_perf < capacity)
> +		min_pstate = DIV_ROUND_UP(cap_pstate * min_perf, capacity);
> +
> +	if (min_pstate < cpu->pstate.min_pstate)
> +		min_pstate = cpu->pstate.min_pstate;
> +
> +	if (min_pstate < cpu->min_perf_ratio)
> +		min_pstate = cpu->min_perf_ratio;
> +
> +	max_pstate = min(cap_pstate, cpu->max_perf_ratio);
> +	if (max_pstate < min_pstate)
> +		max_pstate = min_pstate;
> +
> +	target_pstate = clamp_t(int, target_pstate, min_pstate, max_pstate);
> +
> +	intel_cpufreq_adjust_hwp(cpu, min_pstate, max_pstate, target_pstate, true);

I'm confused... HWP doesn't do pstate, yet everything here is now called
pstate, help?

> +
> +	cpu->pstate.current_pstate = target_pstate;
> +	intel_cpufreq_trace(cpu, INTEL_PSTATE_TRACE_FAST_SWITCH, old_pstate);
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ