From cc727fbb415e3ab4c83c40b1b2eb08081d38d262 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 23 Jan 2017 12:34:07 -0500 Subject: [PATCH] Fix: 4.10 hotplug adaptation backward compat MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit from /home/compudj/git/lttng-modules/lttng-context-perf-counters.c:23: /home/compudj/git/lttng-modules/lttng-context-perf-counters.c: In function ‘lttng_add_perf_counter_to_ctx’: /home/compudj/git/lttng-modules/lttng-context-perf-counters.c:353:22: error: ‘cpu’ undeclared (first use in this function) for_each_online_cpu(cpu) { ^ ./include/linux/cpumask.h:223:8: note: in definition of macro ‘for_each_cpu’ for ((cpu) = -1; \ ^ /home/compudj/git/lttng-modules/lttng-context-perf-counters.c:353:2: note: in expansion of macro ‘for_each_online_cpu’ for_each_online_cpu(cpu) { ^ /home/compudj/git/lttng-modules/lttng-context-perf-counters.c:353:22: note: each undeclared identifier is reported only once for each function it appears in for_each_online_cpu(cpu) { ^ ./include/linux/cpumask.h:223:8: note: in definition of macro ‘for_each_cpu’ for ((cpu) = -1; \ ^ /home/compudj/git/lttng-modules/lttng-context-perf-counters.c:353:2: note: in expansion of macro ‘for_each_online_cpu’ for_each_online_cpu(cpu) { ^ ./include/linux/cpumask.h:224:38: warning: left-hand operand of comma expression has no effect [-Wunused-value] (cpu) = cpumask_next((cpu), (mask)), \ ^ ./include/linux/cpumask.h:717:36: note: in expansion of macro ‘for_each_cpu’ #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) ^ /home/compudj/git/lttng-modules/lttng-context-perf-counters.c:353:2: note: in expansion of macro ‘for_each_online_cpu’ for_each_online_cpu(cpu) { ^ scripts/Makefile.build:289: recipe for target '/home/compudj/git/lttng-modules/lttng-context-perf-counters.o' failed make[2]: *** [/home/compudj/git/lttng-modules/lttng-context-perf-counters.o] Error 1 make[2]: *** Waiting for unfinished jobs.... Signed-off-by: Mathieu Desnoyers --- lttng-context-perf-counters.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lttng-context-perf-counters.c b/lttng-context-perf-counters.c index 843cda6e..8afc11f8 100644 --- a/lttng-context-perf-counters.c +++ b/lttng-context-perf-counters.c @@ -350,14 +350,18 @@ cpuhp_prepare_error: #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */ counter_busy: counter_error: - for_each_online_cpu(cpu) { - if (events[cpu] && !IS_ERR(events[cpu])) - perf_event_release_kernel(events[cpu]); - } - put_online_cpus(); + { + int cpu; + + for_each_online_cpu(cpu) { + if (events[cpu] && !IS_ERR(events[cpu])) + perf_event_release_kernel(events[cpu]); + } + put_online_cpus(); #ifdef CONFIG_HOTPLUG_CPU - unregister_cpu_notifier(&perf_field->nb); + unregister_cpu_notifier(&perf_field->nb); #endif + } #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */ find_error: lttng_remove_context_field(ctx, field); -- 2.34.1