Skip to content

Commit

Permalink
tools/virtio/ringtest: fix run-on-all.sh to work without /dev/cpu
Browse files Browse the repository at this point in the history
/dev/cpu is only available on x86 with certain modules (e.g. msr) enabled.
Using lscpu to get processors count is more portable.

Signed-off-by: Mike Rapoport <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
rppt authored and mstsirkin committed Jun 6, 2016
1 parent 3b220cf commit ef1b144
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/virtio/ringtest/run-on-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#use last CPU for host. Why not the first?
#many devices tend to use cpu0 by default so
#it tends to be busier
HOST_AFFINITY=$(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n|tail -1)
HOST_AFFINITY=$(lscpu -p=cpu | tail -1)

#run command on all cpus
for cpu in $(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n);
for cpu in $(seq 0 $HOST_AFFINITY)
do
#Don't run guest and host on same CPU
#It actually works ok if using signalling
Expand Down

0 comments on commit ef1b144

Please sign in to comment.