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: <20180828081911.GC23727@krava>
Date:   Tue, 28 Aug 2018 10:19:11 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] perf/x86/intel: Export mem events only if there's PEBs
 support

On Tue, Aug 28, 2018 at 10:12:32AM +0200, Peter Zijlstra wrote:
> On Mon, Aug 27, 2018 at 11:06:24AM +0200, Jiri Olsa wrote:
> > +static __init struct attribute **get_hsw_events_attrs(bool *alloc)
> >  {
> > +	if (boot_cpu_has(X86_FEATURE_RTM)) {
> > +		*alloc = true;
> > +		return merge_attr(hsw_events_attrs, hsw_tsx_events_attrs);
> > +	}
> > +	return hsw_events_attrs;
> >  }
> 
> 
> 
> > @@ -4357,6 +4374,15 @@ __init int intel_pmu_init(void)
> >  		WARN_ON(!x86_pmu.format_attrs);
> >  	}
> >  
> > +	if (x86_pmu.pebs && mem_attr) {
> > +		struct attribute **attr = x86_pmu.cpu_events;
> > +
> > +		x86_pmu.cpu_events = merge_attr(x86_pmu.cpu_events, mem_attr);
> > +
> > +		if (alloc_events)
> > +			kfree(attr);
> > +	}
> > +
> >  	if (x86_pmu.num_counters > INTEL_PMC_MAX_GENERIC) {
> >  		WARN(1, KERN_ERR "hw perf events %d > max(%d), clipping!",
> >  		     x86_pmu.num_counters, INTEL_PMC_MAX_GENERIC);
> 
> 
> static __init struct attribute **
> get_events_attrs(struct attribute **base,
> 		 struct attribute **mem,
> 		 struct attribute **tsx)
> {
> 	struct attribute **attrs = base;
> 	struct attribute **old;
> 
> 	if (mem) {
> 		old = attrs;
> 		attrs = merge_attrs(attrs, mem);
> 		if (old != base)
> 			kfree(old);
> 	}
> 
> 	if (tsx && boot_cpu_has(X86_FEATURE_RTM)) {
> 		old = attrs;
> 		attrs = merge_attrs(attrs, tsx);
> 		if (old != base)
> 			kfree(old);
> 	}
> 
> 	return attrs;
> }
> 
> Would that not help to concentrate things a little more?

looks like it would ;-) will check and repost

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