diff options
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r-- | meta/recipes-kernel/systemtap/systemtap/0001-Make-stp_task_work-compatible-with-6.11-kernels.patch | 103 | ||||
-rw-r--r-- | meta/recipes-kernel/systemtap/systemtap_git.bb | 1 |
2 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Make-stp_task_work-compatible-with-6.11-kernels.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Make-stp_task_work-compatible-with-6.11-kernels.patch new file mode 100644 index 0000000000..62a8dafa9b --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-Make-stp_task_work-compatible-with-6.11-kernels.patch | |||
@@ -0,0 +1,103 @@ | |||
1 | From 317669e7b44bc2688253f5ab9641c308f30566bc Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Cermak <mcermak@redhat.com> | ||
3 | Date: Wed, 24 Jul 2024 16:47:42 +0200 | ||
4 | Subject: [PATCH] Make stp_task_work compatible with 6.11 kernels | ||
5 | |||
6 | Update systemtap runtime so that it works with kernel commit | ||
7 | 68cbd415dd4b task_work: | ||
8 | |||
9 | s/task_work_cancel()/task_work_cancel_func()/ | ||
10 | |||
11 | Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=a64dc4e2e0195ca80c6509df511a42459b40e9af] | ||
12 | |||
13 | Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com> | ||
14 | --- | ||
15 | buildrun.cxx | 1 + | ||
16 | .../linux/autoconf-task_work_cancel_func.c | 3 +++ | ||
17 | runtime/linux/runtime.h | 2 +- | ||
18 | runtime/stp_task_work.c | 21 ++++++++++++++----- | ||
19 | 4 files changed, 21 insertions(+), 6 deletions(-) | ||
20 | create mode 100644 runtime/linux/autoconf-task_work_cancel_func.c | ||
21 | |||
22 | diff --git a/buildrun.cxx b/buildrun.cxx | ||
23 | index 816842072..4c528b1b1 100644 | ||
24 | --- a/buildrun.cxx | ||
25 | +++ b/buildrun.cxx | ||
26 | @@ -396,6 +396,7 @@ compile_pass (systemtap_session& s) | ||
27 | output_exportconf(s, o2, "__module_text_address", "STAPCONF_MODULE_TEXT_ADDRESS"); | ||
28 | output_exportconf(s, o2, "add_timer_on", "STAPCONF_ADD_TIMER_ON"); | ||
29 | output_autoconf(s, o, cs, "autoconf-514-panic.c", "STAPCONF_514_PANIC", NULL); | ||
30 | + output_autoconf(s, o, cs, "autoconf-task_work_cancel_func.c", "STAPCONF_TASK_WORK_CANCEL_FUNC", NULL); | ||
31 | |||
32 | output_dual_exportconf(s, o2, "probe_kernel_read", "probe_kernel_write", "STAPCONF_PROBE_KERNEL"); | ||
33 | output_autoconf(s, o, cs, "autoconf-hw_breakpoint_context.c", | ||
34 | diff --git a/runtime/linux/autoconf-task_work_cancel_func.c b/runtime/linux/autoconf-task_work_cancel_func.c | ||
35 | new file mode 100644 | ||
36 | index 000000000..0d460de6c | ||
37 | --- /dev/null | ||
38 | +++ b/runtime/linux/autoconf-task_work_cancel_func.c | ||
39 | @@ -0,0 +1,3 @@ | ||
40 | +#include <linux/task_work.h> | ||
41 | + | ||
42 | +void* c = & task_work_cancel_func; | ||
43 | diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h | ||
44 | index a5840794a..acb32d584 100644 | ||
45 | --- a/runtime/linux/runtime.h | ||
46 | +++ b/runtime/linux/runtime.h | ||
47 | @@ -246,7 +246,7 @@ static void *kallsyms_uprobe_get_swbp_addr; | ||
48 | static void *kallsyms_task_work_add; | ||
49 | #endif | ||
50 | #if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED) | ||
51 | -static void *kallsyms_task_work_cancel; | ||
52 | +static void *kallsyms_task_work_cancel_fn; | ||
53 | #endif | ||
54 | |||
55 | #if !defined(STAPCONF_TRY_TO_WAKE_UP_EXPORTED) && !defined(STAPCONF_WAKE_UP_STATE_EXPORTED) | ||
56 | diff --git a/runtime/stp_task_work.c b/runtime/stp_task_work.c | ||
57 | index 0dd3095b6..4818fecbf 100644 | ||
58 | --- a/runtime/stp_task_work.c | ||
59 | +++ b/runtime/stp_task_work.c | ||
60 | @@ -3,14 +3,25 @@ | ||
61 | |||
62 | #include "linux/task_work_compatibility.h" | ||
63 | |||
64 | +// Handle kernel commit 68cbd415dd4b9c5b9df69f0f091879e56bf5907a | ||
65 | +// task_work: s/task_work_cancel()/task_work_cancel_func()/ | ||
66 | +#if defined(STAPCONF_TASK_WORK_CANCEL_FUNC) | ||
67 | +#define TASK_WORK_CANCEL_FN task_work_cancel_func | ||
68 | +#else | ||
69 | +#define TASK_WORK_CANCEL_FN task_work_cancel | ||
70 | +#endif | ||
71 | + | ||
72 | +#define STRINGIFY(x) #x | ||
73 | +#define TOSTRING(x) STRINGIFY(x) | ||
74 | + | ||
75 | #if !defined(STAPCONF_TASK_WORK_ADD_EXPORTED) | ||
76 | // First typedef from the original decls, then #define as typecasted calls. | ||
77 | typedef typeof(&task_work_add) task_work_add_fn; | ||
78 | #define task_work_add(a,b,c) ibt_wrapper(int, (* (task_work_add_fn)kallsyms_task_work_add)((a), (b), (c))) | ||
79 | #endif | ||
80 | #if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED) | ||
81 | -typedef typeof(&task_work_cancel) task_work_cancel_fn; | ||
82 | -#define task_work_cancel(a,b) ibt_wrapper(struct callback_head *, (* (task_work_cancel_fn)kallsyms_task_work_cancel)((a), (b))) | ||
83 | +typedef typeof(&TASK_WORK_CANCEL_FN) task_work_cancel_fn; | ||
84 | +#define task_work_cancel(a,b) ibt_wrapper(struct callback_head *, (* (task_work_cancel_fn)kallsyms_task_work_cancel_fn)((a), (b))) | ||
85 | #endif | ||
86 | |||
87 | /* To avoid a crash when a task_work callback gets called after the | ||
88 | @@ -35,9 +46,9 @@ stp_task_work_init(void) | ||
89 | } | ||
90 | #endif | ||
91 | #if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED) | ||
92 | - kallsyms_task_work_cancel = (void *)kallsyms_lookup_name("task_work_cancel"); | ||
93 | - if (kallsyms_task_work_cancel == NULL) { | ||
94 | - _stp_error("Can't resolve task_work_cancel!"); | ||
95 | + kallsyms_task_work_cancel_fn = (void *)kallsyms_lookup_name(TOSTRING(TASK_WORK_CANCEL_FN)); | ||
96 | + if (kallsyms_task_work_cancel_fn == NULL) { | ||
97 | + _stp_error("Can't resolve %s!", TOSTRING(TASK_WORK_CANCEL_FN)); | ||
98 | return -ENOENT; | ||
99 | } | ||
100 | #endif | ||
101 | -- | ||
102 | 2.34.1 | ||
103 | |||
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb index 68f5c76428..c2874516f4 100644 --- a/meta/recipes-kernel/systemtap/systemtap_git.bb +++ b/meta/recipes-kernel/systemtap/systemtap_git.bb | |||
@@ -9,6 +9,7 @@ require systemtap_git.inc | |||
9 | SRC_URI += " \ | 9 | SRC_URI += " \ |
10 | file://0001-improve-reproducibility-for-c-compiling.patch \ | 10 | file://0001-improve-reproducibility-for-c-compiling.patch \ |
11 | file://0001-staprun-address-ncurses-6.3-failures.patch \ | 11 | file://0001-staprun-address-ncurses-6.3-failures.patch \ |
12 | file://0001-Make-stp_task_work-compatible-with-6.11-kernels.patch \ | ||
12 | " | 13 | " |
13 | 14 | ||
14 | DEPENDS = "elfutils" | 15 | DEPENDS = "elfutils" |