Bug #895
closedKVM events are not available, probe modules is silently not loading
100%
Description
The lttng-probe-kvm and lttng-probe-kvm-x86 had the same TRACE_SYSTEM string. Because of that, both modules can't be loaded at the same time. The second module fails to load silently. This patch rename the TRACE_SYSTEM of lttng-probe-kvm-x86 to avoid the clash.
I confirm the bug with the master branch of lttng-modules and kernel 4.1. Here is the steps to reproduce:
#!/bin/sh # stop sessiond daemon to remove all lttng modules sudo service lttng-sessiond stop # load the kvm probe, then kvm-x86, which have the same TRACE_SYSTEM string sudo modprobe lttng-probe-kvm sudo modprobe lttng-probe-kvm-x86 test -n "$(lsmod | grep "lttng_probe_kvm ")" && echo "module lttng_probe_kvm loaded" || echo "module lttng_probe_kvm failed to load" test -n "$(lsmod | grep "lttng_probe_kvm_x86 ")" && echo "module lttng_probe_kvm_x86 loaded" || echo "module lttng_probe_kvm_x86 failed to load" # start the service to query available events sudo service lttng-sessiond start # broken synchronization, but that should be enough for the sessiond to start sleep 2 # test if the kvm_entry event is available (included in the lttng-probe-kvm-x86 probe) test -n "$(lttng list -k | grep kvm_entry)" && echo "PASS kvm_entry available" || echo "FAIL kvm_entry not available"
The attached patch solves the issue. Here is the output of the above script without the patch:
./test.sh lttng-sessiond stop/waiting module lttng_probe_kvm loaded module lttng_probe_kvm_x86 failed to load lttng-sessiond start/running, process 2179 FAIL kvm_entry not available
And here is the output with the patch:
$ ./test.sh lttng-sessiond stop/waiting module lttng_probe_kvm loaded module lttng_probe_kvm_x86 loaded lttng-sessiond start/running, process 3325 PASS kvm_entry available
The patch does not changes the event names, such that _MAP macros is not necessary for event name backward compatibility.
Files
Updated by Francis Giraldeau over 9 years ago
The fundamental problem is that TRACE_SYSTEM string is used to generate the symbol names in the modules. If both have "kvm", then their init functions are the same, and the kernel won't load the module.
$ make probes/lttng-probe-kvm.i probes/lttng-probe-kvm-x86.i $ grep "init_module(void) " probes/lttng-probe-kvm.i probes/lttng-probe-kvm-x86.i probes/lttng-probe-kvm.i:static inline __attribute__((no_instrument_function)) initcall_t __inittest(void) { return __lttng_events_init__kvm; } int init_module(void) __attribute__((alias("__lttng_events_init__kvm")));; probes/lttng-probe-kvm-x86.i:static inline __attribute__((no_instrument_function)) initcall_t __inittest(void) { return __lttng_events_init__kvm; } int init_module(void) __attribute__((alias("__lttng_events_init__kvm")));; <pre>
Updated by Mathieu Desnoyers over 8 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset modules|commit:b36bb1a8d9cb32b6ce199f05f399b1ca639e240e.