I'm reasonably sure that the solution to this requires adding an alternate
definition to instrumentation/events/lttmg-module/sched.h.
My first attempt was this:
#if (LTTNG_RT_VERSION_CODE >= LTTNG_RT_KERNEL_VERSION(4,9,27,18))
/*
* Tracepoint for showing priority inheritance modifying a tasks
* priority.
*/
LTTNG_TRACEPOINT_EVENT(sched_pi_setprio,
TP_PROTO(struct task_struct *tsk, struct task_struct *pi_task),
TP_ARGS(tsk, pi_task),
TP_FIELDS(
ctf_array_text(char, comm, tsk->comm, TASK_COMM_LEN)
ctf_integer(pid_t, tid, tsk->pid)
ctf_integer(int, oldprio, tsk->prio - MAX_RT_PRIO)
ctf_integer(int, newprio, (pi_task ? pi_task->prio :
tsk->prio) - MAX_RT_PRIO)
)
)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
followed by the rest of the existing code. Unfortunately this doesn't
actually work because LTTNG_RT_VERSION_CODE appears to rely on the
presence of a localversion-rt file in the kernel source tree, which does
not exist in the linux-headers-4.9-rt-amd64 package. So I'm not sure what
the appropriate way of detecting an rt-patched kernel is.
(For reference, the kernel change appears to have been from
https://lwn.net/Articles/722745/.)