summaryrefslogtreecommitdiffstats
path: root/smt_analysis_rtss20
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 00:08:12 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 00:08:12 -0400
commit3b0aa125061b362b23ecf66afe8319e3a268c874 (patch)
tree9323b85d5a3a0d14e33a28caa9ffc3b8ce7225be /smt_analysis_rtss20
parentedb491490ccd0cae4bd28ca9c9a7e095a47c749b (diff)
Add pair benchmarking and isolation specification into run_bench.sh
This allows `run_bench.sh` to replace all previous general paired benchmarking scripts. See `run_everything.sh` for an example of how to use the new script. This also fixes two critical bugs present in the old scripts: 1. The cpus_list was incorrectly set for resctrl when running synchronous pair timing with L2+L3 isolation (i). Each write to that file replaces the previous contents, and it was previously written once for each core. This prevented the entire 1st core from using any L3 cache. 2. The competing task list was indexed improperly in the asynchronous pair timing script. This caused the competing task to always be identical to the task being profiled. These issues combine to imply that in the rejected RTSS'20 paper: - All Level-C SMT timing data is suspect - Level-A and -B SMT timing data with L2+L3 isolation (i) is wildly optimistic
Diffstat (limited to 'smt_analysis_rtss20')
-rwxr-xr-xsmt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh175
-rwxr-xr-xsmt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh161
2 files changed, 0 insertions, 336 deletions
diff --git a/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh b/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh
deleted file mode 100755
index 2ac3fc1..0000000
--- a/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh
+++ /dev/null
@@ -1,175 +0,0 @@
1#!/bin/bash
2
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4
7tacleNames=tacleNames.txt
8
9if [ $# -lt 4 ]; then
10 echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
11 exit
12fi
13
14if [ $# -gt 4 ]; then
15 echo "Using alternate list of TACLe benchmarks from $5"
16 tacleNames=$5
17fi
18
19if [ "$EUID" -ne 0 ]
20then
21 echo "You need to be root to enable interrupt isolation and real-time execution!"
22 exit
23fi
24
25echo "Making sure that binaries are up to date..."
26while read i; do
27 make bin/$i
28done < $tacleNames
29echo "Done. Disabling real-time throttling..."
30
31# Turn off rt throttling
32echo -1 > /proc/sys/kernel/sched_rt_runtime_us
33echo "Done. Redirecting all interrupts to core 0..."
34
35# Redirect all interrupts to core 0
36i=0
37for IRQ in /proc/irq/*
38do
39 # Skip default_smp_affinity
40 if [ -d $IRQ ]; then
41 irqList[$i]=$(cat $IRQ/smp_affinity_list)
42 echo 0 2> /dev/null > $IRQ/smp_affinity_list
43 fi
44 i=$(( $i + 1 ))
45done
46
47# Read the names of each benchmark
48j=0
49while read i; do
50 tacleProg[$j]=$i
51 j=$(( $j + 1 ))
52done < $tacleNames
53
54echo "Done. Checking for wbinvd module..."
55if [[ ! -f "/proc/wbinvd" ]]; then
56 echo "ERROR: wbinvd module not loaded. Exiting..."
57 exit
58fi
59
60# Enable L3 isolation
61echo "Done. Enabling L3 isolation..."
62mount -t resctrl resctrl /sys/fs/resctrl
63mkdir -p /sys/fs/resctrl/benchmarks
64echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
65echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list
66# Reset global bandwith control and remove L3 from global
67echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
68echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
69# Alloc L3 to benchmark
70echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
71echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
72echo "Done. Verifying configuration with user..."
73
74# Generate file name string
75# We append to this as we parse the environment settings
76runID=$(date +"%b%d-%H")
77
78# Confirm configuration with user
79echo "=== Global Config ==="
80cat /sys/fs/resctrl/schemata
81echo "=== Core $firstCore and $secondCore Config ==="
82cat /sys/fs/resctrl/benchmarks/schemata
83if [[ $6 == "--contend" ]]; then
84 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
85 echo "ERROR: thrasher binary not fonud. Exiting..."
86 exit
87 fi
88 echo "Will run 6 contending tasks"
89 runID=$runID-c
90else
91 runID=$runID-xc
92fi
93if uname -a | grep -q "mc2"; then
94 echo "MC^2 Autodetected. Cache coloring will be DISABLED."
95 runID=$runID-i
96else
97 echo "MC^2 not detected. Cache coloring will be DISABLED."
98 runID=$runID-xi
99fi
100echo "Results will be saved as $runID-$userRunID-LC-DIS.txt"
101echo "Press enter to confirm environment, Ctrl-C to exit..."
102read
103
104# Start contending tasks
105if [[ $6 == "--contend" ]]; then
106 echo "Done. Starting 6 contending tasks..."
107 # Run two contending tasks on each other CCX
108 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
109 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
110 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
111 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
112 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
113 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
114fi
115sleep 1 # Wait for contending tasks to start
116echo "Done. Beginning benchmarks..."
117
118num_tests=$(wc -l < $tacleNames)
119for (( i = 0; i < $num_tests ; i++ ))
120do
121 # For level-C analysis, we must run all vs all
122 for (( j = 0; j < $num_tests ; j++ )) #loop through programs
123 do
124 # Autodetect MC^2
125 # Get DIS to loop continuously in the background by infinite restarts
126 if uname -a | grep -q "mc2"; then
127 bash -c "while true; do chrt -r 97 numactl --interleave=all taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 &> /dev/null; done" & PID1=$!;
128 else
129 bash -c "while true; do chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 &> /dev/null; done" & PID1=$!;
130 fi
131 # Each sample runs in its own process
132 for ((k=0;k<=maxJobs;k++)); do
133 if uname -a | grep -q "mc2"; then
134 chrt -r 97 numactl --interleave=all taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!;
135 else
136 chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!;
137 fi
138 done
139 # The paired task runs continuously in this configuration, so we have
140 # to kill it once the task that we're measuring finishes.
141 wait $PID2
142 kill $PID1
143 # Killing bash will not kill its children by default - work aronud that here
144 killall transitive &> /dev/null
145 killall matrix &> /dev/null
146 killall pointer &> /dev/null
147 killall field &> /dev/null
148 killall neighborhood &> /dev/null
149 killall update &> /dev/null
150 killall gen_input.py &> /dev/null
151 echo ${tacleProg[$i]} ${tacleProg[$j]}
152 done
153 echo COMPLETE: ${tacleProg[$i]}
154done
155
156# End contending tasks
157if [[ $6 == "--contend" ]]; then
158 killall thrasher
159fi
160
161# Remove semaphores from system
162# Leaving them won't hurt these tests, but would be messy and is bad practice
163# TODO: Do this directly in the benchmarks. They should clean up after themselves
164./bin/cleanupSemaphores
165
166# Put smp_affinty back the way it was
167i=0
168for IRQ in /proc/irq/*
169do
170 if [ -d $IRQ ]; then
171 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
172 fi
173 i=$(( $i + 1 ))
174done
175
diff --git a/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh b/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh
deleted file mode 100755
index 923dba0..0000000
--- a/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh
+++ /dev/null
@@ -1,161 +0,0 @@
1#!/bin/bash
2
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4