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, 18 Dec 2014 15:28:27 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	mingo@...nel.org, linux-kernel@...r.kernel.org,
	Frederic Weisbecker <fweisbec@...il.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] perf ftrace: Factor regs retrieval for function tracer

On Thu, Dec 18, 2014 at 03:20:27PM +0100, Peter Zijlstra wrote:
> On Thu, Dec 18, 2014 at 03:08:47PM +0100, Jiri Olsa wrote:
> > diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
> > index 6fa484de2ba1..54bffedd28b6 100644
> > --- a/kernel/trace/trace_event_perf.c
> > +++ b/kernel/trace/trace_event_perf.c
> > @@ -304,7 +304,7 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,
> >  {
> >  	struct ftrace_entry *entry;
> >  	struct hlist_head *head;
> > -	struct pt_regs regs;
> > +	struct pt_regs **regsp, *regs = pt_regs;
> >  	int rctx;
> >  
> >  	head = this_cpu_ptr(event_function.perf_events);
> > @@ -316,16 +316,24 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,
> >  
> >  	BUILD_BUG_ON(ENTRY_SIZE > PERF_MAX_TRACE_SIZE);
> >  
> > -	perf_fetch_caller_regs(&regs);
> > +	/*
> > +	 * The ftrace_ops is registered with SAVE_REGS_IF_SUPPORTED,
> > +	 * so if we got pt_regs defined, we don't need to retrieve
> > +	 * regs buffer through perf_trace_buf_prepare.
> > +	 */
> > +	regsp = pt_regs ? NULL : &regs;
> >  
> > -	entry = perf_trace_buf_prepare(ENTRY_SIZE, TRACE_FN, NULL, &rctx);
> > +	entry = perf_trace_buf_prepare(ENTRY_SIZE, TRACE_FN, regsp, &rctx);
> >  	if (!entry)
> >  		return;
> >  
> > +	if (regsp)
> > +		perf_fetch_caller_regs(regs);
> > +
> 
> 
> Would not something like:
> 
> 	struct pt_regs *regs;
> 
> 	entry = perf_trace_buf_prepare(ENTRY_SIZE, TRACE_FN, &regs, &rctx);
> 	if (!pt_regs) {
> 		perf_fetch_caller_regs(regs);
> 		pt_regs = regs;
> 	}
> 
> Be simpler?

well, I wanted to omit touching the '__perf_regs' var
in perf_trace_buf_prepare:

        if (regs)
                *regs = this_cpu_ptr(&__perf_regs[*rctxp]);

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