[lttng-dev] [PATCH lttng-modules] wrapper/perf.h: Fix kernel version condition

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Mon Dec 10 11:05:33 EST 2012


* Andrew Gabbasov (andrew_gabbasov at mentor.com) wrote:
> The pid_t parameter of function perf_event_create_kernel_counter
> was changed to task_struct pointer starting from 2.6.37.x.

Did you check if 2.6.36.x stable kernels also introduced this change ?
This might explain why in my own testing I did put 2.6.36 as kernel
version cutoff.

Thanks,

Mathieu

> 
> Signed-off-by: Andrew Gabbasov <andrew_gabbasov at mentor.com>
> ---
>  wrapper/perf.h |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/wrapper/perf.h b/wrapper/perf.h
> index 5dfa84b..5de205c 100644
> --- a/wrapper/perf.h
> +++ b/wrapper/perf.h
> @@ -34,7 +34,7 @@ wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
>  }
>  #else /* defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99)) */
>  
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
>  static inline struct perf_event *
>  wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
>  				int cpu,
> @@ -43,7 +43,7 @@ wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
>  {
>  	return perf_event_create_kernel_counter(attr, cpu, task, callback);
>  }
> -#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) */
> +#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) */
>  static inline struct perf_event *
>  wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
>  				int cpu,
> @@ -60,8 +60,11 @@ wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
>  	return perf_event_create_kernel_counter(attr, cpu, pid, callback);
>  }
>  
> +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) */
> +
> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
>  #define local64_read(l)		atomic64_read(l)
> -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) */
> +#endif
>  
>  #endif /* defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99)) */
>  
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list