]> git.pld-linux.org Git - packages/lttng-modules.git/blob - kernel-5.1.patch
- fix building with kernel 5.1
[packages/lttng-modules.git] / kernel-5.1.patch
1 From 2ca0c84f0b4a915c555a0b83102d94ac941619ca Mon Sep 17 00:00:00 2001
2 From: Michael Jeanson <mjeanson@efficios.com>
3 Date: Mon, 18 Mar 2019 16:20:32 -0400
4 Subject: [PATCH] Fix: mm: create the new vm_fault_t type (v5.1)
5
6 See upstream commit:
7
8   commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
9   Author: Souptick Joarder <jrdr.linux@gmail.com>
10   Date:   Thu Mar 7 16:31:14 2019 -0800
11
12     mm: create the new vm_fault_t type
13
14     Page fault handlers are supposed to return VM_FAULT codes, but some
15     drivers/file systems mistakenly return error numbers.  Now that all
16     drivers/file systems have been converted to use the vm_fault_t return
17     type, change the type definition to no longer be compatible with 'int'.
18     By making it an unsigned int, the function prototype becomes
19     incompatible with a function which returns int.  Sparse will detect any
20     attempts to return a value which is not a VM_FAULT code.
21
22     VM_FAULT_SET_HINDEX and VM_FAULT_GET_HINDEX values are changed to avoid
23     conflict with other VM_FAULT codes.
24
25 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
26 ---
27  lib/ringbuffer/ring_buffer_mmap.c | 12 +++++++++++-
28  1 file changed, 11 insertions(+), 1 deletion(-)
29
30 diff --git a/lib/ringbuffer/ring_buffer_mmap.c b/lib/ringbuffer/ring_buffer_mmap.c
31 index 30dd93ef..fab94588 100644
32 --- a/lib/ringbuffer/ring_buffer_mmap.c
33 +++ b/lib/ringbuffer/ring_buffer_mmap.c
34 @@ -20,7 +20,11 @@
35  /*
36   * fault() vm_op implementation for ring buffer file mapping.
37   */
38 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
39 +static vm_fault_t lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf)
40 +#else
41  static int lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf)
42 +#endif
43  {
44         struct lib_ring_buffer *buf = vma->vm_private_data;
45         struct channel *chan = buf->backend.chan;
46 @@ -53,7 +57,13 @@ static int lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fa
47         return 0;
48  }
49  
50 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
51 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
52 +static vm_fault_t lib_ring_buffer_fault(struct vm_fault *vmf)
53 +{
54 +       struct vm_area_struct *vma = vmf->vma;
55 +       return lib_ring_buffer_fault_compat(vma, vmf);
56 +}
57 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
58  static int lib_ring_buffer_fault(struct vm_fault *vmf)
59  {
60         struct vm_area_struct *vma = vmf->vma;
61 From 92da05ce1f73488a57e7fd79e9c03113cefdb76f Mon Sep 17 00:00:00 2001
62 From: Michael Jeanson <mjeanson@efficios.com>
63 Date: Mon, 18 Mar 2019 16:20:33 -0400
64 Subject: [PATCH] Fix: rcu: Remove wrapper definitions for obsolete RCU...
65  (v5.1)
66
67 See upstream commit :
68
69 commit 6ba7d681aca22e53385bdb35b1d7662e61905760
70 Author: Paul E. McKenney <paulmck@linux.ibm.com>
71 Date:   Wed Jan 9 15:22:03 2019 -0800
72
73     rcu: Remove wrapper definitions for obsolete RCU update functions
74
75     None of synchronize_rcu_bh, synchronize_rcu_bh_expedited, call_rcu_bh,
76     rcu_barrier_bh, synchronize_sched, synchronize_sched_expedited,
77     call_rcu_sched, rcu_barrier_sched, get_state_synchronize_sched, and
78     cond_synchronize_sched are actually used.  This commit therefore removes
79     their trivial wrapper-function definitions.
80
81 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
82 ---
83  lttng-events.c | 5 +++++
84  1 file changed, 5 insertions(+)
85
86 diff --git a/lttng-events.c b/lttng-events.c
87 index 566080a3..f4206c54 100644
88 --- a/lttng-events.c
89 +++ b/lttng-events.c
90 @@ -75,7 +75,12 @@ int _lttng_field_statedump(struct lttng_session *session,
91  
92  void synchronize_trace(void)
93  {
94 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
95 +       synchronize_rcu();
96 +#else
97         synchronize_sched();
98 +#endif
99 +
100  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
101  #ifdef CONFIG_PREEMPT_RT_FULL
102         synchronize_rcu();
103 From d6cd2c9598a06f0ba1ba885bbe754e8836528310 Mon Sep 17 00:00:00 2001
104 From: Michael Jeanson <mjeanson@efficios.com>
105 Date: Mon, 18 Mar 2019 16:20:34 -0400
106 Subject: [PATCH] Fix: pipe: stop using ->can_merge (v5.1)
107
108 See upstream commit:
109
110   commit 01e7187b41191376cee8bea8de9f907b001e87b4
111   Author: Jann Horn <jannh@google.com>
112   Date:   Wed Jan 23 15:19:18 2019 +0100
113
114     pipe: stop using ->can_merge
115
116     Al Viro pointed out that since there is only one pipe buffer type to which
117     new data can be appended, it isn't necessary to have a ->can_merge field in
118     struct pipe_buf_operations, we can just check for a magic type.
119
120 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
121 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
122 ---
123  lib/ringbuffer/ring_buffer_splice.c | 2 ++
124  1 file changed, 2 insertions(+)
125
126 diff --git a/lib/ringbuffer/ring_buffer_splice.c b/lib/ringbuffer/ring_buffer_splice.c
127 index 468641bc..52179a79 100644
128 --- a/lib/ringbuffer/ring_buffer_splice.c
129 +++ b/lib/ringbuffer/ring_buffer_splice.c
130 @@ -43,7 +43,9 @@ static void lib_ring_buffer_pipe_buf_release(struct pipe_inode_info *pipe,
131  }
132  
133  static const struct pipe_buf_operations ring_buffer_pipe_buf_ops = {
134 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0))
135         .can_merge = 0,
136 +#endif
137  #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
138         .map = generic_pipe_buf_map,
139         .unmap = generic_pipe_buf_unmap,
140 From 8a88382fb09bbeda443044ee8cdb8f92040636bc Mon Sep 17 00:00:00 2001
141 From: Michael Jeanson <mjeanson@efficios.com>
142 Date: Mon, 18 Mar 2019 16:20:35 -0400
143 Subject: [PATCH] Fix: Revert "KVM: MMU: show mmu_valid_gen..." (v5.1)
144
145 See upstream commit :
146
147   commit b59c4830ca185ba0e9f9e046fb1cd10a4a92627a
148   Author: Sean Christopherson <sean.j.christopherson@intel.com>
149   Date:   Tue Feb 5 13:01:30 2019 -0800
150
151     Revert "KVM: MMU: show mmu_valid_gen in shadow page related tracepoints"
152
153     ...as part of removing x86 KVM's fast invalidate mechanism, i.e. this
154     is one part of a revert all patches from the series that introduced the
155     mechanism[1].
156
157     This reverts commit 2248b023219251908aedda0621251cffc548f258.
158
159 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
160 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
161 ---
162  .../events/lttng-module/arch/x86/kvm/mmutrace.h        | 10 +++++++++-
163  1 file changed, 9 insertions(+), 1 deletion(-)
164
165 diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
166 index 39ec6a98..e25a7745 100644
167 --- a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
168 +++ b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
169 @@ -14,7 +14,15 @@
170  #undef TRACE_SYSTEM
171  #define TRACE_SYSTEM kvm_mmu
172  
173 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
174 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
175 +
176 +#define LTTNG_KVM_MMU_PAGE_FIELDS \
177 +       ctf_integer(__u64, gfn, (sp)->gfn) \
178 +       ctf_integer(__u32, role, (sp)->role.word) \
179 +       ctf_integer(__u32, root_count, (sp)->root_count) \
180 +       ctf_integer(bool, unsync, (sp)->unsync)
181 +
182 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
183  
184  #define LTTNG_KVM_MMU_PAGE_FIELDS \
185         ctf_integer(unsigned long, mmu_valid_gen, (sp)->mmu_valid_gen) \
186 From 1b7b9c650ebb94358365512199559b0ece3e657c Mon Sep 17 00:00:00 2001
187 From: Michael Jeanson <mjeanson@efficios.com>
188 Date: Tue, 9 Apr 2019 14:12:41 -0400
189 Subject: [PATCH] Fix: Remove start and number from syscall_get_arguments()
190  args (v5.1)
191
192   commit b35f549df1d7520d37ba1e6d4a8d4df6bd52d136
193   Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
194   Date:   Mon Nov 7 16:26:37 2016 -0500
195
196     syscalls: Remove start and number from syscall_get_arguments() args
197
198     At Linux Plumbers, Andy Lutomirski approached me and pointed out that the
199     function call syscall_get_arguments() implemented in x86 was horribly
200     written and not optimized for the standard case of passing in 0 and 6 for
201     the starting index and the number of system calls to get. When looking at
202     all the users of this function, I discovered that all instances pass in only
203     0 and 6 for these arguments. Instead of having this function handle
204     different cases that are never used, simply rewrite it to return the first 6
205     arguments of a system call.
206
207     This should help out the performance of tracing system calls by ptrace,
208     ftrace and perf.
209
210     Link: http://lkml.kernel.org/r/20161107213233.754809394@goodmis.org
211
212 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
213 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
214 ---
215  lttng-syscalls.c  | 57 ++++++++++++++++++++++++-----------------------
216  wrapper/syscall.h | 34 ++++++++++++++++++++++++++++
217  2 files changed, 63 insertions(+), 28 deletions(-)
218  create mode 100644 wrapper/syscall.h
219
220 diff --git a/lttng-syscalls.c b/lttng-syscalls.c
221 index bcc06b5c..ebd9246c 100644
222 --- a/lttng-syscalls.c
223 +++ b/lttng-syscalls.c
224 @@ -25,6 +25,7 @@
225  #include <wrapper/tracepoint.h>
226  #include <wrapper/file.h>
227  #include <wrapper/rcu.h>
228 +#include <wrapper/syscall.h>
229  #include <lttng-events.h>
230  
231  #ifndef CONFIG_COMPAT
232 @@ -361,9 +362,9 @@ struct lttng_syscall_filter {
233  static void syscall_entry_unknown(struct lttng_event *event,
234         struct pt_regs *regs, unsigned int id)
235  {
236 -       unsigned long args[UNKNOWN_SYSCALL_NRARGS];
237 +       unsigned long args[LTTNG_SYSCALL_NR_ARGS];
238  
239 -       syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args);
240 +       lttng_syscall_get_arguments(current, regs, args);
241         if (unlikely(in_compat_syscall()))
242                 __event_probe__compat_syscall_entry_unknown(event, id, args);
243         else
244 @@ -432,9 +433,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
245         case 1:
246         {
247                 void (*fptr)(void *__data, unsigned long arg0) = entry->func;
248 -               unsigned long args[1];
249 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
250  
251 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
252 +               lttng_syscall_get_arguments(current, regs, args);
253                 fptr(event, args[0]);
254                 break;
255         }
256 @@ -443,9 +444,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
257                 void (*fptr)(void *__data,
258                         unsigned long arg0,
259                         unsigned long arg1) = entry->func;
260 -               unsigned long args[2];
261 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
262  
263 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
264 +               lttng_syscall_get_arguments(current, regs, args);
265                 fptr(event, args[0], args[1]);
266                 break;
267         }
268 @@ -455,9 +456,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
269                         unsigned long arg0,
270                         unsigned long arg1,
271                         unsigned long arg2) = entry->func;
272 -               unsigned long args[3];
273 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
274  
275 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
276 +               lttng_syscall_get_arguments(current, regs, args);
277                 fptr(event, args[0], args[1], args[2]);
278                 break;
279         }
280 @@ -468,9 +469,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
281                         unsigned long arg1,
282                         unsigned long arg2,
283                         unsigned long arg3) = entry->func;
284 -               unsigned long args[4];
285 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
286  
287 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
288 +               lttng_syscall_get_arguments(current, regs, args);
289                 fptr(event, args[0], args[1], args[2], args[3]);
290                 break;
291         }
292 @@ -482,9 +483,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
293                         unsigned long arg2,
294                         unsigned long arg3,
295                         unsigned long arg4) = entry->func;
296 -               unsigned long args[5];
297 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
298  
299 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
300 +               lttng_syscall_get_arguments(current, regs, args);
301                 fptr(event, args[0], args[1], args[2], args[3], args[4]);
302                 break;
303         }
304 @@ -497,9 +498,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
305                         unsigned long arg3,
306                         unsigned long arg4,
307                         unsigned long arg5) = entry->func;
308 -               unsigned long args[6];
309 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
310  
311 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
312 +               lttng_syscall_get_arguments(current, regs, args);
313                 fptr(event, args[0], args[1], args[2],
314                         args[3], args[4], args[5]);
315                 break;
316 @@ -512,9 +513,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
317  static void syscall_exit_unknown(struct lttng_event *event,
318         struct pt_regs *regs, int id, long ret)
319  {
320 -       unsigned long args[UNKNOWN_SYSCALL_NRARGS];
321 +       unsigned long args[LTTNG_SYSCALL_NR_ARGS];
322  
323 -       syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args);
324 +       lttng_syscall_get_arguments(current, regs, args);
325         if (unlikely(in_compat_syscall()))
326                 __event_probe__compat_syscall_exit_unknown(event, id, ret,
327                         args);
328 @@ -588,9 +589,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
329                 void (*fptr)(void *__data,
330                         long ret,
331                         unsigned long arg0) = entry->func;
332 -               unsigned long args[1];
333 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
334  
335 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
336 +               lttng_syscall_get_arguments(current, regs, args);
337                 fptr(event, ret, args[0]);
338                 break;
339         }
340 @@ -600,9 +601,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
341                         long ret,
342                         unsigned long arg0,
343                         unsigned long arg1) = entry->func;
344 -               unsigned long args[2];
345 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
346  
347 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
348 +               lttng_syscall_get_arguments(current, regs, args);
349                 fptr(event, ret, args[0], args[1]);
350                 break;
351         }
352 @@ -613,9 +614,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
353                         unsigned long arg0,
354                         unsigned long arg1,
355                         unsigned long arg2) = entry->func;
356 -               unsigned long args[3];
357 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
358  
359 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
360 +               lttng_syscall_get_arguments(current, regs, args);
361                 fptr(event, ret, args[0], args[1], args[2]);
362                 break;
363         }
364 @@ -627,9 +628,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
365                         unsigned long arg1,
366                         unsigned long arg2,
367                         unsigned long arg3) = entry->func;
368 -               unsigned long args[4];
369 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
370  
371 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
372 +               lttng_syscall_get_arguments(current, regs, args);
373                 fptr(event, ret, args[0], args[1], args[2], args[3]);
374                 break;
375         }
376 @@ -642,9 +643,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
377                         unsigned long arg2,
378                         unsigned long arg3,
379                         unsigned long arg4) = entry->func;
380 -               unsigned long args[5];
381 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
382  
383 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
384 +               lttng_syscall_get_arguments(current, regs, args);
385                 fptr(event, ret, args[0], args[1], args[2], args[3], args[4]);
386                 break;
387         }
388 @@ -658,9 +659,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
389                         unsigned long arg3,
390                         unsigned long arg4,
391                         unsigned long arg5) = entry->func;
392 -               unsigned long args[6];
393 +               unsigned long args[LTTNG_SYSCALL_NR_ARGS];
394  
395 -               syscall_get_arguments(current, regs, 0, entry->nrargs, args);
396 +               lttng_syscall_get_arguments(current, regs, args);
397                 fptr(event, ret, args[0], args[1], args[2],
398                         args[3], args[4], args[5]);
399                 break;
400 diff --git a/wrapper/syscall.h b/wrapper/syscall.h
401 new file mode 100644
402 index 00000000..8715f0c5
403 --- /dev/null
404 +++ b/wrapper/syscall.h
405 @@ -0,0 +1,34 @@
406 +/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
407 + *
408 + * wrapper/syscall.h
409 + *
410 + * wrapper around asm/syscall.h.
411 + *
412 + * Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
413 + */
414 +
415 +#ifndef _LTTNG_WRAPPER_SYSCALL_H
416 +#define _LTTNG_WRAPPER_SYSCALL_H
417 +
418 +#include <asm/syscall.h>
419 +#include <lttng-kernel-version.h>
420 +
421 +#define LTTNG_SYSCALL_NR_ARGS 6
422 +
423 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
424 +
425 +#define lttng_syscall_get_arguments(task, regs, args) \
426 +       syscall_get_arguments(task, regs, args)
427 +
428 +#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0) */
429 +
430 +static inline
431 +void lttng_syscall_get_arguments(struct task_struct *task,
432 +               struct pt_regs *regs, unsigned long *args)
433 +{
434 +       syscall_get_arguments(task, regs, 0, LTTNG_SYSCALL_NR_ARGS, args);
435 +}
436 +
437 +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0) */
438 +
439 +#endif /* _LTTNG_WRAPPER_SYSCALL_H */
This page took 0.074575 seconds and 3 git commands to generate.