diff options
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules/0001-Fix-handle-missing-ftrace-header-on-v4.12.patch')
-rw-r--r-- | meta/recipes-kernel/lttng/lttng-modules/0001-Fix-handle-missing-ftrace-header-on-v4.12.patch | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-handle-missing-ftrace-header-on-v4.12.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-handle-missing-ftrace-header-on-v4.12.patch new file mode 100644 index 0000000000..37c1f9af49 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-handle-missing-ftrace-header-on-v4.12.patch | |||
@@ -0,0 +1,96 @@ | |||
1 | From fea65d0c097a42cf163bf7035985a6da330b9a1f Mon Sep 17 00:00:00 2001 | ||
2 | From: Michael Jeanson <mjeanson@efficios.com> | ||
3 | Date: Fri, 23 Jun 2017 14:29:42 -0400 | ||
4 | Subject: [PATCH 1/8] Fix: handle missing ftrace header on v4.12 | ||
5 | Organization: O.S. Systems Software LTDA. | ||
6 | |||
7 | Properly handle the case where we build against the distro headers of a | ||
8 | kernel >= 4.12 and ftrace is enabled but the private header is | ||
9 | unavailable. | ||
10 | |||
11 | Upstream-Status: Backport [2.9.4] | ||
12 | |||
13 | Signed-off-by: Michael Jeanson <mjeanson@efficios.com> | ||
14 | Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | ||
15 | --- | ||
16 | Makefile.ABI.workarounds | 21 +++++++++++++++++++++ | ||
17 | lttng-events.h | 2 +- | ||
18 | probes/Kbuild | 19 ++++--------------- | ||
19 | 3 files changed, 26 insertions(+), 16 deletions(-) | ||
20 | |||
21 | diff --git a/Makefile.ABI.workarounds b/Makefile.ABI.workarounds | ||
22 | index c3717f8..2e6c4aa 100644 | ||
23 | --- a/Makefile.ABI.workarounds | ||
24 | +++ b/Makefile.ABI.workarounds | ||
25 | @@ -27,3 +27,24 @@ RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR) | ||
26 | ifneq ($(RT_PATCH_VERSION), 0) | ||
27 | ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION) | ||
28 | endif | ||
29 | + | ||
30 | +# Starting with kernel 4.12, the ftrace header was moved to private headers | ||
31 | +# and as such is not available when building against distro headers instead | ||
32 | +# of the full kernel sources. In the situation, define LTTNG_FTRACE_MISSING_HEADER | ||
33 | +# so we can enable the compat code even if CONFIG_DYNAMIC_FTRACE is enabled. | ||
34 | +ifneq ($(CONFIG_DYNAMIC_FTRACE),) | ||
35 | + ftrace_dep = $(srctree)/kernel/trace/trace.h | ||
36 | + ftrace_dep_check = $(wildcard $(ftrace_dep)) | ||
37 | + have_ftrace_header = $(shell \ | ||
38 | + if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ | ||
39 | + if [ -z "$(ftrace_dep_check)" ] ; then \ | ||
40 | + echo "no" ; \ | ||
41 | + exit ; \ | ||
42 | + fi; \ | ||
43 | + fi; \ | ||
44 | + echo "yes" ; \ | ||
45 | + ) | ||
46 | + ifeq ($(have_ftrace_header), no) | ||
47 | + ccflags-y += -DLTTNG_FTRACE_MISSING_HEADER | ||
48 | + endif | ||
49 | +endif | ||
50 | diff --git a/lttng-events.h b/lttng-events.h | ||
51 | index 173f369..5a96bf3 100644 | ||
52 | --- a/lttng-events.h | ||
53 | +++ b/lttng-events.h | ||
54 | @@ -810,7 +810,7 @@ int lttng_kretprobes_event_enable_state(struct lttng_event *event, | ||
55 | } | ||
56 | #endif | ||
57 | |||
58 | -#ifdef CONFIG_DYNAMIC_FTRACE | ||
59 | +#if defined(CONFIG_DYNAMIC_FTRACE) && !defined(LTTNG_FTRACE_MISSING_HEADER) | ||
60 | int lttng_ftrace_register(const char *name, | ||
61 | const char *symbol_name, | ||
62 | struct lttng_event *event); | ||
63 | diff --git a/probes/Kbuild b/probes/Kbuild | ||
64 | index 78bf3fb..cc1c065 100644 | ||
65 | --- a/probes/Kbuild | ||
66 | +++ b/probes/Kbuild | ||
67 | @@ -259,22 +259,11 @@ ifneq ($(CONFIG_KRETPROBES),) | ||
68 | endif # CONFIG_KRETPROBES | ||
69 | |||
70 | ifneq ($(CONFIG_DYNAMIC_FTRACE),) | ||
71 | - ftrace_dep = $(srctree)/kernel/trace/trace.h | ||
72 | - ftrace_dep_check = $(wildcard $(ftrace_dep)) | ||
73 | - ftrace = $(shell \ | ||
74 | - if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ | ||
75 | - if [ -z "$(ftrace_dep_check)" ] ; then \ | ||
76 | - echo "warn" ; \ | ||
77 | - exit ; \ | ||
78 | - fi; \ | ||
79 | - fi; \ | ||
80 | - echo "lttng-ftrace.o" ; \ | ||
81 | - ) | ||
82 | - ifeq ($(ftrace),warn) | ||
83 | + ifeq ($(have_ftrace_header),yes) | ||
84 | + obj-$(CONFIG_LTTNG) += lttng-ftrace.o | ||
85 | + else | ||
86 | $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.) | ||
87 | - ftrace = | ||
88 | - endif # $(ftrace),warn | ||
89 | - obj-$(CONFIG_LTTNG) += $(ftrace) | ||
90 | + endif | ||
91 | endif # CONFIG_DYNAMIC_FTRACE | ||
92 | |||
93 | # vim:syntax=make | ||
94 | -- | ||
95 | 2.14.1 | ||
96 | |||