On Tue, 3 Jul 2018 11:32:51 -0300
Marcelo Tosatti <mtosatti(a)redhat.com> wrote:
As noted in the bugzilla ticket
https://bugzilla.redhat.com/show_bug.cgi?id=1554851
The QEMU I/O thread can interrupt the time measurement
of the timer. To avoid this problem, only
pin the vCPU thread.
That approach looks good to me, and I could confirm that it does
fix the BZ. However, applying the profile is failing for me:
./find-lapictscdeadline-optimal.sh: line 10: 1*100/ 0,2,4,6: division by 0 (error token is
",2,4,6")
could not find optimal latency'
2018-07-03 16:42:53,060 ERROR tuned.plugins.plugin_script: script
'/usr/lib/tuned/realtime-virtual-host/script.sh' returned error code: 1
2018-07-03 16:42:53,119 INFO tuned.daemon.daemon: static tuning from profile
'realtime-virtual-host' applied
Also, there a few more details below.
Signed-off-by: Marcelo Tosatti <mtosatti(a)redhat.com>
diff --git a/profiles/realtime-virtual-host/script.sh
b/profiles/realtime-virtual-host/script.sh
index e821bef..3708107 100755
--- a/profiles/realtime-virtual-host/script.sh
+++ b/profiles/realtime-virtual-host/script.sh
@@ -17,20 +17,38 @@ run_tsc_deadline_latency()
for i in `seq 1000 500 7000`; do
echo $i > $KVM_LAPIC_FILE
- chrt -f 1 taskset -c $1 $QEMU -enable-kvm -device pc-testdev \
+
+ port=9000
+ for port in `seq 9000 1 1000`; do
+ echo "test" | nc localhost $port
+ R=$?
+ if [ $R -eq 1 ]; then
+ break
+ fi
+ done
There's a race here. Between finding the port and starting QEMU a
process may use the port, in which case QEMU will fail to start.
One way of fixing this would be to use a unix socket in -chardev.
And/or check taskset and wait for failure (which we probably should do
anyways).
+
+ chrt -f 1 $QEMU -S -enable-kvm -device pc-testdev \
-device isa-debug-exit,iobase=0xf4,iosize=0x4 \
-display none -serial stdio -device pci-testdev \
-kernel "$TSCDEADLINE_LATENCY" \
- -cpu host | grep latency | cut -f 2 -d ":" > $dir/out
-
- if [ ! -f $dir/out ]; then
- die running $TSCDEADLINE_LATENCY failed
- fi
+ -cpu host \
+ -mon chardev=char0,mode=readline \
+ -chardev socket,id=char0,nowait,port=$port,server,host=127.0.0.1 | grep
latency | cut -f 2 -d ":" > $dir/out &
+
+ sleep 1s
+ pidofvcpu=`echo "info cpus" | nc 127.0.0.1 $port | grep thread_id |
cut -f 3 -d "=" | tr -d "\r"`
+ taskset -p -c $1 $pidofvcpu
+ echo "cont" | nc 127.0.0.1 $port
+ wait
+
+ if [ ! -f $dir/out ]; then
+ die running $TSCDEADLINE_LATENCY failed
+ fi
- tmp=$(wc -l $dir/out | awk '{ print $1 }')
- if [ $tmp -eq 0 ]; then
- die running $TSCDEADLINE_LATENCY failed
- fi
+ tmp=$(wc -l $dir/out | awk '{ print $1 }')
+ if [ $tmp -eq 0 ]; then
+ die running $TSCDEADLINE_LATENCY failed
+ fi
A=0
while read l; do