Re: [PATCH] MIPS: Loongson: Fix complie errors without CONFIG_SMP

2020-08-26 Thread Matthew Wilcox
On Thu, Aug 27, 2020 at 10:31:33AM +0800, hejinyang wrote:
> 
> 
> On 08/26/2020 09:01 PM, Matthew Wilcox wrote:
> > On Wed, Aug 26, 2020 at 08:53:27PM +0800, Jinyang He wrote:
> > > +++ b/arch/mips/include/asm/mach-loongson64/topology.h
> > > @@ -4,7 +4,11 @@
> > >   #ifdef CONFIG_NUMA
> > > +#ifdef CONFIG_SMP
> > >   #define cpu_to_node(cpu)(cpu_logical_map(cpu) >> 2)
> > > +#else
> > > +#define cpu_to_node(cpu) 0
> > > +#endif
> > Are you saying you've enabled NUMA without enabling SMP?  Does that make
> > sense?
> 
> NUMA option normally work with more than two nodes, though Loongson64 use it
> default after patch 6fbde6b492dfc761ad60a68fb2cb32b1eb05b786. Loongson64(3A)'s
> each node consists of 4 cpus while it only has 4 cpus. In other words, it has
> only one node while open NUMA. I'm confused it if NUMA deponds on SMP.
> 
> I'll try fix it with unabling NUMA and SMP later.

mips:
config NUMA
bool "NUMA Support"
depends on SYS_SUPPORTS_NUMA

x86:
config NUMA
bool "NUMA Memory Allocation and Scheduler Support"
depends on SMP

If you had a good reason for enabling NUMA without enabling SMP (CPU-less
memory nodes?), that'd be an interesting discussion to have.  Since your
hardware seems to have SMP by default, I'd suggest just adding the missing
'depends'.


Re: [PATCH] MIPS: Loongson: Fix complie errors without CONFIG_SMP

2020-08-26 Thread hejinyang




On 08/26/2020 09:01 PM, Matthew Wilcox wrote:

On Wed, Aug 26, 2020 at 08:53:27PM +0800, Jinyang He wrote:

+++ b/arch/mips/include/asm/mach-loongson64/topology.h
@@ -4,7 +4,11 @@
  
  #ifdef CONFIG_NUMA
  
+#ifdef CONFIG_SMP

  #define cpu_to_node(cpu)  (cpu_logical_map(cpu) >> 2)
+#else
+#define cpu_to_node(cpu)   0
+#endif

Are you saying you've enabled NUMA without enabling SMP?  Does that make
sense?


NUMA option normally work with more than two nodes, though Loongson64 use it
default after patch 6fbde6b492dfc761ad60a68fb2cb32b1eb05b786. Loongson64(3A)'s
each node consists of 4 cpus while it only has 4 cpus. In other words, it has
only one node while open NUMA. I'm confused it if NUMA deponds on SMP.

I'll try fix it with unabling NUMA and SMP later.

Thanks.:-)



Re: [PATCH] MIPS: Loongson: Fix complie errors without CONFIG_SMP

2020-08-26 Thread Matthew Wilcox
On Wed, Aug 26, 2020 at 08:53:27PM +0800, Jinyang He wrote:
> +++ b/arch/mips/include/asm/mach-loongson64/topology.h
> @@ -4,7 +4,11 @@
>  
>  #ifdef CONFIG_NUMA
>  
> +#ifdef CONFIG_SMP
>  #define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2)
> +#else
> +#define cpu_to_node(cpu) 0
> +#endif

Are you saying you've enabled NUMA without enabling SMP?  Does that make
sense?



[PATCH] MIPS: Loongson: Fix complie errors without CONFIG_SMP

2020-08-26 Thread Jinyang He
Machine as follows,
[0.00] MIPS: machine is loongson,loongson64c-4core-ls7a

If SMP if off, error as follows:

0x0:
In file included from ./include/linux/gfp.h:9:0,
 from ./include/linux/xarray.h:14,
 from ./include/linux/radix-tree.h:18,
 from ./include/linux/fs.h:15,
 from ./include/linux/compat.h:17,
 from arch/mips/kernel/asm-offsets.c:12:
./include/linux/topology.h: In function ‘numa_node_id’:
./include/linux/topology.h:119:2: error: implicit declaration of function 
‘cpu_logical_map’ [-Werror=implicit-function-declaration]
  return cpu_to_node(raw_smp_processor_id());
  ^
In uniprocessor machines cpu_to_node(cpu) values 0.

