Re: [PATCH] arm: Fix linux-next compile error inarch/arm/common/gic.c

From: Will Deacon
Date: Tue Jan 03 2012 - 12:33:22 EST


On Tue, Jan 03, 2012 at 02:05:40PM +0000, Marc Zyngier wrote:
> On 03/01/12 13:53, Rob Herring wrote:
> >>> On Tue, Jan 3, 2012 at 12:33 AM, Joerg Roedel <joerg.roedel@xxxxxxx> wrote:
> >>>> With CONFIG_SMP=n the following compile error occurs:
> >>>>
> >>>> CC arch/arm/common/gic.o
> >>>> arch/arm/common/gic.c: In function 'gic_init_bases':
> >>>> arch/arm/common/gic.c:679:4: error: implicit declaration of function 'cpu_logical_map' [-Werror=implicit-function-declaration]
> >>>> cc1: some warnings being treated as errors

[...]

> > IIRC, part of the problem is asm/smp.h is only included by linux/smp.h
> > for CONFIG_SMP, so this would have to change. Doing that could easily
> > break other arches.
>
> Ah... good point.

We could probably move smp_setup_processor_id out of smp.c if we need to as
it seems as though you can provide a definition of that function even when
!CONFIG_SMP.

> >>
> >> Well, both patches are wrong. In the UP case (and assuming we're running
> >> on physical CPU 0), offset should be 0.
> >>
> >> The second patch would be my favorite approach, except that
> >> cpu_logical_map(x) should return either "x" or 0. And I'm not sure how
> >> to handle the (unlikely?) case of running a UP kernel on a secondary CPU...
> >
> > Wouldn't this be the case with 2 AMP instances of Linux running?

In this configuration, I think returning 0 would probably be the right thing
to do. If it's anything else, there's the implication that both of your
kernels are hanging off the same GIC distributor / SCU / L2 Cache etc. and
so you would need a single SMP kernel (or some funky message passing that we
don't yet have).

The bit we're currently missing is the notion of a cluster ID, but both CPU IDs
should be 0 for AMP.

> Yes, or kexec-ing a UP kernel on a secondary CPU. It really looks like
> we ought to make this cpu_logical_map() independent from CONFIG_SMP.

We could always prevent this from happening by hacking kexec / kexec-tools
but I think that booting a UP kernel on a CPU other than 0 is rather silly :)

So I'd be inclined to simply move the existing smp_setup_processor_id
implementation (and the map declaration) into somewhere like kernel/setup.c
and I think things should work.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/