From ceeaa82b24287613463937df2893dc933a6b5c86 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 2 Sep 2014 18:29:11 -0400 Subject: [PATCH] PR16603 followup: unbreak on rhel4 jistone noted that the smp_call_function_single() function call introduced in commit 590a9ae1acc47 didn't exist on 2.6.9-era kernels. We de-optimize to plain smp_call_function() on such dinosaurs. --- buildrun.cxx | 1 + runtime/linux/autoconf-smpcall-4args.c | 12 ++++++++++++ runtime/time.c | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 runtime/linux/autoconf-smpcall-4args.c diff --git a/buildrun.cxx b/buildrun.cxx index 6f9b78ba6..5d3ab582c 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -385,6 +385,7 @@ compile_pass (systemtap_session& s) output_autoconf(s, o, "autoconf-compat_sigaction.c", "STAPCONF_COMPAT_SIGACTION", NULL); output_autoconf(s, o, "autoconf-netfilter.c", "STAPCONF_NETFILTER_V313", NULL); output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL); + output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL); // used by tapset/timestamp_monotonic.stp output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK"); diff --git a/runtime/linux/autoconf-smpcall-4args.c b/runtime/linux/autoconf-smpcall-4args.c new file mode 100644 index 000000000..2966d95ee --- /dev/null +++ b/runtime/linux/autoconf-smpcall-4args.c @@ -0,0 +1,12 @@ +#include +#include + +void foo (void *arg) +{ + (void) arg; +} + +void bar (void) +{ + smp_call_function_single (0, &foo, 0, 1); +} diff --git a/runtime/time.c b/runtime/time.c index b4c201240..4f6959ee9 100644 --- a/runtime/time.c +++ b/runtime/time.c @@ -240,11 +240,16 @@ __stp_time_cpufreq_callback(struct notifier_block *self, #ifdef DEBUG_TIME _stp_warn ("cpu%d %p freq->%d\n", freqs->cpu, (void*)time, freqs->new); #endif +#if defined(STAPCONF_SMPCALL_5ARGS) || defined(STAPCONF_SMPCALL_4ARGS) (void) smp_call_function_single (freqs->cpu, &__stp_time_smp_callback, 0, #ifdef STAPCONF_SMPCALL_5ARGS 1, /* nonatomic */ #endif 0); /* not wait */ +#else + /* RHEL4ish: cannot direct to a single cpu ... so broadcast to them all */ + (void) smp_call_function (&__stp_time_smp_callback, NULL, 0, 0); +#endif } break; } -- 2.43.5