]> git.pld-linux.org Git - packages/lttng-modules.git/blame - kernel-updates.patch
- updated upstream branch
[packages/lttng-modules.git] / kernel-updates.patch
CommitLineData
0c40909d
JR
1diff --git a/Makefile b/Makefile
2index eeffdfe..07d9d72 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -35,7 +35,8 @@ lttng-tracer-objs := lttng-events.o lttng-abi.o \
6 lttng-context-vtid.o lttng-context-ppid.o \
7 lttng-context-vppid.o lttng-calibrate.o \
8 lttng-context-hostname.o wrapper/random.o \
9- probes/lttng.o wrapper/trace-clock.o
10+ probes/lttng.o wrapper/trace-clock.o \
11+ wrapper/page_alloc.o
12
13 obj-m += lttng-statedump.o
14 lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o \
15@@ -53,7 +54,8 @@ lttng-tracer-objs += $(shell \
16 endif # CONFIG_PERF_EVENTS
17
18 lttng-tracer-objs += $(shell \
19- if [ $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 15 -a $(SUBLEVEL) -ge 0 ] ; then \
20+ if [ $(VERSION) -ge 4 \
21+ -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 15 -a $(SUBLEVEL) -ge 0 \) ] ; then \
22 echo "lttng-tracepoint.o" ; fi;)
23
24 obj-m += probes/
25diff --git a/instrumentation/events/lttng-module/compaction.h b/instrumentation/events/lttng-module/compaction.h
26index 3becac8..7914e23 100644
27--- a/instrumentation/events/lttng-module/compaction.h
28+++ b/instrumentation/events/lttng-module/compaction.h
29@@ -9,6 +9,60 @@
30 #include <linux/version.h>
31 #include <trace/events/gfpflags.h>
32
33+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
34+
35+LTTNG_TRACEPOINT_EVENT_CLASS(mm_compaction_isolate_template,
36+
37+ TP_PROTO(unsigned long start_pfn,
38+ unsigned long end_pfn,
39+ unsigned long nr_scanned,
40+ unsigned long nr_taken),
41+
42+ TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
43+
44+ TP_STRUCT__entry(
45+ __field(unsigned long, start_pfn)
46+ __field(unsigned long, end_pfn)
47+ __field(unsigned long, nr_scanned)
48+ __field(unsigned long, nr_taken)
49+ ),
50+
51+ TP_fast_assign(
52+ tp_assign(start_pfn, start_pfn)
53+ tp_assign(end_pfn, end_pfn)
54+ tp_assign(nr_scanned, nr_scanned)
55+ tp_assign(nr_taken, nr_taken)
56+ ),
57+
58+ TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu",
59+ __entry->start_pfn,
60+ __entry->end_pfn,
61+ __entry->nr_scanned,
62+ __entry->nr_taken)
63+)
64+
65+LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
66+
67+ TP_PROTO(unsigned long start_pfn,
68+ unsigned long end_pfn,
69+ unsigned long nr_scanned,
70+ unsigned long nr_taken),
71+
72+ TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
73+)
74+
75+LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
76+
77+ TP_PROTO(unsigned long start_pfn,
78+ unsigned long end_pfn,
79+ unsigned long nr_scanned,
80+ unsigned long nr_taken),
81+
82+ TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
83+)
84+
85+#else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
86+
87 LTTNG_TRACEPOINT_EVENT_CLASS(mm_compaction_isolate_template,
88
89 TP_PROTO(unsigned long nr_scanned,
90@@ -46,6 +100,8 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_is
91 TP_ARGS(nr_scanned, nr_taken)
92 )
93
94+#endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
95+
96 #if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \
97 LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
98 (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
802e7a46 99diff --git a/instrumentation/events/lttng-module/kmem.h b/instrumentation/events/lttng-module/kmem.h
0c40909d 100index 203a19c..710c9fa 100644
802e7a46
JR
101--- a/instrumentation/events/lttng-module/kmem.h
102+++ b/instrumentation/events/lttng-module/kmem.h
0c40909d 103@@ -286,7 +286,93 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT(mm_page, mm_page_pcpu_drain,
802e7a46
JR
104 __entry->order, __entry->migratetype)
105 )
106
107-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
0c40909d
JR
108+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
109+ || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0))
802e7a46
JR
110+
111+LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag,
112+
113+ TP_PROTO(struct page *page,
114+ int alloc_order, int fallback_order,
0c40909d 115+ int alloc_migratetype, int fallback_migratetype),
802e7a46
JR
116+
117+ TP_ARGS(page,
118+ alloc_order, fallback_order,
0c40909d 119+ alloc_migratetype, fallback_migratetype),
802e7a46
JR
120+
121+ TP_STRUCT__entry(
122+ __field_hex( struct page *, page )
123+ __field( int, alloc_order )
124+ __field( int, fallback_order )
125+ __field( int, alloc_migratetype )
126+ __field( int, fallback_migratetype )
127+ __field( int, change_ownership )
128+ ),
129+
130+ TP_fast_assign(
131+ tp_assign(page, page)
132+ tp_assign(alloc_order, alloc_order)
133+ tp_assign(fallback_order, fallback_order)
134+ tp_assign(alloc_migratetype, alloc_migratetype)
135+ tp_assign(fallback_migratetype, fallback_migratetype)
0c40909d
JR
136+ tp_assign(change_ownership,
137+ (alloc_migratetype == get_pageblock_migratetype(page)))
802e7a46
JR
138+ ),
139+
140+ TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
141+ __entry->page,
142+ page_to_pfn(__entry->page),
143+ __entry->alloc_order,
144+ __entry->fallback_order,
145+ pageblock_order,
146+ __entry->alloc_migratetype,
147+ __entry->fallback_migratetype,
148+ __entry->fallback_order < pageblock_order,
149+ __entry->change_ownership)
150+)
151+
0c40909d 152+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
802e7a46
JR
153+
154+LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag,
155+
156+ TP_PROTO(struct page *page,
157+ int alloc_order, int fallback_order,
0c40909d 158+ int alloc_migratetype, int fallback_migratetype, int new_migratetype),
802e7a46
JR
159+
160+ TP_ARGS(page,
161+ alloc_order, fallback_order,
0c40909d 162+ alloc_migratetype, fallback_migratetype, new_migratetype),
802e7a46
JR
163+
164+ TP_STRUCT__entry(
165+ __field_hex( struct page *, page )
166+ __field( int, alloc_order )
167+ __field( int, fallback_order )
168+ __field( int, alloc_migratetype )
169+ __field( int, fallback_migratetype )
170+ __field( int, change_ownership )
171+ ),
172+
173+ TP_fast_assign(
174+ tp_assign(page, page)
175+ tp_assign(alloc_order, alloc_order)
176+ tp_assign(fallback_order, fallback_order)
177+ tp_assign(alloc_migratetype, alloc_migratetype)
178+ tp_assign(fallback_migratetype, fallback_migratetype)
0c40909d 179+ tp_assign(change_ownership, (new_migratetype == alloc_migratetype))
802e7a46
JR
180+ ),
181+
182+ TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
183+ __entry->page,
184+ page_to_pfn(__entry->page),
185+ __entry->alloc_order,
186+ __entry->fallback_order,
187+ pageblock_order,
188+ __entry->alloc_migratetype,
189+ __entry->fallback_migratetype,
190+ __entry->fallback_order < pageblock_order,
191+ __entry->change_ownership)
192+)
193+
0c40909d 194+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
802e7a46
JR
195
196 LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag,
197
0c40909d
JR
198diff --git a/instrumentation/events/lttng-module/regmap.h b/instrumentation/events/lttng-module/regmap.h
199index 87df6a6..e1a27e7 100644
200--- a/instrumentation/events/lttng-module/regmap.h
201+++ b/instrumentation/events/lttng-module/regmap.h
202@@ -14,6 +14,50 @@ struct device;
203 struct regmap;
204 #endif
205
206+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,4))
207+/*
208+ * Log register events
209+ */
210+LTTNG_TRACEPOINT_EVENT_CLASS(regmap_reg,
211+
212+ TP_PROTO(struct regmap *map, unsigned int reg,
213+ unsigned int val),
214+
215+ TP_ARGS(map, reg, val),
216+
217+ TP_STRUCT__entry(
218+ __string( name, regmap_name(map))
219+ __field( unsigned int, reg )
220+ __field( unsigned int, val )
221+ ),
222+
223+ TP_fast_assign(
224+ tp_strcpy(name, regmap_name(map))
225+ tp_assign(reg, reg)
226+ tp_assign(val, val)
227+ ),
228+
229+ TP_printk("%s reg=%x val=%x", __get_str(name),
230+ (unsigned int)__entry->reg,
231+ (unsigned int)__entry->val)
232+)
233+
234+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_write,
235+
236+ TP_PROTO(struct regmap *map, unsigned int reg,
237+ unsigned int val),
238+
239+ TP_ARGS(map, reg, val)
240+)
241+
242+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_read,
243+
244+ TP_PROTO(struct regmap *map, unsigned int reg,
245+ unsigned int val),
246+
247+ TP_ARGS(map, reg, val)
248+)
249+#else
250 /*
251 * Log register events
252 */
253@@ -47,7 +91,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_write,
254 unsigned int val),
255
256 TP_ARGS(dev, reg, val)
257-
258 )
259
260 LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_read,
261@@ -56,20 +99,79 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_read,
262 unsigned int val),
263
264 TP_ARGS(dev, reg, val)
265-
266 )
267+#endif
268+
269+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,4))
270+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_read_cache,
271+
272+ TP_PROTO(struct regmap *map, unsigned int reg,
273+ unsigned int val),
274
275-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
276+ TP_ARGS(map, reg, val)
277+)
278+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
279 LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_reg, regmap_reg_read_cache,
280
281 TP_PROTO(struct device *dev, unsigned int reg,
282 unsigned int val),
283
284 TP_ARGS(dev, reg, val)
285-
286 )
287 #endif
288
289+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,4))
290+LTTNG_TRACEPOINT_EVENT_CLASS(regmap_block,
291+
292+ TP_PROTO(struct regmap *map, unsigned int reg, int count),
293+
294+ TP_ARGS(map, reg, count),
295+
296+ TP_STRUCT__entry(
297+ __string( name, regmap_name(map))
298+ __field( unsigned int, reg )
299+ __field( int, count )
300+ ),
301+
302+ TP_fast_assign(
303+ tp_strcpy(name, regmap_name(map))
304+ tp_assign(reg, reg)
305+ tp_assign(count, count)
306+ ),
307+
308+ TP_printk("%s reg=%x count=%d", __get_str(name),
309+ (unsigned int)__entry->reg,
310+ (int)__entry->count)
311+)
312+
313+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_block, regmap_hw_read_start,
314+
315+ TP_PROTO(struct regmap *map, unsigned int reg, int count),
316+
317+ TP_ARGS(map, reg, count)
318+)
319+
320+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_block, regmap_hw_read_done,
321+
322+ TP_PROTO(struct regmap *map, unsigned int reg, int count),
323+
324+ TP_ARGS(map, reg, count)
325+)
326+
327+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_block, regmap_hw_write_start,
328+
329+ TP_PROTO(struct regmap *map, unsigned int reg, int count),
330+
331+ TP_ARGS(map, reg, count)
332+)
333+
334+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_block, regmap_hw_write_done,
335+
336+ TP_PROTO(struct regmap *map, unsigned int reg, int count),
337+
338+ TP_ARGS(map, reg, count)
339+)
340+#else
341 LTTNG_TRACEPOINT_EVENT_CLASS(regmap_block,
342
343 TP_PROTO(struct device *dev, unsigned int reg, int count),
344@@ -120,7 +222,32 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_block, regmap_hw_write_done,
345
346 TP_ARGS(dev, reg, count)
347 )
348+#endif
349
350+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,4))
351+LTTNG_TRACEPOINT_EVENT(regcache_sync,
352+
353+ TP_PROTO(struct regmap *map, const char *type,
354+ const char *status),
355+
356+ TP_ARGS(map, type, status),
357+
358+ TP_STRUCT__entry(
359+ __string( name, regmap_name(map))
360+ __string( status, status )
361+ __string( type, type )
362+ ),
363+
364+ TP_fast_assign(
365+ tp_strcpy(name, regmap_name(map))
366+ tp_strcpy(status, status)
367+ tp_strcpy(type, type)
368+ ),
369+
370+ TP_printk("%s type=%s status=%s", __get_str(name),
371+ __get_str(type), __get_str(status))
372+)
373+#else
374 LTTNG_TRACEPOINT_EVENT(regcache_sync,
375
376 TP_PROTO(struct device *dev, const char *type,
377@@ -143,8 +270,44 @@ LTTNG_TRACEPOINT_EVENT(regcache_sync,
378 TP_printk("%s type=%s status=%s", __get_str(name),
379 __get_str(type), __get_str(status))
380 )
381+#endif
382+
383+
384+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,4))
385+LTTNG_TRACEPOINT_EVENT_CLASS(regmap_bool,
386
387-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
388+ TP_PROTO(struct regmap *map, bool flag),
389+
390+ TP_ARGS(map, flag),
391+
392+ TP_STRUCT__entry(
393+ __string( name, regmap_name(map))
394+ __field( int, flag )
395+ ),
396+
397+ TP_fast_assign(
398+ tp_strcpy(name, regmap_name(map))
399+ tp_assign(flag, flag)
400+ ),
401+
402+ TP_printk("%s flag=%d", __get_str(name),
403+ (int)__entry->flag)
404+)
405+
406+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_bool, regmap_cache_only,
407+
408+ TP_PROTO(struct regmap *map, bool flag),
409+
410+ TP_ARGS(map, flag)
411+)
412+
413+LTTNG_TRACEPOINT_EVENT_INSTANCE(regmap_bool, regmap_cache_bypass,
414+
415+ TP_PROTO(struct regmap *map, bool flag),
416+
417+ TP_ARGS(map, flag)
418+)
419+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
420 LTTNG_TRACEPOINT_EVENT_CLASS(regmap_bool,
421
422 TP_PROTO(struct device *dev, bool flag),
423diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
424index a7657ed..79f84b7 100644
425--- a/instrumentation/events/lttng-module/writeback.h
426+++ b/instrumentation/events/lttng-module/writeback.h
427@@ -12,6 +12,8 @@
428
429 #ifndef _TRACE_WRITEBACK_DEF_
430 #define _TRACE_WRITEBACK_DEF_
431+
432+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
433 static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
434 {
435 struct super_block *sb = inode->i_sb;
436@@ -21,8 +23,26 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
437
438 return sb->s_bdi;
439 }
440+#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */
441+
442 #endif
443
444+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
445+#define show_inode_state(state) \
446+ __print_flags(state, "|", \
447+ {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
448+ {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
449+ {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
450+ {I_NEW, "I_NEW"}, \
451+ {I_WILL_FREE, "I_WILL_FREE"}, \
452+ {I_FREEING, "I_FREEING"}, \
453+ {I_CLEAR, "I_CLEAR"}, \
454+ {I_SYNC, "I_SYNC"}, \
455+ {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
456+ {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
457+ {I_REFERENCED, "I_REFERENCED"} \
458+ )
459+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
460 #define show_inode_state(state) \
461 __print_flags(state, "|", \
462 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
463@@ -35,6 +55,7 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
464 {I_SYNC, "I_SYNC"}, \
465 {I_REFERENCED, "I_REFERENCED"} \
466 )
467+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
468
469 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
470 #define WB_WORK_REASON \
471@@ -48,7 +69,91 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
472 {WB_REASON_FORKER_THREAD, "forker_thread"}
473 #endif
474
475-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
476+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
477+
478+LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
479+ TP_PROTO(struct page *page, struct address_space *mapping),
480+ TP_ARGS(page, mapping),
481+ TP_STRUCT__entry (
482+ __array_text(char, name, 32)
483+ __field(unsigned long, ino)
484+ __field(pgoff_t, index)
485+ ),
486+ TP_fast_assign(
487+ tp_memcpy(name,
488+ mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32)
489+ tp_assign(ino, mapping ? mapping->host->i_ino : 0)
490+ tp_assign(index, page->index)
491+ ),
492+ TP_printk("bdi %s: ino=%lu index=%lu",
493+ __entry->name,
494+ __entry->ino,
495+ __entry->index
496+ )
497+)
498+
499+LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
500+ TP_PROTO(struct inode *inode, int flags),
501+ TP_ARGS(inode, flags),
502+ TP_STRUCT__entry (
503+ __array_text(char, name, 32)
504+ __field(unsigned long, ino)
505+ __field(unsigned long, state)
506+ __field(unsigned long, flags)
507+ ),
508+ TP_fast_assign(
509+ /* may be called for files on pseudo FSes w/ unregistered bdi */
510+ tp_memcpy(name,
511+ inode_to_bdi(inode)->dev ?
512+ dev_name(inode_to_bdi(inode)->dev) : "(unknown)", 32)
513+ tp_assign(ino, inode->i_ino)
514+ tp_assign(state, inode->i_state)
515+ tp_assign(flags, flags)
516+ ),
517+ TP_printk("bdi %s: ino=%lu flags=%s",
518+ __entry->name,
519+ __entry->ino,
520+ show_inode_state(__entry->flags)
521+ )
522+)
523+#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
524+LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
525+ TP_PROTO(struct inode *inode, int flags), \
526+ TP_ARGS(inode, flags))
527+LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
528+LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
529+LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty)
530+
531+LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
532+ TP_PROTO(struct inode *inode, struct writeback_control *wbc),
533+ TP_ARGS(inode, wbc),
534+ TP_STRUCT__entry (
535+ __array_text(char, name, 32)
536+ __field(unsigned long, ino)
537+ __field(int, sync_mode)
538+ ),
539+ TP_fast_assign(
540+ tp_memcpy(name,
541+ dev_name(inode_to_bdi(inode)->dev), 32)
542+ tp_assign(ino, inode->i_ino)
543+ tp_assign(sync_mode, wbc->sync_mode)
544+ ),
545+ TP_printk("bdi %s: ino=%lu sync_mode=%d",
546+ __entry->name,
547+ __entry->ino,
548+ __entry->sync_mode
549+ )
550+)
551+
552+#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
553+LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
554+ TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
555+ TP_ARGS(inode, wbc))
556+LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
557+LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
558+
559+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
560+
561 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
562 TP_PROTO(struct page *page, struct address_space *mapping),
563 TP_ARGS(page, mapping),
564@@ -126,8 +231,28 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
565 TP_ARGS(inode, wbc))
566 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
567 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
568+
569 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
570
571+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
572+
573+LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
574+ TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
575+ TP_ARGS(bdi, work),
576+ TP_STRUCT__entry(
577+ __array_text(char, name, 32)
578+ ),
579+ TP_fast_assign(
580+ tp_memcpy(name, bdi->dev ? dev_name(bdi->dev) :
581+ "(unknown)", 32)
582+ ),
583+ TP_printk("bdi %s",
584+ __entry->name
585+ )
586+)
587+
588+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
589+
590 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
591 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
592 TP_ARGS(bdi, work),
593@@ -142,6 +267,9 @@ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
594 __entry->name
595 )
596 )
597+
598+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
599+
600 #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
601 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
602 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
603diff --git a/lttng-events.c b/lttng-events.c
604index 135c8c5..2820a0e 100644
605--- a/lttng-events.c
606+++ b/lttng-events.c
607@@ -20,6 +20,12 @@
608 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
609 */
610
611+/*
612+ * This page_alloc.h wrapper needs to be included before gfpflags.h because it
613+ * overrides a function with a define.
614+ */
615+#include "wrapper/page_alloc.h"
616+
617 #include <linux/module.h>
618 #include <linux/list.h>
619 #include <linux/mutex.h>
620@@ -1271,7 +1277,9 @@ static int __init lttng_events_init(void)
621 ret = wrapper_lttng_fixup_sig(THIS_MODULE);
622 if (ret)
623 return ret;
624-
625+ ret = wrapper_get_pfnblock_flags_mask_init();
626+ if (ret)
627+ return ret;
628 ret = lttng_tracepoint_init();
629 if (ret)
630 return ret;
631diff --git a/lttng-kernel-version.h b/lttng-kernel-version.h
632index 8fad8b0..ec8cee0 100644
633--- a/lttng-kernel-version.h
634+++ b/lttng-kernel-version.h
635@@ -24,7 +24,12 @@
636 */
637
638 #include <linux/version.h>
639-#include <linux/vermagic.h>
640+
641+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
642+#include <generated/utsrelease.h>
643+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) */
644+#include <linux/utsrelease.h>
645+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) */
646
647 /*
648 * This macro checks if the kernel version is between the two specified
649diff --git a/probes/Makefile b/probes/Makefile
650index 8e4ceb7..ee91224 100644
651--- a/probes/Makefile
652+++ b/probes/Makefile
653@@ -169,37 +169,43 @@ CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
654 endif
655
656 obj-m += $(shell \
657- if [ \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
658+ if [ $(VERSION) -ge 4 \
659+ -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
660 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
661 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
662 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \
663 echo "lttng-probe-random.o" ; fi;)
664
665 obj-m += $(shell \
666- if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 2 ] ; then \
667+ if [ $(VERSION) -ge 4 \
668+ -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
669 echo "lttng-probe-rcu.o" ; fi;)
670
671 ifneq ($(CONFIG_REGMAP),)
672 obj-m += $(shell \
673- if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 2 ] ; then \
674+ if [ $(VERSION) -ge 4 \
675+ -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
676 echo "lttng-probe-regmap.o" ; fi;)
677 endif
678
679 ifneq ($(CONFIG_PM_RUNTIME),)
680 obj-m += $(shell \
681- if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 2 ] ; then \
682+ if [ $(VERSION) -ge 4 \
683+ -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
684 echo "lttng-probe-rpm.o" ; fi;)
685 endif
686
687 ifneq ($(CONFIG_SUNRPC),)
688 obj-m += $(shell \
689- if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 4 ] ; then \
690+ if [ $(VERSION) -ge 4 \
691+ -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
692 echo "lttng-probe-sunrpc.o" ; fi;)
693 endif
694
695 ifneq ($(CONFIG_VIDEO_V4L2),)
696 obj-m += $(shell \
697- if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 14 ] ; then \
698+ if [ $(VERSION) -ge 4 \
699+ -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 14 \) ] ; then \
700 echo "lttng-probe-v4l2.o" ; fi;)
701 endif
702
703diff --git a/probes/lttng-events.h b/probes/lttng-events.h
704index 22cabba..0796b71 100644
705--- a/probes/lttng-events.h
706+++ b/probes/lttng-events.h
707@@ -181,7 +181,39 @@ void trace_##_name(_proto);
708
709 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
710 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
711-void trace_##_name(void *__data);
712+void trace_##_name(void);
713+
714+ /*
715+ * Stage 1.1 of the trace events.
716+ *
717+ * Create dummy trace prototypes for each event class, and for each used
718+ * template. This will allow checking whether the prototypes from the
719+ * class and the instance using the class actually match.
720+ */
721+
722+#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
723+
724+#undef TP_PROTO
725+#define TP_PROTO(args...) args
726+
727+#undef TP_ARGS
728+#define TP_ARGS(args...) args
729+
730+#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
731+#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
732+void __event_template_proto___##_template(_proto);
733+
734+#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
735+#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
736+void __event_template_proto___##_template(void);
737+
738+#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
739+#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _tstruct, _assign, _print) \
740+void __event_template_proto___##_name(_proto);
741+
742+#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
743+#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _tstruct, _assign, _print) \
744+void __event_template_proto___##_name(void);
745
746 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
747
748diff --git a/probes/lttng-probe-kmem.c b/probes/lttng-probe-kmem.c
749index c8252ec..0120241 100644
750--- a/probes/lttng-probe-kmem.c
751+++ b/probes/lttng-probe-kmem.c
752@@ -21,6 +21,11 @@
753 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
754 */
755
756+/*
757+ * This page_alloc.h wrapper needs to be included before gfpflags.h because it
758+ * overrides a function with a define.
759+ */
760+#include "../wrapper/page_alloc.h"
761 #include <linux/module.h>
762 #include "../lttng-tracer.h"
763
764diff --git a/wrapper/page_alloc.c b/wrapper/page_alloc.c
765new file mode 100644
766index 0000000..184ec71
767--- /dev/null
768+++ b/wrapper/page_alloc.c
769@@ -0,0 +1,68 @@
770+/*
771+ * wrapper/page_alloc.c
772+ *
773+ * wrapper around get_pfnblock_flags_mask. Using KALLSYMS to get its address
774+ * when available, else we need to have a kernel that exports this function to
775+ * GPL modules.
776+ *
777+ * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
778+ *
779+ * This library is free software; you can redistribute it and/or
780+ * modify it under the terms of the GNU Lesser General Public
781+ * License as published by the Free Software Foundation; only
782+ * version 2.1 of the License.
783+ *
784+ * This library is distributed in the hope that it will be useful,
785+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
786+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
787+ * Lesser General Public License for more details.
788+ *
789+ * You should have received a copy of the GNU Lesser General Public
790+ * License along with this library; if not, write to the Free Software
791+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
792+ */
793+
794+#include "../lttng-kernel-version.h"
795+
796+#if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2))
797+
798+#include <linux/kallsyms.h>
799+#include <linux/mm_types.h>
800+#include <linux/module.h>
801+#include "kallsyms.h"
802+#include "page_alloc.h"
803+
804+static
805+unsigned long (*get_pfnblock_flags_mask_sym)(struct page *page,
806+ unsigned long pfn,
807+ unsigned long end_bitidx,
808+ unsigned long mask);
809+
810+unsigned long wrapper_get_pfnblock_flags_mask(struct page *page,
811+ unsigned long pfn,
812+ unsigned long end_bitidx,
813+ unsigned long mask)
814+{
815+ WARN_ON_ONCE(!get_pfnblock_flags_mask_sym);
816+ if (get_pfnblock_flags_mask_sym) {
817+ return get_pfnblock_flags_mask_sym(page, pfn, end_bitidx, mask);
818+ } else {
819+ return -ENOSYS;
820+ }
821+}
822+EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask);
823+
824+int wrapper_get_pfnblock_flags_mask_init(void)
825+{
826+ get_pfnblock_flags_mask_sym =
827+ (void *) kallsyms_lookup_funcptr("get_pfnblock_flags_mask");
828+ if (!get_pfnblock_flags_mask_sym)
829+ return -1;
830+ return 0;
831+}
832+
833+#else /* #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */
834+
835+#include <linux/pageblock-flags.h>
836+
837+#endif /* #else #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */
838diff --git a/wrapper/page_alloc.h b/wrapper/page_alloc.h
839new file mode 100644
840index 0000000..06e2ddc
841--- /dev/null
842+++ b/wrapper/page_alloc.h
843@@ -0,0 +1,54 @@
844+#ifndef _LTTNG_WRAPPER_PAGE_ALLOC_H
845+#define _LTTNG_WRAPPER_PAGE_ALLOC_H
846+
847+/*
848+ * wrapper/page_alloc.h
849+ *
850+ * wrapper around get_pfnblock_flags_mask. Using KALLSYMS to get its address
851+ * when available, else we need to have a kernel that exports this function to
852+ * GPL modules.
853+ *
854+ * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
855+ *
856+ * This library is free software; you can redistribute it and/or
857+ * modify it under the terms of the GNU Lesser General Public
858+ * License as published by the Free Software Foundation; only
859+ * version 2.1 of the License.
860+ *
861+ * This library is distributed in the hope that it will be useful,
862+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
863+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
864+ * Lesser General Public License for more details.
865+ *
866+ * You should have received a copy of the GNU Lesser General Public
867+ * License along with this library; if not, write to the Free Software
868+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
869+ */
870+
871+#include "../lttng-kernel-version.h"
872+
873+/*
874+ * We need to redefine get_pfnblock_flags_mask to our wrapper, because
875+ * the get_pageblock_migratetype() macro uses it.
876+ */
877+#if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2))
878+
879+#define get_pfnblock_flags_mask wrapper_get_pfnblock_flags_mask
880+
881+#include <linux/mm_types.h>
882+
883+int wrapper_get_pfnblock_flags_mask_init(void);
884+
885+#else /* #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */
886+
887+#include <linux/mm_types.h>
888+
889+static inline
890+int wrapper_get_pfnblock_flags_mask_init(void)
891+{
892+ return 0;
893+}
894+
895+#endif /* else #if defined(CONFIG_KALLSYMS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)) */
896+
897+#endif /* _LTTNG_WRAPPER_PAGE_ALLOC_H */
This page took 0.297655 seconds and 4 git commands to generate.