2006-10-05 17:17:06

by Jiri Kosina

[permalink] [raw]
Subject: [PATCH] make mach-generic/summit.c compile on UP

Hi,

arch/i386/mach-generic/summit.c doesn't compile (neither in current
mainline git tree, nor in 2.6.18-mm3) when CONFIG_SMP is not set:

In file included from arch/i386/mach-generic/summit.c:17:
include/asm/mach-summit/mach_apic.h: In function 'apicid_to_node':
include/asm/mach-summit/mach_apic.h:91: error: 'apicid_2_node' undeclared (first use in this function)
include/asm/mach-summit/mach_apic.h:91: error: (Each undeclared identifier is reported only once
include/asm/mach-summit/mach_apic.h:91: error: for each function it appears in.)

Is the patch below correct?

Signed-off-by: Jiri Kosina <[email protected]>

--- a/include/asm-i386/mach-summit/mach_apic.h
+++ b/include/asm-i386/mach-summit/mach_apic.h
@@ -88,7 +88,11 @@ static inline void clustered_apic_check(

static inline int apicid_to_node(int logical_apicid)
{
+#ifdef CONFIG_SMP
return apicid_2_node[hard_smp_processor_id()];
+#else
+ return 0;
+#endif
}

/* Mapping from cpu number to logical apicid */
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h

--
Jiri Kosina


2006-10-05 20:31:36

by Keith Mannthey

[permalink] [raw]
Subject: Re: [PATCH] make mach-generic/summit.c compile on UP

On Thu, 2006-10-05 at 19:16 +0200, Jiri Kosina wrote:
> Hi,
>
> arch/i386/mach-generic/summit.c doesn't compile (neither in current
> mainline git tree, nor in 2.6.18-mm3) when CONFIG_SMP is not set:
>
> In file included from arch/i386/mach-generic/summit.c:17:
> include/asm/mach-summit/mach_apic.h: In function 'apicid_to_node':
> include/asm/mach-summit/mach_apic.h:91: error: 'apicid_2_node' undeclared (first use in this function)
> include/asm/mach-summit/mach_apic.h:91: error: (Each undeclared identifier is reported only once
> include/asm/mach-summit/mach_apic.h:91: error: for each function it appears in.)
> Is the patch below correct?

Well I guess it would fix the apicid_2_node build error but I can't
think of a single good reason to be in a config where you would need any
of the summit code in UP. Perhaps a kconfig or makefile change in the
right spot would be better.

Can you send along your config file so I can better understand? I seem
to be able to build i386 UP just fine.

Thanks,
Keith

2006-10-05 21:19:05

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] make mach-generic/summit.c compile on UP

On Thu, 5 Oct 2006, keith mannthey wrote:

> > In file included from arch/i386/mach-generic/summit.c:17:
> > include/asm/mach-summit/mach_apic.h: In function 'apicid_to_node':
> > include/asm/mach-summit/mach_apic.h:91: error: 'apicid_2_node' undeclared (first use in this function)
> > include/asm/mach-summit/mach_apic.h:91: error: (Each undeclared identifier is reported only once
> > include/asm/mach-summit/mach_apic.h:91: error: for each function it appears in.)
> > Is the patch below correct?
> Well I guess it would fix the apicid_2_node build error but I can't
> think of a single good reason to be in a config where you would need any
> of the summit code in UP. Perhaps a kconfig or makefile change in the
> right spot would be better.

Yes, this was in fact a product of a random .config (but allowed by
Kconfig rules). There should definitely be a Kconfig rule not allowing
having this non-working .config settings.

I guess that probably making CONFIG_X86_GENERIC dependent on CONFIG_SMP
would not be good, because the mach-default/ makes sense even on UP, am I
right?

Thanks,

--
Jiri Kosina

2006-10-05 22:24:56

by Keith Mannthey

[permalink] [raw]
Subject: Re: [PATCH] make mach-generic/summit.c compile on UP

On Thu, 2006-10-05 at 23:18 +0200, Jiri Kosina wrote:
> On Thu, 5 Oct 2006, keith mannthey wrote:
>
> > > In file included from arch/i386/mach-generic/summit.c:17:
> > > include/asm/mach-summit/mach_apic.h: In function 'apicid_to_node':
> > > include/asm/mach-summit/mach_apic.h:91: error: 'apicid_2_node' undeclared (first use in this function)
> > > include/asm/mach-summit/mach_apic.h:91: error: (Each undeclared identifier is reported only once
> > > include/asm/mach-summit/mach_apic.h:91: error: for each function it appears in.)
> > > Is the patch below correct?
> > Well I guess it would fix the apicid_2_node build error but I can't
> > think of a single good reason to be in a config where you would need any
> > of the summit code in UP. Perhaps a kconfig or makefile change in the
> > right spot would be better.
>
> Yes, this was in fact a product of a random .config (but allowed by
> Kconfig rules). There should definitely be a Kconfig rule not allowing
> having this non-working .config settings.
>
> I guess that probably making CONFIG_X86_GENERIC dependent on CONFIG_SMP
> would not be good, because the mach-default/ makes sense even on UP, am I
> right

Yea I am pretty sure CONFIG_X86_GENERIC is ment to boot UP and SMP
kernels.

