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

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