Re: [PATCH v2 2/3] selftests/resctrl: Fix a division by zero error on Hygon

From: Xiaochen Shen

Date: Sun Dec 07 2025 - 21:27:15 EST


Hi Fenghua,

On 12/6/2025 2:53 AM, Fenghua Yu wrote:
>> @@ -243,6 +243,16 @@ int snc_nodes_per_l3_cache(void)
>>           }
>>           snc_mode = cache_cpus / node_cpus;
>>   +        /*
>> +         * On certain Hygon platforms:
>
> nit. This situation could happen on other platforms than Hygon. Maybe it's better to have a more generic comment here?
>          * On some platforms (e.g. Hygon),
>

I will update the comment as you suggested. Thank you!


> Reviewed-by: Fenghua Yu <fenghuay@xxxxxxxxxx>

Thank you!

>
>> +         * cache_cpus < node_cpus, the calculated snc_mode is 0.
>> +         *
>> +         * Set snc_mode = 1 to indicate that SNC mode is not
>> +         * supported on the platform.
>> +         */
>> +        if (!snc_mode)
>> +            snc_mode = 1;
>> +
>>           if (snc_mode > 1)
>>               ksft_print_msg("SNC-%d mode discovered.\n", snc_mode);
>>       }
> Thanks.
> -Fenghua


Best regards,
Xiaochen Shen