Maybe just moving apicid_2_node to a UP safe location would be a good
way to go as well. I overlooked the fact that CONFIG_X86_GENERIC wasn't
always SMP.

Thanks,
Keith

2006-10-05 23:11:51

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] make mach-generic/summit.c compile on UP

keith mannthey <[email protected]> writes:

> On Thu, 2006-10-05 at 19:16 +0200, Jiri Kosina wrote:
> > Hi,
> >
> > arch/i386/mach-generic/summit.c doesn't compile (neither in current
> > mainline git tree, nor in 2.6.18-mm3) when CONFIG_SMP is not set:
> >
> > In file included from arch/i386/mach-generic/summit.c:17:
> > include/asm/mach-summit/mach_apic.h: In function 'apicid_to_node':
> > include/asm/mach-summit/mach_apic.h:91: error: 'apicid_2_node' undeclared (first use in this function)
> > include/asm/mach-summit/mach_apic.h:91: error: (Each undeclared identifier is reported only once
> > include/asm/mach-summit/mach_apic.h:91: error: for each function it appears in.)
> > Is the patch below correct?
>
> Well I guess it would fix the apicid_2_node build error but I can't
> think of a single good reason to be in a config where you would need any
> of the summit code in UP.

The reason I allowed it originally was that it would allow UP distribution
boot kernels to find all devices on Summit where you need the special
APIC drivers etc. for that.

But then distributions are mostly switching to SMP kernels by default
anyways so it's a bit obsolete.

-Andi

2006-10-06 09:12:10

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] make mach-generic/summit.c compile on UP

On Thu, 5 Oct 2006, keith mannthey wrote:

> Yea I am pretty sure CONFIG_X86_GENERIC is ment to boot UP and SMP
> kernels.
> Maybe just moving apicid_2_node to a UP safe location would be a good
> way to go as well. I overlooked the fact that CONFIG_X86_GENERIC wasn't
> always SMP.

Below is the patch doing exactly this. Fixes compilation of Linus' git
tree, applicable also to -mm. Please apply.

[PATCH] make kernels with CONFIG_X86_GENERIC and !CONFIG_SMP compilable

CONFIG_X86_GENERIC is not exclusively CONFIG_SMP, as mach-default/ could
be compiled also for UP archs. The patch fixes compilation error in
include/asm/mach-summit/mach_apic.h in case CONFIG_X86_GENERIC && !CONFIG_SMP

Signed-off-by: Jiri Kosina <[email protected]>

include/asm-i386/smp.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -46,8 +46,6 @@ extern u8 x86_cpu_to_apicid[];

#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]

-extern u8 apicid_2_node[];
-
#ifdef CONFIG_HOTPLUG_CPU
extern void cpu_exit_clear(void);
extern void cpu_uninit(void);
@@ -101,6 +99,9 @@ #define NO_PROC_ID 0xFF /* No processo
#endif

#ifndef __ASSEMBLY__
+
+extern u8 apicid_2_node[];
+
#ifdef CONFIG_X86_LOCAL_APIC
static __inline int logical_smp_processor_id(void)
{

--
Jiri Kosina

2006-10-06 17:23:46

by Keith Mannthey

[permalink] [raw]
Subject: Re: [PATCH] make mach-generic/summit.c compile on UP

On Fri, 2006-10-06 at 11:11 +0200, Jiri Kosina wrote:
> On Thu, 5 Oct 2006, keith mannthey wrote:
>
> > Yea I am pretty sure CONFIG_X86_GENERIC is ment to boot UP and SMP
> > kernels.
> > Maybe just moving apicid_2_node to a UP safe location would be a good
> > way to go as well. I overlooked the fact that CONFIG_X86_GENERIC wasn't
> > always SMP.
>
> Below is the patch doing exactly this. Fixes compilation of Linus' git
> tree, applicable also to -mm. Please apply.
>
> [PATCH] make kernels with CONFIG_X86_GENERIC and !CONFIG_SMP compilable
>
> CONFIG_X86_GENERIC is not exclusively CONFIG_SMP, as mach-default/ could
> be compiled also for UP archs. The patch fixes compilation error in
> include/asm/mach-summit/mach_apic.h in case CONFIG_X86_GENERIC && !CONFIG_SMP
>
> Signed-off-by: Jiri Kosina <[email protected]>
>
> include/asm-i386/smp.h | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> --- a/include/asm-i386/smp.h
> +++ b/include/asm-i386/smp.h
> @@ -46,8 +46,6 @@ extern u8 x86_cpu_to_apicid[];
>
> #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
>
> -extern u8 apicid_2_node[];
> -
> #ifdef CONFIG_HOTPLUG_CPU
> extern void cpu_exit_clear(void);
> extern void cpu_uninit(void);
> @@ -101,6 +99,9 @@ #define NO_PROC_ID 0xFF /* No processo
> #endif
>
> #ifndef __ASSEMBLY__
> +
> +extern u8 apicid_2_node[];
> +
> #ifdef CONFIG_X86_LOCAL_APIC
> static __inline int logical_smp_processor_id(void)
> {

Look good to me. Thanks for fixing this.

Acked-by: Keith Mannthey <[email protected]>