cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

run-on-all.sh (670B)


      1#!/bin/sh
      2# SPDX-License-Identifier: GPL-2.0
      3
      4CPUS_ONLINE=$(lscpu --online -p=cpu|grep -v -e '#')
      5#use last CPU for host. Why not the first?
      6#many devices tend to use cpu0 by default so
      7#it tends to be busier
      8HOST_AFFINITY=$(echo "${CPUS_ONLINE}"|tail -n 1)
      9
     10#run command on all cpus
     11for cpu in $CPUS_ONLINE
     12do
     13	#Don't run guest and host on same CPU
     14	#It actually works ok if using signalling
     15	if
     16		(echo "$@" | grep -e "--sleep" > /dev/null) || \
     17			test $HOST_AFFINITY '!=' $cpu
     18	then
     19		echo "GUEST AFFINITY $cpu"
     20		"$@" --host-affinity $HOST_AFFINITY --guest-affinity $cpu
     21	fi
     22done
     23echo "NO GUEST AFFINITY"
     24"$@" --host-affinity $HOST_AFFINITY
     25echo "NO AFFINITY"
     26"$@"