Since the bug report, I worked with Yannick on the bug and discovered new elements that could help target the problem.
I'll try here to answer your questions and give the new elements.
OS and system¶
xaf@station11-64:~$ uname -a
Linux station11-64 3.2.0-4-rt-amd64 #1 SMP PREEMPT RT Debian 3.2.32-1 x86_64 GNU/Linux
xaf@station11-64:~$ cat /proc/cpuinfo | grep "^model name"
model name : Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
model name : Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
model name : Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
model name : Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
Hyperthreading off (working on real time...)
npt¶
Forgot to mention, the version used for these tests is the v0.02 (tag). The new version I'm working on is not currently mature enough and needs some configure options to work as the v0.02 works (it shouldn't have been pushed online yet... my bad). Sorry for that.
CPU shielding¶
# disable NMI watchdog
/sbin/sysctl -q -e -w "kernel.nmi_watchdog=0"
# Restrict stopmachine to cpu 0
/sbin/sysctl -q -e -w "kernel.stopmachine_cpumask=0x1"
# Restrict pagedrain to cpu 0
/sbin/sysctl -q -e -w "vm.pagedrain_cpumask=0x1"
# Disable scheduler RT throttling
/sbin/sysctl -q -e -w "kernel.sched_rt_runtime_us=-1"
# Disable softlockup detection.
/sbin/sysctl -q -e -w "kernel.softlockup_thresh=-1"
# Set default IRQ affinity to cpu 0
echo 1 > /proc/irq/default_smp_affinity
# Set affinity for all active IRQs
for i in /proc/irq/[0-9]*; do
echo 1 > $i/smp_affinity 2>/dev/null
done
# Mount cgroups
mkdir /cpusets
mount -t cgroup -ocpuset cpuset /cpusets
# Disable systemwide load balancing
cd /cpusets
echo 0 > cpuset.sched_load_balance
# Create system cpuset
mkdir system
echo 0 > system/cpuset.cpus
echo 0 > system/cpuset.mems
echo 0 > system/cpuset.sched_load_balance
echo 1 > system/cpuset.cpu_exclusive
# Move all tasks
for t in `cat tasks`; do
echo $t > system/tasks
done
# Create NPT cpuset
mkdir npt
echo 1 > npt/cpuset.cpus
echo 0 > npt/cpuset.mems
echo 0 > npt/cpuset.sched_load_balance
echo 1 > npt/cpuset.cpu_exclusive
# Create LTTng cpuset
mkdir lttng
echo 2 > lttng/cpuset.cpus
echo 0 > lttng/cpuset.mems
echo 0 > lttng/cpuset.sched_load_balance
echo 1 > lttng/cpuset.cpu_exclusive
UST and kernel trace¶
We discovered that we can have drops of events in UST traces but also in kernel traces, depending on the configuration of the system. In all the cases the drops of events appeared, the kernel trace was also activated. I forgot to mention that in my bug report as I didn't see that it could be linked. By doing more tests and desactivating it, we found that it was linked.
In all cases, the test procedure was the following (in root/with sudo):
lttng create lttngrt
lttng enable-channel k -k --num-subbuf 32 --subbuf-size 1048576
lttng enable-event -c k -k -a
lttng enable-channel u -u --num-subbuf 32 --subbuf-size 1048576
lttng enable-event -c u -u "npt:loop","npt:start","npt:stop"
./npt --eval-cpu-speed -l10000000
lttng destroy
This test procedure should be run in a shell put in the npt cpuset:
echo $$ > /cpuset/npt/tasks
It should be run after starting a sessiond in another shell put in the lttng cpuset:
echo $$ > /cpuset/lttng/tasks
Here are the information about the different tests made and the results obtained.
Without CPU shielding¶
LTTng v2.1.0¶
No drops of events were encountered with this configuration.
Another test we made was not using the cli() and sti() and we encountered event drops in the UST trace (not kernel) in this case. The following tests will only use npt with active cli() and sti() calls to analyze the regression of LTTng.
LTTng-tools (bd2d5dd) & UST (34a91bd)¶
Here, the number of dropped events is always 8602021 for UST. No event is dropped for the kernel.
With CPU shielding¶
LTTng v2.1.0¶
No drops of events were encountered with this configuration.
LTTng-tools (bd2d5dd) & UST (34a91bd)¶
The drops explained in the bugreport were encountered here (8602021 for UST).
There were two situations in which we were able not to have drops of events for UST:
- When we added a new CPU to the LTTng cpuset (echo 2-3 > lttng/cpuset.cpus), but there where drops of kernel events.
- When we put a very big subbuffer size for the kernel channel (4M instead of 1M here). In this case, the kernel was just never restarting working on the buffers after it used them a first time as it has as much space as needed for the whole kernel trace of the npt run. No drops of kernel events either in this case.
The idea that came from that is that the "consumerd"s of lttng were interfering. When the kernel consumerd needs to run, the UST consumerd has to wait, and thus if the kernel consumerd is not able to follow the rythm, he is just keeping all the CPU time. This situation seems weird to me as NPT is not generating any kernel event, and UST should not generate such events either.
Number of events expected for npt UST tracepoints¶
10000007 events are expected. This number is:
- 1 tracepoint npt:start
- 5 tracepoints npt:loop to prepare the npt work (before calculating loops time)
- 10000000 tracepoints npt:loop (-l option)
- 1 tracepoint npt:stop