Use lttng-modules ABI version ioctl
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/2 Use lttng-modules ABI version ioctl
Check compatibility between lttng-modules and tools using a version numbering specifically for the ABI, rather than relying on the major version of lttng-modules per se. This takes into account that we sometimes depend on lock-step updates of the toolchain, including tools and modules.
Signed-off-by Mathieu Desnoyers <[email protected]>
--- src/bin/lttng-sessiond/kernel.c | 25 +++++++++++++++++++------ src/common/kernel-ctl/kernel-ctl.c | 6 ++++++ src/common/kernel-ctl/kernel-ctl.h | 1 + src/common/kernel-ctl/kernel-ioctl.h | 5 +++++ src/common/lttng-kernel.h | 5 +++++ 5 files changed, 36 insertions(+), 6 deletions(-)
src/bin/lttng-sessiond/kernel.c +19 -6
@@ -26,6 +26,7 @@#include <common/common.h> #include <common/kernel-ctl/kernel-ctl.h> +#include <common/kernel-ctl/kernel-ioctl.h> #include <common/sessiond-comm/sessiond-comm.h> #include "consumer.h"
@@ -698,6 +699,7 @@ int kernel_validate_version(int tracer_fd) {int ret;struct lttng_kernel_tracer_version version; +struct lttng_kernel_tracer_abi_version abi_version; ret =kernctl_tracer_version (tracer_fd, &version);if (ret <0 ) {
@@ -706,17 +708,28 @@ int kernel_validate_version(int tracer_fd) }/* Validate version */ -if (version.major !=KERN_MODULES_PRE_MAJOR - && version.major !=KERN_MODULES_MAJOR ) { +if (version.major !=VERSION_MAJOR ) { +ERR ("Kernel tracer major version (%d) is not compatible with lttng-tools major version (%d)" , + version.major,VERSION_MAJOR ); goto error_version; } - -DBG2 ("Kernel tracer version validated (major version %d)" , version.major); + ret =kernctl_tracer_abi_version (tracer_fd, &abi_version); +if (ret <0 ) { +ERR ("Failed at getting lttng-modules ABI version" ); + goto error; + } +if (abi_version.major !=LTTNG_MODULES_ABI_MAJOR_VERSION ) { +ERR ("Kernel tracer ABI version (%d.%d) is not compatible with expected ABI major version (%d.*)" , + abi_version.major, abi_version.minor, +LTTNG_MODULES_ABI_MAJOR_VERSION ); + goto error; + } +DBG2 ("Kernel tracer version validated (%d.%d, ABI %d.%d)" , + version.major, version.minor, + abi_version.major, abi_version.minor);return 0 ; error_version: -ERR ("Kernel major version %d is not compatible (supporting <= %d)" , - version.major,KERN_MODULES_MAJOR ) ret =-1 ; error:
src/common/kernel-ctl/kernel-ctl.c +6 -0
@@ -346,6 +346,12 @@ end:return ret; } +int kernctl_tracer_abi_version (int fd, +struct lttng_kernel_tracer_abi_version *v) +{ +return ioctl (fd,LTTNG_KERNEL_TRACER_ABI_VERSION , v); +} +int kernctl_wait_quiescent (int fd) { return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_WAIT_QUIESCENT,
src/common/kernel-ctl/kernel-ctl.h +1 -0
@@ -38,6 +38,7 @@ int kernctl_stop_session(int fd);int kernctl_tracepoint_list (int fd);int kernctl_syscall_list (int fd);int kernctl_tracer_version (int fd,struct lttng_kernel_tracer_version *v); +int kernctl_tracer_abi_version (int fd,struct lttng_kernel_tracer_abi_version *v);int kernctl_wait_quiescent (int fd);int kernctl_calibrate (int fd,struct lttng_kernel_calibrate *calibrate);
src/common/kernel-ctl/kernel-ioctl.h +5 -0
@@ -19,6 +19,9 @@#ifndef _LTT_KERNEL_IOCTL_H#define _LTT_KERNEL_IOCTL_H +#define LTTNG_MODULES_ABI_MAJOR_VERSION 1 +#define LTTNG_MODULES_ABI_MINOR_VERSION 0 +/* Get a snapshot of the current ring buffer producer and consumer positions */ #define RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00)/* Get the consumer position (iteration start) */
@@ -104,6 +107,8 @@#define LTTNG_KERNEL_CALIBRATE \ _IOWR(0xF6, 0x49, struct lttng_kernel_calibrate)#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x4A) +#define LTTNG_KERNEL_TRACER_ABI_VERSION \ + _IOR(0xF6, 0x4B, struct lttng_kernel_tracer_abi_version)/* Session FD ioctl */ #define LTTNG_KERNEL_METADATA \
src/common/lttng-kernel.h +5 -0
@@ -124,6 +124,11 @@ struct lttng_kernel_tracer_version {uint32_t patchlevel; }LTTNG_PACKED ; +struct lttng_kernel_tracer_abi_version { +uint32_t major; +uint32_t minor; +}LTTNG_PACKED ; +enum lttng_kernel_calibrate_type {LTTNG_KERNEL_CALIBRATE_KRETPROBE , };
Signature · 1 line
2.1.0
Re: [PATCH lttng-tools 1/2] Fix: syscall list ioctl number conflict
In reply to a message not in the archivemerged in 2.6.0-rc2
David
Quoted 21 lines · Mathieu Desnoyers
Signed-off-by Mathieu Desnoyers <[email protected]>--- src/common/kernel-ctl/kernel-ioctl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/common/kernel-ctl/kernel-ioctl.h +1
-1@@ -103,7 +103,7 @@#define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x48)#define LTTNG_KERNEL_CALIBRATE \ _IOWR(0xF6, 0x49, struct lttng_kernel_calibrate) -#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x49) +#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x4A)/* Session FD ioctl */ #define LTTNG_KERNEL_METADATA \Signature · 1 line
2.1.0
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev