1 From 6229bbaa423832f6b7c7a658ad11e1d4242752ff Mon Sep 17 00:00:00 2001
2 From: Michael Jeanson <mjeanson@efficios.com>
3 Date: Wed, 8 Jun 2022 12:56:36 -0400
4 Subject: [PATCH 1/4] fix: mm/page_alloc: fix tracepoint
5 mm_page_alloc_zone_locked() (v5.19)
9 commit 10e0f7530205799e7e971aba699a7cb3a47456de
10 Author: Wonhyuk Yang <vvghjk1234@gmail.com>
11 Date: Thu May 19 14:08:54 2022 -0700
13 mm/page_alloc: fix tracepoint mm_page_alloc_zone_locked()
15 Currently, trace point mm_page_alloc_zone_locked() doesn't show correct
18 First, when alloc_flag has ALLOC_HARDER/ALLOC_CMA, page can be allocated
19 from MIGRATE_HIGHATOMIC/MIGRATE_CMA. Nevertheless, tracepoint use
20 requested migration type not MIGRATE_HIGHATOMIC and MIGRATE_CMA.
22 Second, after commit 44042b4498728 ("mm/page_alloc: allow high-order pages
23 to be stored on the per-cpu lists") percpu-list can store high order
24 pages. But trace point determine whether it is a refiil of percpu-list by
25 comparing requested order and 0.
27 To handle these problems, make mm_page_alloc_zone_locked() only be called
28 by __rmqueue_smallest with correct migration type. With a new argument
29 called percpu_refill, it can show roughly whether it is a refill of
32 Change-Id: I2e4a57393757f12b9c5a4566c4d1102ee2474a09
33 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
34 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
36 include/instrumentation/events/kmem.h | 45 +++++++++++++++++++++++++++
37 1 file changed, 45 insertions(+)
39 diff --git a/include/instrumentation/events/kmem.h b/include/instrumentation/events/kmem.h
40 index 29c0fb7f..8c19e962 100644
41 --- a/include/instrumentation/events/kmem.h
42 +++ b/include/instrumentation/events/kmem.h
43 @@ -218,6 +218,50 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc,
47 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
48 +LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
50 + TP_PROTO(struct page *page, unsigned int order, int migratetype,
53 + TP_ARGS(page, order, migratetype, percpu_refill),
56 + ctf_integer_hex(struct page *, page, page)
57 + ctf_integer(unsigned long, pfn,
58 + page ? page_to_pfn(page) : -1UL)
59 + ctf_integer(unsigned int, order, order)
60 + ctf_integer(int, migratetype, migratetype)
61 + ctf_integer(int, percpu_refill, percpu_refill)
65 +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked,
67 + kmem_mm_page_alloc_zone_locked,
69 + TP_PROTO(struct page *page, unsigned int order, int migratetype,
72 + TP_ARGS(page, order, migratetype, percpu_refill)
75 +LTTNG_TRACEPOINT_EVENT_MAP(mm_page_pcpu_drain,
77 + kmem_mm_page_pcpu_drain,
79 + TP_PROTO(struct page *page, unsigned int order, int migratetype),
81 + TP_ARGS(page, order, migratetype),
84 + ctf_integer(unsigned long, pfn,
85 + page ? page_to_pfn(page) : -1UL)
86 + ctf_integer(unsigned int, order, order)
87 + ctf_integer(int, migratetype, migratetype)
91 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
93 TP_PROTO(struct page *page, unsigned int order, int migratetype),
94 @@ -250,6 +294,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_pcpu_drain,
96 TP_ARGS(page, order, migratetype)
100 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,19,2) \
101 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
106 From 5e2f832d59d51589ab69479c7db43c7581fb9346 Mon Sep 17 00:00:00 2001
107 From: Michael Jeanson <mjeanson@efficios.com>
108 Date: Wed, 8 Jun 2022 13:07:59 -0400
109 Subject: [PATCH 2/4] fix: fs: Remove flags parameter from aops->write_begin
112 See upstream commit :
114 commit 9d6b0cd7579844761ed68926eb3073bab1dca87b
115 Author: Matthew Wilcox (Oracle) <willy@infradead.org>
116 Date: Tue Feb 22 14:31:43 2022 -0500
118 fs: Remove flags parameter from aops->write_begin
120 There are no more aop flags left, so remove the parameter.
122 Change-Id: I82725b93e13d749f52a631b2ac60df81a5e839f8
123 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
124 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
126 include/instrumentation/events/ext4.h | 30 +++++++++++++++++++++++++++
127 1 file changed, 30 insertions(+)
129 diff --git a/include/instrumentation/events/ext4.h b/include/instrumentation/events/ext4.h
130 index 513762c0..222416ec 100644
131 --- a/include/instrumentation/events/ext4.h
132 +++ b/include/instrumentation/events/ext4.h
133 @@ -122,6 +122,35 @@ LTTNG_TRACEPOINT_EVENT(ext4_begin_ordered_truncate,
137 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
138 +LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_begin,
140 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
142 + TP_ARGS(inode, pos, len),
145 + ctf_integer(dev_t, dev, inode->i_sb->s_dev)
146 + ctf_integer(ino_t, ino, inode->i_ino)
147 + ctf_integer(loff_t, pos, pos)
148 + ctf_integer(unsigned int, len, len)
152 +LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__write_begin, ext4_write_begin,
154 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
156 + TP_ARGS(inode, pos, len)
159 +LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__write_begin, ext4_da_write_begin,
161 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
163 + TP_ARGS(inode, pos, len)
166 LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_begin,
168 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
169 @@ -153,6 +182,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__write_begin, ext4_da_write_begin,
171 TP_ARGS(inode, pos, len, flags)
175 LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_end,
176 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
181 From c6da9604b1666780ea4725b3b3d1bfa1548f9c89 Mon Sep 17 00:00:00 2001
182 From: Michael Jeanson <mjeanson@efficios.com>
183 Date: Wed, 15 Jun 2022 12:07:16 -0400
184 Subject: [PATCH 3/4] fix: workqueue: Fix type of cpu in trace event (v5.19)
186 See upstream commit :
188 commit 873a400938b31a1e443c4d94b560b78300787540
189 Author: Wonhyuk Yang <vvghjk1234@gmail.com>
190 Date: Wed May 4 11:32:03 2022 +0900
192 workqueue: Fix type of cpu in trace event
194 The trace event "workqueue_queue_work" use unsigned int type for
195 req_cpu, cpu. This casue confusing cpu number like below log.
197 $ cat /sys/kernel/debug/tracing/trace
198 cat-317 [001] ...: workqueue_queue_work: ... req_cpu=8192 cpu=4294967295
200 So, change unsigned type to signed type in the trace event. After
201 applying this patch, cpu number will be printed as -1 instead of
202 4294967295 as folllows.
204 $ cat /sys/kernel/debug/tracing/trace
205 cat-1338 [002] ...: workqueue_queue_work: ... req_cpu=8192 cpu=-1
207 Change-Id: I478083c350b6ec314d87e9159dc5b342b96daed7
208 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
209 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
211 include/instrumentation/events/workqueue.h | 49 ++++++++++++++++++++--
212 1 file changed, 46 insertions(+), 3 deletions(-)
214 diff --git a/include/instrumentation/events/workqueue.h b/include/instrumentation/events/workqueue.h
215 index 023b65a8..5693cf89 100644
216 --- a/include/instrumentation/events/workqueue.h
217 +++ b/include/instrumentation/events/workqueue.h
218 @@ -28,10 +28,35 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work,
222 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
224 * workqueue_queue_work - called when a work gets queued
225 * @req_cpu: the requested cpu
226 - * @cwq: pointer to struct cpu_workqueue_struct
227 + * @pwq: pointer to struct pool_workqueue
228 + * @work: pointer to struct work_struct
230 + * This event occurs when a work is queued immediately or once a
231 + * delayed work is actually queued on a workqueue (ie: once the delay
232 + * has been reached).
234 +LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
236 + TP_PROTO(int req_cpu, struct pool_workqueue *pwq,
237 + struct work_struct *work),
239 + TP_ARGS(req_cpu, pwq, work),
242 + ctf_integer_hex(void *, work, work)
243 + ctf_integer_hex(void *, function, work->func)
244 + ctf_integer(int, req_cpu, req_cpu)
247 +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
249 + * workqueue_queue_work - called when a work gets queued
250 + * @req_cpu: the requested cpu
251 + * @pwq: pointer to struct pool_workqueue
252 * @work: pointer to struct work_struct
254 * This event occurs when a work is queued immediately or once a
255 @@ -40,17 +65,34 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work,
257 LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
259 -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
260 TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq,
261 struct work_struct *work),
263 TP_ARGS(req_cpu, pwq, work),
266 + ctf_integer_hex(void *, work, work)
267 + ctf_integer_hex(void *, function, work->func)
268 + ctf_integer(unsigned int, req_cpu, req_cpu)
273 + * workqueue_queue_work - called when a work gets queued
274 + * @req_cpu: the requested cpu
275 + * @cwq: pointer to struct cpu_workqueue_struct
276 + * @work: pointer to struct work_struct
278 + * This event occurs when a work is queued immediately or once a
279 + * delayed work is actually queued on a workqueue (ie: once the delay
280 + * has been reached).
282 +LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
284 TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq,
285 struct work_struct *work),
287 TP_ARGS(req_cpu, cwq, work),
291 ctf_integer_hex(void *, work, work)
292 @@ -58,6 +100,7 @@ LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
293 ctf_integer(unsigned int, req_cpu, req_cpu)
299 * workqueue_activate_work - called when a work gets activated
304 From 96c477dabaaf6cd1734bebe0972fef877e5a463b Mon Sep 17 00:00:00 2001
305 From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
306 Date: Fri, 29 Jul 2022 15:37:43 -0400
307 Subject: [PATCH 4/4] fix: net: skb: introduce kfree_skb_reason()
310 See upstream commit :
312 commit c504e5c2f9648a1e5c2be01e8c3f59d394192bd3
313 Author: Menglong Dong <imagedong@tencent.com>
314 Date: Sun Jan 9 14:36:26 2022 +0800
316 net: skb: introduce kfree_skb_reason()
318 Introduce the interface kfree_skb_reason(), which is able to pass
319 the reason why the skb is dropped to 'kfree_skb' tracepoint.
321 Add the 'reason' field to 'trace_kfree_skb', therefor user can get
322 more detail information about abnormal skb with 'drop_monitor' or
325 All drop reasons are defined in the enum 'skb_drop_reason', and
326 they will be print as string in 'kfree_skb' tracepoint in format
329 ( Maybe the reasons should be defined in a uapi header file, so that
330 user space can use them? )
332 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
333 Change-Id: Ib3c039207739dad10f097cf76474e0822e351273
335 include/instrumentation/events/skb.h | 4 +++-
336 1 file changed, 3 insertions(+), 1 deletion(-)
338 diff --git a/include/instrumentation/events/skb.h b/include/instrumentation/events/skb.h
339 index 237e54ad..186732ea 100644
340 --- a/include/instrumentation/events/skb.h
341 +++ b/include/instrumentation/events/skb.h
344 * Tracepoint for free an sk_buff:
346 -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
347 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
348 + || LTTNG_KERNEL_RANGE(5,15,58, 5,16,0))
350 LTTNG_TRACEPOINT_ENUM(skb_drop_reason,
352 ctf_enum_value("NOT_SPECIFIED", SKB_DROP_REASON_NOT_SPECIFIED)