lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 22 Aug 2020 17:33:39 +0800
From:   Yunfeng Ye <yeyunfeng@...wei.com>
To:     Thomas Gleixner <tglx@...utronix.de>
CC:     <linux-kernel@...r.kernel.org>, Shiyuan Hu <hushiyuan@...wei.com>,
        Hewenliang <hewenliang4@...wei.com>
Subject: Re: [PATCH] genirq/proc: Show percpu irq affinity



On 2020/8/13 16:27, Thomas Gleixner wrote:
> Yunfeng Ye <yeyunfeng@...wei.com> writes:
> 
>> When the "affinity=" cmdline parameter is configured,
> 
> There is no such parameter.
> 
>> the interrupt affinity displayed in the proc directory does not match
>> with that of the the percu interrupt, and the percu interrupt uses
>> desc->percu_affinity.
> 
> And when the non-existing parameter is not on the command line then
> irq->affinity is showing the correct value magically?
> 
> Definitely not: It's unconditionally showing irq->affinity and that is
> pretty unlikely to match irq->percpu_affinity in any case.
> 
Sorry,it is "irqaffinity=" cmdline parameter. it will set irq_default_affinity
mask. if the interrupt is not the managed irq, the irq_desc will use
irq_default_affinity as default affinity.

For example, the cmdline "irqaffinity=0,1,126,127" on the 128 cores system:

[root@...alhost ~]# cat /proc/irq/4/smp_affinity_list
0-1,126-127

The irq 4 is "arch_timer" interrupt, which is a percpu interrupt.

So is it necessary to show the percpu irq affinity correct?

thanks.

>> diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
>> index 32c071d7bc03..b9d0fa87b4b4 100644
>> --- a/kernel/irq/proc.c
>> +++ b/kernel/irq/proc.c
>> @@ -52,6 +52,8 @@ static int show_irq_affinity(int type, struct seq_file *m)
>>  	case AFFINITY:
>>  	case AFFINITY_LIST:
>>  		mask = desc->irq_common_data.affinity;
>> +		if (irqd_is_per_cpu(&desc->irq_data))
>> +			mask = desc->percpu_affinity;
> 
> This breaks all architecture which mark interrupts as per CPU without
> using the partition mechanism resulting in a NULL pointer dereference.
> 
Yes, it is a problem.

> Thanks,
> 
>         tglx
> 
> .
> 

Powered by blists - more mailing lists