| 1 |
|
| 2 |
cyclictest does not catch all cases where packet forwarding |
| 3 |
latency can exceed a given threshold. |
| 4 |
|
| 5 |
Example: |
| 6 |
|
| 7 |
# taskset -c 3 ./queuelat -m 20000 -c 100 -p 13 -f `sh ./get_cpuinfo_mhz.sh` |
| 8 |
|
| 9 |
# rmmod targeted-ipi; insmod ./targeted-ipi.ko ipidest=3 nripis=200 interval=2 delay=10 |
| 10 |
|
| 11 |
<...>-4566 [003] .....11 4474.559880: tracing_mark_write: memmove block queue_size=28 queue_dec=279 queue_inc=307 delta=23685 ns |
| 12 |
<...>-4566 [003] .....11 4474.559912: tracing_mark_write: memmove block queue_size=63 queue_dec=279 queue_inc=314 delta=24198 ns |
| 13 |
<...>-4566 [003] .....11 4474.559937: tracing_mark_write: memmove block queue_size=97 queue_dec=279 queue_inc=313 delta=24090 ns |
| 14 |
<...>-4566 [003] .....11 4474.559965: tracing_mark_write: memmove block queue_size=130 queue_dec=279 queue_inc=312 delta=24048 ns |
| 15 |
<...>-4566 [003] .....11 4474.559993: tracing_mark_write: memmove block queue_size=162 queue_dec=279 queue_inc=311 delta=23957 ns |
| 16 |
<...>-4566 [003] .....11 4474.560018: tracing_mark_write: memmove block queue_size=193 queue_dec=279 queue_inc=310 delta=23912 ns |
| 17 |
<...>-4566 [003] .....11 4474.560046: tracing_mark_write: memmove block queue_size=225 queue_dec=279 queue_inc=311 delta=23965 ns |
| 18 |
<...>-4566 [003] .....11 4474.560074: tracing_mark_write: memmove block queue_size=257 queue_dec=279 queue_inc=311 delta=23971 ns |
| 19 |
<...>-4566 [003] .....11 4474.560102: tracing_mark_write: memmove block queue_size=288 queue_dec=279 queue_inc=310 delta=23902 ns |
| 20 |
<...>-4566 [003] .....11 4474.560127: tracing_mark_write: memmove block queue_size=320 queue_dec=279 queue_inc=311 delta=23945 ns |
| 21 |
<...>-4566 [003] .....11 4474.560155: tracing_mark_write: memmove block queue_size=351 queue_dec=279 queue_inc=310 delta=23921 ns |
| 22 |
<...>-4566 [003] .....11 4474.560180: tracing_mark_write: memmove block queue_size=381 queue_dec=279 queue_inc=309 delta=23839 ns |
| 23 |
<...>-4566 [003] .....11 4474.560208: tracing_mark_write: memmove block queue_size=412 queue_dec=279 queue_inc=310 delta=23876 ns |
| 24 |
<...>-4566 [003] .....11 4474.560236: tracing_mark_write: memmove block queue_size=443 queue_dec=279 queue_inc=310 delta=23886 ns |
| 25 |
<...>-4566 [003] .....11 4474.560261: tracing_mark_write: memmove block queue_size=474 queue_dec=279 queue_inc=310 delta=23901 ns |
| 26 |
<...>-4566 [003] .....11 4474.560288: tracing_mark_write: memmove block queue_size=505 queue_dec=279 queue_inc=310 delta=23891 ns |
| 27 |
<...>-4566 [003] .....11 4474.560316: tracing_mark_write: memmove block queue_size=535 queue_dec=279 queue_inc=309 delta=23822 ns |
| 28 |
<...>-4566 [003] .....11 4474.560341: tracing_mark_write: memmove block queue_size=565 queue_dec=279 queue_inc=309 delta=23815 ns |
| 29 |
<...>-4566 [003] .....11 4474.560353: tracing_mark_write: queue length exceeded: queue_size=565 max_queue_len=559 |
| 30 |
|
| 31 |
# taskset -c 3 cyclictest -m -n -q -p95 -D 60m -h60 -i 200 |
| 32 |
|
| 33 |
# rmmod targeted-ipi; insmod ./targeted-ipi.ko ipidest=3 nripis=20000 interval=2 delay=10 |
| 34 |
|
| 35 |
Cyclictest results: |
| 36 |
|
| 37 |
# Total: 000068099 |
| 38 |
# Min Latencies: 00001 |
| 39 |
# Avg Latencies: 00002 |
| 40 |
# Max Latencies: 00008 |
| 41 |
# Histogram Overflows: 00000 |
| 42 |
|
| 43 |
|
| 44 |
----- queuelat basics: |
| 45 |
|
| 46 |
Queuelat simulates a DPDK queue. From queuelat.c: |
| 47 |
|
| 48 |
Program parameters: |
| 49 |
max_queue_len: maximum latency allowed, in nanoseconds (int). |
| 50 |
cycles_per_packet: number of cycles to process one packet (int). |
| 51 |
mpps(million-packet-per-sec): million packets per second (float). |
| 52 |
tsc_freq_mhz: TSC frequency in MHz, as measured by TSC PIT calibration |
| 53 |
(search for "Detected XXX MHz processor" in dmesg, and use the integer part). |
| 54 |
timeout: timeout (in seconds). |
| 55 |
|
| 56 |
How it works |
| 57 |
============ |
| 58 |
|
| 59 |
The program in essence does: |
| 60 |
|
| 61 |
b = rdtsc(); |
| 62 |
memmove(dest, src, n); |
| 63 |
a = rdtsc(); |
| 64 |
|
| 65 |
delay = convert_to_ns(a - b); |
| 66 |
|
| 67 |
queue_size += packets_queued_in(delay); |
| 68 |
queue_size -= packets_processed; |
| 69 |
|
| 70 |
if (queue_size > max_queue_len) |
| 71 |
FAIL(); |
| 72 |
|
| 73 |
packets_processed is fixed, and is estimated as follows: |
| 74 |
n is determined first, so that the stats bucket with highest count |
| 75 |
takes max_latency/2. |
| 76 |
for max_latency/2, we calculate how many packets can be drained |
| 77 |
in that time (using cycles_per_packet). |
| 78 |
|
| 79 |
Queuelat output |
| 80 |
=============== |
| 81 |
|
| 82 |
During calibration, queuelat outputs the following table: |
| 83 |
|
| 84 |
[9600 - 9699] = 0 packetfillrates=[67 - 67] |
| 85 |
[9700 - 9799] = 7907 packetfillrates=[67 - 68] |
| 86 |
[9800 - 9899] = 42085 packetfillrates=[68 - 69] |
| 87 |
[9900 - 9999] = 7 packetfillrates=[69 - 69] |
| 88 |
[10000 - 10099] = 1 packetfillrates=[70 - 70] |
| 89 |
| | | | |
| 90 |
| | | | |
| 91 |
| | | |_________ [min - max] number of |
| 92 |
| | | packets the queue will reach |
| 93 |
| | | with specified mpps in this |
| 94 |
| | | time (without draining) |
| 95 |
| | | |
| 96 |
| | |______________________________ number of hits for this |
| 97 |
| | bucket |
| 98 |
| | |
| 99 |
| |______________________________________ min amount of time (ns) |
| 100 |
| this bucket accepts |
| 101 |
| |
| 102 |
|______________________________________________ max amount of time (ns) |
| 103 |
this bucket accepts |
| 104 |
|
| 105 |
|
| 106 |
On success, queuelat outputs a table similar to cyclictest: |
| 107 |
|
| 108 |
[7000 - 7099] = 0 |
| 109 |
[7100 - 7199] = 2 |
| 110 |
[7200 - 7299] = 2457 |
| 111 |
[7300 - 7399] = 21058 |
| 112 |
| | | |
| 113 |
| | |___________ Number of processing loops that hit this |
| 114 |
| | bucket. |
| 115 |
| | |
| 116 |
| |____________________ Maximum number of nanoseconds of this bucket. |
| 117 |
| |
| 118 |
| |
| 119 |
|___________________________ Minimum number of nanoseconds in this bucket. |
| 120 |
|
| 121 |
That is a processing loop will account into a bucket if its duration |
| 122 |
is |
| 123 |
|
| 124 |
min_number_ns_in_bucket < duration < max_number_ns_in_bucket |
| 125 |
|
| 126 |
|
| 127 |
Automatic determination of Mpps |
| 128 |
=============================== |
| 129 |
|
| 130 |
There is a script called determine_maximum_mpps.sh, which should be edited |
| 131 |
to include the pinning and -RT priority configuration for your machine. |
| 132 |
|
| 133 |
PREAMBLE="taskset -c 2 chrt -f 1" |
| 134 |
MAXLAT="20000" |
| 135 |
CYCLES_PER_PACKET="300" |
| 136 |
|
| 137 |
This script will find the maximum mpps parameter which can sustain: |
| 138 |
|
| 139 |
1) 10 consecutive 30 second runs. |
| 140 |
2) 1 run of 10 minutes. |
| 141 |
|
| 142 |
Without violating the latency specified with $MAXLAT. |
| 143 |
|