2022-09-20 08:18:27

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the bitmap tree

Hi all,

After merging the bitmap tree, today's linux-next build (powerpc
allyesconfig) failed like this:

ld: arch/powerpc/kernel/head_64.o: in function `generic_secondary_common_init':
(.text+0x545e): undefined reference to `nr_cpu_ids'

Caused by commit

c90c5bd9f2d6 ("lib/cpumask: add FORCE_NR_CPUS config option")

This build has CONFIG_FORCE_NR_CPUS set but the (assembler) code expects
nr_cpu_ids to be a variable ...

I have reverted that commit for today.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-09-20 15:08:00

by Yury Norov

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the bitmap tree

On Tue, Sep 20, 2022 at 06:08:39PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the bitmap tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
>
> ld: arch/powerpc/kernel/head_64.o: in function `generic_secondary_common_init':
> (.text+0x545e): undefined reference to `nr_cpu_ids'
>
> Caused by commit
>
> c90c5bd9f2d6 ("lib/cpumask: add FORCE_NR_CPUS config option")
>
> This build has CONFIG_FORCE_NR_CPUS set but the (assembler) code expects
> nr_cpu_ids to be a variable ...
>
> I have reverted that commit for today.

Thanks for report, Stephen.

I did PPC build for bitmap-for-next, and it was OK on top of
v6-rc4. On today's -next I can reproduce the failure. It's weird
because the code in trouble was added at 2011 in 768d18ad6d5e6
("powerpc: Don't search for paca in freed memory").

Anyways, the fix is straightforward. I updated the bitmap-for-next
with it, and will send it for review shortly.
--

diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index cf2c08902c05..7cb97881635e 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -400,7 +400,11 @@ generic_secondary_common_init:
#else
LOAD_REG_ADDR(r8, paca_ptrs) /* Load paca_ptrs pointe */
ld r8,0(r8) /* Get base vaddr of array */
+#if (NR_CPUS == 1) || defined(CONFIG_FORCE_NR_CPUS)
+ LOAD_REG_IMMEDIATE(r7, NR_CPUS)
+#else
LOAD_REG_ADDR(r7, nr_cpu_ids) /* Load nr_cpu_ids address */
+#endif
lwz r7,0(r7) /* also the max paca allocated */
li r5,0 /* logical cpu id */
1: