Blame SOURCES/tuned-2.10.0-realtime-virtual-host-pin-only-vcpu-thread-to-isolated-pcpu.patch

b14826
From 4790e570ce0e41bde4e1866ed6e3cba723b5f4d8 Mon Sep 17 00:00:00 2001
b14826
From: Marcelo Tosatti <mtosatti@redhat.com>
b14826
Date: Wed, 4 Jul 2018 17:30:37 -0300
b14826
Subject: [PATCH] realtime-virtual-host: pin only the vcpu thread to isolated
b14826
 pCPU (v2)
b14826
b14826
As noted in the bugzilla ticket
b14826
b14826
https://bugzilla.redhat.com/show_bug.cgi?id=1554851
b14826
b14826
The QEMU I/O thread can interrupt the time measurement
b14826
of the timer. To avoid this problem, only
b14826
pin the vCPU thread.
b14826
b14826
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
b14826
Reviewed-and-Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
b14826
b14826
v2:
b14826
   - Use unix sockets (Luiz)
b14826
   - Proper numeric output (Luiz)
b14826
---
b14826
 profiles/realtime-virtual-host/script.sh | 31 ++++++++++++++++--------
b14826
 1 file changed, 21 insertions(+), 10 deletions(-)
b14826
b14826
diff --git a/profiles/realtime-virtual-host/script.sh b/profiles/realtime-virtual-host/script.sh
b14826
index 515d2547..32e962db 100755
b14826
--- a/profiles/realtime-virtual-host/script.sh
b14826
+++ b/profiles/realtime-virtual-host/script.sh
b14826
@@ -17,20 +17,31 @@ run_tsc_deadline_latency()
b14826
 
b14826
     for i in `seq 1000 500 7000`; do
b14826
         echo $i > $KVM_LAPIC_FILE
b14826
-        chrt -f 1 taskset -c $1 $QEMU -enable-kvm -device pc-testdev \
b14826
+
b14826
+        unixpath=`mktemp`
b14826
+
b14826
+        chrt -f 1 $QEMU -S -enable-kvm -device pc-testdev \
b14826
             -device isa-debug-exit,iobase=0xf4,iosize=0x4 \
b14826
             -display none -serial stdio -device pci-testdev \
b14826
             -kernel "$TSCDEADLINE_LATENCY"  \
b14826
-            -cpu host | grep latency | cut -f 2 -d ":" > $dir/out
b14826
-
b14826
-	if [ ! -f $dir/out ]; then
b14826
-	    die running $TSCDEADLINE_LATENCY failed
b14826
-	fi
b14826
+            -cpu host \
b14826
+            -mon chardev=char0,mode=readline \
b14826
+            -chardev socket,id=char0,nowait,path=$unixpath,server | grep latency | cut -f 2 -d ":" > $dir/out &
b14826
+
b14826
+        sleep 1s
b14826
+        pidofvcpu=`echo "info cpus" | nc -U $unixpath | grep thread_id | cut -f 3 -d "=" | tr -d "\r"`
b14826
+        taskset -p -c $1 $pidofvcpu >/dev/null
b14826
+        echo "cont" | nc -U $unixpath >/dev/null
b14826
+        wait
b14826
+
b14826
+        if [ ! -f $dir/out ]; then
b14826
+             die running $TSCDEADLINE_LATENCY failed
b14826
+        fi
b14826
 
b14826
-	tmp=$(wc -l $dir/out | awk '{ print $1 }')
b14826
-	if [ $tmp -eq 0 ]; then
b14826
-	    die running $TSCDEADLINE_LATENCY failed
b14826
-	fi
b14826
+        tmp=$(wc -l $dir/out | awk '{ print $1 }')
b14826
+        if [ $tmp -eq 0 ]; then
b14826
+            die running $TSCDEADLINE_LATENCY failed
b14826
+        fi
b14826
 
b14826
         A=0
b14826
         while read l; do