xref: /kernel/linux/linux-5.10/tools/virtio/ringtest/run-on-all.sh
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/tools/virtio/ringtest/
18c2ecf20Sopenharmony_ci#!/bin/sh
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciCPUS_ONLINE=$(lscpu --online -p=cpu|grep -v -e '#')
58c2ecf20Sopenharmony_ci#use last CPU for host. Why not the first?
68c2ecf20Sopenharmony_ci#many devices tend to use cpu0 by default so
78c2ecf20Sopenharmony_ci#it tends to be busier
88c2ecf20Sopenharmony_ciHOST_AFFINITY=$(echo "${CPUS_ONLINE}"|tail -n 1)
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#run command on all cpus
118c2ecf20Sopenharmony_cifor cpu in $CPUS_ONLINE
128c2ecf20Sopenharmony_cido
138c2ecf20Sopenharmony_ci	#Don't run guest and host on same CPU
148c2ecf20Sopenharmony_ci	#It actually works ok if using signalling
158c2ecf20Sopenharmony_ci	if
168c2ecf20Sopenharmony_ci		(echo "$@" | grep -e "--sleep" > /dev/null) || \
178c2ecf20Sopenharmony_ci			test $HOST_AFFINITY '!=' $cpu
188c2ecf20Sopenharmony_ci	then
198c2ecf20Sopenharmony_ci		echo "GUEST AFFINITY $cpu"
208c2ecf20Sopenharmony_ci		"$@" --host-affinity $HOST_AFFINITY --guest-affinity $cpu
218c2ecf20Sopenharmony_ci	fi
228c2ecf20Sopenharmony_cidone
238c2ecf20Sopenharmony_ciecho "NO GUEST AFFINITY"
248c2ecf20Sopenharmony_ci"$@" --host-affinity $HOST_AFFINITY
258c2ecf20Sopenharmony_ciecho "NO AFFINITY"
268c2ecf20Sopenharmony_ci"$@"
27

Indexes created Thu Nov 07 10:32:03 CST 2024