[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dd5eb61b-8adf-4289-7342-7711e87dba0e@loongson.cn>
Date: Wed, 27 Mar 2024 09:09:04 +0800
From: maobibo <maobibo@...ngson.cn>
To: loongson-kernel@...ts.loongnix.cn, Huacai Chen <chenhuacai@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, Arnd Bergmann <arnd@...db.de>,
Marc Zyngier <maz@...nel.org>
Cc: loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: Give chance to build under !CONFIG_SMP
On 2024/3/27 上午5:30, Tiezhu Yang wrote:
> Hi Bibo,
>
> On 3/26/24 20:58, maobibo wrote:
>>
>>
>> On 2024/3/26 下午2:21, Tiezhu Yang wrote:
>>> In the current code, SMP is selected in Kconfig for LoongArch, the users
>>> can not unset it, this is reasonable for a multiprocessor machine.
>>> But as
>>> the help info of config SMP said, if you have a system with only one
>>> CPU,
>>> say N. On a uniprocessor machine, the kernel will run faster if you
>>> say N
>>> here.
>>>
>>> The Loongson-2K0500 is a single-core CPU for applications like
>>> industrial
>>> control, printing terminals, and BMC (Baseboard Management Controller),
>>> there are many development boards, products and solutions on the market,
>>> so it is better and necessary to give a chance to build under
>>> !CONFIG_SMP
>>> for a uniprocessor machine.
>
> ...
>
>>> +++ b/arch/loongarch/include/asm/smp.h
>>> @@ -6,6 +6,7 @@
>>> #ifndef __ASM_SMP_H
>>> #define __ASM_SMP_H
>>> +#ifdef CONFIG_SMP
>>> #include <linux/atomic.h>
>>> #include <linux/bitops.h>
>>> #include <linux/linkage.h>
>>> @@ -101,4 +102,8 @@ static inline void __cpu_die(unsigned int cpu)
>>> }
>>> #endif
>>> +#else /* !CONFIG_SMP */
>>> +#define cpu_logical_map(cpu) 0
>> It is unsafe here though physical cpuid of BSP is 0 always.
>> It is better to use __cpu_logical_map[cpu] or read_csr_cpuid()
>>
>>> +#endif
If kernel run with AMP mode where each cpu has its separate kernel img,
physical cpuid of BSP will be not 0.
>
> ...
>
>>> +++ b/arch/loongarch/power/suspend.c
>>> @@ -44,7 +44,9 @@ void loongarch_common_resume(void)
>>> {
>>> sync_counter();
>>> local_flush_tlb_all();
>>> +#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
>>> csr_write64(per_cpu_offset(0), PERCPU_BASE_KS);
>>> +#endif
>> It is another issue, CONFIG_HAVE_SETUP_PER_CPU_AREA should not depend
>> on NUMA. PERCPU_BASE_KS should be set even for UP.
>
> Thanks for your review and suggestions.
>
> Let me wait for some days, if no more comments, I will address in v3
> since the v2 has been sent.
It is fine to me. Do something is better than do nothing, only that we
should be careful and it will take much time.
Regards
Bibo Mao
>
> Thanks,
> Tiezhu
>
> _______________________________________________
> Loongson-kernel mailing list -- loongson-kernel@...ts.loongnix.cn
> To unsubscribe send an email to loongson-kernel-leave@...ts.loongnix.cn
Powered by blists - more mailing lists