linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: Fix compile error seen in non-SMP builds
@ 2014-10-11  1:15 Guenter Roeck
  2014-10-11 13:16 ` Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-10-11  1:15 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, linux-arm-kernel, linux-kernel, Guenter Roeck,
	Frederic Weisbecker

Fix:

In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
        from include/linux/irq_work.h:46,
        from include/linux/perf_event.h:49,
        from include/linux/ftrace_event.h:9,
        from include/trace/syscall.h:6,
        from include/linux/syscalls.h:81,
        from init/main.c:18:
./arch/arm64/include/asm/smp.h:24:3:
	error: #error "<asm/smp.h> included in non-SMP build"
 # error "<asm/smp.h> included in non-SMP build"
   ^
./arch/arm64/include/asm/smp.h:27:0: warning: "raw_smp_processor_id" redefined
 #define raw_smp_processor_id() (current_thread_info()->cpu)
 ^

and:

In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
        from include/linux/irq_work.h:46,
        from kernel/irq_work.c:11:
./arch/arm64/include/asm/smp_plat.h:56:30:
        error: ‘NR_CPUS’ undeclared here (not in a function)
        extern u64 __cpu_logical_map[NR_CPUS];

by providing a helper function in smp_plat.h, similar to the arm implementation,
and by removing NR_CPUS from smp_plat.h.

Fixes: 3631073659d0 ("arm64: Tell irq work about self IPI support")
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Compile tested and booted in qemu for both SMP and non-SMP builds.

 arch/arm64/include/asm/irq_work.h |  4 ++--
 arch/arm64/include/asm/smp.h      |  2 --
 arch/arm64/include/asm/smp_plat.h | 17 ++++++++++++++++-
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/include/asm/irq_work.h b/arch/arm64/include/asm/irq_work.h
index 8e24ef3..33199a9 100644
--- a/arch/arm64/include/asm/irq_work.h
+++ b/arch/arm64/include/asm/irq_work.h
@@ -1,11 +1,11 @@
 #ifndef __ASM_IRQ_WORK_H
 #define __ASM_IRQ_WORK_H
 
-#include <asm/smp.h>
+#include <asm/smp_plat.h>
 
 static inline bool arch_irq_work_has_interrupt(void)
 {
-	return !!__smp_cross_call;
+	return have_smp_crosscall();
 }
 
 #endif /* __ASM_IRQ_WORK_H */
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 780f82c..a498f2c 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -48,8 +48,6 @@ extern void smp_init_cpus(void);
  */
 extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
 
-extern void (*__smp_cross_call)(const struct cpumask *, unsigned int);
-
 /*
  * Called from the secondary holding pen, this is the secondary CPU entry point.
  */
diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h
index 59e2823..9ae4fde 100644
--- a/arch/arm64/include/asm/smp_plat.h
+++ b/arch/arm64/include/asm/smp_plat.h
@@ -21,6 +21,21 @@
 
 #include <asm/types.h>
 
+/*
+ * Return true if we are running on a SMP platform
+ * and __smp_cross_call is installed.
+ */
+static inline bool have_smp_crosscall(void)
+{
+#ifndef CONFIG_SMP
+	return false;
+#else
+	extern void (*__smp_cross_call)(const struct cpumask *, unsigned int);
+
+	return !!__smp_cross_call;
+#endif
+}
+
 struct mpidr_hash {
 	u64	mask;
 	u32	shift_aff[4];
@@ -37,7 +52,7 @@ static inline u32 mpidr_hash_size(void)
 /*
  * Logical CPU mapping.
  */
-extern u64 __cpu_logical_map[NR_CPUS];
+extern u64 __cpu_logical_map[];
 #define cpu_logical_map(cpu)    __cpu_logical_map[cpu]
 
 #endif /* __ASM_SMP_PLAT_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: Fix compile error seen in non-SMP builds
  2014-10-11  1:15 [PATCH] arm64: Fix compile error seen in non-SMP builds Guenter Roeck
@ 2014-10-11 13:16 ` Frederic Weisbecker
  2014-10-11 14:49   ` Guenter Roeck
  2014-10-11 16:45   ` Alexei Starovoitov
  2014-10-19 15:22 ` Guenter Roeck
  2014-10-20 17:22 ` Catalin Marinas
  2 siblings, 2 replies; 7+ messages in thread
