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)
8 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
9 Author: Souptick Joarder <jrdr.linux@gmail.com>
10 Date: Thu Mar 7 16:31:14 2019 -0800
12 mm: create the new vm_fault_t type
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.
22 VM_FAULT_SET_HINDEX and VM_FAULT_GET_HINDEX values are changed to avoid
23 conflict with other VM_FAULT codes.
25 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
27 lib/ringbuffer/ring_buffer_mmap.c | 12 +++++++++++-
28 1 file changed, 11 insertions(+), 1 deletion(-)
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
36 * fault() vm_op implementation for ring buffer file mapping.
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)
41 static int lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf)
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
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)
54 + struct vm_area_struct *vma = vmf->vma;
55 + return lib_ring_buffer_fault_compat(vma, vmf);
57 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
58 static int lib_ring_buffer_fault(struct vm_fault *vmf)
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...
69 commit 6ba7d681aca22e53385bdb35b1d7662e61905760
70 Author: Paul E. McKenney <paulmck@linux.ibm.com>
71 Date: Wed Jan 9 15:22:03 2019 -0800
73 rcu: Remove wrapper definitions for obsolete RCU update functions
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.
81 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
83 lttng-events.c | 5 +++++
84 1 file changed, 5 insertions(+)
86 diff --git a/lttng-events.c b/lttng-events.c
87 index 566080a3..f4206c54 100644
90 @@ -75,7 +75,12 @@ int _lttng_field_statedump(struct lttng_session *session,
92 void synchronize_trace(void)
94 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
100 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
101 #ifdef CONFIG_PREEMPT_RT_FULL
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)
110 commit 01e7187b41191376cee8bea8de9f907b001e87b4
111 Author: Jann Horn <jannh@google.com>
112 Date: Wed Jan 23 15:19:18 2019 +0100
114 pipe: stop using ->can_merge
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.
120 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
121 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
123 lib/ringbuffer/ring_buffer_splice.c | 2 ++
124 1 file changed, 2 insertions(+)
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,
133 static const struct pipe_buf_operations ring_buffer_pipe_buf_ops = {
134 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0))
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)
145 See upstream commit :
147 commit b59c4830ca185ba0e9f9e046fb1cd10a4a92627a
148 Author: Sean Christopherson <sean.j.christopherson@intel.com>
149 Date: Tue Feb 5 13:01:30 2019 -0800
151 Revert "KVM: MMU: show mmu_valid_gen in shadow page related tracepoints"
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
157 This reverts commit 2248b023219251908aedda0621251cffc548f258.
159 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
160 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
162 .../events/lttng-module/arch/x86/kvm/mmutrace.h | 10 +++++++++-
163 1 file changed, 9 insertions(+), 1 deletion(-)
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
171 #define TRACE_SYSTEM kvm_mmu
173 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
174 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
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)
182 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
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()
192 commit b35f549df1d7520d37ba1e6d4a8d4df6bd52d136
193 Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
194 Date: Mon Nov 7 16:26:37 2016 -0500
196 syscalls: Remove start and number from syscall_get_arguments() args
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.
207 This should help out the performance of tracing system calls by ptrace,
210 Link: http://lkml.kernel.org/r/20161107213233.754809394@goodmis.org
212 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
213 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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
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
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>
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)
236 - unsigned long args[UNKNOWN_SYSCALL_NRARGS];
237 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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);
244 @@ -432,9 +433,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
247 void (*fptr)(void *__data, unsigned long arg0) = entry->func;
248 - unsigned long args[1];
249 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
251 - syscall_get_arguments(current, regs, 0, entry->nrargs, args);
252 + lttng_syscall_get_arguments(current, regs, args);
253 fptr(event, args[0]);
256 @@ -443,9 +444,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
257 void (*fptr)(void *__data,
259 unsigned long arg1) = entry->func;
260 - unsigned long args[2];
261 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
268 @@ -455,9 +456,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
271 unsigned long arg2) = entry->func;
272 - unsigned long args[3];
273 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
280 @@ -468,9 +469,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
283 unsigned long arg3) = entry->func;
284 - unsigned long args[4];
285 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
292 @@ -482,9 +483,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
295 unsigned long arg4) = entry->func;
296 - unsigned long args[5];
297 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
304 @@ -497,9 +498,9 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
307 unsigned long arg5) = entry->func;
308 - unsigned long args[6];
309 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
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)
320 - unsigned long args[UNKNOWN_SYSCALL_NRARGS];
321 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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,
328 @@ -588,9 +589,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
329 void (*fptr)(void *__data,
331 unsigned long arg0) = entry->func;
332 - unsigned long args[1];
333 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
335 - syscall_get_arguments(current, regs, 0, entry->nrargs, args);
336 + lttng_syscall_get_arguments(current, regs, args);
337 fptr(event, ret, args[0]);
340 @@ -600,9 +601,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
343 unsigned long arg1) = entry->func;
344 - unsigned long args[2];
345 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
352 @@ -613,9 +614,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
355 unsigned long arg2) = entry->func;
356 - unsigned long args[3];
357 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
364 @@ -627,9 +628,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
367 unsigned long arg3) = entry->func;
368 - unsigned long args[4];
369 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
376 @@ -642,9 +643,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
379 unsigned long arg4) = entry->func;
380 - unsigned long args[5];
381 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
388 @@ -658,9 +659,9 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
391 unsigned long arg5) = entry->func;
392 - unsigned long args[6];
393 + unsigned long args[LTTNG_SYSCALL_NR_ARGS];
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]);
400 diff --git a/wrapper/syscall.h b/wrapper/syscall.h
402 index 00000000..8715f0c5
404 +++ b/wrapper/syscall.h
406 +/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
408 + * wrapper/syscall.h
410 + * wrapper around asm/syscall.h.
412 + * Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
415 +#ifndef _LTTNG_WRAPPER_SYSCALL_H
416 +#define _LTTNG_WRAPPER_SYSCALL_H
418 +#include <asm/syscall.h>
419 +#include <lttng-kernel-version.h>
421 +#define LTTNG_SYSCALL_NR_ARGS 6
423 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
425 +#define lttng_syscall_get_arguments(task, regs, args) \
426 + syscall_get_arguments(task, regs, args)
428 +#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0) */
431 +void lttng_syscall_get_arguments(struct task_struct *task,
432 + struct pt_regs *regs, unsigned long *args)
434 + syscall_get_arguments(task, regs, 0, LTTNG_SYSCALL_NR_ARGS, args);
437 +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0) */
439 +#endif /* _LTTNG_WRAPPER_SYSCALL_H */