]> sourceware.org Git - systemtap.git/commitdiff
runtime: Add a universal stp_synchronize_sched
authorJosh Stone <jistone@redhat.com>
Fri, 20 Jun 2014 16:45:46 +0000 (09:45 -0700)
committerJosh Stone <jistone@redhat.com>
Fri, 20 Jun 2014 16:45:46 +0000 (09:45 -0700)
The kernel has had synchronize_sched for a while.  However, in the RHEL5
era this was merely a #define to synchronize_rcu, which our exportconf
wouldn't detect.  RHEL4 only had synchronize_kernel.

Now stp_synchronize_sched covers all of these options, otherwise issuing
an #error message.

buildrun.cxx
runtime/dyninst/runtime.h
runtime/linux/runtime.h
runtime/linux/runtime_context.h
translate.cxx

index 5d434c713a001eaff64f08478f3495ae5107d8ff..6f820a819979333e5db5386766fb169166005881 100644 (file)
@@ -323,6 +323,8 @@ compile_pass (systemtap_session& s)
   output_autoconf(s, o, "autoconf-uaccess.c", "STAPCONF_LINUX_UACCESS_H", NULL);
   output_autoconf(s, o, "autoconf-oneachcpu-retry.c", "STAPCONF_ONEACHCPU_RETRY", NULL);
   output_autoconf(s, o, "autoconf-dpath-path.c", "STAPCONF_DPATH_PATH", NULL);
+  output_exportconf(s, o, "synchronize_kernel", "STAPCONF_SYNCHRONIZE_KERNEL");
+  output_exportconf(s, o, "synchronize_rcu", "STAPCONF_SYNCHRONIZE_RCU");
   output_exportconf(s, o, "synchronize_sched", "STAPCONF_SYNCHRONIZE_SCHED");
   output_autoconf(s, o, "autoconf-task-uid.c", "STAPCONF_TASK_UID", NULL);
   output_autoconf(s, o, "autoconf-from_kuid_munged.c", "STAPCONF_FROM_KUID_MUNGED", NULL);
index 506cf1abad81bc84854e44ba6d0234eb8fbae906..1ae95a8a2eff1d20e1ed989803dbb1d1ff03de96 100644 (file)
@@ -271,6 +271,8 @@ err_attr:
        return rc;
 }
 
+static inline void stp_synchronize_sched(void) { }
+
 /*
  * For stapdyn to work in a multiprocess environment, the module must be
  * prepared to be loaded multiple times in different processes.  Thus, we have
index 21319ff5869648d78a85f9c2a42bcb6a807ed855..ec792d62db2f9118172ea2d5e6800dc4562514c7 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/profile.h>
+#include <linux/rcupdate.h>
 //#include <linux/utsrelease.h> // newer kernels only
 //#include <linux/compile.h>
 #ifdef STAPCONF_GENERATED_COMPILE
@@ -276,6 +277,20 @@ static struct kernel_param_ops param_ops_int64_t = {
 #endif
 #undef _STP_KERNEL_PARAM_ARG
 
+
+static inline void stp_synchronize_sched(void)
+{
+#if defined(STAPCONF_SYNCHRONIZE_SCHED)
+  synchronize_sched();
+#elif defined(STAPCONF_SYNCHRONIZE_RCU)
+  synchronize_rcu();
+#elif defined(STAPCONF_SYNCHRONIZE_KERNEL)
+  synchronize_kernel();
+#else
+#error "No implementation for stp_synchronize_sched!"
+#endif
+}
+
 /************* Module Stuff ********************/
 
 
index 6729f8d4f1d1815b8d4ec4e64bc2c7c1cdf5925b..c9ffe180b36f23d48597cbcd5bd2551c76217d6f 100644 (file)
@@ -47,11 +47,7 @@ static void _stp_runtime_contexts_free(void)
        }
 
        /* Sync to make sure existing readers are done.  */
-#ifdef STAPCONF_SYNCHRONIZE_SCHED
-       synchronize_sched();
-#else
-       synchronize_kernel();
-#endif
+       stp_synchronize_sched();
 
        /* Now we can actually free the contexts.  */
        for_each_possible_cpu(cpu) {
index 5d6821f390c3e741745b2e932dedd73699b59eaf..b549cc0f134d17f3c092a2c1ae2385e49e5d5788 100644 (file)
@@ -1872,9 +1872,7 @@ c_unparser::emit_module_init ()
 
   // For any partially registered/unregistered kernel facilities.
   o->newline() << "atomic_set (session_state(), STAP_SESSION_STOPPED);";
-  o->newline() << "#ifdef STAPCONF_SYNCHRONIZE_SCHED";
-  o->newline() << "synchronize_sched();";
-  o->newline() << "#endif";
+  o->newline() << "stp_synchronize_sched();";
 
   // In case tracepoints were started, they need to be cleaned up
   o->newline() << "#ifdef STAP_NEED_TRACEPOINTS";
@@ -1958,9 +1956,7 @@ c_unparser::emit_module_exit ()
   // Let's wait a while to make sure they're all done, done, done.
 
   // cargo cult prologue
-  o->newline() << "#ifdef STAPCONF_SYNCHRONIZE_SCHED";
-  o->newline() << "synchronize_sched();";
-  o->newline() << "#endif";
+  o->newline() << "stp_synchronize_sched();";
 
   // NB: systemtap_module_exit is assumed to be called from ordinary
   // user context, say during module unload.  Among other things, this
@@ -1969,9 +1965,7 @@ c_unparser::emit_module_exit ()
 
   // cargo cult epilogue
   o->newline() << "atomic_set (session_state(), STAP_SESSION_STOPPED);";
-  o->newline() << "#ifdef STAPCONF_SYNCHRONIZE_SCHED";
-  o->newline() << "synchronize_sched();";
-  o->newline() << "#endif";
+  o->newline() << "stp_synchronize_sched();";
 
   // XXX: might like to have an escape hatch, in case some probe is
   // genuinely stuck somehow
This page took 0.045081 seconds and 5 git commands to generate.