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  linux-cve-announce  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:   Wed, 15 Dec 2021 10:57:11 +0900
From:   Rei Yamamoto <yamamoto.rei@...fujitsu.com>
To:     tglx@...utronix.de
Cc:     hch@....de, kbusch@...nel.org, linux-kernel@...r.kernel.org,
        maz@...nel.org, ming.lei@...hat.com, yamamoto.rei@...fujitsu.com
Subject: Re: [PATCH] irq: consider cpus on nodes are unbalanced

On Wed, Nov 24 2021 at 20:33, Thomas Gleixner wrote:
> Cc'ing a few people who worked on this code.
>
>> If cpus on a node are offline at boot time, there are
>> difference in the number of nodes between when building affinity
>> masks for present cpus and when building affinity masks for possible
>> cpus. This patch fixes 2 problems caused by the difference of the
>> number of nodes:
>>
>>  - If some unused vectors remain after building masks for present cpus,
>>    remained vectors are assigned for building masks for possible cpus.
>>    Therefore "numvecs <= nodes" condition must be
>>    "vecs_to_assign <= nodes_to_assign". Fix this problem by making this
>>    condition appropriate.
>>
>>  - The routine of "numvecs <= nodes" condition can overwrite bits of
>>    masks for present cpus in building masks for possible cpus. Fix this
>>    problem by making CPU bits, which is not target, not changing.
>>
>> Signed-off-by: Rei Yamamoto <yamamoto.rei@...fujitsu.com>
>> ---
>>  kernel/irq/affinity.c | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
>> index f7ff8919dc9b..1cdf89e5e2fb 100644
>> --- a/kernel/irq/affinity.c
>> +++ b/kernel/irq/affinity.c
>> @@ -267,10 +267,16 @@ static int __irq_build_affinity_masks(unsigned int startvec,
>>  	 * If the number of nodes in the mask is greater than or equal the
>>  	 * number of vectors we just spread the vectors across the nodes.
>>  	 */
>> -	if (numvecs <= nodes) {
>> +	if (numvecs - (curvec - firstvec) <= nodes) {
>>  		for_each_node_mask(n, nodemsk) {
>> +			unsigned int ncpus;
>> +
>> +			cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]);
>> +			ncpus = cpumask_weight(nmsk);
>> +			if (!ncpus)
>> +				continue;
>>  			cpumask_or(&masks[curvec].mask, &masks[curvec].mask,
>> -				   node_to_cpumask[n]);
>> +				   nmsk);
>>  			if (++curvec == last_affv)
>>  				curvec = firstvec;
>>  		}

Do you have any comments?

Rei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