1 From 526f13c844cd29f89bd3e924867d9ddfe3c40ade Mon Sep 17 00:00:00 2001
2 From: Michael Jeanson <mjeanson@efficios.com>
3 Date: Wed, 15 Jun 2022 12:07:16 -0400
4 Subject: [PATCH 3/3] fix: workqueue: Fix type of cpu in trace event (v5.19)
8 commit 873a400938b31a1e443c4d94b560b78300787540
9 Author: Wonhyuk Yang <vvghjk1234@gmail.com>
10 Date: Wed May 4 11:32:03 2022 +0900
12 workqueue: Fix type of cpu in trace event
14 The trace event "workqueue_queue_work" use unsigned int type for
15 req_cpu, cpu. This casue confusing cpu number like below log.
17 $ cat /sys/kernel/debug/tracing/trace
18 cat-317 [001] ...: workqueue_queue_work: ... req_cpu=8192 cpu=4294967295
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.
24 $ cat /sys/kernel/debug/tracing/trace
25 cat-1338 [002] ...: workqueue_queue_work: ... req_cpu=8192 cpu=-1
27 Upstream-Status: Backport
29 Change-Id: I478083c350b6ec314d87e9159dc5b342b96daed7
30 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
31 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
33 include/instrumentation/events/workqueue.h | 49 ++++++++++++++++++++--
34 1 file changed, 46 insertions(+), 3 deletions(-)
36 diff --git a/include/instrumentation/events/workqueue.h b/include/instrumentation/events/workqueue.h
37 index 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,
44 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
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
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).
56 +LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
58 + TP_PROTO(int req_cpu, struct pool_workqueue *pwq,
59 + struct work_struct *work),
61 + TP_ARGS(req_cpu, pwq, work),
64 + ctf_integer_hex(void *, work, work)
65 + ctf_integer_hex(void *, function, work->func)
66 + ctf_integer(int, req_cpu, req_cpu)
69 +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
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
76 * This event occurs when a work is queued immediately or once a
77 @@ -40,17 +65,34 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work,
79 LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
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),
85 TP_ARGS(req_cpu, pwq, work),
88 + ctf_integer_hex(void *, work, work)
89 + ctf_integer_hex(void *, function, work->func)
90 + ctf_integer(unsigned int, req_cpu, req_cpu)
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
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).
104 +LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
106 TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq,
107 struct work_struct *work),
109 TP_ARGS(req_cpu, cwq, work),
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)
121 * workqueue_activate_work - called when a work gets activated