diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 00:08:12 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 00:08:12 -0400 |
| commit | 3b0aa125061b362b23ecf66afe8319e3a268c874 (patch) | |
| tree | 9323b85d5a3a0d14e33a28caa9ffc3b8ce7225be /smt_analysis_rtss20 | |
| parent | edb491490ccd0cae4bd28ca9c9a7e095a47c749b (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-x | smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh | 175 | ||||
| -rwxr-xr-x | smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh | 161 |
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 | |||
| 3 | firstCore=$1 | ||
| 4 | secondCore=$2 | ||
| 5 | maxJobs=$3 | ||
| 6 | userRunID=$4 | ||
| 7 | tacleNames=tacleNames.txt | ||
| 8 | |||
| 9 | if [ $# -lt 4 ]; then | ||
| 10 | echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]" | ||
| 11 | exit | ||
| 12 | fi | ||
| 13 | |||
| 14 | if [ $# -gt 4 ]; then | ||
| 15 | echo "Using alternate list of TACLe benchmarks from $5" | ||
| 16 | tacleNames=$5 | ||
| 17 | fi | ||
| 18 | |||
| 19 | if [ "$EUID" -ne 0 ] | ||
| 20 | then | ||
| 21 | echo "You need to be root to enable interrupt isolation and real-time execution!" | ||
| 22 | exit | ||
| 23 | fi | ||
| 24 | |||
| 25 | echo "Making sure that binaries are up to date..." | ||
| 26 | while read i; do | ||
| 27 | make bin/$i | ||
| 28 | done < $tacleNames | ||
| 29 | echo "Done. Disabling real-time throttling..." | ||
| 30 | |||
| 31 | # Turn off rt throttling | ||
| 32 | echo -1 > /proc/sys/kernel/sched_rt_runtime_us | ||
| 33 | echo "Done. Redirecting all interrupts to core 0..." | ||
| 34 | |||
| 35 | # Redirect all interrupts to core 0 | ||
| 36 | i=0 | ||
| 37 | for IRQ in /proc/irq/* | ||
| 38 | do | ||
| 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 )) | ||
| 45 | done | ||
| 46 | |||
| 47 | # Read the names of each benchmark | ||
| 48 | j=0 | ||
| 49 | while read i; do | ||
| 50 | tacleProg[$j]=$i | ||
| 51 | j=$(( $j + 1 )) | ||
| 52 | done < $tacleNames | ||
| 53 | |||
| 54 | echo "Done. Checking for wbinvd module..." | ||
| 55 | if [[ ! -f "/proc/wbinvd" ]]; then | ||
| 56 | echo "ERROR: wbinvd module not loaded. Exiting..." | ||
| 57 | exit | ||
| 58 | fi | ||
| 59 | |||
| 60 | # Enable L3 isolation | ||
| 61 | echo "Done. Enabling L3 isolation..." | ||
| 62 | mount -t resctrl resctrl /sys/fs/resctrl | ||
| 63 | mkdir -p /sys/fs/resctrl/benchmarks | ||
| 64 | echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
| 65 | echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
| 66 | # Reset global bandwith control and remove L3 from global | ||
| 67 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
| 68 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
| 69 | # Alloc L3 to benchmark | ||
| 70 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata | ||
| 71 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
| 72 | echo "Done. Verifying configuration with user..." | ||
| 73 | |||
| 74 | # Generate file name string | ||
| 75 | # We append to this as we parse the environment settings | ||
| 76 | runID=$(date +"%b%d-%H") | ||
| 77 | |||
| 78 | # Confirm configuration with user | ||
| 79 | echo "=== Global Config ===" | ||
| 80 | cat /sys/fs/resctrl/schemata | ||
| 81 | echo "=== Core $firstCore and $secondCore Config ===" | ||
| 82 | cat /sys/fs/resctrl/benchmarks/schemata | ||
| 83 | if [[ $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 | ||
| 90 | else | ||
| 91 | runID=$runID-xc | ||
| 92 | fi | ||
| 93 | if uname -a | grep -q "mc2"; then | ||
| 94 | echo "MC^2 Autodetected. Cache coloring will be DISABLED." | ||
| 95 | runID=$runID-i | ||
| 96 | else | ||
| 97 | echo "MC^2 not detected. Cache coloring will be DISABLED." | ||
| 98 | runID=$runID-xi | ||
| 99 | fi | ||
| 100 | echo "Results will be saved as $runID-$userRunID-LC-DIS.txt" | ||
| 101 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
| 102 | read | ||
| 103 | |||
| 104 | # Start contending tasks | ||
| 105 | if [[ $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 & | ||
| 114 | fi | ||
| 115 | sleep 1 # Wait for contending tasks to start | ||
| 116 | echo "Done. Beginning benchmarks..." | ||
| 117 | |||
| 118 | num_tests=$(wc -l < $tacleNames) | ||
| 119 | for (( i = 0; i < $num_tests ; i++ )) | ||
| 120 | do | ||
| 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]} | ||
| 154 | done | ||
| 155 | |||
| 156 | # End contending tasks | ||
| 157 | if [[ $6 == "--contend" ]]; then | ||
| 158 | killall thrasher | ||
| 159 | fi | ||
| 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 | ||
| 167 | i=0 | ||
| 168 | for IRQ in /proc/irq/* | ||
| 169 | do | ||
| 170 | if [ -d $IRQ ]; then | ||
| 171 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
| 172 | fi | ||
| 173 | i=$(( $i + 1 )) | ||
| 174 | done | ||
| 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 | |||
| 3 | firstCore=$1 | ||
| 4 | secondCore=$2 | ||
| 5 | maxJobs=$3 | ||
| 6 | userRunID=$4 | ||
