2 # SPDX-License-Identifier: GPL-2.0
4 CPUS_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
8 HOST_AFFINITY
=$
(echo "${CPUS_ONLINE}"|
tail -n 1)
10 #run command on all cpus
11 for cpu
in $CPUS_ONLINE
13 #Don't run guest and host on same CPU
14 #It actually works ok if using signalling
16 (echo "$@" |
grep -e "--sleep" > /dev
/null
) || \
17 test $HOST_AFFINITY '!=' $cpu
19 echo "GUEST AFFINITY $cpu"
20 "$@" --host-affinity $HOST_AFFINITY --guest-affinity $cpu
23 echo "NO GUEST AFFINITY"
24 "$@" --host-affinity $HOST_AFFINITY