summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJinfeng Wang <jinfeng.wang.cn@windriver.com>2025-09-08 10:44:55 +0800
committerSteve Sakoman <steve@sakoman.com>2025-09-22 13:17:52 -0700
commit838a12c6216dc40e7cd4b811e4a1c99cb9958f40 (patch)
treee65756cbe31e3d54c4d5d4c373221aa981064a54 /meta
parentc0775e49999088784dff543d02a1cb48d35f724c (diff)
downloadpoky-838a12c6216dc40e7cd4b811e4a1c99cb9958f40.tar.gz
systemtap: Fix task_work_cancel build
Backport a patch to fix: 107 | twork = task_work_cancel(task, func); | ^~~~ | | | task_work_func_t {aka void (*)(struct callback_head *)} /work/rad/wrs/wrl-systemtap-demo/qemux86-64-std-23p17/build/tmp-glibc/work/x86_64-linux/systemtap-native/4.8-r0/recipe-sysroot-native/usr/share/systemtap/runtime/stp_task_work.c:107:40: note: expected 'struct callback_head *' but argument is of type 'task_work_func_t' {aka 'void (*)(struct callback_head *)'} /work/rad/wrs/wrl-systemtap-demo/qemux86-64-std-23p17/build/tmp-glibc/work/x86_64-linux/systemtap-native/4.8-r0/recipe-sysroot-native/usr/share/systemtap/runtime/stp_task_work.c:13:26: error: incompatible types when assigning to type 'struct callback_head *' from type 'bool' {aka '_Bool'} 13 | #define task_work_cancel (* (task_work_cancel_fn)kallsyms_task_work_cancel) | ^ /work/rad/wrs/wrl-systemtap-demo/qemux86-64-std-23p17/build/tmp-glibc/work/x86_64-linux/systemtap-native/4.8-r0/recipe-sysroot-native/usr/share/systemtap/runtime/stp_task_work.c:107:17: note: in expansion of macro 'task_work_cancel' 107 | twork = task_work_cancel(task, func); | ^~~~~~~~~~~~~~~~ (From OE-Core rev: 58509b54a464cd5b692ad4ef8dd333eb9c14abfa) Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Make-stp_task_work-compatible-with-6.11-kernels.patch103
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.bb1
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 @@
1From 317669e7b44bc2688253f5ab9641c308f30566bc Mon Sep 17 00:00:00 2001
2From: Martin Cermak <mcermak@redhat.com>
3Date: Wed, 24 Jul 2024 16:47:42 +0200
4Subject: [PATCH] Make stp_task_work compatible with 6.11 kernels
5
6Update systemtap runtime so that it works with kernel commit
768cbd415dd4b task_work:
8
9s/task_work_cancel()/task_work_cancel_func()/
10
11Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=a64dc4e2e0195ca80c6509df511a42459b40e9af]
12
13Signed-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
22diff --git a/buildrun.cxx b/buildrun.cxx
23index 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",
34diff --git a/runtime/linux/autoconf-task_work_cancel_func.c b/runtime/linux/autoconf-task_work_cancel_func.c
35new file mode 100644
36index 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;
43diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h
44index 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)
56diff --git a/runtime/stp_task_work.c b/runtime/stp_task_work.c
57index 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--
1022.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
9SRC_URI += " \ 9SRC_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
14DEPENDS = "elfutils" 15DEPENDS = "elfutils"