Package: lttng-modules
Version: 2.5.0-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu  ubuntu-patch

Dear Maintainer,

*** /tmp/tmp75lvr6/bug_body

In Ubuntu, the attached patch was applied to achieve the following:
  * Fix dkms build failure for Utopic kernels (LP: #1396758)


Thanks for considering the patch.


-- System Information:
Debian Release: jessie/sid
  APT prefers trusty-updates
  APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 
'trusty'), (100, 'trusty-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-37-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru lttng-modules-2.5.0/debian/changelog lttng-modules-2.5.0/debian/changelog
diff -Nru lttng-modules-2.5.0/debian/patches/lttng-modules-2.5.0-Utopic.patch lttng-modules-2.5.0/debian/patches/lttng-modules-2.5.0-Utopic.patch
--- lttng-modules-2.5.0/debian/patches/lttng-modules-2.5.0-Utopic.patch	1969-12-31 19:00:00.000000000 -0500
+++ lttng-modules-2.5.0/debian/patches/lttng-modules-2.5.0-Utopic.patch	2014-12-17 16:20:25.000000000 -0500
@@ -0,0 +1,197 @@
+Description: Add support for 3.16 kernel and LTTNG_UBUNTU_VERSION_CODE.
+ 
+ lttng-modules (2.5.0-1ubuntu1) utopic; urgency=medium
+ .
+   * Fix dkms build failure for Utopic kernels (LP: #1396758)
+Author: Joseph Salisbury <[email protected]>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1396758
+
+--- lttng-modules-2.5.0.orig/instrumentation/events/lttng-module/compaction.h
++++ lttng-modules-2.5.0/instrumentation/events/lttng-module/compaction.h
+@@ -6,6 +6,7 @@
+ 
+ #include <linux/types.h>
+ #include <linux/tracepoint.h>
++#include <linux/version.h>
+ #include <trace/events/gfpflags.h>
+ 
+ DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
+@@ -45,6 +46,48 @@ DEFINE_EVENT(mm_compaction_isolate_templ
+ 	TP_ARGS(nr_scanned, nr_taken)
+ )
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
++TRACE_EVENT(mm_compaction_migratepages,
++
++	TP_PROTO(unsigned long nr_all,
++		int migrate_rc,
++		struct list_head *migratepages),
++
++	TP_ARGS(nr_all, migrate_rc, migratepages),
++
++	TP_STRUCT__entry(
++		__field(unsigned long, nr_migrated)
++		__field(unsigned long, nr_failed)
++	),
++
++	TP_fast_assign(
++		tp_assign(nr_migrated,
++			nr_all -
++			(migrate_rc >= 0 ? migrate_rc :
++				({
++					unsigned long nr_failed = 0;
++					struct list_head *page_lru;
++
++					list_for_each(page_lru, migratepages)
++						nr_failed++;
++					nr_failed;
++				})))
++		tp_assign(nr_failed,
++				({
++					unsigned long nr_failed = 0;
++					struct list_head *page_lru;
++
++					list_for_each(page_lru, migratepages)
++						nr_failed++;
++					nr_failed;
++				}))
++	),
++
++	TP_printk("nr_migrated=%lu nr_failed=%lu",
++		__entry->nr_migrated,
++		__entry->nr_failed)
++)
++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
+ TRACE_EVENT(mm_compaction_migratepages,
+ 
+ 	TP_PROTO(unsigned long nr_migrated,
+@@ -66,7 +109,7 @@ TRACE_EVENT(mm_compaction_migratepages,
+ 		__entry->nr_migrated,
+ 		__entry->nr_failed)
+ )
+-
++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
+ 
+ #endif /* _TRACE_COMPACTION_H */
+ 
+--- lttng-modules-2.5.0.orig/instrumentation/events/lttng-module/vmscan.h
++++ lttng-modules-2.5.0/instrumentation/events/lttng-module/vmscan.h
+@@ -238,6 +238,44 @@ TRACE_EVENT(mm_shrink_slab_start,
+ 		__entry->total_scan)
+ )
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
++TRACE_EVENT(mm_shrink_slab_end,
++	TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval,
++		long unused_scan_cnt, long new_scan_cnt, long total_scan),
++
++	TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt,
++		total_scan),
++
++	TP_STRUCT__entry(
++		__field(struct shrinker *, shr)
++		__field(int, nid)
++		__field(void *, shrink)
++		__field(long, unused_scan)
++		__field(long, new_scan)
++		__field(int, retval)
++		__field(long, total_scan)
++	),
++
++	TP_fast_assign(
++		tp_assign(shr, shr)
++		tp_assign(nid, nid)
++		tp_assign(shrink, shr->scan_objects)
++		tp_assign(unused_scan, unused_scan_cnt)
++		tp_assign(new_scan, new_scan_cnt)
++		tp_assign(retval, shrinker_retval)
++		tp_assign(total_scan, total_scan)
++	),
++
++	TP_printk("%pF %p: nid %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d",
++		__entry->shrink,
++		__entry->shr,
++		__entry->nid,
++		__entry->unused_scan,
++		__entry->new_scan,
++		__entry->total_scan,
++		__entry->retval)
++)
++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
+ TRACE_EVENT(mm_shrink_slab_end,
+ 	TP_PROTO(struct shrinker *shr, int shrinker_retval,
+ 		long unused_scan_cnt, long new_scan_cnt),
+@@ -274,6 +312,7 @@ TRACE_EVENT(mm_shrink_slab_end,
+ 		__entry->total_scan,
+ 		__entry->retval)
+ )
++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
+ #endif
+ 
+ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
+--- lttng-modules-2.5.0.orig/lttng-kernel-version.h
++++ lttng-modules-2.5.0/lttng-kernel-version.h
+@@ -24,6 +24,7 @@
+  */
+ 
+ #include <linux/version.h>
++#include <linux/vermagic.h>
+ 
+ /*
+  * This macro checks if the kernel version is between the two specified
+@@ -33,4 +34,18 @@
+ 	(LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
+ 	 LINUX_VERSION_CODE < KERNEL_VERSION(a_high, b_high, c_high))
+ 
++#define LTTNG_UBUNTU_KERNEL_VERSION(a, b, c, d) \
++	(((a) << 24) + ((b) << 16) + (c << 8) + (d))
++
++#define LTTNG_UBUNTU_VERSION_CODE \
++	((LINUX_VERSION_CODE << 8) + UTS_UBUNTU_RELEASE_ABI)
++
++#define LTTNG_UBUNTU_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
++		a_high, b_high, c_high, d_high) \
++	(defined(UTS_UBUNTU_RELEASE_ABI) && \
++		LTTNG_UBUNTU_VERSION_CODE >= \
++		LTTNG_UBUNTU_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
++		LTTNG_UBUNTU_VERSION_CODE < \
++		LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
++
+ #endif /* _LTTNG_KERNEL_VERSION_H */
+--- lttng-modules-2.5.0.orig/lttng-statedump-impl.c
++++ lttng-modules-2.5.0/lttng-statedump-impl.c
+@@ -389,8 +389,20 @@ void lttng_statedump_process_ns(struct l
+ 	struct nsproxy *proxy;
+ 	struct pid_namespace *pid_ns;
+ 
++	/*
++	* Back and forth on locking strategy within Linux upstream for nsproxy.
++	* See Linux upstream commit 728dba3a39c66b3d8ac889ddbe38b5b1c264aec3
++	* "namespaces: Use task_lock and not rcu to protect nsproxy"
++	* for details.
++	*/
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) || \
++		LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,36, 3,14,0,0) || \
++		LTTNG_UBUNTU_KERNEL_RANGE(3,16,0,11, 3,17,0,0))
++	proxy = p->nsproxy;
++#else
+ 	rcu_read_lock();
+ 	proxy = task_nsproxy(p);
++#endif
+ 	if (proxy) {
+ 		pid_ns = lttng_get_proxy_pid_ns(proxy);
+ 		do {
+@@ -402,7 +414,13 @@ void lttng_statedump_process_ns(struct l
+ 		trace_lttng_statedump_process_state(session,
+ 			p, type, mode, submode, status, NULL);
+ 	}
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) || \
++		LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,36, 3,14,0,0) || \
++		LTTNG_UBUNTU_KERNEL_RANGE(3,16,0,11, 3,17,0,0))
++	/* (nothing) */
++#else
+ 	rcu_read_unlock();
++#endif
+ }
+ 
+ static
diff -Nru lttng-modules-2.5.0/debian/patches/series lttng-modules-2.5.0/debian/patches/series
--- lttng-modules-2.5.0/debian/patches/series	1969-12-31 19:00:00.000000000 -0500
+++ lttng-modules-2.5.0/debian/patches/series	2014-12-17 16:15:57.000000000 -0500
@@ -0,0 +1 @@
+lttng-modules-2.5.0-Utopic.patch

Reply via email to