]> sourceware.org Git - systemtap.git/commitdiff
Add a PR20516 workaround by using kallsyms_lookup_name to find udelay_simple.
authorDavid Smith <dsmith@redhat.com>
Fri, 6 Oct 2017 15:32:53 +0000 (10:32 -0500)
committerDavid Smith <dsmith@redhat.com>
Fri, 6 Oct 2017 15:32:53 +0000 (10:32 -0500)
* runtime/linux/common_session_state.h (stp_session_init): Use
  kallsyms_lookup_name() to find udelay_simple() if it exists but isn't
  exported.
* runtime/linux/runtime.h: Ditto.
* buildrun.cxx (compile_pass): Add an new autoconf test for
  udelay_simple().
* runtime/linux/autoconf-udelay_simple.c: New file.

buildrun.cxx
runtime/linux/autoconf-udelay_simple.c [new file with mode: 0644]
runtime/linux/common_session_state.h
runtime/linux/runtime.h

index dd07593444c2b7427f09ca8a9fe306d460fc1485..a72f05d9b01ea8777ae3cc06af3c218e59728aae 100644 (file)
@@ -447,7 +447,9 @@ compile_pass (systemtap_session& s)
   output_exportconf(s, o, "vmalloc_node", "STAPCONF_VMALLOC_NODE");
 
   // RHBZ1233912 - s390 temporary workaround for non-atomic udelay()
-  output_exportconf(s, o, "udelay_simple", "STAPCONF_UDELAY_SIMPLE");
+  output_exportconf(s, o, "udelay_simple", "STAPCONF_UDELAY_SIMPLE_EXPORTED");
+  output_autoconf(s, o, "autoconf-udelay_simple.c", "STAPCONF_UDELAY_SIMPLE",
+                 NULL);
 
   output_autoconf(s, o, "autoconf-tracepoint-strings.c", "STAPCONF_TRACEPOINT_STRINGS", NULL);
   output_autoconf(s, o, "autoconf-timerfd.c", "STAPCONF_TIMERFD_H", NULL);
diff --git a/runtime/linux/autoconf-udelay_simple.c b/runtime/linux/autoconf-udelay_simple.c
new file mode 100644 (file)
index 0000000..3a7b19f
--- /dev/null
@@ -0,0 +1,6 @@
+#include <asm/delay.h>
+
+void foo (unsigned long long usecs)
+{
+    udelay_simple(usecs);
+}
index f52300685a75aeea55d73c50ff5941973d124aba..4443490802cf1be21ebec93de22111fbebbfd230 100644 (file)
@@ -78,5 +78,15 @@ static int stp_session_init(void)
        g_refresh_timing = _stp_stat_init(STAT_OP_MIN, STAT_OP_MAX, STAT_OP_AVG, STAT_OP_VARIANCE, 0, NULL);
 #endif
 
+#if defined(STAPCONF_UDELAY_SIMPLE) && !defined(STAPCONF_UDELAY_SIMPLE_EXPORTED)
+       // PR20516: Some s390 kernels that have udelay_simple() don't
+       // have it exported. Note that we have to do this early since
+       // other init routines could call udelay().
+        kallsyms_udelay_simple = (void *)kallsyms_lookup_name("udelay_simple");
+        if (kallsyms_udelay_simple == NULL) {
+           _stp_error("couldn't find udelay_simple");
+           return 1;
+        }
+#endif
        return 0;
 }
index 1ba777d9c40004e2195a83f13b81340ea630883a..9c585a20d41b85dc6f15dddc74acbf3545c3b5cd 100644 (file)
 #define STP_TRANSPORT_VERSION 1
 #endif
 
-#ifdef STAPCONF_UDELAY_SIMPLE
+#if defined(STAPCONF_UDELAY_SIMPLE_EXPORTED)
 #undef udelay
 #define udelay(x) udelay_simple(x)
+#elif defined(STAPCONF_UDELAY_SIMPLE)
+#undef udelay
+static void *kallsyms_udelay_simple;
+typedef typeof(&udelay_simple) udelay_simple_fn;
+#define udelay(x) ((* (udelay_simple_fn)(kallsyms_udelay_simple))((x)))
 #endif
 
 #ifndef clamp
This page took 0.03261 seconds and 5 git commands to generate.