Fix: Add granularity to RHEL kernel version checks
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mathieu Desnoyers
Appliedmerged into master, stable-2.8 and stable-2.7, thanks!
Mathieu
Quoted 216 lines · ----- On Mar 29, 2016, at 7:32 PM, Michael Jeanson [email protected] wrote:
Our RHEL kernel version macros were based on the major and minor version of the distribution version like "7.2" instead of the full kernel version like "327.4.4". This prevented us from adding compatibility changes with sufficient granularity.
Signed-off-by Michael Jeanson <[email protected]>---
Makefile.ABI.workarounds | 6 ++++++ abi-rhel-version.sh | 21 +++++++++++++++++++++ instrumentation/events/lttng-module/block.h | 2 +- instrumentation/events/lttng-module/kvm.h | 4 ++-- instrumentation/events/lttng-module/scsi.h | 2 +- instrumentation/events/lttng-module/writeback.h | 3 ++- lttng-kernel-version.h | 24 ++++++++++++++++-------- wrapper/trace-clock.h | 2 +- 8 files changed, 50 insertions(+), 14 deletions(-)create mode 100755
abi-rhel-version.shMakefile.ABI.workarounds +0
-0@@ -10,6 +10,12 @@ ifneq ($(DEB_API_VERSION), 0) ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)endif
+RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-rhel-version.sh $(CURDIR))
Makefile.ABI.workarounds +5
-0+ +ifneq ($(RHEL_API_VERSION), 0) + ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION) +endif +RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR))
ifneq ($(RT_PATCH_VERSION), 0)
abi-rhel-version.sh new file +12
-0@@ -0,0 +1,21 @@ +#!/bin/sh + +# First argument is the path to the kernel headers. +KPATH=$1 + +if [ ! -f ${KPATH}/include/generated/uapi/linux/version.h ]; then + echo 0 + exit 0 +fi + +# Assuming KPATH is the target kernel headers directory +RHEL_RELEASE=$(sed -rn 's/^#define RHEL_RELEASE "(.*)"/\1/p'
${KPATH}/include/generated/uapi/linux/version.h)abi-rhel-version.sh new file +2
-0+ +RHEL_RELEASE_MAJOR=$(echo ${RHEL_RELEASE} | sed -r's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\1/') +RHEL_RELEASE_MINOR=$(echo ${RHEL_RELEASE} | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\2/') +RHEL_RELEASE_PATCH=$(echo ${RHEL_RELEASE} | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\3/')
abi-rhel-version.sh new file +3
-0+ +# Combine all update numbers into one +RHEL_API_VERSION=$((RHEL_RELEASE_MAJOR * 10000 + RHEL_RELEASE_MINOR * 100 +
RHEL_RELEASE_PATCH))abi-rhel-version.sh new file +2
-0+ +echo ${RHEL_API_VERSION}instrumentation/events/lttng-module/block.h +1
-1@@ -203,7 +203,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(block_rq_with_error, block_rq_requeue, ||LTTNG_KERNEL_RANGE (3 ,4 ,91 ,3 ,5 ,0 ) \ ||LTTNG_KERNEL_RANGE (3 ,2 ,58 ,3 ,3 ,0 ) \ ||LTTNG_UBUNTU_KERNEL_RANGE (3 ,13 ,11 ,28 ,3 ,14 ,0 ,0 ) \ - || LTTNG_RHEL_KERNEL_RANGE(3,10,0,7,1, 3,11,0,0,0)) + || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))/** *
block_rq_complete- block IO operation completed by device driverinstrumentation/events/lttng-module/kvm.h +1
-1@@ -112,7 +112,7 @@ LTTNG_TRACEPOINT_EVENT(kvm_fpu, )#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,18 ,0 ) \ - ||LTTNG_RHEL_KERNEL_RANGE (3 ,10 ,0 ,7 ,2 ,3 ,11 ,0 ,0 ,0 )) + ||LTTNG_RHEL_KERNEL_RANGE (3 ,10 ,0 ,327 ,0 ,0 ,3 ,11 ,0 ,0 ,0 ,0 )) LTTNG_TRACEPOINT_EVENT(kvm_age_page, TP_PROTO(ulong gfn, int level, struct kvm_memory_slot *slot, int ref),@@ -199,7 +199,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready,
kvm_async_pf_ready
)#if (
LINUX_VERSION_CODE>=KERNEL_VERSION(3,13,0)\instrumentation/events/lttng-module/kvm.h +1
-1- || LTTNG_RHEL_KERNEL_RANGE(3,10,0,7,1, 3,11,0,0,0)) + || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))LTTNG_TRACEPOINT_EVENT(
kvm_async_pf_completed,instrumentation/events/lttng-module/scsi.h +1
-1@@ -16,7 +16,7 @@#define scsi_opcode_name (opcode) { opcode, #opcode }#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,19 ,0 ) \ - ||LTTNG_RHEL_KERNEL_RANGE (3 ,10 ,0 ,7 ,2 ,3 ,11 ,0 ,0 ,0 )) + ||LTTNG_RHEL_KERNEL_RANGE (3 ,10 ,0 ,327 ,0 ,0 ,3 ,11 ,0 ,0 ,0 ,0 ))#define show_opcode_name (val) \ __print_symbolic(val, \instrumentation/events/lttng-module/writeback.h +2
-1@@ -13,7 +13,8 @@ #ifndef _TRACE_WRITEBACK_DEF_ #define _TRACE_WRITEBACK_DEF_ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) && \ + LTTNG_RHEL_VERSION_CODE < LTTNG_RHEL_KERNEL_VERSION(3,10,0,327,10,1)) static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) { struct super_block *sb = inode->i_sb;lttng-kernel-version.h +16
-8@@ -39,6 +39,8 @@ (LINUX_VERSION_CODE >=KERNEL_VERSION (a_low, b_low, c_low) && \LINUX_VERSION_CODE <KERNEL_VERSION (a_high, b_high, c_high)) +/* Ubuntu */ +#define LTTNG_UBUNTU_KERNEL_VERSION (a, b, c, d) \ (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))@@ -56,6 +58,8 @@ LTTNG_UBUNTU_VERSION_CODE < \ LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high)) +/* Debian */ +#define LTTNG_DEBIAN_KERNEL_VERSION (a, b, c, d, e, f) \ (((((a) << 16) + ((b) << 8) + (c)) * 1000000ULL) + ((d) * 10000) + ((e) * 100) + (f))@@ -73,22 +77,26 @@ LTTNG_DEBIAN_VERSION_CODE < \ LTTNG_DEBIAN_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high)) -#define LTTNG_RHEL_KERNEL_VERSION (a, b, c, d, e) \ - (((a) * (1ULL << 32)) + ((b) << 24) + ((c) << 16) + ((d) << 8) + (e)) +#define LTTNG_RHEL_KERNEL_VERSION (a, b, c, d, e, f) \ + (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f)) + +/* RHEL */ -#ifdef RHEL_RELEASE_CODE +#ifdef RHEL_API_VERSION #define LTTNG_RHEL_VERSION_CODE \ - ((LINUX_VERSION_CODE * (1ULL << 16)) + RHEL_RELEASE_CODE) + ((LINUX_VERSION_CODE * 10000000ULL) + RHEL_API_VERSION)#else #define LTTNG_RHEL_VERSION_CODE 0#endif -#define LTTNG_RHEL_KERNEL_RANGE (a_low, b_low, c_low, d_low, e_low, \ - a_high, b_high, c_high, d_high, e_high) \ +#define LTTNG_RHEL_KERNEL_RANGE (a_low, b_low, c_low, d_low, e_low, f_low, \ + a_high, b_high, c_high, d_high, e_high, f_high) \ (LTTNG_RHEL_VERSION_CODE >= \ - LTTNG_RHEL_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low) && \ + LTTNG_RHEL_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \ LTTNG_RHEL_VERSION_CODE < \ - LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high)) + LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high)) + +/* RT patch */ #define LTTNG_RT_KERNEL_VERSION (a, b, c, d) \(((a) << 24) + ((b) << 16) + ((c) << 8) + (d))wrapper/trace-clock.h +1
-1@@ -40,7 +40,7 @@#include <wrapper/percpu-defs.h> #include <wrapper/random.h> -#if ((LTTNG_KERNEL_RANGE(3,10,0, 3,10,14) && !LTTNG_RHEL_KERNEL_RANGE(3,10,0,7,0, 3,10,14,0,0)) \ +#if ((LTTNG_KERNEL_RANGE(3,10,0, 3,10,14) && !LTTNG_RHEL_KERNEL_RANGE (3 ,10 ,0 ,123 ,0 ,0 ,3 ,10 ,14 ,0 ,0 ,0 )) \ ||LTTNG_KERNEL_RANGE (3 ,11 ,0 ,3 ,11 ,3 ))#error "Linux kernels 3.10 and 3.11 introduce a deadlock in the timekeeping subsystem. Fixed by commit
7bd36014460f793c19e7d6c94dab67b0afcfcb7f\"timekeeping: Fix HRTICK related deadlock from ntp lock changes\" in Linux." #endif
--
2.7.4
Signature · 7 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev