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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110523123919.GF1728@nowhere>
Date:	Mon, 23 May 2011 14:39:21 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 1/2] perf tools: Fix sample size bit operations

On Mon, May 23, 2011 at 01:28:15PM +0200, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@...il.com> wrote:
> 
> > What we want is to count the number of bits in the mask,
> > not some other random operation written in the middle
> > of the night.
> > 
> > Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
> > Cc: Ingo Molnar <mingo@...e.hu>
> > Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> > Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> > Cc: Stephane Eranian <eranian@...gle.com>
> > ---
> >  tools/perf/util/event.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> > index 17c1c3c..d3fa7e4 100644
> > --- a/tools/perf/util/event.c
> > +++ b/tools/perf/util/event.c
> > @@ -42,7 +42,7 @@ int perf_sample_size(u64 sample_type)
> >  	int i;
> >  
> >  	for (i = 0; i < 64; i++) {
> > -		if ((mask << i) & 1)
> > +		if (mask & (1 << i))
> >  			size++;
> >  	}
> 
> I fixed this to be 1UL and applied your fixes out of email - perf top and perf 
> report works fine now, so this was a 64-bitness bug (you probably used a 32-bit 
> system for testing?).

Nope I was using a 64 machine for testing, but I only tested sched_switch
events with callchains on perf report and perf script.

Perhaps that bug triggered only on perf top or with default cpu-cycle events.

> 
> Btw., shouldnt this use hweight() or such?

A real proper way would better have that yeah :)
--
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