From: Frederic Weisbecker @ 2014-10-11 13:16 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel

On Fri, Oct 10, 2014 at 06:15:34PM -0700, Guenter Roeck wrote:
> Fix:
> 
> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>         from include/linux/irq_work.h:46,
>         from include/linux/perf_event.h:49,
>         from include/linux/ftrace_event.h:9,
>         from include/trace/syscall.h:6,
>         from include/linux/syscalls.h:81,
>         from init/main.c:18:
> ./arch/arm64/include/asm/smp.h:24:3:
> 	error: #error "<asm/smp.h> included in non-SMP build"
>  # error "<asm/smp.h> included in non-SMP build"
>    ^
> ./arch/arm64/include/asm/smp.h:27:0: warning: "raw_smp_processor_id" redefined
>  #define raw_smp_processor_id() (current_thread_info()->cpu)
>  ^
> 
> and:
> 
> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>         from include/linux/irq_work.h:46,
>         from kernel/irq_work.c:11:
> ./arch/arm64/include/asm/smp_plat.h:56:30:
>         error: ‘NR_CPUS’ undeclared here (not in a function)
>         extern u64 __cpu_logical_map[NR_CPUS];
> 
> by providing a helper function in smp_plat.h, similar to the arm implementation,
> and by removing NR_CPUS from smp_plat.h.
> 
> Fixes: 3631073659d0 ("arm64: Tell irq work about self IPI support")
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

That looks good to me.

Note, ARM64 is one of the archs I couldn't test due to the lack of a
nolibc cross compiler in https://www.kernel.org/pub/tools/crosstool/

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: Fix compile error seen in non-SMP builds
  2014-10-11 13:16 ` Frederic Weisbecker
@ 2014-10-11 14:49   ` Guenter Roeck
  2014-10-11 16:45   ` Alexei Starovoitov
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-10-11 14:49 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel

On 10/11/2014 06:16 AM, Frederic Weisbecker wrote:
> On Fri, Oct 10, 2014 at 06:15:34PM -0700, Guenter Roeck wrote:
>> Fix:
>>
>> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>>          from include/linux/irq_work.h:46,
>>          from include/linux/perf_event.h:49,
>>          from include/linux/ftrace_event.h:9,
>>          from include/trace/syscall.h:6,
>>          from include/linux/syscalls.h:81,
>>          from init/main.c:18:
>> ./arch/arm64/include/asm/smp.h:24:3:
>> 	error: #error "<asm/smp.h> included in non-SMP build"
>>   # error "<asm/smp.h> included in non-SMP build"
>>     ^
>> ./arch/arm64/include/asm/smp.h:27:0: warning: "raw_smp_processor_id" redefined
>>   #define raw_smp_processor_id() (current_thread_info()->cpu)
>>   ^
>>
>> and:
>>
>> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>>          from include/linux/irq_work.h:46,
>>          from kernel/irq_work.c:11:
>> ./arch/arm64/include/asm/smp_plat.h:56:30:
>>          error: ‘NR_CPUS’ undeclared here (not in a function)
>>          extern u64 __cpu_logical_map[NR_CPUS];
>>
>> by providing a helper function in smp_plat.h, similar to the arm implementation,
>> and by removing NR_CPUS from smp_plat.h.
>>
>> Fixes: 3631073659d0 ("arm64: Tell irq work about self IPI support")
>> Cc: Frederic Weisbecker <fweisbec@gmail.com>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>
> That looks good to me.
>
> Note, ARM64 is one of the archs I couldn't test due to the lack of a
> nolibc cross compiler in https://www.kernel.org/pub/tools/crosstool/
>
No worries. Even if you had, you might not have caught the non-SMP case.
I only recently added a non-SMP build myself.

Is the toolchain issue out of principle (not wanting to use a cross
compiler that includes glibc) or because you did not find a cross
compiler ? Linaro provides toolchains for aarch64, though they are
only 32 bit. I built one myself using buildroot (select binutils 2.24
and gcc 4.9.1).

In general I have been quite successful using buildroot to create
toolchains, including ones for oddball architectures like score
(after patching buildroot to support it, of course).

Guenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: Fix compile error seen in non-SMP builds
  2014-10-11 13:16 ` Frederic Weisbecker
  2014-10-11 14:49   ` Guenter Roeck
@ 2014-10-11 16:45   ` Alexei Starovoitov
  1 sibling, 0 replies; 7+ messages in thread
