From e5db76ee18640ce27df8756e573ef8b497af4750 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Sat, 17 Oct 2020 21:36:21 -0400 Subject: All the TACLeBench runner scripts as used for the (rejected) RTSS'20 submission Everything without isolation: run_tacle_rtss20.sh For isolation you have to run the hodgepodge of scripts as before. --- all_pairs/run_all_pairs.sh | 107 ++++++++++++- all_pairs/run_all_pairs_L3_ONLY.sh | 170 +++++++++++++++++++++ baseline/run_baseline.sh | 108 +++++++++++-- baseline/run_baseline_L3_ONLY.sh | 152 ++++++++++++++++++ run_tacle_rtss20.sh | 48 ++++++ smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh | 161 +++++++++++++++++++ 6 files changed, 727 insertions(+), 19 deletions(-) create mode 100755 all_pairs/run_all_pairs_L3_ONLY.sh create mode 100755 baseline/run_baseline_L3_ONLY.sh create mode 100755 run_tacle_rtss20.sh create 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 index d48f211..2260216 100755 --- a/all_pairs/run_all_pairs.sh +++ b/all_pairs/run_all_pairs.sh @@ -3,11 +3,11 @@ firstCore=$1 secondCore=$2 maxJobs=$3 -runID=$4 +userRunID=$4 tacleNames=tacleNames.txt if [ $# -lt 4 ]; then - echo "Usage $0 [TACLe names file]" + echo "Usage $0 [TACLe names file] [--contend]" exit fi @@ -16,6 +16,12 @@ if [ $# -gt 4 ]; then 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 @@ -33,11 +39,10 @@ do # Skip default_smp_affinity if [ -d $IRQ ]; then irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 > $IRQ/smp_affinity_list + echo 0 2> /dev/null > $IRQ/smp_affinity_list fi i=$(( $i + 1 )) done -echo "Done. Beginning benchmarks..." # Read the names of each benchmark j=0 @@ -46,20 +51,106 @@ while read i; do 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 - chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID"-A" 1 & \ - chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID"-B" 2 & - wait + # 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 @@ -70,7 +161,7 @@ i=0 for IRQ in /proc/irq/* do if [ -d $IRQ ]; then - echo ${irqList[$i]} > $IRQ/smp_affinity_list + 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 new file mode 100755 index 0000000..8ed5eeb --- /dev/null +++ b/all_pairs/run_all_pairs_L3_ONLY.sh @@ -0,0 +1,170 @@ +#!/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/baseline/run_baseline.sh b/baseline/run_baseline.sh index f7a98fa..c5b67b6 100755 --- a/baseline/run_baseline.sh +++ b/baseline/run_baseline.sh @@ -2,11 +2,11 @@ core=$1 maxJobs=$2 -runID=$3 +userRunID=$3 tacleNames=tacleNames.txt if [ $# -lt 3 ]; then - echo "Usage $0 [TACLe names file]" + echo "Usage $0 [TACLe names file] [--contend]" exit fi @@ -15,6 +15,12 @@ if [ $# -gt 3 ]; then 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 @@ -32,11 +38,10 @@ do # Skip default_smp_affinity if [ -d $IRQ ]; then irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 > $IRQ/smp_affinity_list + echo 0 2> /dev/null > $IRQ/smp_affinity_list fi i=$(( $i + 1 )) done -echo "Done. Beginning benchmarks..." # Read the names of each benchmark j=0 @@ -45,25 +50,106 @@ while read i; do 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/cpu15/cpufreq/scaling_governor +echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo + +# 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=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 $1 Config ===" +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. Cache coloring and interleaving will be enabled." + runID=$runID-i +else + echo "MC^2 not detected." + 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.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 - # Check if we're using LITMUS^RT or not - if grep -q "#define LITMUS 1" source/extra.h; then - ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID 1 - else - chrt -r 97 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID 1 - fi + # 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 +#chrt -r 97 numactl -m 0 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID-NOINTERLEAVE 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]} > $IRQ/smp_affinity_list + echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list fi i=$(( $i + 1 )) done diff --git a/baseline/run_baseline_L3_ONLY.sh b/baseline/run_baseline_L3_ONLY.sh new file mode 100755 index 0000000..4183653 --- /dev/null +++ b/baseline/run_baseline_L3_ONLY.sh @@ -0,0 +1,152 @@ +#!/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/run_tacle_rtss20.sh b/run_tacle_rtss20.sh new file mode 100755 index 0000000..6770c55 --- /dev/null +++ b/run_tacle_rtss20.sh @@ -0,0 +1,48 @@ +#!/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_baseline.sh 15 1001 1k ../all_pairs/tacleNames.txt +baseYes=baseline/$(date +"%b%d-%H")-c-xi-1k.txt +echo "" | ./run_baseline.sh 15 1001 1k ../all_pairs/tacleNames.txt --contend + +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_TACLe.sh b/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh new file mode 100755 index 0000000..923dba0 --- /dev/null +++ b/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh @@ -0,0 +1,161 @@ +#!/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