On 02/05/2016 10:49 AM, Quinn Tran wrote:
> On 2/4/16, 10:20 AM, "Bart Van Assche" <bart.vanass...@sandisk.com> wrote:
>> On 02/04/2016 08:45 AM, Himanshu Madhani wrote:
>>> From: Quinn Tran <quinn.t...@qlogic.com>
>>>
>>>> cat /sys/kernel/debug/qla2xxx/*/irq_cpuid
>>> qla2xxx_81
>>>               IRQ Name  Vector  CPUID
>>>      qla2xxx (default)  150     9
>>>        qla2xxx (rsp_q)  151     9
>>>       qla2xxx (atio_q)  152     9
>>
>> Hello Quinn and Himanshu,
>>
>> Do you think it would be possible to generate this information via a
>> user-space script from /proc/interrupts and /proc/irq/<n>/smp_affinity?
>>
>> Thanks,
>>
>> Bart.
>
> Bart,
> 
> Currently, the data from the 2 mentioned “/proc” entry points were not able 
> to give us the host_id/port & the vector information.
> 
> The 2 alternatives are i) change the driver code to register host id along 
> with the vector and add script to combine the infos,  ii) 1 code change that 
> gives us the summary.
> 
> We choose path 2 for the ease of usage.

Hello Quinn,

Please have another look at /proc/interrupts and
/proc/irq/<n>/smp_affinity. The information that is exported through
this patch is already available there. This is why I think this patch
should be dropped. All you need is something like the shell script below.

Sample output (nn = NUMA node; num = IRQ vector):

==== IRQs
nn cpu num count name
0  6   105  1753 PCI-MSI-edge      qla2xxx (rsp_q)                 
1  1   104  8781 PCI-MSI-edge      qla2xxx (default)               
1  1   107  1629 PCI-MSI-edge      qla2xxx (rsp_q)                 

The shell script that produced the above output:

ppi() {
    { echo "$(<"/sys/devices/system/cpu/cpu$1/topology/physical_package_id")" 
|| echo '?'; } 2>/dev/null
}

echo "==== IRQs"
printf "%-2s %-3s %-3s %12s %-50s\n" nn cpu num count name
cat /proc/interrupts |
  while read line; do
    num="$(echo "$line" | sed -n 
's/^[[:blank:]]*\([0-9]*\):\([0-9[:blank:]]*\)\(.*\)/\1/p')"
    [ -z "$num" ] && continue
    count=0
    for c in $(echo "$line" | sed -n 
's/^[[:blank:]]*\([0-9]*\):\([0-9[:blank:]]*\)\(.*\)/\2/p'); do
        count=$((count+c))
    done
    name="$(echo "$line" | sed -n 
's/^[[:blank:]]*\([0-9]*\):\([0-9[:blank:]]*\)\(.*\)/\3/p')"
    if [ -r "/proc/irq/$num/smp_affinity_list" ]; then
        al="$(<"/proc/irq/$num/smp_affinity_list")"
        cpu="${al/-*}" 
        cpu="${cpu/,*}"
        ppi="$(ppi "$cpu")"
    else
        cpu="?"
        ppi="?"
    fi
    printf "%-2s %-3d %-3d %12d %-50s\n" "$ppi" "$cpu" "$num" "$count" "$name"
  done |
  sort -n -k1,3

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to