]> git.pld-linux.org Git - packages/lttng-modules.git/blob - kernel-5.19.patch
- upstream fixes for kernel 5.19, rel 2
[packages/lttng-modules.git] / kernel-5.19.patch
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)
6
7 See upstream commit :
8
9   commit 10e0f7530205799e7e971aba699a7cb3a47456de
10   Author: Wonhyuk Yang <vvghjk1234@gmail.com>
11   Date:   Thu May 19 14:08:54 2022 -0700
12
13     mm/page_alloc: fix tracepoint mm_page_alloc_zone_locked()
14
15     Currently, trace point mm_page_alloc_zone_locked() doesn't show correct
16     information.
17
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.
21
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.
26
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
30     percpu-list.
31
32 Change-Id: I2e4a57393757f12b9c5a4566c4d1102ee2474a09
33 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
34 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
35 ---
36  include/instrumentation/events/kmem.h | 45 +++++++++++++++++++++++++++
37  1 file changed, 45 insertions(+)
38
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,
44         )
45  )
46  
47 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
48 +LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
49 +
50 +       TP_PROTO(struct page *page, unsigned int order, int migratetype,
51 +                       int percpu_refill),
52 +
53 +       TP_ARGS(page, order, migratetype, percpu_refill),
54 +
55 +       TP_FIELDS(
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)
62 +       )
63 +)
64 +
65 +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked,
66 +
67 +       kmem_mm_page_alloc_zone_locked,
68 +
69 +       TP_PROTO(struct page *page, unsigned int order, int migratetype,
70 +                       int percpu_refill),
71 +
72 +       TP_ARGS(page, order, migratetype, percpu_refill)
73 +)
74 +
75 +LTTNG_TRACEPOINT_EVENT_MAP(mm_page_pcpu_drain,
76 +
77 +       kmem_mm_page_pcpu_drain,
78 +
79 +       TP_PROTO(struct page *page, unsigned int order, int migratetype),
80 +
81 +       TP_ARGS(page, order, migratetype),
82 +
83 +       TP_FIELDS(
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)
88 +       )
89 +)
90 +#else
91  LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
92  
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,
95  
96         TP_ARGS(page, order, migratetype)
97  )
98 +#endif
99  
100  #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,19,2)  \
101         || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0)          \
102 -- 
103 2.37.2
104
105
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
110  (v5.19)
111
112 See upstream commit :
113
114   commit 9d6b0cd7579844761ed68926eb3073bab1dca87b
115   Author: Matthew Wilcox (Oracle) <willy@infradead.org>
116   Date:   Tue Feb 22 14:31:43 2022 -0500
117
118     fs: Remove flags parameter from aops->write_begin
119
120     There are no more aop flags left, so remove the parameter.
121
122 Change-Id: I82725b93e13d749f52a631b2ac60df81a5e839f8
123 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
124 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
125 ---
126  include/instrumentation/events/ext4.h | 30 +++++++++++++++++++++++++++
127  1 file changed, 30 insertions(+)
128
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,
134         )
135  )
136  
137 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
138 +LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_begin,
139 +
140 +       TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
141 +
142 +       TP_ARGS(inode, pos, len),
143 +
144 +       TP_FIELDS(
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)
149 +       )
150 +)
151 +
152 +LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__write_begin, ext4_write_begin,
153 +
154 +       TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
155 +
156 +       TP_ARGS(inode, pos, len)
157 +)
158 +
159 +LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__write_begin, ext4_da_write_begin,
160 +
161 +       TP_PROTO(struct inode *inode, loff_t pos, unsigned int len),
162 +
163 +       TP_ARGS(inode, pos, len)
164 +)
165 +#else
166  LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_begin,
167  
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,
170  
171         TP_ARGS(inode, pos, len, flags)
172  )
173 +#endif
174  
175  LTTNG_TRACEPOINT_EVENT_CLASS(ext4__write_end,
176         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
177 -- 
178 2.37.2
179
180
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)
185
186 See upstream commit :
187
188   commit 873a400938b31a1e443c4d94b560b78300787540
189   Author: Wonhyuk Yang <vvghjk1234@gmail.com>
190   Date:   Wed May 4 11:32:03 2022 +0900
191
192     workqueue: Fix type of cpu in trace event
193
194     The trace event "workqueue_queue_work" use unsigned int type for
195     req_cpu, cpu. This casue confusing cpu number like below log.
196
197     $ cat /sys/kernel/debug/tracing/trace
198     cat-317  [001] ...: workqueue_queue_work: ... req_cpu=8192 cpu=4294967295
199
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.
203
204     $ cat /sys/kernel/debug/tracing/trace
205     cat-1338  [002] ...: workqueue_queue_work: ... req_cpu=8192 cpu=-1
206
207 Change-Id: I478083c350b6ec314d87e9159dc5b342b96daed7
208 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
209 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
210 ---
211  include/instrumentation/events/workqueue.h | 49 ++++++++++++++++++++--
212  1 file changed, 46 insertions(+), 3 deletions(-)
213
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,
219         )
220  )
221  
222 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0))
223  /**
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
229 + *
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).
233 + */
234 +LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
235 +
236 +       TP_PROTO(int req_cpu, struct pool_workqueue *pwq,
237 +                struct work_struct *work),
238 +
239 +       TP_ARGS(req_cpu, pwq, work),
240 +
241 +       TP_FIELDS(
242 +               ctf_integer_hex(void *, work, work)
243 +               ctf_integer_hex(void *, function, work->func)
244 +               ctf_integer(int, req_cpu, req_cpu)
245 +       )
246 +)
247 +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0))
248 +/**
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
253   *
254   * This event occurs when a work is queued immediately or once a
255 @@ -40,17 +65,34 @@ LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work,
256   */
257  LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
258  
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),
262  
263         TP_ARGS(req_cpu, pwq, work),
264 +
265 +       TP_FIELDS(
266 +               ctf_integer_hex(void *, work, work)
267 +               ctf_integer_hex(void *, function, work->func)
268 +               ctf_integer(unsigned int, req_cpu, req_cpu)
269 +       )
270 +)
271  #else
272 +/**
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
277 + *
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).
281 + */
282 +LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
283 +
284         TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq,
285                  struct work_struct *work),
286  
287         TP_ARGS(req_cpu, cwq, work),
288 -#endif
289  
290         TP_FIELDS(
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)
294         )
295  )
296 +#endif
297  
298  /**
299   * workqueue_activate_work - called when a work gets activated
300 -- 
301 2.37.2
302
303
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()
308  (v5.15.58..v5.16)
309
310 See upstream commit :
311
312   commit c504e5c2f9648a1e5c2be01e8c3f59d394192bd3
313   Author: Menglong Dong <imagedong@tencent.com>
314   Date:   Sun Jan 9 14:36:26 2022 +0800
315
316     net: skb: introduce kfree_skb_reason()
317
318     Introduce the interface kfree_skb_reason(), which is able to pass
319     the reason why the skb is dropped to 'kfree_skb' tracepoint.
320
321     Add the 'reason' field to 'trace_kfree_skb', therefor user can get
322     more detail information about abnormal skb with 'drop_monitor' or
323     eBPF.
324
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
327     of 'reason: XXX'.
328
329     ( Maybe the reasons should be defined in a uapi header file, so that
330     user space can use them? )
331
332 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
333 Change-Id: Ib3c039207739dad10f097cf76474e0822e351273
334 ---
335  include/instrumentation/events/skb.h | 4 +++-
336  1 file changed, 3 insertions(+), 1 deletion(-)
337
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
342 @@ -13,7 +13,9 @@
343  /*
344   * Tracepoint for free an sk_buff:
345   */
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))
349 +
350  LTTNG_TRACEPOINT_ENUM(skb_drop_reason,
351         TP_ENUM_VALUES(
352                 ctf_enum_value("NOT_SPECIFIED", SKB_DROP_REASON_NOT_SPECIFIED)
353 -- 
354 2.37.2
355
This page took 0.126925 seconds and 3 git commands to generate.