blob: 63f9c40d9262b3d21cf5d49afee92344460bd6b5 [file] [log] [blame]
Andrew Geissler615f2f12022-07-15 14:00:58 -05001From 526f13c844cd29f89bd3e924867d9ddfe3c40ade Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Wed, 15 Jun 2022 12:07:16 -0400
4Subject: [PATCH 3/3] fix: workqueue: Fix type of cpu in trace event (v5.19)
5
6See upstream commit :
7
8 commit 873a400938b31a1e443c4d94b560b78300787540
9 Author: Wonhyuk Yang <vvghjk1234@gmail.com>
10 Date: Wed May 4 11:32:03 2022 +0900
11
12 workqueue: Fix type of cpu in trace event
13
14 The trace event "workqueue_queue_work" use unsigned int type for
15 req_cpu, cpu. This casue confusing cpu number like below log.
16
17 $ cat /sys/kernel/debug/tracing/trace
18 cat-317 [001] ...: workqueue_queue_work: ... req_cpu=8192 cpu=4294967295
19
20 So, change unsigned type to signed type in the trace event. After
21 applying this patch, cpu number will be printed as -1 instead of
22 4294967295 as folllows.
23
24 $ cat /sys/kernel/debug/tracing/trace
25 cat-1338 [002] ...: workqueue_queue_work: ... req_cpu=8192 cpu=-1
26
27Upstream-Status: Backport
28
29Change-Id: I478083c350b6ec314d87e9159dc5b342b96daed7
30Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
31Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
32---
33 include/instrumentation/events/workqueue.h | 49 ++++++++++++++++++++--
34 1 file changed, 46 insertions(+), 3 deletions(-)
35
36diff --git a/include/instrumentation/events/workqueue.h b/include/instrumentation/events/workqueue.h
37index 023b65a8..5693cf89 100644
38--- a/include/instrumentation/events/workqueue.h
39+++ b/include/instrumentation/events/workqueue.h
40@@ -28,10 +28,35 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work,
41 )
42 )
43
44+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
45 /**
46 * workqueue_queue_work - called when a work gets queued
47 * @req_cpu: the requested cpu
48- * @cwq: pointer to struct cpu_workqueue_struct
49+ * @pwq: pointer to struct pool_workqueue
50+ * @work: pointer to struct work_struct
51+ *
52+ * This event occurs when a work is queued immediately or once a
53+ * delayed work is actually queued on a workqueue (ie: once the delay
54+ * has been reached).
55+ */
56+LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
57+
58+ TP_PROTO(int req_cpu, struct pool_workqueue *pwq,
59+ struct work_struct *work),
60+
61+ TP_ARGS(req_cpu, pwq, work),
62+
63+ TP_FIELDS(
64+ ctf_integer_hex(void *, work, work)
65+ ctf_integer_hex(void *, function, work->func)
66+ ctf_integer(int, req_cpu, req_cpu)
67+ )
68+)
69+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
70+/**
71+ * workqueue_queue_work - called when a work gets queued
72+ * @req_cpu: the requested cpu
73+ * @pwq: pointer to struct pool_workqueue
74 * @work: pointer to struct work_struct
75 *
76 * This event occurs when a work is queued immediately or once a
77@@ -40,17 +65,34 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work,
78 */
79 LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
80
81-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
82 TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq,
83 struct work_struct *work),
84
85 TP_ARGS(req_cpu, pwq, work),
86+
87+ TP_FIELDS(
88+ ctf_integer_hex(void *, work, work)
89+ ctf_integer_hex(void *, function, work->func)
90+ ctf_integer(unsigned int, req_cpu, req_cpu)
91+ )
92+)
93 #else
94+/**
95+ * workqueue_queue_work - called when a work gets queued
96+ * @req_cpu: the requested cpu
97+ * @cwq: pointer to struct cpu_workqueue_struct
98+ * @work: pointer to struct work_struct
99+ *
100+ * This event occurs when a work is queued immediately or once a
101+ * delayed work is actually queued on a workqueue (ie: once the delay
102+ * has been reached).
103+ */
104+LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
105+
106 TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq,
107 struct work_struct *work),
108
109 TP_ARGS(req_cpu, cwq, work),
110-#endif
111
112 TP_FIELDS(
113 ctf_integer_hex(void *, work, work)
114@@ -58,6 +100,7 @@ LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
115 ctf_integer(unsigned int, req_cpu, req_cpu)
116 )
117 )
118+#endif
119
120 /**
121 * workqueue_activate_work - called when a work gets activated
122--
1232.19.1
124