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: <20230908132754.GI19320@noisy.programming.kicks-ass.net>
Date:   Fri, 8 Sep 2023 15:27:54 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Meng Li <li.meng@....com>
Cc:     "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Huang Rui <ray.huang@....com>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        linux-acpi@...r.kernel.org, Shuah Khan <skhan@...uxfoundation.org>,
        linux-kselftest@...r.kernel.org,
        Nathan Fontenot <nathan.fontenot@....com>,
        Deepak Sharma <deepak.sharma@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Mario Limonciello <mario.limonciello@....com>,
        Shimmer Huang <shimmer.huang@....com>,
        Perry Yuan <Perry.Yuan@....com>,
        Xiaojian Du <Xiaojian.Du@....com>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Borislav Petkov <bp@...en8.de>, Wyes Karny <wyes.karny@....com>
Subject: Re: [PATCH V5 5/7] cpufreq: amd-pstate: Update amd-pstate preferred
 core ranking dynamically

On Tue, Sep 05, 2023 at 09:51:14AM +0800, Meng Li wrote:

> +static void amd_pstate_update_highest_perf(unsigned int cpu)
> +{
> +	struct cpufreq_policy *policy;
> +	struct amd_cpudata *cpudata;
> +	u32 prev_high = 0, cur_high = 0;
> +	u64 highest_perf;
> +	int ret;
> +
> +	if (!prefcore)
> +		return;
> +
> +	ret = amd_pstate_get_highest_perf(cpu, &highest_perf);
> +	if (ret)
> +		return;
> +
> +	policy = cpufreq_cpu_get(cpu);
> +	cpudata = policy->driver_data;
> +	cur_high = highest_perf;
> +	prev_high = READ_ONCE(cpudata->cppc_highest_perf);
> +
> +	if (prev_high != cur_high) {
> +		WRITE_ONCE(cpudata->cppc_highest_perf, cur_high);
> +		sched_set_itmt_core_prio(cur_high, cpu);

I just noticed, your cur_high is explicitly 'u32', but
sched_set_itmt_core_prio() and the rest of the scheduler use 'int' (aka
s32). If you somehow get that top bit set things might not work out as
expected.

Please double check.

> +	}
> +
> +	cpufreq_cpu_put(policy);
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