From: Alexei Starovoitov @ 2014-10-11 16:45 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Guenter Roeck, Catalin Marinas, Will Deacon, linux-arm-kernel,
	linux-kernel

On Sat, Oct 11, 2014 at 6:16 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
>
> Note, ARM64 is one of the archs I couldn't test due to the lack of a
> nolibc cross compiler in https://www.kernel.org/pub/tools/crosstool/

that table is not up to date. There is one there for aarch64:
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: Fix compile error seen in non-SMP builds
  2014-10-11  1:15 [PATCH] arm64: Fix compile error seen in non-SMP builds Guenter Roeck
  2014-10-11 13:16 ` Frederic Weisbecker
@ 2014-10-19 15:22 ` Guenter Roeck
  2014-10-20 17:22 ` Catalin Marinas
  2 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-10-19 15:22 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, linux-arm-kernel, linux-kernel, Frederic Weisbecker

On Fri, Oct 10, 2014 at 06:15:34PM -0700, Guenter Roeck wrote:
> Fix:
> 
> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>         from include/linux/irq_work.h:46,
>         from include/linux/perf_event.h:49,
>         from include/linux/ftrace_event.h:9,
>         from include/trace/syscall.h:6,
>         from include/linux/syscalls.h:81,
>         from init/main.c:18:
> ./arch/arm64/include/asm/smp.h:24:3:
> 	error: #error "<asm/smp.h> included in non-SMP build"
>  # error "<asm/smp.h> included in non-SMP build"
>    ^
> ./arch/arm64/include/asm/smp.h:27:0: warning: "raw_smp_processor_id" redefined
>  #define raw_smp_processor_id() (current_thread_info()->cpu)
>  ^
> 
> and:
> 
> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>         from include/linux/irq_work.h:46,
>         from kernel/irq_work.c:11:
> ./arch/arm64/include/asm/smp_plat.h:56:30:
>         error: ‘NR_CPUS’ undeclared here (not in a function)
>         extern u64 __cpu_logical_map[NR_CPUS];
> 
> by providing a helper function in smp_plat.h, similar to the arm implementation,
> and by removing NR_CPUS from smp_plat.h.
> 
> Fixes: 3631073659d0 ("arm64: Tell irq work about self IPI support")
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

ping ...

The commit causing the problem has been applied to 3.17, meaning
this patch, once in mainline, will have to be applied to 3.17 as well.

Guenter

> ---
> Compile tested and booted in qemu for both SMP and non-SMP builds.
> 
>  arch/arm64/include/asm/irq_work.h |  4 ++--
>  arch/arm64/include/asm/smp.h      |  2 --
>  arch/arm64/include/asm/smp_plat.h | 17 ++++++++++++++++-
>  3 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/irq_work.h b/arch/arm64/include/asm/irq_work.h
> index 8e24ef3..33199a9 100644
> --- a/arch/arm64/include/asm/irq_work.h
> +++ b/arch/arm64/include/asm/irq_work.h
> @@ -1,11 +1,11 @@
>  #ifndef __ASM_IRQ_WORK_H
>  #define __ASM_IRQ_WORK_H
>  
> -#include <asm/smp.h>
> +#include <asm/smp_plat.h>
>  
>  static inline bool arch_irq_work_has_interrupt(void)
>  {
> -	return !!__smp_cross_call;
> +	return have_smp_crosscall();
>  }
>  
>  #endif /* __ASM_IRQ_WORK_H */
> diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
> index 780f82c..a498f2c 100644
> --- a/arch/arm64/include/asm/smp.h
> +++ b/arch/arm64/include/asm/smp.h
> @@ -48,8 +48,6 @@ extern void smp_init_cpus(void);
>   */
>  extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
>  
> -extern void (*__smp_cross_call)(const struct cpumask *, unsigned int);
> -
>  /*
>   * Called from the secondary holding pen, this is the secondary CPU entry point.
>   */
> diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h
> index 59e2823..9ae4fde 100644
> --- a/arch/arm64/include/asm/smp_plat.h
> +++ b/arch/arm64/include/asm/smp_plat.h
> @@ -21,6 +21,21 @@
>  
>  #include <asm/types.h>
>  
> +/*
> + * Return true if we are running on a SMP platform
> + * and __smp_cross_call is installed.
> + */
> +static inline bool have_smp_crosscall(void)
> +{
> +#ifndef CONFIG_SMP
> +	return false;
> +#else
> +	extern void (*__smp_cross_call)(const struct cpumask *, unsigned int);
> +
> +	return !!__smp_cross_call;
> +#endif
> +}
> +
>  struct mpidr_hash {
>  	u64	mask;
>  	u32	shift_aff[4];
> @@ -37,7 +52,7 @@ static inline u32 mpidr_hash_size(void)
>  /*
>   * Logical CPU mapping.
>   */
> -extern u64 __cpu_logical_map[NR_CPUS];
> +extern u64 __cpu_logical_map[];
>  #define cpu_logical_map(cpu)    __cpu_logical_map[cpu]
>  
>  #endif /* __ASM_SMP_PLAT_H */
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: Fix compile error seen in non-SMP builds
  2014-10-11  1:15 [PATCH] arm64: Fix compile error seen in non-SMP builds Guenter Roeck
  2014-10-11 13:16 ` Frederic Weisbecker
  2014-10-19 15:22 ` Guenter Roeck
@ 2014-10-20 17:22 ` Catalin Marinas
  2014-10-20 18:13   ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Catalin Marinas @ 2014-10-20 17:22 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Will Deacon, linux-arm-kernel, linux-kernel, Frederic Weisbecker

