2022-09-29 09:31:04

by WANG Xuerui

[permalink] [raw]
Subject: Re: [PATCH V3] LoongArch: Fix cpu name after s3/s4

On 9/29/22 16:55, Jianmin Lv wrote:
> On coming back from s3/s4, the cpu name will be overwritten
> in cpu_probe path of seconary cpu, so we don't overwrite it
> if it has been initialized.

The sentences are confusing, first "the CPU name will be overwritten"
then "don't overwrite it if initialized" -- seems the CPU name will get
overwritten despite the patch's clear intent.

Better to keep it simple: "Don't overwrite the CPU name on coming back
from S3/S4 if it is already initialized."

>
> Signed-off-by: Jianmin Lv <[email protected]>
>
> diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c
> index 529ab8f44ec6..255a09876ef2 100644
> --- a/arch/loongarch/kernel/cpu-probe.c
> +++ b/arch/loongarch/kernel/cpu-probe.c
> @@ -187,7 +187,9 @@ static inline void cpu_probe_loongson(struct cpuinfo_loongarch *c, unsigned int
> uint64_t *vendor = (void *)(&cpu_full_name[VENDOR_OFFSET]);
> uint64_t *cpuname = (void *)(&cpu_full_name[CPUNAME_OFFSET]);
>
> - __cpu_full_name[cpu] = cpu_full_name;
> + if (!__cpu_full_name[cpu])
> + __cpu_full_name[cpu] = cpu_full_name;
> +
> *vendor = iocsr_read64(LOONGARCH_IOCSR_VENDOR);
> *cpuname = iocsr_read64(LOONGARCH_IOCSR_CPUNAME);
>

Otherwise LGTM.

Reviewed-by: WANG Xuerui <[email protected]>

--
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/


2022-09-29 09:43:00

by 吕建民

[permalink] [raw]
Subject: Re: [PATCH V3] LoongArch: Fix cpu name after s3/s4



On 2022/9/29 下午5:06, WANG Xuerui wrote:
> On 9/29/22 16:55, Jianmin Lv wrote:
>> On coming back from s3/s4, the cpu name will be overwritten
>> in cpu_probe path of seconary cpu, so we don't overwrite it
>> if it has been initialized.
>
> The sentences are confusing, first "the CPU name will be overwritten"
> then "don't overwrite it if initialized" -- seems the CPU name will get
> overwritten despite the patch's clear intent.
>
> Better to keep it simple: "Don't overwrite the CPU name on coming back
> from S3/S4 if it is already initialized."
>

Thanks, Xuerui, let me change it.

>>
>> Signed-off-by: Jianmin Lv <[email protected]>
>>
>> diff --git a/arch/loongarch/kernel/cpu-probe.c
>> b/arch/loongarch/kernel/cpu-probe.c
>> index 529ab8f44ec6..255a09876ef2 100644
>> --- a/arch/loongarch/kernel/cpu-probe.c
>> +++ b/arch/loongarch/kernel/cpu-probe.c
>> @@ -187,7 +187,9 @@ static inline void cpu_probe_loongson(struct
>> cpuinfo_loongarch *c, unsigned int
>>       uint64_t *vendor = (void *)(&cpu_full_name[VENDOR_OFFSET]);
>>       uint64_t *cpuname = (void *)(&cpu_full_name[CPUNAME_OFFSET]);
>> -    __cpu_full_name[cpu] = cpu_full_name;
>> +    if (!__cpu_full_name[cpu])
>> +        __cpu_full_name[cpu] = cpu_full_name;
>> +
>>       *vendor = iocsr_read64(LOONGARCH_IOCSR_VENDOR);
>>       *cpuname = iocsr_read64(LOONGARCH_IOCSR_CPUNAME);
>
> Otherwise LGTM.
>
> Reviewed-by: WANG Xuerui <[email protected]>
>