Re: [RFC][PATCH 7/7] perf: Optimize sw events
From: Peter Zijlstra
Date: Fri Oct 15 2010 - 10:57:31 EST
On Fri, 2010-10-15 at 11:16 +0200, Peter Zijlstra wrote:
> On Thu, 2010-10-14 at 22:34 +0200, Peter Zijlstra wrote:
>
> > Index: linux-2.6/include/linux/perf_event.h
> > ===================================================================
> > --- linux-2.6.orig/include/linux/perf_event.h
> > +++ linux-2.6/include/linux/perf_event.h
> > @@ -1013,15 +1013,17 @@ static inline void perf_fetch_caller_reg
> > static inline void
> > perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
> > {
> > - if (atomic_read(&perf_swevent_enabled[event_id])) {
> > - struct pt_regs hot_regs;
> > + struct pt_regs hot_regs;
> >
> > - if (!regs) {
> > - perf_fetch_caller_regs(&hot_regs);
> > - regs = &hot_regs;
> > - }
> > - __perf_sw_event(event_id, nr, nmi, regs, addr);
> > + JUMP_LABEL(&perf_swevent_enabled[event_id], have_event);
> > + return;
> > +
> > +have_event:
> > + if (!regs) {
> > + perf_fetch_caller_regs(&hot_regs);
> > + regs = &hot_regs;
> > }
> > + __perf_sw_event(event_id, nr, nmi, regs, addr);
> > }
> >
>
> OK, so it appears I only compile tested this bit without jump_label
> support, with that bit added back this horribly fails to compile like:
>
> In file included from /usr/src/linux-2.6/arch/x86/mm/fault.c:13:
> /usr/src/linux-2.6/include/linux/perf_event.h: In function âperf_sw_event.clone.0â:
> /usr/src/linux-2.6/include/linux/perf_event.h:1018: warning: asm operand 0 probably doesnât match constraints
> /usr/src/linux-2.6/include/linux/perf_event.h:1018: error: impossible constraint in âasmâ
>
Ah, figured it out, it needs __attribute__((always_inline)), otherwise
we end up with multiple keys for one label, which will clealy not work.
I thought we had a __force_inline macro but I can't seem to find that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/