On Sat, Oct 11, 2014 at 02:15:34AM +0100, Guenter Roeck wrote:
> Fix:
> 
> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>         from include/linux/irq_work.h:46,
>         from include/linux/perf_event.h:49,
>         from include/linux/ftrace_event.h:9,
>         from include/trace/syscall.h:6,
>         from include/linux/syscalls.h:81,
>         from init/main.c:18:
> ./arch/arm64/include/asm/smp.h:24:3:
> 	error: #error "<asm/smp.h> included in non-SMP build"
>  # error "<asm/smp.h> included in non-SMP build"
>    ^
> ./arch/arm64/include/asm/smp.h:27:0: warning: "raw_smp_processor_id" redefined
>  #define raw_smp_processor_id() (current_thread_info()->cpu)
>  ^
> 
> and:
> 
> In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
>         from include/linux/irq_work.h:46,
>         from kernel/irq_work.c:11:
> ./arch/arm64/include/asm/smp_plat.h:56:30:
>         error: ‘NR_CPUS’ undeclared here (not in a function)
>         extern u64 __cpu_logical_map[NR_CPUS];
> 
> by providing a helper function in smp_plat.h, similar to the arm implementation,
> and by removing NR_CPUS from smp_plat.h.
> 
> Fixes: 3631073659d0 ("arm64: Tell irq work about self IPI support")
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Isn't something like this simpler:

diff --git a/arch/arm64/include/asm/irq_work.h b/arch/arm64/include/asm/irq_work.h
index 8e24ef3f7c82..b4f6b19a8a68 100644
--- a/arch/arm64/include/asm/irq_work.h
+++ b/arch/arm64/include/asm/irq_work.h
@@ -1,6 +1,8 @@
 #ifndef __ASM_IRQ_WORK_H
 #define __ASM_IRQ_WORK_H
 
