From: Peter Zijlstra on
On Wed, 2010-03-03 at 07:55 +0100, Frederic Weisbecker wrote:
> /*
> + * Hot regs snapshot support -- arch specific
> + * This needs to be a macro because we want the current
> + * frame pointer.
> + */
> +#ifndef PERF_SAVE_REGS
> +#define PERF_SAVE_REGS(regs) memset(regs, 0, sizeof(*regs));
> +#endif

It would be nice to have the fallback at least set the current or
calling IP, now you've basically wrecked stuff for everything !x86.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Steven Rostedt on
On Wed, 2010-03-03 at 07:55 +0100, Frederic Weisbecker wrote:

> +/*
> * Output
> */
> static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail,
> @@ -4337,6 +4347,8 @@ static const struct pmu perf_ops_task_clock = {
> void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
> int entry_size)
> {
> + struct pt_regs regs;
> +
> struct perf_raw_record raw = {
> .size = entry_size,
> .data = record,
> @@ -4347,14 +4359,11 @@ void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
> .raw = &raw,
> };
>
> - struct pt_regs *regs = get_irq_regs();
> -
> - if (!regs)
> - regs = task_pt_regs(current);
> + PERF_SAVE_REGS(&regs);
>
> /* Trace events already protected against recursion */
> do_perf_sw_event(PERF_TYPE_TRACEPOINT, event_id, count, 1,
> - &data, regs);
> + &data, &regs);

Off-topic: Why is the above a perf sw event? Couldn't that also be a
normal TRACE_EVENT()?

-- Steve

> }
> EXPORT_SYMBOL_GPL(perf_tp_event);
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on
On Wed, 2010-03-03 at 11:06 -0500, Steven Rostedt wrote:
> On Wed, 2010-03-03 at 07:55 +0100, Frederic Weisbecker wrote:
>
> > +/*
> > * Output
> > */
> > static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail,
> > @@ -4337,6 +4347,8 @@ static const struct pmu perf_ops_task_clock = {
> > void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
> > int entry_size)
> > {
> > + struct pt_regs regs;
> > +
> > struct perf_raw_record raw = {
> > .size = entry_size,
> > .data = record,
> > @@ -4347,14 +4359,11 @@ void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
> > .raw = &raw,
> > };
> >
> > - struct pt_regs *regs = get_irq_regs();
> > -
> > - if (!regs)
> > - regs = task_pt_regs(current);
> > + PERF_SAVE_REGS(&regs);
> >
> > /* Trace events already protected against recursion */
> > do_perf_sw_event(PERF_TYPE_TRACEPOINT, event_id, count, 1,
> > - &data, regs);
> > + &data, &regs);
>
> Off-topic: Why is the above a perf sw event? Couldn't that also be a
> normal TRACE_EVENT()?

Well, no, this is the stuff that transforms TRACE_EVENT() into perf
software events ;-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Steven Rostedt on
On Wed, 2010-03-03 at 17:37 +0100, Peter Zijlstra wrote:

> > > /* Trace events already protected against recursion */
> > > do_perf_sw_event(PERF_TYPE_TRACEPOINT, event_id, count, 1,
> > > - &data, regs);
> > > + &data, &regs);
> >
> > Off-topic: Why is the above a perf sw event? Couldn't that also be a
> > normal TRACE_EVENT()?
>
> Well, no, this is the stuff that transforms TRACE_EVENT() into perf
> software events ;-)
>

oops, my bad :-), I thought this was in the x86 arch directory. For the
University, I was helping them with adding trace points for page faults
when I came across this in arch/x86/mm/fault.c:

perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);


This is what I actually was wondering about. Why is it a "perf only"
trace point instead of a TRACE_EVENT()?

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on
On Wed, 2010-03-03 at 12:07 -0500, Steven Rostedt wrote:
> oops, my bad :-), I thought this was in the x86 arch directory. For the
> University, I was helping them with adding trace points for page faults
> when I came across this in arch/x86/mm/fault.c:
>
> perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
>
>
> This is what I actually was wondering about. Why is it a "perf only"
> trace point instead of a TRACE_EVENT()?

Because I wanted to make perf usable without having to rely on funny
tracepoints. That is, I am less worried about committing software
counters to ABI than I am about TRACE_EVENT(), which still gives me a
terribly uncomfortable feeling.

Also, building with all CONFIG_TRACE_*=n will still yield a usable perf,
which is something the embedded people might fancy, all that TRACE stuff
adds lots of code.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/