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: <20190620125059.GZ3436@hirez.programming.kicks-ass.net>
Date:   Thu, 20 Jun 2019 14:50:59 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Zhang Rui <rui.zhang@...el.com>
Cc:     linux-x86 <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
        mingo@...hat.com, acme@...nel.org,
        alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
        namhyung@...nel.org, tglx@...utronix.de,
        "Liang, Kan" <kan.liang@...el.com>
Subject: Re: [PATCH] perf/rapl: restart perf rapl counter after resume

On Mon, Jun 17, 2019 at 09:41:37PM +0800, Zhang Rui wrote:

> After S3 suspend/resume, "perf stat -I 1000 -e power/energy-pkg/ -a"
> reports an insane value for the very first sampling period after resume
> as shown below.
> 
>     19.278989977               2.16 Joules power/energy-pkg/
>     20.279373569               1.96 Joules power/energy-pkg/
>     21.279765481               2.09 Joules power/energy-pkg/
>     22.280305420               2.10 Joules power/energy-pkg/
>     25.504782277   4,294,966,686.01 Joules power/energy-pkg/
>     26.505114993               3.58 Joules power/energy-pkg/
>     27.505471758               1.66 Joules power/energy-pkg/
> 
> Fix this by resetting the counter right after resume.

Cute...


> +#ifdef CONFIG_PM
> +
> +static int perf_rapl_suspend(void)
> +{
> +	int i;
> +
> +	get_online_cpus();
> +	for (i = 0; i < rapl_pmus->maxpkg; i++)
> +		rapl_pmu_update_all(rapl_pmus->pmus[i]);
> +	put_online_cpus();
> +	return 0;
> +}
> +
> +static void perf_rapl_resume(void)
> +{
> +	int i;
> +
> +	get_online_cpus();
> +	for (i = 0; i < rapl_pmus->maxpkg; i++)
> +		rapl_pmu_restart_all(rapl_pmus->pmus[i]);
> +	put_online_cpus();
> +}

What's the reason for that get/put_online_cpus() here ?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