+#ifdef CONFIG_SMP
+
 #include <asm/smp.h>
 
 static inline bool arch_irq_work_has_interrupt(void)
@@ -8,4 +10,13 @@ static inline bool arch_irq_work_has_interrupt(void)
 	return !!__smp_cross_call;
 }
 
+#else
+
+static inline bool arch_irq_work_has_interrupt(void)
+{
+	return false;
+}
+
+#endif
+
 #endif /* __ASM_IRQ_WORK_H */

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: Fix compile error seen in non-SMP builds
  2014-10-20 17:22 ` Catalin Marinas
@ 2014-10-20 18:13   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2014-10-20 18:13 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, linux-arm-kernel, linux-kernel, Frederic Weisbecker

On Mon, Oct 20, 2014 at 06:22:09PM +0100, Catalin Marinas wrote:
> On Sat, Oct 11, 2014 at 02:15:34AM +0100, Guenter Roeck wrote:
> > Fix:
> > 
> > In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
> >         from include/linux/irq_work.h:46,
> >         from include/linux/perf_event.h:49,
> >         from include/linux/ftrace_event.h:9,
> >         from include/trace/syscall.h:6,
> >         from include/linux/syscalls.h:81,
> >         from init/main.c:18:
> > ./arch/arm64/include/asm/smp.h:24:3:
> > 	error: #error "<asm/smp.h> included in non-SMP build"
> >  # error "<asm/smp.h> included in non-SMP build"
> >    ^
> > ./arch/arm64/include/asm/smp.h:27:0: warning: "raw_smp_processor_id" redefined
> >  #define raw_smp_processor_id() (current_thread_info()->cpu)
> >  ^
> > 
> > and:
> > 
> > In file included from ./arch/arm64/include/asm/irq_work.h:4:0,
> >         from include/linux/irq_work.h:46,
> >         from kernel/irq_work.c:11:
> > ./arch/arm64/include/asm/smp_plat.h:56:30:
> >         error: ‘NR_CPUS’ undeclared here (not in a function)
> >         extern u64 __cpu_logical_map[NR_CPUS];
> > 
> > by providing a helper function in smp_plat.h, similar to the arm implementation,
> > and by removing NR_CPUS from smp_plat.h.
> > 
> > Fixes: 3631073659d0 ("arm64: Tell irq work about self IPI support")
> > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> 
> Isn't something like this simpler:
> 

Yes, that works as well.

Feel free to add my Tested-by: if you want to take that patch.

Thanks,
Guenter

> diff --git a/arch/arm64/include/asm/irq_work.h b/arch/arm64/include/asm/irq_work.h
> index 8e24ef3f7c82..b4f6b19a8a68 100644
> --- a/arch/arm64/include/asm/irq_work.h
> +++ b/arch/arm64/include/asm/irq_work.h
> @@ -1,6 +1,8 @@
>  #ifndef __ASM_IRQ_WORK_H
>  #define __ASM_IRQ_WORK_H
>  
> +#ifdef CONFIG_SMP
> +
>  #include <asm/smp.h>
>  
>  static inline bool arch_irq_work_has_interrupt(void)
> @@ -8,4 +10,13 @@ static inline bool arch_irq_work_has_interrupt(void)
>  	return !!__smp_cross_call;
>  }
>  
> +#else
> +
> +static inline bool arch_irq_work_has_interrupt(void)
> +{
> +	return false;
> +}
> +
> +#endif
> +
>  #endif /* __ASM_IRQ_WORK_H */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-20 18:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-11  1:15 [PATCH] arm64: Fix compile error seen in non-SMP builds Guenter Roeck
2014-10-11 13:16 ` Frederic Weisbecker
2014-10-11 14:49   ` Guenter Roeck
2014-10-11 16:45   ` Alexei Starovoitov
2014-10-19 15:22 ` Guenter Roeck
2014-10-20 17:22 ` Catalin Marinas
2014-10-20 18:13   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).