Skip to content

Commit

Permalink
ofed_scripts/show_irq_affinity.sh: Add CPU number to the script output
Browse files Browse the repository at this point in the history
Example:
show_irq_affinity.sh mlx5_0 show_cpu_number
Note: without the show_cpu_number flag, the output will be as it was.

output before:
124: 0,00000001
125: 0,00000002
126: 0,00000004
127: 0,00000008
128: 0,00000010
129: 0,00000020
130: 0,00000040

output after:
124 (cpu #0): 0,00000001
125 (cpu Mellanox#1): 0,00000002
126 (cpu Mellanox#2): 0,00000004
127 (cpu Mellanox#3): 0,00000008
128 (cpu Mellanox#4): 0,00000010
129 (cpu Mellanox#5): 0,00000020
130 (cpu Mellanox#6): 0,00000040

Signed-off-by: Guy Twig <[email protected]>
Signed-off-by: Vladimir Sokolovsky <[email protected]>
  • Loading branch information
Guy Twig authored and vladsokolovsky committed May 6, 2020
1 parent 8d25da7 commit c366492
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 2 additions & 0 deletions metadata/Guy_Twig.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sep=;
Change-Id=I1fe60563bb3fc1b256aa6c01bb264a7c44cc2626; subject=ofed_scripts/show_irq_affinity.sh: Add CPU number to the script output; feature=ofed_scripts; upstream_status=ignore; general=;
17 changes: 12 additions & 5 deletions ofed_scripts/common_irq_affinity.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,24 @@ function get_irq_list
echo "Error - interface or device \"$interface\" does not exist" 1>&2
exit 1
fi
echo $irq_list
sorted_irq_list=$( echo $irq_list | tr " " "\n" | sort -g | tr "\n" " " )
echo $sorted_irq_list
}

function show_irq_affinity
{
irq_num=$1
show_cpu_number=$2
smp_affinity_path="/proc/irq/$irq_num/smp_affinity"
if [ -f $smp_affinity_path ]; then
echo -n "$irq_num: "
cat $smp_affinity_path
fi
cpu_number_path="/proc/irq/$irq_num/smp_affinity_list"
if [ -f $smp_affinity_path ]; then
if [ -f $cpu_number_path ] && [ "$show_cpu_number" == "show_cpu_number" ]; then
echo -n "$irq_num (cpu #`cat $cpu_number_path`): "
else
echo -n "$irq_num: "
fi
cat $smp_affinity_path
fi
}

function show_irq_affinity_hints
Expand Down
8 changes: 5 additions & 3 deletions ofed_scripts/show_irq_affinity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
# and/or other materials provided with the distribution.
#
if [ -z $1 ]; then
echo "usage: $0 <interface or IB device> "
exit 1
echo "usage: $0 <interface or IB device> [show_cpu_number]"
exit 1
fi

source common_irq_affinity.sh
Expand All @@ -38,8 +38,10 @@ if [ -z "$IRQS" ] ; then
exit 1
fi

show_cpu=$2

for irq in $IRQS
do
show_irq_affinity $irq
show_irq_affinity $irq $show_cpu
done

0 comments on commit c366492

Please sign in to comment.