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, 11 Mar 2010 09:32:41 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	eranian@...gle.com
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu, paulus@...ba.org,
	fweisbec@...il.com, robert.richter@....com, davem@...emloft.net,
	perfmon2-devel@...ts.sf.net, eranian@...il.com
Subject: Re: [PATCH] perf_events: fix X86 bogus counts when multiplexing

On Wed, 2010-03-10 at 22:17 -0800, eranian@...gle.com wrote:
> This patch fixes a bug in 2.6.33 X86 event scheduling whereby
> all counts are bogus as soon as events need to be multiplexed
> because the PMU is overcommitted.
> 
> The code in hw_perf_enable() was causing multiplexed events
> to accumulate collected counts twice causing bogus results.
> 
> This is demonstrated on AMD Barcelona with the example
> below. First run, no conflict, you obtain the actual counts.
> Second run, PMU overcommitted, multiplexing, all events are
> over-counted. Third run, patch applied, you obtain the correct
> count through scaling.
> 

I'm a bit puzzled by this one, if we, during scheduling move an event
from idx 1 to idx 2, we need to stop it on 1 and start if on 2,
otherwise we do not properly transfer its count, right?

With the below patch it does no such thing.

I did fix some funnies I observed with hw_perf_enable() while doing the
PEBS stuff, and -tip does it wrong differently from what you illustrate,
so while there defenately is something to fix, I doubt the below is
correct.

> 	Signed-off-by: Stephane Eranian <eranian@...gle.com>
> --
>  perf_event.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index 97cddbf..ef5d63f 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -818,8 +818,6 @@ void hw_perf_enable(void)
>  			    match_prev_assignment(hwc, cpuc, i))
>  				continue;
>  
> -			x86_pmu_stop(event);
> -
>  			hwc->idx = -1;
>  		}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