ABI with support for compat 32/64 bits
A message that is not in the archive (sent off-list or not yet received): [email protected]
* Julien Desfossez ([email protected]) wrote:
[...]
Review
Quoted 6 lines
(quoted diff) +6
-0+#define LTTNG_KERNEL_CHANNEL_PADDING1 LTTNG_SYMBOL_NAME_LEN + 32 +struct lttng_kernel_channel { + uint64_t subbuf_size; /* bytes */ + uint64_t num_subbuf; /* power of 2 */ + unsigned int switch_timer_interval; /* usec */ + unsigned int read_timer_interval; /* usec */
->
Review
Quoted 2 lines
(quoted diff) +2
-0+ int overwrite; /* 1: overwrite, 0: discard */ + enum lttng_event_output output; /* splice, mmap */
field order mismatch with lttng-modules. Please re-review all structures between modules and tools headers.
Thanks,
Mathieu
Quoted 8 lines
(quoted diff) +3
-0+ + char padding[LTTNG_KERNEL_CHANNEL_PADDING1]; +}__attribute__((packed)); #endif /* _LTTNG_KERNEL_H */Signature · 1 line
1.7.9.5
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Julien Desfossez:
Quoted 58 lines
The current ABI does not work for compat 32/64 bits. This patch moves the current ABI as old-abi and provides a new ABI in which all the structures exchanged between user and kernel-space are packed. Also this new ABI moves the "int overwrite" member of the struct
lttng_kernel_channelto remove the alignment added by the compiler.A patch for lttng-modules has been developed in parallel to this one to support the new ABI. These 2 patches have been tested in all possible configurations (applied or not) on 64-bit and 32-bit kernels (with
CONFIG_COMPAT) and a user-space in 32 and 64-bit.Here are the results of the tests : k 64 compat | u 32 compat
| OK k 64 compat | u 64 compat | OK k 64 compat | u 32 non-compat | KO k 64 compat | u 64 non-compat | OKk 64 non-compat | u 64 compat | OK k 64 non-compat | u 32
compat | KO k 64 non-compat | u 64 non-compat | OK k 64
non-compat | u 32 non-compat | KOk 32 compat | u compat | OK k 32 compat | u
non-compat | OKk 32 non-compat | u compat | OK k 32 non-compat | u
non-compat | OKThe results are as expected : - on 32-bit user-space and kernel, every configuration works. - on 64-bit user-space and kernel, every configuration works. - with 32-bit user-space on a 64-bit kernel the only configuration where it works is when the compat patch is applied everywhere.
Signed-off-by Julien Desfossez <[email protected]> ---
src/bin/lttng-sessiond/trace-kernel.h| 1 +src/common/kernel-ctl/kernel-ctl.c| 210
+++++++++++++++++++++++++++++----src/common/kernel-ctl/kernel-ctl.h | 1 + src/common/kernel-ctl/kernel-ioctl.h | 74 ++++++++---- src/common/lttng-kernel-old.h | 115 ++++++++++++++++++ src/common/lttng-kernel.h | 31 +++-- 6 files changed,383 insertions(+), 49 deletions(-) create mode 100644
src/common/lttng-kernel-old.h(quoted diff) +0
-0
b/src/bin/lttng-sessiond/trace-kernel.hindex f04d9e7..c86cc27 100644 ---a/src/bin/lttng-sessiond/trace-kernel.h+++b/src/bin/lttng-sessiond/trace-kernel.h@@ -22,6 +22,7 @@#include <
lttng/lttng.h> #include <common/lttng-kernel.h> +#include <common/lttng-kernel-old.h>#include "
consumer.h"(quoted diff) +0
-0
b/src/common/kernel-ctl/kernel-ctl.cindex 1396cd9..ab29dd0 100644 ---a/src/common/kernel-ctl/kernel-ctl.c+++b/src/common/kernel-ctl/kernel-ctl.c@@ -18,38 +18,163 @@
Quoted 8 lines
#define
__USE_LINUX_IOCTL_DEFS#include <sys/ioctl.h> +#include <string.h>#include "
kernel-ctl.h" #include "kernel-ioctl.h"+/* + * This flag indicates whether lttng-tools must use the new or the old kernel + * ABI (without compat support for 32/64 bits). + */
As discuss, having a better comment to explain "what is old kernel". Since this compat layer is due to be removed someday, just explain why please.
Quoted 1 line
+static int
lttng_kernel_use_old_abi= -1; +
I'm a bit "painful" on that but I really want each functions in lttng-tools to be commented and args explained briefly and return value.
Also normally, we have a location for compat layer "stuff" which is src/common/compat. In this case I'm ok to let it here since this is _suppose_ to be temporary.
However, temporary stuff always stays forever... so a clear comment that we plan to remove this compat layer after 2.1 at some point in time. (Maybe a XXX comment).
I'm asking all this because, since this is named with _old*_, in a couple of months, I'll need to understand what this is about and why it's not called "compat_...2_0_..."
Quoted 11 lines
+static inline int compat_ioctl_no_arg(int fd, unsigned long
oldname, + unsigned long newname) +{ + int ret; + + if
(lttng_kernel_use_old_abi== -1) { + ret =ioctl(fd, newname); +
if (!ret) { +lttng_kernel_use_old_abi= 0; + goto end; + } +lttng_kernel_use_old_abi= 1; + } + if (lttng_kernel_use_old_abi)
{ + ret =ioctl(fd, oldname); + } else { + ret = ioctl(fd,
newname); + } + +end: + return ret; +} + intkernctl_create_session(int fd){ - return ioctl(fd,LTTNG_KERNEL_SESSION); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_SESSION, +LTTNG_KERNEL_SESSION); }
Quoted 12 lines
/* open the metadata global channel */ int
kernctl_open_metadata(int fd, struct lttng_channel_attr *chops){ -
returnioctl(fd, LTTNG_KERNEL_METADATA, chops); + structlttng_kernel_old_channelold_channel; + structlttng_kernel_channel
channel; + + if (lttng_kernel_use_old_abi) { +
old_channel.overwrite =chops->overwrite; + old_channel.subbuf_size =chops->subbuf_size; + old_channel.num_subbuf =chops->num_subbuf; + old_channel.switch_timer_interval =chops->switch_timer_interval; + old_channel.read_timer_interval =chops->read_timer_interval; +
old_channel.output =chops->output; + memcpy(old_channel.padding,chops->padding,sizeof(chops->padding));
The size of this memcpy should use the old_channel padding being the destination buffer. I know this is "controlled buffer and known size" but it can be error proned in the future with any changes to the current ABI. (More to fix below).
Quoted 7 lines
+ + return
ioctl(fd, LTTNG_KERNEL_OLD_METADATA, &old_channel); +
} + + channel.overwrite =chops->overwrite; + channel.subbuf_size =chops->subbuf_size; + channel.num_subbuf =chops->num_subbuf; +
channel.switch_timer_interval =chops->switch_timer_interval; + channel.read_timer_interval =chops->read_timer_interval; +
channel.output =chops->output; + memcpy(channel.padding,chops->padding,sizeof(chops->padding));
Here.
Quoted 5 lines
+ + return
ioctl(fd, LTTNG_KERNEL_METADATA, &channel); }int kernctl_create_channel(int fd, struct
lttng_channel_attr
*chops) { - returnioctl(fd, LTTNG_KERNEL_CHANNEL, chops); + structlttng_kernel_old_channelold_channel;
Move this inside the if(OLD).
Quoted 8 lines
(quoted diff) +1
-0+ struct lttng_kernel_channel channel; + + if(
lttng_kernel_use_old_abi) { + old_channel.overwrite =chops->overwrite; + old_channel.subbuf_size =chops->subbuf_size;(quoted diff) +1
-0+ old_channel.num_subbuf = chops->num_subbuf; +old_channel.switch_timer_interval =
chops->switch_timer_interval; + old_channel.read_timer_interval =chops->read_timer_interval; +
old_channel.output =chops->output; + memcpy(old_channel.padding,chops->padding,sizeof(chops->padding));
Here.
Quoted 7 lines
+ + return
ioctl(fd, LTTNG_KERNEL_OLD_CHANNEL, &old_channel); + }
+ + channel.overwrite =chops->overwrite; + channel.subbuf_size =chops->subbuf_size; + channel.num_subbuf =chops->num_subbuf; +
channel.switch_timer_interval =chops->switch_timer_interval; + channel.read_timer_interval =chops->read_timer_interval; +
channel.output =chops->output; + memcpy(channel.padding,chops->padding,sizeof(chops->padding));
Here.
Quoted 9 lines
+ + return
ioctl(fd, LTTNG_KERNEL_CHANNEL, &channel); }int
kernctl_create_stream(int fd){ - return ioctl(fd,LTTNG_KERNEL_STREAM); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_STREAM, +LTTNG_KERNEL_STREAM); }int
kernctl_create_event(int fd, struct lttng_kernel_event *ev){ +
if (lttng_kernel_use_old_abi) { + structlttng_kernel_eventold_event;
Shouldn't that be lttng_kernel_old_event here ?
Quoted 56 lines
+ +
memcpy(old_event.name, ev->name, sizeof(old_event.name)); +
old_event.instrumentation =ev->instrumentation; + switch
(ev->instrumentation) { + caseLTTNG_KERNEL_KPROBE: +
old_event.u.kprobe.addr =ev->u.kprobe.addr; + old_event.u.kprobe.offset =ev->u.kprobe.offset; + memcpy(old_event.u.kprobe.symbol_name, +ev->u.kprobe.symbol_name, +sizeof(old_event.u.kprobe.symbol_name)); + break; + caseLTTNG_KERNEL_KRETPROBE: + old_event.u.kretprobe.addr =ev->u.kretprobe.addr; + old_event.u.kretprobe.offset =ev->u.kretprobe.offset; + memcpy(old_event.u.kretprobe.symbol_name, +ev->u.kretprobe.symbol_name, +sizeof(old_event.u.kretprobe.symbol_name)); + break; + caseLTTNG_KERNEL_FUNCTION: + memcpy(old_event.u.ftrace.symbol_name, +ev->u.ftrace.symbol_name, +sizeof(old_event.u.ftrace.symbol_name)); + break; + default: +
break; + } + + return ioctl(fd,LTTNG_KERNEL_OLD_EVENT,&old_event); + } returnioctl(fd, LTTNG_KERNEL_EVENT, ev); }int
kernctl_add_context(int fd, struct lttng_kernel_context *ctx)
{ + if (lttng_kernel_use_old_abi) { + structlttng_kernel_old_contextold_ctx; + + old_ctx.ctx =ctx->ctx; +
/* only type that uses the union */ + if (ctx->ctx==LTTNG_KERNEL_CONTEXT_PERF_COUNTER) { +
old_ctx.u.perf_counter.type = +ctx->u.perf_counter.type; +
old_ctx.u.perf_counter.config = +ctx->u.perf_counter.config; +
memcpy(old_ctx.u.perf_counter.name, +ctx->u.perf_counter.name,(quoted diff) +1
-0+ sizeof(old_ctx.u.perf_counter.name)); + } + return ioctl(fd,
LTTNG_KERNEL_OLD_CONTEXT,&old_ctx); + } return ioctl(fd,LTTNG_KERNEL_CONTEXT, ctx); }(quoted diff) +0
-0@@ -57,44 +182,96 @@ int kernctl_add_context(int fd, struct
lttng_kernel_context*ctx) /* Enable event, channel and session
ioctl */ intkernctl_enable(int fd){ - return ioctl(fd,LTTNG_KERNEL_ENABLE); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_ENABLE, +LTTNG_KERNEL_ENABLE); }/* Disable event, channel and session ioctl */ int
kernctl_disable(int fd){ - return ioctl(fd,LTTNG_KERNEL_DISABLE); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_DISABLE, +LTTNG_KERNEL_DISABLE); }int
kernctl_start_session(int fd){ - return ioctl(fd,LTTNG_KERNEL_SESSION_START); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_SESSION_START, +LTTNG_KERNEL_SESSION_START); }int
kernctl_stop_session(int fd){ - return ioctl(fd,LTTNG_KERNEL_SESSION_STOP); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_SESSION_STOP, +LTTNG_KERNEL_SESSION_STOP); }- int
kernctl_tracepoint_list(int fd){ - return ioctl(fd,LTTNG_KERNEL_TRACEPOINT_LIST); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_TRACEPOINT_LIST, +LTTNG_KERNEL_TRACEPOINT_LIST); }
Quoted 10 lines
int kernctl_tracer_version(int fd, struct
lttng_kernel_tracer_version*v) { - return ioctl(fd,LTTNG_KERNEL_TRACER_VERSION, v); + int ret; + + if
(lttng_kernel_use_old_abi== -1) { + ret = ioctl(fd,LTTNG_KERNEL_TRACER_VERSION, v); + if (!ret) { +lttng_kernel_use_old_abi= 0; + goto end; + } +lttng_kernel_use_old_abi= 1; + } + if (lttng_kernel_use_old_abi)
{ + structlttng_kernel_old_tracer_versionold_v; + + ret =ioctl(fd, LTTNG_KERNEL_OLD_TRACER_VERSION, &old_v); + if (ret) +
goto end;
{} missing
Quoted 14 lines
(quoted diff) +1
-0+ v->major = old_v.major; + v->minor = old_v.minor; +
v->patchlevel= old_v.patchlevel; + } else { + ret = ioctl(fd,LTTNG_KERNEL_TRACER_VERSION, v); + } + +end: + return ret; }int
kernctl_wait_quiescent(int fd){ - return ioctl(fd,LTTNG_KERNEL_WAIT_QUIESCENT); + return compat_ioctl_no_arg(fd,LTTNG_KERNEL_OLD_WAIT_QUIESCENT, +LTTNG_KERNEL_WAIT_QUIESCENT);
}int kernctl_calibrate(int fd, struct
lttng_kernel_calibrate
*calibrate) { - return ioctl(fd,LTTNG_KERNEL_CALIBRATE,
calibrate); + int ret; + + if (lttng_kernel_use_old_abi== -1) { +
ret =ioctl(fd, LTTNG_KERNEL_CALIBRATE, calibrate); + if (!ret) {(quoted diff) +1
-0+ lttng_kernel_use_old_abi = 0; + goto end; + } +
Quoted 5 lines
lttng_kernel_use_old_abi= 1; + } + if (lttng_kernel_use_old_abi)
{ + structlttng_kernel_old_calibrateold_calibrate; + +
old_calibrate.type =calibrate->type; + ret = ioctl(fd,LTTNG_KERNEL_OLD_CALIBRATE,&old_calibrate); + if (ret) + goto
end;
{} missing
Quoted 47 lines
(quoted diff) +1
-0+ calibrate->type = old_calibrate.type; + } else { + ret =
ioctl(fd, LTTNG_KERNEL_CALIBRATE, calibrate); + } + +end: + return
ret; }(quoted diff) +0
-0@@ -193,10 +370,3 @@ int kernctl_set_stream_id(int fd, unsigned long *stream_id) { return ioctl(fd, RING_BUFFER_SET_STREAM_ID,
stream_id); } - -/* Get the offset of thestream_idin the packet header */ -int kernctl_get_net_stream_id_offset(int fd, unsigned
long *offset) -{ - return ioctl(fd,LTTNG_KERNEL_STREAM_ID_OFFSET,
offset); - -} diff --gita/src/common/kernel-ctl/kernel-ctl.hb/src/common/kernel-ctl/kernel-ctl.hindex 18712d9..85a3a18 100644 ---a/src/common/kernel-ctl/kernel-ctl.h+++b/src/common/kernel-ctl/kernel-ctl.h@@ -21,6 +21,7 @@#include <
lttng/lttng.h> #include <common/lttng-kernel.h> +#include <common/lttng-kernel-old.h>int
kernctl_create_session(int fd); intkernctl_open_metadata(int fd, struct lttng_channel_attr *chops); diff --gita/src/common/kernel-ctl/kernel-ioctl.hb/src/common/kernel-ctl/kernel-ioctl.hindex 35942be..1d34222 100644 ---a/src/common/kernel-ctl/kernel-ioctl.h+++b/src/common/kernel-ctl/kernel-ioctl.h@@ -49,37 +49,69 @@ /* map stream to stream id for network streaming */ #defineRING_BUFFER_SET_STREAM_ID_IOW(0xF6,0x0D, unsigned
long)+/* Old ABI (without support for 32/64 bits compat) */ +/* LTTng file descriptor ioctl */ +#define
LTTNG_KERNEL_OLD_SESSION_IO(0xF6, 0x40)+#defineLTTNG_KERNEL_OLD_TRACER_VERSION\(quoted diff) +4
-0+ _IOR(0xF6, 0x41, struct lttng_kernel_old_tracer_version) +#define LTTNG_KERNEL_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42) +#define LTTNG_KERNEL_OLD_WAIT_QUIESCENT _IO(0xF6, 0x43) +#define LTTNG_KERNEL_OLD_CALIBRATE \ + _IOWR(0xF6, 0x44, struct
lttng_kernel_old_calibrate) + +/* Session FD ioctl */ +#defineLTTNG_KERNEL_OLD_METADATA\ + _IOW(0xF6,0x50,
structlttng_kernel_old_channel) +#defineLTTNG_KERNEL_OLD_CHANNEL
\ +_IOW(0xF6, 0x51, struct lttng_kernel_old_channel)+#defineLTTNG_KERNEL_OLD_SESSION_START_IO(0xF6, 0x52)+#defineLTTNG_KERNEL_OLD_SESSION_STOP_IO(0xF6, 0x53)+ +/*
Channel FD ioctl */ +#defineLTTNG_KERNEL_OLD_STREAM_IO(0xF6, 0x60)+#defineLTTNG_KERNEL_OLD_EVENT\(quoted diff) +1
-0+ _IOW(0xF6, 0x61, struct lttng_kernel_old_event) +#define
LTTNG_KERNEL_OLD_STREAM_ID_OFFSET\ + _IOR(0xF6,0x62,
unsigned long)
Quoted 6 lines
+/* Event and Channel FD ioctl */ +#define
LTTNG_KERNEL_OLD_CONTEXT
\ +_IOW(0xF6, 0x70, struct lttng_kernel_old_context)+ +/* Event,
Channel and Session ioctl */ +#defineLTTNG_KERNEL_OLD_ENABLE_IO(0xF6, 0x80)+#defineLTTNG_KERNEL_OLD_DISABLE_IO(0xF6, 0x81)+ + +/* New ABI (with suport for 32/64 bits compat) */
Maybe just use "Current ABI" with version number also. (2.1 in this case I guess).
Thanks
David
Quoted 155 lines
/* LTTng file descriptor ioctl */ -#define
LTTNG_KERNEL_SESSION_IO(0xF6, 0x40)-#defineLTTNG_KERNEL_TRACER_VERSION\ -_IOR(0xF6, 0x41, struct lttng_kernel_tracer_version)-#defineLTTNG_KERNEL_TRACEPOINT_LIST_IO(0xF6, 0x42)-#defineLTTNG_KERNEL_WAIT_QUIESCENT_IO(0xF6, 0x43)+#defineLTTNG_KERNEL_SESSION_IO(0xF6, 0x45)+#defineLTTNG_KERNEL_TRACER_VERSION\ + _IOR(0xF6,0x46, structlttng_kernel_tracer_version) +#defineLTTNG_KERNEL_TRACEPOINT_LIST_IO(0xF6, 0x47)+#defineLTTNG_KERNEL_WAIT_QUIESCENT_IO(0xF6,0x48) #defineLTTNG_KERNEL_CALIBRATE\ - _IOWR(0xF6,0x44, structlttng_kernel_calibrate) + _IOWR(0xF6,0x49, structlttng_kernel_calibrate)/* Session FD ioctl */ -#define
LTTNG_KERNEL_METADATA
\ -_IOW(0xF6, 0x50, struct lttng_channel_attr)-#defineLTTNG_KERNEL_CHANNEL\ - _IOW(0xF6,0x51, structlttng_channel_attr) -#defineLTTNG_KERNEL_SESSION_START_IO(0xF6, 0x52)-#defineLTTNG_KERNEL_SESSION_STOP_IO(0xF6, 0x53)+#defineLTTNG_KERNEL_METADATA\ + _IOW(0xF6,0x54, structlttng_kernel_channel) +#defineLTTNG_KERNEL_CHANNEL
\ +_IOW(0xF6, 0x55, struct lttng_kernel_channel)+#defineLTTNG_KERNEL_SESSION_START_IO(0xF6, 0x56)+#defineLTTNG_KERNEL_SESSION_STOP_IO(0xF6, 0x57)/* Channel FD ioctl */ -#define
LTTNG_KERNEL_STREAM_IO(0xF6, 0x60)-#defineLTTNG_KERNEL_EVENT\ -_IOW(0xF6, 0x61, struct lttng_kernel_event)-#defineLTTNG_KERNEL_STREAM_ID_OFFSET\ - _IOR(0xF6,0x62, unsigned
long) +#defineLTTNG_KERNEL_STREAM_IO(0xF6, 0x62)+#defineLTTNG_KERNEL_EVENT\ + _IOW(0xF6,0x63, structlttng_kernel_event)/* Event and Channel FD ioctl */ -#define
LTTNG_KERNEL_CONTEXT
\ -_IOW(0xF6, 0x70, struct lttng_kernel_context)+#defineLTTNG_KERNEL_CONTEXT\ + _IOW(0xF6,0x71, structlttng_kernel_context)/* Event, Channel and Session ioctl */ -#define
LTTNG_KERNEL_ENABLE_IO(0xF6, 0x80)-#defineLTTNG_KERNEL_DISABLE_IO(0xF6, 0x81)+#defineLTTNG_KERNEL_ENABLE_IO(0xF6, 0x82)
+#defineLTTNG_KERNEL_DISABLE_IO(0xF6, 0x83)#endif /*
_LTT_KERNEL_IOCTL_H*/ diff --gita/src/common/lttng-kernel-old.hb/src/common/lttng-kernel-old.hnew file mode 100644 index 0000000..1b8999a ---/dev/null+++b/src/common/lttng-kernel-old.h@@ -0,0 +1,115 @@ +/* + * Copyright
(C) 2011 - Julien Desfossez <[email protected]> + * Mathieu Desnoyers <[email protected]> + * David Goulet <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +(quoted diff) +2
-0+#ifndef _LTTNG_KERNEL_OLD_H +#define _LTTNG_KERNEL_OLD_H + +#include <stdint.h> +#include <common/lttng-kernel.h> + +/* + *LTTng DebugFS ABI structures. + * + * This is the kernel ABI copied from lttng-modules tree. + */ + +/* Perf counter attributes */
+structlttng_kernel_old_perf_counter_ctx{ +uint32_ttype; +uint64_tconfig; + char name[LTTNG_KERNEL_SYM_NAME_LEN]; +}; + +/*
Event/Channel context */ +#defineLTTNG_KERNEL_OLD_CONTEXT_PADDING116 +#defineLTTNG_KERNEL_OLD_CONTEXT_PADDING2LTTNG_KERNEL_SYM_NAME_LEN+ 32 +structlttng_kernel_old_context{ +
enumlttng_kernel_context_typectx; + char
padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING1]; + + union { + structlttng_kernel_old_perf_counter_ctxperf_counter; + char
padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING2]; + } u; +}; + +structlttng_kernel_old_kretprobe{ +uint64_taddr; + +uint64_toffset;(quoted diff) +1
-0+ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; +}; + +/* + * Eitheraddr is used, or
symbol_nameand offset. + */ +structlttng_kernel_old_kprobe{ +uint64_taddr; + +uint64_toffset; +
char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; +}; + +/* Function
tracer */ +structlttng_kernel_old_function{ + char
symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; +}; + +#defineLTTNG_KERNEL_OLD_EVENT_PADDING116 +#defineLTTNG_KERNEL_OLD_EVENT_PADDING2LTTNG_KERNEL_SYM_NAME_LEN+ 32
+structlttng_kernel_old_event{ + char
name[LTTNG_KERNEL_SYM_NAME_LEN]; + enumlttng_kernel_instrumentationinstrumentation; + char
padding[LTTNG_KERNEL_OLD_EVENT_PADDING1]; + + /* Per
instrumentation type configuration */ + union { + structlttng_kernel_old_kretprobekretprobe; + structlttng_kernel_old_kprobekprobe; + structlttng_kernel_old_function
ftrace; + char padding[LTTNG_KERNEL_OLD_EVENT_PADDING2]; + } u;
+}; + +structlttng_kernel_old_tracer_version{ +uint32_tmajor; +uint32_tminor; +uint32_tpatchlevel; +}; + +structlttng_kernel_old_calibrate{ + enumlttng_kernel_calibrate_type
type; /* type (input) */ +}; + +/* + * kernel channel + */ +#defineLTTNG_KERNEL_OLD_CHANNEL_PADDING1LTTNG_SYMBOL_NAME_LEN+ 32
+structlttng_kernel_old_channel{ + int overwrite;
/* 1: overwrite, 0: discard */ +uint64_tsubbuf_size;
/* bytes */ +uint64_tnum_subbuf; /* power of 2 */(quoted diff) +1
-0+ unsigned int switch_timer_interval; /* usec */ + unsigned int
read_timer_interval; /* usec */ + enumlttng_event_outputoutput;
/* splice, mmap */ + + char
padding[LTTNG_KERNEL_OLD_CHANNEL_PADDING1]; +}; + +#endif /*_LTTNG_KERNEL_OLD_H*/ diff --gita/src/common/lttng-kernel.hb/src/common/lttng-kernel.hindex dbeb6aa..ac881bf 100644 ---a/src/common/lttng-kernel.h+++b/src/common/lttng-kernel.h@@ -59,7 +59,7 @@ structlttng_kernel_perf_counter_ctx{uint32_ttype;uint64_tconfig; char name[LTTNG_KERNEL_SYM_NAME_LEN]; -}; +}__attribute__((packed));/* Event/Channel context */ #define
LTTNG_KERNEL_CONTEXT_PADDING116 @@ -72,14 +72,14 @@ structlttng_kernel_context{ structlttng_kernel_perf_counter_ctxperf_counter; char padding[LTTNG_KERNEL_CONTEXT_PADDING2]; } u; -}; +}__attribute__((packed));struct
lttng_kernel_kretprobe{uint64_taddr;
uint64_toffset; char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; -}; +}__attribute__((packed));/* * Either addr is used, or
symbol_nameand offset. @@ -89,12 +89,12 @@ structlttng_kernel_kprobe{
uint64_toffset; char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; -}; +}__attribute__((packed));/* Function tracer */ struct
lttng_kernel_function{ char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; -}; +}__attribute__((packed));#define
LTTNG_KERNEL_EVENT_PADDING116 #defineLTTNG_KERNEL_EVENT_PADDING2LTTNG_KERNEL_SYM_NAME_LEN+ 32 @@
-110,13 +110,13 @@ structlttng_kernel_event{ structlttng_kernel_functionftrace; char padding[LTTNG_KERNEL_EVENT_PADDING2]; } u; -}; +}__attribute__((packed));struct
lttng_kernel_tracer_version{uint32_tmajor;uint32_tminor;uint32_tpatchlevel; -}; +}__attribute__((packed));enum
lttng_kernel_calibrate_type{LTTNG_KERNEL_CALIBRATE_KRETPROBE, @@ -124,6 +124,21 @@ enumlttng_kernel_calibrate_type{struct
lttng_kernel_calibrate{ enumlttng_kernel_calibrate_type
type; /* type (input) */ -}; +}__attribute__((packed)); + +/* + *
kernel channel + */ +#defineLTTNG_KERNEL_CHANNEL_PADDING1LTTNG_SYMBOL_NAME_LEN+ 32 +structlttng_kernel_channel{ +uint64_tsubbuf_size; /* bytes */ +uint64_tnum_subbuf; /* power of 2 */ + unsigned intswitch_timer_interval; /* usec */ + unsigned intread_timer_interval; /* usec */ + int overwrite;
/* 1: overwrite, 0: discard */ + enumlttng_event_outputoutput;
/* splice, mmap */ + + char
padding[LTTNG_KERNEL_CHANNEL_PADDING1]; +}__attribute__((packed));
Quoted 1 line
#endif /*
_LTTNG_KERNEL_H*/
-----BEGIN PGP SIGNATURE-----
iQEcBAEBCgAGBQJQahOGAAoJEELoaioR9I02x3UIAKpJrPlrhDp+IS/bgfnN6DTs xpSN2Cfmmwsa8+rifSglsMf4FjPX4YrzB3ONhvLtyxTN81l1YhynYk87cE3aXEiw 2fZR5jXkU7jogk1BAd546pI5TpNU3i53JMjB+aN33tyJfIxo8pu2TnN94Rau0IDn a81ETaA5y9ABdMAc8nhH1UeUjVPFuoQkqmSePTpUWrVbWFbDPI+JJAtSEZV3MlZ7 sDnoaBNRqfqJ2oYld5GtHtDrU0BoGVhT/de9ED4TC/Pn4q1Tj6e4LgOXOw2ZK4Lb 7uH7XcoL87UUISsgzuEKfreeZQ+nDef8+TTk8Fe3DHoOfiW8Pp4BP8kN3VExcMA= =xWuT
-----END PGP SIGNATURE-----