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:	Tue, 5 May 2015 17:22:38 +0000
From:	"Liang, Kan" <kan.liang@...el.com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	"mingo@...nel.org" <mingo@...nel.org>,
	"acme@...radead.org" <acme@...radead.org>,
	"eranian@...gle.com" <eranian@...gle.com>,
	"andi@...stfloor.org" <andi@...stfloor.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH V7 3/6] perf, x86: handle multiple records in PEBS buffer


> On Tue, May 05, 2015 at 04:30:25PM +0000, Liang, Kan wrote:
> > > > +	for (at = base; at < top; at += x86_pmu.pebs_record_size) {
> > > >  		struct pebs_record_nhm *p = at;
> > > >
> > > >  		for_each_set_bit(bit, (unsigned long *)&p->status,
> > > >  				 x86_pmu.max_pebs_events) {
> > > >  			event = cpuc->events[bit];
> > > >  			WARN_ON_ONCE(!event);
> > > >
> > > > +			if (event->attr.precise_ip)
> > > > +				break;
> > > > +		}
> > >
> > > Would it make sense to delay looking for the event until you've
> > > found there is a single bit set -- and already know which bit that is?
> > >
> >
> > Yes, I think we can test cpuc->pebs_enabled here.
> > It should be better than attr.precise_ip checking.
> >
> > -       for (; at < top; at += x86_pmu.pebs_record_size) {
> > +       for (at = base; at < top; at += x86_pmu.pebs_record_size) {
> >                 struct pebs_record_nhm *p = at;
> >
> >                 for_each_set_bit(bit, (unsigned long *)&p->status,
> >                                  x86_pmu.max_pebs_events) {
> > -                       event = cpuc->events[bit];
> > -                       if (!test_bit(bit, cpuc->active_mask))
> > -                               continue;
> > -
> > -                       WARN_ON_ONCE(!event);
> >
> > -                       if (!event->attr.precise_ip)
> > -                               continue;
> > +                       if (test_bit(bit, cpuc->pebs_enabled))
> > +                               break;
> > +               }
> >
> 
> Can't we take that entire for_each_set_bit() loop out?
> 
> It appears to me we effectively do that single test_bit() test you left in
> there already with the & cpuc->pebs_enabled later on.
> 
> 
Right, will use find_first_bit to replace.

+       for (at = base; at < top; at += x86_pmu.pebs_record_size) {
                struct pebs_record_nhm *p = at;

-               for_each_set_bit(bit, (unsigned long *)&p->status,
-                                x86_pmu.max_pebs_events) {
-                       event = cpuc->events[bit];
-                       if (!test_bit(bit, cpuc->active_mask))
-                               continue;
-
-                       WARN_ON_ONCE(!event);
-
-                       if (!event->attr.precise_ip)
-                               continue;
-
-                       if (__test_and_set_bit(bit, (unsigned long *)&status))
+               bit = find_first_bit((unsigned long *)&p->status,
+                                       x86_pmu.max_pebs_events);

Thanks,
Kan

--
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