]> sourceware.org Git - systemtap.git/commitdiff
task_finder_vma: add autoconf check for hlist_add_tail_rcu()
authorSultan Alsawaf <sultan@openresty.com>
Mon, 12 Jul 2021 20:31:36 +0000 (15:31 -0500)
committerSultan Alsawaf <sultan@openresty.com>
Tue, 13 Jul 2021 17:26:45 +0000 (10:26 -0700)
The 3.10 version check for hlist_add_tail_rcu() only works for RHEL
kernels. Kernels older than 4.7 that lack the hlist_add_tail_rcu() backport
won't compile (such as Debian kernels). Add an autoconf stub to know for
certain if hlist_add_tail_rcu() is present.

buildrun.cxx
runtime/linux/autoconf-hlist_add_tail_rcu.c [new file with mode: 0644]
runtime/task_finder_vma.c

index ba3daa0a08c6bbd5c44b33d1bd4460578228f651..0c244db721c29e2b27f79345987adeec58e86258 100644 (file)
@@ -520,6 +520,8 @@ compile_pass (systemtap_session& s)
                  "STAPCONF_ATOMIC_FETCH_ADD_UNLESS", NULL);
   output_autoconf(s, o, cs, "autoconf-lockdown-debugfs.c", "STAPCONF_LOCKDOWN_DEBUGFS", NULL);
   output_autoconf(s, o, cs, "autoconf-lockdown-kernel.c", "STAPCONF_LOCKDOWN_KERNEL", NULL);
+  output_autoconf(s, o, cs, "autoconf-hlist_add_tail_rcu.c",
+                 "STAPCONF_HLIST_ADD_TAIL_RCU", NULL);
   
   // used by runtime/linux/netfilter.c
   output_exportconf(s, o2, "nf_register_hook", "STAPCONF_NF_REGISTER_HOOK");
diff --git a/runtime/linux/autoconf-hlist_add_tail_rcu.c b/runtime/linux/autoconf-hlist_add_tail_rcu.c
new file mode 100644 (file)
index 0000000..2c46608
--- /dev/null
@@ -0,0 +1,6 @@
+#include <linux/rculist.h>
+
+void foo(struct hlist_node *n, struct hlist_head *h)
+{
+       hlist_add_tail_rcu(n, h);
+}
index 965bbdae40376977255be0cfaac83d8d838b8ba9..81a96c7cf8ecf8e5f2394784d74dd59833b7178d 100644 (file)
@@ -21,7 +21,7 @@ static inline bool atomic_try_cmpxchg(atomic_t *v, int *old, int new)
 }
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
+#ifndef STAPCONF_HLIST_ADD_TAIL_RCU
 // Added in linux 4.7, backported to rhel 7, not present in rhel 6
 #define hlist_first_rcu(head)   (*((struct hlist_node __rcu **)(&(head)->first)))
 #define hlist_next_rcu(node)    (*((struct hlist_node __rcu **)(&(node)->next)))
This page took 0.029599 seconds and 5 git commands to generate.