Re: [PATCH 4/4] perf: provide a DEPRECTAED power trace API to user space

Frank Ch. Eigler
2010-10-04T16:11:40Z

Hi -

> Provide a CONFIG_DEPRECATED_POWER_EVENT_TRACING option in order
> to provide backward compatibility with the user space tracing tools.

This is clever:

> +/* Map new events trace points calls to old ones */
> +#define trace_processor_idle(state, cpu_id) \
> + do { \
> + if (state != 0) \
> + trace_power_start(POWER_CSTATE, state, cpu_id); \
> + else \
> + trace_power_end(cpu_id); \
> + } while (0)

but with this code, are the new tracepoints firing at all? In other
words, does this backward-compatibility config option effectively
disable the newer ones? If so, this is probably avoidable.

Instead of redirecting the new tracepoint calls to these macros, an
alternative may intercept (un)registration for the old tracepoint
names, and map them to (un)registration of the real tracepoints. See
how syscall tracepoints map to a special (un)registration callback in
include/trace/events/syscalls.h (syscall_*regfunc). Instead of
setting a TIF flag, the new functions can call
register_processor_idle() et al., and their respective callbacks can
call the backward-compatibility tracepoints.

The starting point would be to recast the power_start, power_end,
power_frequency tracepoints via TRACE_EVENT_FN() instead of
TRACE_EVENT().

- FChE