arch/mips/include/asm/mach-loongson64/topology.h -> 0x0

And then errors follows,

0x1:
In file included from ./arch/mips/include/asm/mach-loongson64/topology.h:5:0,
 from ./arch/mips/include/asm/topology.h:11,
 from ./include/linux/topology.h:36,
 from ./include/linux/gfp.h:9,
 from ./include/linux/xarray.h:14,
 from ./include/linux/radix-tree.h:18,
 from ./include/linux/fs.h:15,
 from ./include/linux/compat.h:17,
 from arch/mips/kernel/asm-offsets.c:12:
./arch/mips/include/asm/smp.h:28:44: error: macro "raw_smp_processor_id" passed 
1 arguments, but takes just 0
 static inline int raw_smp_processor_id(void)
^
./arch/mips/include/asm/smp.h:29:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or 
‘__attribute__’ before ‘{’ token
 {
 ^
./arch/mips/include/asm/smp.h:38:0: warning: "raw_smp_processor_id" redefined
 #define raw_smp_processor_id raw_smp_processor_id
 ^
In file included from ./arch/mips/include/asm/cpu-type.h:12:0,
 from ./arch/mips/include/asm/timex.h:19,
 from ./include/linux/timex.h:65,
 from ./include/linux/time32.h:13,
 from ./include/linux/time.h:73,
 from ./include/linux/compat.h:10,
 from arch/mips/kernel/asm-offsets.c:12:
./include/linux/smp.h:160:0: note: this is the location of the previous 
definition
 #define raw_smp_processor_id()   0
 ^

0x2:
In file included from ./arch/mips/include/asm/mach-loongson64/topology.h:5:0,
 from ./arch/mips/include/asm/topology.h:11,
 from ./include/linux/topology.h:36,
 from ./include/linux/gfp.h:9,
 from ./include/linux/xarray.h:14,
 from ./include/linux/radix-tree.h:18,
 from ./include/linux/fs.h:15,
 from ./include/linux/compat.h:17,
 from arch/mips/kernel/asm-offsets.c:12:
./arch/mips/include/asm/smp.h:42:29: error: ‘CONFIG_MIPS_NR_CPU_NR_MAP’ 
undeclared here (not in a function)
 extern int __cpu_number_map[CONFIG_MIPS_NR_CPU_NR_MAP];
 ^

0x3:
./arch/mips/include/asm/smp.h:69:20: error: redefinition of 
‘smp_send_reschedule’
 static inline void smp_send_reschedule(int cpu)
^
In file included from ./arch/mips/include/asm/cpu-type.h:12:0,
 from ./arch/mips/include/asm/timex.h:19,
 from ./include/linux/timex.h:65,
 from ./include/linux/time32.h:13,
 from ./include/linux/time.h:73,
 from ./include/linux/compat.h:10,
 from arch/mips/kernel/asm-offsets.c:12:
./include/linux/smp.h:167:20: note: previous definition of 
‘smp_send_reschedule’ was here
 static inline void smp_send_reschedule(int cpu) { }
^
In file included from ./arch/mips/include/asm/mach-loongson64/topology.h:5:0,
 from ./arch/mips/include/asm/topology.h:11,
 from ./include/linux/topology.h:36,
 from ./include/linux/gfp.h:9,
 from ./include/linux/xarray.h:14,
 from ./include/linux/radix-tree.h:18,
 from ./include/linux/fs.h:15,
 from ./include/linux/compat.h:17,
 from arch/mips/kernel/asm-offsets.c:12:
./arch/mips/include/asm/smp.h: In function ‘smp_send_reschedule’:

0x4:
./arch/mips/include/asm/smp.h:73:8: error: dereferencing pointer to incomplete 
type
  mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
^
./arch/mips/include/asm/smp.h: In function ‘kexec_nonboot_cpu’:
./arch/mips/include/asm/smp.h:99:15: error: dereferencing pointer to incomplete 
type
  return mp_ops->kexec_nonboot_cpu();
   ^
./arch/mips/include/asm/smp.h:99:2: warning: ‘return’ with a value, in function 
returning void
  return mp_ops->kexec_nonboot_cpu();
  ^
./arch/mips/include/asm/smp.h: In function ‘kexec_nonboot_cpu_func’:
./arch/mips/include/asm/smp.h:106:15: error: dereferencing pointer to 
incomplete type
  return mp_ops->kexec_nonboot_cpu;
   ^
./arch/mips/include/asm/smp.h: In function