ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
endif
+RHEL_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-rhel-version.sh $(CURDIR))
+
+ifneq ($(RHEL_API_VERSION), 0)
+ ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
+endif
+
RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(KERNELDIR))
ifneq ($(RT_PATCH_VERSION), 0)
--- /dev/null
+#!/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)
+
+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/')
+
+# Combine all update numbers into one
+RHEL_API_VERSION=$((RHEL_RELEASE_MAJOR * 10000 + RHEL_RELEASE_MINOR * 100 + RHEL_RELEASE_PATCH))
+
+echo ${RHEL_API_VERSION}
|| 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 driver
)
#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),
)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,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))
LTTNG_TRACEPOINT_EVENT(
kvm_async_pf_completed,
#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, \
#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;
(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))
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))
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))
#include "percpu-defs.h"
#include "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