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: <37D7C6CF3E00A74B8858931C1DB2F0770160F974@SHSMSX103.ccr.corp.intel.com>
Date:	Tue, 7 Oct 2014 02:59:20 +0000
From:	"Liang, Kan" <kan.liang@...el.com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	"eranian@...gle.com" <eranian@...gle.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"mingo@...hat.com" <mingo@...hat.com>,
	"paulus@...ba.org" <paulus@...ba.org>,
	"acme@...nel.org" <acme@...nel.org>,
	"ak@...ux.intel.com" <ak@...ux.intel.com>,
	"Yan, Zheng" <zheng.z.yan@...el.com>
Subject: RE: [PATCH V5 08/16] perf, x86: track number of events that use LBR
 callstack


> 
> On Wed, Sep 10, 2014 at 10:09:05AM -0400, kan.liang@...el.com wrote:
> > @@ -204,9 +204,15 @@ void intel_pmu_lbr_sched_task(struct
> perf_event_context *ctx, bool sched_in)
> >  	}
> >  }
> >
> > +static inline bool branch_user_callstack(unsigned br_sel) {
> > +	return (br_sel & X86_BR_USER) && (br_sel & X86_BR_CALL_STACK); }
> > +
> >  void intel_pmu_lbr_enable(struct perf_event *event)  {
> >  	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
> > +	struct x86_perf_task_context *task_ctx;
> >
> >  	if (!x86_pmu.lbr_nr)
> >  		return;
> > @@ -220,6 +226,10 @@ void intel_pmu_lbr_enable(struct perf_event
> *event)
> >  	}
> >  	cpuc->br_sel = event->hw.branch_reg.reg;
> >
> > +	task_ctx = event->ctx ? event->ctx->task_ctx_data : NULL;
> > +	if (task_ctx && branch_user_callstack(cpuc->br_sel))
> > +		task_ctx->lbr_callstack_users++;
> > +
> 
> Does it make sense to flip those conditions to avoid a potentially useless
> dereference?

I'm not quite sure I understand your meaning here.
But lbr_callstack_users is an indicator for save/restore the LBR stack on context switch.
Here, we only change the lbr_callstack_users, when it's LBR call stack and has space for saving LBR stack.

Should I change the code as below?
+       if (branch_user_callstack(cpuc->br_sel) && event->ctx &&
+               (task_ctx = event->ctx->task_ctx_data))
+               task_ctx->lbr_callstack_users++;

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