From 3b0aa125061b362b23ecf66afe8319e3a268c874 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 00:08:12 -0400 Subject: 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 --- all_pairs/run_all_pairs.sh | 168 ------------- all_pairs/run_all_pairs_L3_ONLY.sh | 170 -------------- all_pairs/tacleNames.txt | 18 +- baseline/run_baseline_L3_ONLY.sh | 152 ------------ baseline/tacleNames.txt | 18 +- run_all_tacle.sh | 58 +++++ run_bench.sh | 261 ++++++++++++++++----- run_everything.sh | 21 -- run_tacle_all.sh | 49 ---- smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh | 175 -------------- smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh | 161 ------------- 11 files changed, 284 insertions(+), 967 deletions(-) delete mode 100755 all_pairs/run_all_pairs.sh delete mode 100755 all_pairs/run_all_pairs_L3_ONLY.sh delete mode 100755 baseline/run_baseline_L3_ONLY.sh create mode 100755 run_all_tacle.sh delete mode 100755 run_everything.sh delete mode 100755 run_tacle_all.sh delete mode 100755 smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh delete mode 100755 smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh diff --git a/all_pairs/run_all_pairs.sh b/all_pairs/run_all_pairs.sh deleted file mode 100755 index 2260216..0000000 --- a/all_pairs/run_all_pairs.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/bash - -firstCore=$1 -secondCore=$2 -maxJobs=$3 -userRunID=$4 -tacleNames=tacleNames.txt - -if [ $# -lt 4 ]; then - echo "Usage $0 [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 4 ]; then - echo "Using alternate list of TACLe benchmarks from $5" - tacleNames=$5 -fi - -if [ "$EUID" -ne 0 ] -then - echo "You need to be root to enable interrupt isolation and real-time execution!" - exit -fi - -echo "Making sure that binaries are up to date..." -while read i; do - make bin/$i -done < $tacleNames -echo "Done. Disabling real-time throttling..." - -# Turn off rt throttling -echo -1 > /proc/sys/kernel/sched_rt_runtime_us -echo "Done. Redirecting all interrupts to core 0..." - -# Redirect all interrupts to core 0 -i=0 -for IRQ in /proc/irq/* -do - # Skip default_smp_affinity - if [ -d $IRQ ]; then - irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - -# Read the names of each benchmark -j=0 -while read i; do - tacleProg[$j]=$i - j=$(( $j + 1 )) -done < $tacleNames - -echo "Done. Checking for wbinvd module..." -if [[ ! -f "/proc/wbinvd" ]]; then - echo "ERROR: wbinvd module not loaded. Exiting..." - exit -fi - -echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." -echo "performance" > /sys/devices/system/cpu/cpu$firstCore/cpufreq/scaling_governor -echo "performance" > /sys/devices/system/cpu/cpu$secondCore/cpufreq/scaling_governor - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list -echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list -# Reset global bandwith control and remove L3 from global -echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata -# Alloc L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata -echo "Done. Verifying configuration with user..." - -# Generate file name string -# We append to this as we parse the environment settings -runID=$(date +"%b%d-%H") - -# Confirm configuration with user -echo "=== Global Config ===" -cat /sys/fs/resctrl/schemata -echo "=== Core $firstCore and $secondCore Config ===" -cat /sys/fs/resctrl/benchmarks/schemata -if [[ $6 == "--contend" ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not fonud. Exiting..." - exit - fi - echo "Will run 6 contending tasks" - runID=$runID-c -else - runID=$runID-xc -fi -if uname -a | grep -q "mc2"; then - echo "MC^2 Autodetected. Cache coloring will be enabled." - runID=$runID-i -else - echo "MC^2 not detected. Cache coloring will be DISABLED." - runID=$runID-xi -fi -if pwd | grep -qi dis; then - echo "Autodetected DIS. Will use script-level looping." -fi -echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $6 == "--contend" ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & -fi -sleep 1 # Wait for contending tasks to start -echo "Done. Beginning benchmarks..." - -num_tests=$(wc -l < $tacleNames) -for (( i = 0; i < $num_tests ; i++ )) -do - for (( j = $i; j < $num_tests ; j++ )) #loop through programs - do - # If using DIS, we have to iterate in the script as DIS won't do it for us - pwd | grep -qi dis - iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") - for ((k=0;k<=iters;k++)); do - # Autodetect MC^2 - if uname -a | grep -q "mc2"; then - chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!; - chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!; - else - chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!; - chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!; - fi - wait $PID1 $PID2 - done - echo ${tacleProg[$i]} ${tacleProg[$j]} - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $6 == "--contend" ]]; then - killall thrasher -fi - -# Remove semaphores from system -# Leaving them won't hurt these tests, but would be messy and is bad practice -# TODO: Do this directly in the benchmarks. They should clean up after themselves -./bin/cleanupSemaphores - -# Put smp_affinty back the way it was -i=0 -for IRQ in /proc/irq/* -do - if [ -d $IRQ ]; then - echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - diff --git a/all_pairs/run_all_pairs_L3_ONLY.sh b/all_pairs/run_all_pairs_L3_ONLY.sh deleted file mode 100755 index 8ed5eeb..0000000 --- a/all_pairs/run_all_pairs_L3_ONLY.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash - -firstCore=$1 -secondCore=$2 -maxJobs=$3 -userRunID=$4 -tacleNames=tacleNames.txt - -if [ $# -lt 4 ]; then - echo "Usage $0 [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 4 ]; then - echo "Using alternate list of TACLe benchmarks from $5" - tacleNames=$5 -fi - -if [ "$EUID" -ne 0 ] -then - echo "You need to be root to enable interrupt isolation and real-time execution!" - exit -fi - -echo "Making sure that binaries are up to date..." -while read i; do - make bin/$i -done < $tacleNames -echo "Done. Disabling real-time throttling..." - -# Turn off rt throttling -echo -1 > /proc/sys/kernel/sched_rt_runtime_us -echo "Done. Redirecting all interrupts to core 0..." - -# Redirect all interrupts to core 0 -i=0 -for IRQ in /proc/irq/* -do - # Skip default_smp_affinity - if [ -d $IRQ ]; then - irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - -# Read the names of each benchmark -j=0 -while read i; do - tacleProg[$j]=$i - j=$(( $j + 1 )) -done < $tacleNames - -echo "Done. Checking for wbinvd module..." -if [[ ! -f "/proc/wbinvd" ]]; then - echo "ERROR: wbinvd module not loaded. Exiting..." - exit -fi - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -mkdir -p /sys/fs/resctrl/benchmarks2 -echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list -echo $secondCore > /sys/fs/resctrl/benchmarks2/cpus_list -# Reset global bandwith control and remove L3 from global -echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata -# Alloc half L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata -# Alloc other half L3 to benchmark2 -echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks2/schemata -echo "Done. Verifying configuration with user..." - -# Generate file name string -# We append to this as we parse the environment settings -runID=$(date +"%b%d-%H") - -# Confirm configuration with user -echo "=== Global Config ===" -cat /sys/fs/resctrl/schemata -echo "=== Core $firstCore Config ===" -cat /sys/fs/resctrl/benchmarks/schemata -echo "=== Core $secondCore Config ===" -cat /sys/fs/resctrl/benchmarks2/schemata -if [[ $6 == "--contend" ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not found. Exiting..." - exit - fi - echo "Will run 6 contending tasks" - runID=$runID-c -else - runID=$runID-xc -fi -if uname -a | grep -q "mc2"; then - echo "MC^2 Autodetected. Not supported by this script!." - exit -else - echo "MC^2 not detected. Cache coloring will be enabled in the L3 only.." - runID=$runID-i3 -fi -if pwd | grep -qi dis; then - echo "Autodetected DIS. Will use script-level looping." -fi -echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $6 == "--contend" ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & -fi -sleep 1 # Wait for contending tasks to start -echo "Done. Beginning benchmarks..." - -num_tests=$(wc -l < $tacleNames) -for (( i = 0; i < $num_tests ; i++ )) -do - for (( j = $i; j < $num_tests ; j++ )) #loop through programs - do - # If using DIS, we have to iterate in the script as DIS won't do it for us - pwd | grep -qi dis - iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") - for ((k=0;k<=iters;k++)); do - # Autodetect MC^2 - if uname -a | grep -q "mc2"; then - chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!; - chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!; - else - chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!; - chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!; - fi - wait $PID1 $PID2 - done - echo ${tacleProg[$i]} ${tacleProg[$j]} - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $6 == "--contend" ]]; then - killall thrasher -fi - -# Remove semaphores from system -# Leaving them won't hurt these tests, but would be messy and is bad practice -# TODO: Do this directly in the benchmarks. They should clean up after themselves -./bin/cleanupSemaphores - -# Put smp_affinty back the way it was -i=0 -for IRQ in /proc/irq/* -do - if [ -d $IRQ ]; then - echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - diff --git a/all_pairs/tacleNames.txt b/all_pairs/tacleNames.txt index 8f4845a..2e02966 100644 --- a/all_pairs/tacleNames.txt +++ b/all_pairs/tacleNames.txt @@ -1,19 +1,23 @@ petrinet -ndes statemate -adpcm_dec +ndes +h264_dec +huff_dec cjpeg_wrbmp +fmref +audiobeam +adpcm_dec adpcm_enc +g723_enc +huff_enc +gsm_dec cjpeg_transupp -dijkstra epic -fmref -gsm_dec -h264_dec -huff_enc +anagram rijndael_enc rijndael_dec gsm_enc susan +dijkstra ammunition mpeg2 diff --git a/baseline/run_baseline_L3_ONLY.sh b/baseline/run_baseline_L3_ONLY.sh deleted file mode 100755 index 4183653..0000000 --- a/baseline/run_baseline_L3_ONLY.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash - -core=$1 -maxJobs=$2 -userRunID=$3 -tacleNames=tacleNames.txt - -if [ $# -lt 3 ]; then - echo "Usage $0 [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 3 ]; then - echo "Using alternate list of TACLe benchmarks from $4" - tacleNames=$4 -fi - -if [ "$EUID" -ne 0 ] -then - echo "You need to be root to enable interrupt isolation and real-time execution!" - exit -fi - -echo "Making sure that binaries are up to date..." -while read i; do - make bin/$i -done < $tacleNames -echo "Done. Disabling real-time throttling..." - -# Turn off rt throttling -echo -1 > /proc/sys/kernel/sched_rt_runtime_us -echo "Done. Redirecting all interrupts to core 0..." - -# Redirect all interrupts to core 0 -i=0 -for IRQ in /proc/irq/* -do - # Skip default_smp_affinity - if [ -d $IRQ ]; then - irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - -# Read the names of each benchmark -j=0 -while read i; do - tacleProg[$j]=$i - j=$(( $j + 1 )) -done < $tacleNames - -echo "Done. Checking for wbinvd module..." -if [[ ! -f "/proc/wbinvd" ]]; then - echo "ERROR: wbinvd module not loaded. Exiting..." - exit -fi - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -echo $1 > /sys/fs/resctrl/benchmarks/cpus_list -# Reset global bandwith control and remove L3 from global -echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata -# Alloc L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata -echo "Done. Verifying configuration with user..." - -# Generate file name string -# We append to this as we parse the environment settings -runID=$(date +"%b%d-%H") - -# Confirm configuration with user -echo "=== Global Config ===" -cat /sys/fs/resctrl/schemata -echo "=== Core $1 Config ===" -cat /sys/fs/resctrl/benchmarks/cpus_list -cat /sys/fs/resctrl/benchmarks/schemata -if [[ $5 == "--contend" ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not fonud. Exiting..." - exit - fi - echo "Will run 6 contending tasks" - runID=$runID-c -else - runID=$runID-xc -fi -if uname -a | grep -q "mc2"; then - echo "MC^2 Autodetected. NOT SUPPORTED. Exiting..." - exit -else - echo "MC^2 not detected. 50% L3 allocation enabled." - runID=$runID-i3 -fi -if pwd | grep -qi dis; then - echo "Autodetected DIS. Will use script-level looping." -fi -echo "Results will be saved as $runID-$userRunID.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $5 == "--contend" ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & -fi -sleep 1 # Wait for contending tasks to start -echo "Done. Beginning benchmarks..." - -num_tests=$(wc -l < $tacleNames) -for (( i = 0; i < $num_tests ; i++ )) -do - # If using DIS, we have to iterate in the script as DIS won't do it for us - pwd | grep -qi dis - iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") - for ((k=0;k<=iters;k++)); do - # Check if we're using LITMUS^RT or not - if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then - ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 - else - # Interleave memory allocations between all nodes (only 1 node w/out MC^2) - chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 - fi - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $5 == "--contend" ]]; then - killall thrasher -fi - -# Put smp_affinty back the way it was -i=0 -for IRQ in /proc/irq/* -do - if [ -d $IRQ ]; then - echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - diff --git a/baseline/tacleNames.txt b/baseline/tacleNames.txt index 8f4845a..2e02966 100644 --- a/baseline/tacleNames.txt +++ b/baseline/tacleNames.txt @@ -1,19 +1,23 @@ petrinet -ndes statemate -adpcm_dec +ndes +h264_dec +huff_dec cjpeg_wrbmp +fmref +audiobeam +adpcm_dec adpcm_enc +g723_enc +huff_enc +gsm_dec cjpeg_transupp -dijkstra epic -fmref -gsm_dec -h264_dec -huff_enc +anagram rijndael_enc rijndael_dec gsm_enc susan +dijkstra ammunition mpeg2 diff --git a/run_all_tacle.sh b/run_all_tacle.sh new file mode 100755 index 0000000..c0f07cc --- /dev/null +++ b/run_all_tacle.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Copyright 2020 Joshua Bakita +# Runs TACLeBench in every configuration needed +# for the paper and schedulability studies + +maxJobs=$1 +runID=$2 + +if [ $# -lt 2 ]; then + echo "Usage $0 " + exit +fi +date + +# Run the pairs baseline and some comparisons to examine the effect of less cache +cd baseline +make all -j32 +# Full L3, full L2 - xi is the baseline for the pairs +baseXI=baseline/$(date +"%b%d-%H")-c-xi-$runID.txt +echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I xi $runID +# Half L3, full L2 - i3 sees effect of half L3 +baseI3=baseline/$(date +"%b%d-%H")-c-i3-$runID.txt +echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I i3 $runID +# Half L3, half L2 - additional effect of half L2 +baseI=baseline/$(date +"%b%d-%H")-c-i-$runID.txt +echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I i $runID +date + +# Run the Level-A/-B pairs +cd ../all_pairs +make all -j32 +# No cache isolation +pairXI=all_pairs/$(date +"%b%d-%H")-c-xi-$runID.txt +echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi $runID +# Shared L2, split L3 +pairI3=all_pairs/$(date +"%b%d-%H")-c-i3-$runID.txt +echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i3 $runID +# Split L2, split L3 +pairI=all_pairs/$(date +"%b%d-%H")-c-i-$runID.txt +echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i $runID +date + +# Run the Level-C pairs +cd ../baseline +pairC=baseline/$(date +"%b%d-%H")-c-xi-async-$runID.txt +echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi -A $runID +date + +echo "==== DONE ====" +echo "Results are in:" +echo "- $baseXI" +echo "- $baseI3" +echo "- $baseI" +echo "- $pairXI" +echo "- $pairI3" +echo "- $pairI" +echo "- $pairC" + diff --git a/run_bench.sh b/run_bench.sh index 4e09faa..250d843 100755 --- a/run_bench.sh +++ b/run_bench.sh @@ -1,24 +1,43 @@ #!/bin/bash +# Copyright 2020 Joshua Bakita +# A unified script for timing: +# - SMT pairs with synchronous launches (hard real-time methodolgy) +# - SMT pairs with asynchronous launches (soft real-time methodolgy) +# - Unpaired tasks +# - The cache alloc vs WSS setting exploration for DIS +# These can all be done with: +# - No cache management +# - L3 cache splitting +# - L2+L3 cache splitting (if OS supported) + +if grep -q "#define LITMUS 1" ../extra.h ./extra.h 2> /dev/null; then + LITMUS=1 +fi if [ $# -lt 5 ]; then - echo "Usage $0 -m MODE -p CPU -l LOOPS -b FILE [-c] RUN_ID" - echo " -m base|dis Which benchmarking mode to use" + echo "Usage $0 -m MODE -p CPU -l LOOPS -b FILE [-B] [-I] RUN_ID" + echo " -m base|dis|pair Which benchmarking mode to use" echo " -p CPU Which CPU to run each benchmark on" echo " -l LOOPS How many loops of each benchmark to do" echo " -b FILE List of benchmarks to execute. Optional tab-" echo " delimited 2nd column specifies an input" echo " generation command (fed to bench via stdin)" echo " -B Enable background contenders on other CCXes" + echo " -I xi|i3|i Isolation mode: none (xi) (default), way-based" + echo " L3-only (i3), or color-based L2+L3 (i)" echo "Mode base requires no additional options." echo "Mode dis does not support the 2nd col. of -b and needs:" echo " -W FILE List of working set sizes to pass gen_input.py" echo " -T FILE Input template to pass to gen_input.py" echo " -C FILE List of cache configurations to test" - exit + echo "Mode pair options:" + echo " -P CPU CPU to run the 2nd benchmark on" + echo " -A Async. (Don't synchronize the pair at job" + echo " boundries.) Typically used SMT in soft realtime" fi # Name options similarly to rtspin -while getopts “m:p:l:b:BW:T:C:” opt; do +while getopts “m:p:l:b:BI:W:T:C:P:A” opt; do case $opt in # Required m) mode=$OPTARG ;; @@ -27,9 +46,14 @@ while getopts “m:p:l:b:BW:T:C:” opt; do b) benchNames=$OPTARG ;; # Optional B) contend=1 ;; + I) iso_mode=$OPTARG ;; +# DIS W) wss_settings=$OPTARG ;; T) template_input=$OPTARG ;; C) cache_settings=$OPTARG ;; +# Pair + P) core_two=$OPTARG ;; + A) async=1 ;; esac done # Reset to read operands @@ -37,7 +61,7 @@ shift $((OPTIND -1)) userRunID=$1 # Required argument checking -if [[ "$mode" != "base" ]] && [[ "$mode" != "dis" ]]; then +if [[ "$mode" != "base" && "$mode" != "dis" && $mode != pair ]]; then echo "Invalid argument: MODE must be either 'base' or 'dis'" exit fi @@ -72,14 +96,37 @@ if [[ "$mode" == "dis" ]] && [[ ! -f "$cache_settings" ]]; then exit fi +# Pair argument checking +if [[ "$mode" == "pair" && ! -v core_two ]]; then + echo "Missing argument: mode=pair reqires -P" + exit +fi +if [[ "$mode" != "pair" ]] && [[ -v async || -v core_two ]]; then + echo "Invalid argument: -A and -P require mode=pair" + exit +fi + +# Additional checks +if [[ $userRunID == "" ]]; then + echo "Missing argument: a run ID is required" + exit +fi +if [[ -v contend && ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then + echo "ERROR: cannot find thrasher binary for -B. Exiting..." + exit +fi +if [[ $iso_mode == "i" && ! $(uname -a | grep "mc2") ]]; then + echo "Isolation mode 'i' requires the MC^2 kernel. Exiting..." + exit +fi + # Check permissions and update state -if [ "$EUID" -ne 0 ] -then +if [[ "$EUID" != 0 ]]; then echo "You need to be root to enable interrupt isolation and real-time execution!" exit fi -echo "Done. Loading benchmark names and input..." +echo "Loading benchmark names and input..." # Read the names of each benchmark and load input. # This might look a bit scary, but all it does is @@ -96,11 +143,16 @@ done < $benchNames echo "Making sure that binaries are up to date..." for b in ${bench[@]}; do - make bin/$b - if [[ $? ]]; then + # Build "bin/bench" if bin directory + if [[ -d bin ]]; then + make bin/$b + fi + # If that failed, try a different name + if [[ "$?" != 0 || ! -d bin ]]; then make $b fi - if [[ ! -f $b && ! -f "./bin/$b" ]]; then + # If bench is still not in bin or curr dir, fail + if [[ ! -f "./$b" && ! -f "./bin/$b" ]]; then echo "Unable to find benchmark $b" exit fi @@ -123,26 +175,86 @@ do i=$(( $i + 1 )) done +echo "Done. Creating cleanup handler..." +function cleanup { + # End contending tasks + if [[ -v contend ]]; then + killall thrasher + fi + + # Restore cache access to everyone + echo "L3:0=ffff;1=ffff;2=ffff;3=ffff" > /sys/fs/resctrl/schemata + if [[ -e /sys/fs/resctrl/benchmarks ]]; then + echo "" > /sys/fs/resctrl/benchmarks/cpus_list + fi + if [[ -e /sys/fs/resctrl/benchmarks2 ]]; then + echo "" > /sys/fs/resctrl/benchmarks2/cpus_list + fi + + # Put smp_affinty back the way it was + i=0 + for IRQ in /proc/irq/* + do + if [ -d $IRQ ]; then + echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list + fi + i=$(( $i + 1 )) + done +} +# This sets the cleanup function to be called when we exit for any reason +trap cleanup EXIT + echo "Done. Checking for wbinvd module..." if [[ ! -f "/proc/wbinvd" ]]; then echo "ERROR: wbinvd module not loaded. Exiting..." exit fi -echo "Done. Setting core $core to 'performance'..." +echo "Done. Setting cores to 'performance'..." echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor +if [[ -v core_two ]]; then + echo "performance" > /sys/devices/system/cpu/cpu$core_two/cpufreq/scaling_governor +fi # Enable L3 isolation -echo "Done. Enabling L3 isolation..." +echo "Done. Setting up L3 isolation..." mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -echo $core > /sys/fs/resctrl/benchmarks/cpus_list # Reset global bandwith control and remove L3 from global echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata # Alloc L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata +# (this logic is safe when $core_two is empty) +if [[ $iso_mode == "i" ]]; then + # With "i" we rely on numactl to do isolation + # Full L3 access from both cores + mkdir -p /sys/fs/resctrl/benchmarks + # Must write both at the same time. Appends unsupported! + echo $core,$core_two > /sys/fs/resctrl/benchmarks/cpus_list + echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata + # But each core is bound to its own numa mem node + numa_arg0="--membind=0" + numa_arg1="--membind=1" +elif [[ $iso_mode == "i3" ]]; then + # With "i3" we rely on resctrl to do isolation + mkdir -p /sys/fs/resctrl/benchmarks + mkdir -p /sys/fs/resctrl/benchmarks2 + echo $core > /sys/fs/resctrl/benchmarks/cpus_list + echo $core_two > /sys/fs/resctrl/benchmarks2/cpus_list + echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata + echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata + # Disable numa-based isolation + numa_arg0="--interleave=all" + numa_arg1="--interleave=all" +else + iso_mode="xi" + # No isolation via numactl or resctrl + mkdir -p /sys/fs/resctrl/benchmarks + echo $core,$core_two > /sys/fs/resctrl/benchmarks/cpus_list + echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata + # Disable numa-based isolation + numa_arg0="--interleave=all" + numa_arg1="--interleave=all" +fi echo "Done. Verifying configuration with user..." # Generate file name string @@ -152,26 +264,42 @@ runID=$(date +"%b%d-%H") # Confirm configuration with user echo "=== Global Config ===" cat /sys/fs/resctrl/schemata -echo "=== Core $core Config ===" +echo "=== NUMA Config ===" +echo " '$numa_arg0' and '$numa_arg1'" +echo "=== Core $(cat /sys/fs/resctrl/benchmarks/cpus_list) Config ===" cat /sys/fs/resctrl/benchmarks/schemata +if [[ -v core_two && $(cat /sys/fs/resctrl/benchmarks2/cpus_list) ]]; then + echo "=== Core $(cat /sys/fs/resctrl/benchmarks2/cpus_list) Config ===" + cat /sys/fs/resctrl/benchmarks2/schemata +fi + if [[ -v contend ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not fonud. Exiting..." - exit - fi echo "Will run 6 contending tasks" runID=$runID-c else runID=$runID-xc fi -if uname -a | grep -q "mc2"; then - echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled." - runID=$runID-i + +runID=$runID-$iso_mode + +if [[ -v async ]]; then + echo "Will use asynchronous job pairing" + runID=$runID-async +fi + +if [[ $mode == "pair" && ! -v async ]]; then + echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" else - echo "MC^2 not detected." - runID=$runID-xi + echo "Results will be saved as $runID-$userRunID.txt" +fi + +if [[ $core == 0 || "$core_two" == 0 ]]; then + echo "!!!!! DANGER !!!!!" + echo "! Running real-time tasks on core 0 will conflict with interrupt" + echo "! handling and likely freeze your system! Only continue if you know" + echo "! exactly what you're doing!!" + echo "!!!!!!!!!!!!!!!!!!" fi -echo "Results will be saved as $runID-$userRunID.txt" echo "Press enter to confirm environment, Ctrl-C to exit..." read @@ -194,38 +322,72 @@ FAIL_COLOR="\033[0;31m" GOOD_COLOR="\033[0;32m" RESET_COLOR="\033[0m" -num_tests=$(wc -l < $benchNames) # For each benchmark -for (( i = 0; i < $num_tests ; i++ )); do +for (( i = 0; i < ${#bench[@]} ; i++ )); do + # Search for the benchmark in this directory, than /bin if [[ -f ${bench[$i]} ]]; then - binary="${bench[$i]}" + prefix="." else - binary="./bin/${bench[$i]}" + prefix="./bin" fi if [[ "$mode" == "base" ]]; then # Just run the benchmark if TACLeBench # Check if we're using LITMUS^RT or not - if grep -q "#define LITMUS 1" ../extra.h; then - echo "Using LITMUS-RT!" - echo "${input[$i]}" | numactl -m 0 ./bin/$binary ${bench[$i]} $maxJobs $core $runID-$userRunID 1 + if [[ -v $LITMUS ]]; then + echo "${input[$i]}" | numactl $numa_arg0 $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $runID-$userRunID 1 else - # Interleave memory allocations between all nodes (only 1 node w/out MC^2) - # (this is right because we're testing a task w/out SMT, so it gets both colors) - echo "${input[$i]}" | chrt -r 97 numactl --interleave=all taskset -c $core ./$binary ${bench[$i]} $maxJobs $core $runID-$userRunID 1 + # Remember: Unpaired tasks always get access to all colors (so we --interleave all) + echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $runID-$userRunID 1 fi elif [[ "$mode" == "dis" ]]; then # Loop through each WSS and cache config if DIS while read j; do # For cache setting echo $j > /sys/fs/resctrl/benchmarks/schemata while read ii; do # For WSS setting - if grep -q "#define LITMUS 1" ../extra.h; then - echo "Using LITMUS-RT!" - ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | numactl -m 0 ./$binary $bench[$i]}-$ii-$j $maxJobs $core $runID 1 + if [[ -v $LITMUS ]]; then + ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | numactl $numa_arg0 $prefix/${bench[$i]} $bench[$i]}-$ii-$j $maxJobs $core $runID 1 else - ./gen_input.py ${bench[$i]} $template_input $ii | chrt -r 97 numactl -m 0 taskset -c $core ./$binary ${bench[$i]}-$ii-$j $maxJobs $core $runID 1 + ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]}-$ii-$j $maxJobs $core $runID 1 fi done < $wss_settings done < $cache_settings + elif [[ "$mode" == "pair" ]]; then + # Only async truly needs to do all-pairs + if [[ ! -v async ]]; then + start=$i + else + start=0 + fi + for (( j = $start; j < ${#bench[@]} ; j++ )); do + if [[ ! -v async ]]; then + # Synchronize between pairs - original hard real-time SMT approach + if [[ -v $LITMUS ]]; then + echo "${input[$i]}" | numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $core_two ${bench[$j]} $runID-$userRunID-A 1 & PID1=$!; + echo "${input[$j]}" | numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$j]} ${bench[$j]} $maxJobs $core_two $core ${bench[$i]} $runID-$userRunID-B 2 & PID2=$!; + else + echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $core_two ${bench[$j]} $runID-$userRunID-A 1 & PID1=$!; + echo "${input[$j]}" | chrt -r 97 numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$j]} ${bench[$j]} $maxJobs $core_two $core ${bench[$i]} $runID-$userRunID-B 2 & PID2=$!; + fi + # We launched them asynchronously, so we have to wait + wait $PID1 $PID2 + else + # No synchronization between pairs - original soft real-time SMT approach + if [[ -v $LITMUS ]]; then + echo "${input[$i]}" | numactl $numa_arg0 taskset -c $core $prefix/${bench[$j]} ${bench[$j]} -1 $core NULL 0 & PID1=$!; + echo "${input[$j]}" | numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$i]} ${bench[$i]}"+"${bench[$j]} $maxJobs $core_two $runID-$userRunID 1 & PID2=$!; + else + echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$j]} ${bench[$j]} -1 $core NULL 0 & PID1=$!; + echo "${input[$j]}" | chrt -r 97 numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$i]} ${bench[$i]}"+"${bench[$j]} $maxJobs $core_two $runID-$userRunID 1 & PID2=$!; + fi + wait $PID2 + kill $PID1 + fi + if [[ $? != 0 ]]; then + echo -e ${FAIL_COLOR}FAILED${RESET_COLOR}: ${bench[$i]} ${bench[$j]} + else + echo -e ${GOOD_COLOR}COMPLETE${RESET_COLOR}: ${bench[$i]} ${bench[$j]} + fi + done fi if [[ $? != 0 ]]; then echo -e ${FAIL_COLOR}FAILED${RESET_COLOR}: ${bench[$i]} @@ -234,18 +396,3 @@ for (( i = 0; i < $num_tests ; i++ )); do fi done -# End contending tasks -if [[ -v contend ]]; then - killall thrasher -fi - -# Put smp_affinty back the way it was -i=0 -for IRQ in /proc/irq/* -do - if [ -d $IRQ ]; then - echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - diff --git a/run_everything.sh b/run_everything.sh deleted file mode 100755 index 8d46ad7..0000000 --- a/run_everything.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -maxJobs=$1 -runID=$2 - -if [ $# -lt 2 ]; then - echo "Usage $0 " - exit -fi - -date -cd baseline -make all -../interference-benchmark/deactivateCoresSMT.bash -./run_baseline.sh 15 $maxJobs $runID -date -cd ../all_pairs -../../interference-benchmark/activateCores.bash -make all -./run_all_pairs.sh 15 31 $maxJobs $runID -date diff --git a/run_tacle_all.sh b/run_tacle_all.sh deleted file mode 100755 index dd5a443..0000000 --- a/run_tacle_all.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# Copyright 2020 Joshua Bakita -# This script runs the baselines and Level-A/B and Level-C all_pairs -# for TACLe w/out MC^2 - -if uname -a | grep -q mc2; then - echo "You need to run this without MC^2!" - exit -fi - -if [ "$EUID" -ne 0 ]; then - echo "You need to be root to enable interrupt isolation and real-time execution!" - exit -fi - -echo "This will run the contended and uncontended TACLe baseline, all-pairs, and Level-C micro-benchamarks in non-interactive mode." -echo "Please press enter to confirm (Ctrl-C to abort)..." -read - -echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor -echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governor - -cd baseline -baseNo=baseline/$(date +"%b%d-%H")-xc-xi-1k.txt -echo "" | ../run_bench.sh -m base -p 15 -l 1001 -b ../all_pairs/tacleNames.txt 1k -baseYes=baseline/$(date +"%b%d-%H")-c-xi-1k.txt -echo "" | ../run_bench.sh -B -m make -p 15 -l 1001 -b ../all_pairs/tacleNames.txt 1k - -cd ../all_pairs -pairsNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k -echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt -pairsYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k -echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt --contend - -cd ../baseline -echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt -cNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k-LC-TACLe.txt -echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt --contend -cYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k-LC-TACLe.txt - -echo "==== DONE ===" -echo "Results are in:" -echo "- "$baseNo -echo "- "$baseYes -echo "- "$pairsNo" (A/B)" -echo "- "$pairsYes" (A/B)" -echo "- "$cNo -echo "- "$cYes - 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 @@ -#!/bin/bash - -firstCore=$1 -secondCore=$2 -maxJobs=$3 -userRunID=$4 -tacleNames=tacleNames.txt - -if [ $# -lt 4 ]; then - echo "Usage $0 [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 4 ]; then - echo "Using alternate list of TACLe benchmarks from $5" - tacleNames=$5 -fi - -if [ "$EUID" -ne 0 ] -then - echo "You need to be root to enable interrupt isolation and real-time execution!" - exit -fi - -echo "Making sure that binaries are up to date..." -while read i; do - make bin/$i -done < $tacleNames -echo "Done. Disabling real-time throttling..." - -# Turn off rt throttling -echo -1 > /proc/sys/kernel/sched_rt_runtime_us -echo "Done. Redirecting all interrupts to core 0..." - -# Redirect all interrupts to core 0 -i=0 -for IRQ in /proc/irq/* -do - # Skip default_smp_affinity - if [ -d $IRQ ]; then - irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - -# Read the names of each benchmark -j=0 -while read i; do - tacleProg[$j]=$i - j=$(( $j + 1 )) -done < $tacleNames - -echo "Done. Checking for wbinvd module..." -if [[ ! -f "/proc/wbinvd" ]]; then - echo "ERROR: wbinvd module not loaded. Exiting..." - exit -fi - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list -echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list -# Reset global bandwith control and remove L3 from global -echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata -# Alloc L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata -echo "Done. Verifying configuration with user..." - -# Generate file name string -# We append to this as we parse the environment settings -runID=$(date +"%b%d-%H") - -# Confirm configuration with user -echo "=== Global Config ===" -cat /sys/fs/resctrl/schemata -echo "=== Core $firstCore and $secondCore Config ===" -cat /sys/fs/resctrl/benchmarks/schemata -if [[ $6 == "--contend" ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not fonud. Exiting..." - exit - fi - echo "Will run 6 contending tasks" - runID=$runID-c -else - runID=$runID-xc -fi -if uname -a | grep -q "mc2"; then - echo "MC^2 Autodetected. Cache coloring will be DISABLED." - runID=$runID-i -else - echo "MC^2 not detected. Cache coloring will be DISABLED." - runID=$runID-xi -fi -echo "Results will be saved as $runID-$userRunID-LC-DIS.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $6 == "--contend" ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & -fi -sleep 1 # Wait for contending tasks to start -echo "Done. Beginning benchmarks..." - -num_tests=$(wc -l < $tacleNames) -for (( i = 0; i < $num_tests ; i++ )) -do - # For level-C analysis, we must run all vs all - for (( j = 0; j < $num_tests ; j++ )) #loop through programs - do - # Autodetect MC^2 - # Get DIS to loop continuously in the background by infinite restarts - if uname -a | grep -q "mc2"; then - 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=$!; - else - bash -c "while true; do chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 &> /dev/null; done" & PID1=$!; - fi - # Each sample runs in its own process - for ((k=0;k<=maxJobs;k++)); do - if uname -a | grep -q "mc2"; then - chrt -r 97 numactl --interleave=all taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!; - else - chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!; - fi - done - # The paired task runs continuously in this configuration, so we have - # to kill it once the task that we're measuring finishes. - wait $PID2 - kill $PID1 - # Killing bash will not kill its children by default - work aronud that here - killall transitive &> /dev/null - killall matrix &> /dev/null - killall pointer &> /dev/null - killall field &> /dev/null - killall neighborhood &> /dev/null - killall update &> /dev/null - killall gen_input.py &> /dev/null - echo ${tacleProg[$i]} ${tacleProg[$j]} - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $6 == "--contend" ]]; then - killall thrasher -fi - -# Remove semaphores from system -# Leaving them won't hurt these tests, but would be messy and is bad practice -# TODO: Do this directly in the benchmarks. They should clean up after themselves -./bin/cleanupSemaphores - -# Put smp_affinty back the way it was -i=0 -for IRQ in /proc/irq/* -do - if [ -d $IRQ ]; then - echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - 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 @@ -#!/bin/bash - -firstCore=$1 -secondCore=$2 -maxJobs=$3 -userRunID=$4 -tacleNames=tacleNames.txt - -if [ $# -lt 4 ]; then - echo "Usage $0 [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 4 ]; then - echo "Using alternate list of TACLe benchmarks from $5" - tacleNames=$5 -fi - -if [ "$EUID" -ne 0 ] -then - echo "You need to be root to enable interrupt isolation and real-time execution!" - exit -fi - -echo "Making sure that binaries are up to date..." -while read i; do - make bin/$i -done < $tacleNames -echo "Done. Disabling real-time throttling..." - -# Turn off rt throttling -echo -1 > /proc/sys/kernel/sched_rt_runtime_us -echo "Done. Redirecting all interrupts to core 0..." - -# Redirect all interrupts to core 0 -i=0 -for IRQ in /proc/irq/* -do - # Skip default_smp_affinity - if [ -d $IRQ ]; then - irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - -# Read the names of each benchmark -j=0 -while read i; do - tacleProg[$j]=$i - j=$(( $j + 1 )) -done < $tacleNames - -echo "Done. Checking for wbinvd module..." -if [[ ! -f "/proc/wbinvd" ]]; then - echo "ERROR: wbinvd module not loaded. Exiting..." - exit -fi - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list -echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list -# Reset global bandwith control and remove L3 from global -echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata -# Alloc L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata -echo "Done. Verifying configuration with user..." - -# Generate file name string -# We append to this as we parse the environment settings -runID=$(date +"%b%d-%H") - -# Confirm configuration with user -echo "=== Global Config ===" -cat /sys/fs/resctrl/schemata -echo "=== Core $firstCore and $secondCore Config ===" -cat /sys/fs/resctrl/benchmarks/schemata -if [[ $6 == "--contend" ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not fonud. Exiting..." - exit - fi - echo "Will run 6 contending tasks" - runID=$runID-c -else - runID=$runID-xc -fi -if uname -a | grep -q "mc2"; then - echo "MC^2 Autodetected. Cache coloring will be DISABLED." - runID=$runID-i -else - echo "MC^2 not detected. Cache coloring will be DISABLED." - runID=$runID-xi -fi -echo "Results will be saved as $runID-$userRunID-LC-TACLe.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $6 == "--contend" ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & -fi -sleep 1 # Wait for contending tasks to start -echo "Done. Beginning benchmarks..." - -num_tests=$(wc -l < $tacleNames) -for (( i = 0; i < $num_tests ; i++ )) -do - # For level-C analysis, we must run all vs all - for (( j = 0; j < $num_tests ; j++ )) #loop through programs - do - # Autodetect MC^2 - if uname -a | grep -q "mc2"; then - # -1 loops means loop forever - chrt -r 97 numactl --interleave=all taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 & PID1=$!; - chrt -r 97 numactl --interleave=all taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-TACLe 1 & PID2=$!; - else - chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 & PID1=$!; - chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-TACLe 1 & PID2=$!; - fi - # The paired task runs continuously in this configuration, so we have - # to kill it once the task that we're measuring finishes. - wait $PID2 - kill $PID1 - echo ${tacleProg[$i]} ${tacleProg[$j]} - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $6 == "--contend" ]]; then - killall thrasher -fi - -# Remove semaphores from system -# Leaving them won't hurt these tests, but would be messy and is bad practice -# TODO: Do this directly in the benchmarks. They should clean up after themselves -./bin/cleanupSemaphores - -# Put smp_affinty back the way it was -i=0 -for IRQ in /proc/irq/* -do - if [ -d $IRQ ]; then - echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - -- cgit v1.2.2