Fix: handle missing ftrace header on v4.12
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 23 Jun 2017 18:29:42 +0000 (14:29 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 23 Jun 2017 19:09:32 +0000 (15:09 -0400)
Properly handle the case where we build against the distro headers of a
kernel >= 4.12 and ftrace is enabled but the private header is
unavailable.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile.ABI.workarounds
lttng-events.h
probes/Kbuild

index c3717f814d8c544ef5be9eb444e024196ba89ef4..2e6c4aa231577057a7c6476977095b29261a677d 100644 (file)
@@ -27,3 +27,24 @@ RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR)
 ifneq ($(RT_PATCH_VERSION), 0)
   ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
 endif
+
+# Starting with kernel 4.12, the ftrace header was moved to private headers
+# and as such is not available when building against distro headers instead
+# of the full kernel sources. In the situation, define LTTNG_FTRACE_MISSING_HEADER
+# so we can enable the compat code even if CONFIG_DYNAMIC_FTRACE is enabled.
+ifneq ($(CONFIG_DYNAMIC_FTRACE),)
+  ftrace_dep = $(srctree)/kernel/trace/trace.h
+  ftrace_dep_check = $(wildcard $(ftrace_dep))
+  have_ftrace_header = $(shell \
+    if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \
+      if [ -z "$(ftrace_dep_check)" ] ; then \
+        echo "no" ; \
+        exit ; \
+      fi; \
+    fi; \
+    echo "yes" ; \
+    )
+  ifeq ($(have_ftrace_header), no)
+    ccflags-y += -DLTTNG_FTRACE_MISSING_HEADER
+  endif
+endif
index f55bf6637c93643ae70fd32b09934dfd3e22dce3..17dd8d3a3c312ef35da53f4cbbdd4aba75d4a2f7 100644 (file)
@@ -810,7 +810,7 @@ int lttng_kretprobes_event_enable_state(struct lttng_event *event,
 }
 #endif
 
-#ifdef CONFIG_DYNAMIC_FTRACE
+#if defined(CONFIG_DYNAMIC_FTRACE) && !defined(LTTNG_FTRACE_MISSING_HEADER)
 int lttng_ftrace_register(const char *name,
                          const char *symbol_name,
                          struct lttng_event *event);
index 78bf3fb229380cfbb8d6b06e73ea46f67b946b71..cc1c0656e4ad2a7556aab9fac1fe87c65bc800aa 100644 (file)
@@ -259,22 +259,11 @@ ifneq ($(CONFIG_KRETPROBES),)
 endif # CONFIG_KRETPROBES
 
 ifneq ($(CONFIG_DYNAMIC_FTRACE),)
-  ftrace_dep = $(srctree)/kernel/trace/trace.h
-  ftrace_dep_check = $(wildcard $(ftrace_dep))
-  ftrace = $(shell \
-    if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \
-      if [ -z "$(ftrace_dep_check)" ] ; then \
-        echo "warn" ; \
-        exit ; \
-      fi; \
-    fi; \
-    echo "lttng-ftrace.o" ; \
-    )
-  ifeq ($(ftrace),warn)
+  ifeq ($(have_ftrace_header),yes)
+    obj-$(CONFIG_LTTNG) += lttng-ftrace.o
+  else
     $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.)
-    ftrace =
-  endif # $(ftrace),warn
-  obj-$(CONFIG_LTTNG) += $(ftrace)
+  endif
 endif # CONFIG_DYNAMIC_FTRACE
 
 # vim:syntax=make
This page took 0.028718 seconds and 4 git commands to generate.