Skip to contentSkip to conversation

ARM: fix missing 'cpu_relax()' declaration

PATCH New Marc Zyngier 2 participants 8 messages May 23, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

ARM build fails with the following symptom:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function 'spin_unlock_wait':
include/linux/spinlock.h:360: error: implicit declaration of function 'cpu_relax' make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1

Fix it by including <asm/processor.h>.

---
 arch/arm/include/asm/spinlock.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/include/asm/spinlock.h +2 -0
index fdd3820..65fa3c8 100644
@@ -5,6 +5,8 @@
 #error SMP not supported on pre-ARMv6 CPUs
 #endif
 
+#include <asm/processor.h>
+
 /*
  * sev and wfe are ARMv6K extensions.  Uniprocessor ARMv6 may not have the K
  * extensions, so when running on UP, we have to patch these instructions away.
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

Quoted 12 lines · Marc Zyngier

ARM build fails with the following symptom:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function 'spin_unlock_wait':
include/linux/spinlock.h:360: error: implicit declaration of function 'cpu_relax' make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1

Quoted 3 lines

Fix it by including <asm/processor.h>.

Wonder why we haven't see this before. Could you send this to the patch system please?

Thanks.

#2 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

Quoted 13 lines · Russell King - ARM Linux
Quoted 12 lines · Marc Zyngier

ARM build fails with the following symptom:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function 'spin_unlock_wait':
include/linux/spinlock.h:360: error: implicit declaration of function 'cpu_relax' make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1

Quoted 6 lines
Quoted 3 lines

Fix it by including <asm/processor.h>.

Wonder why we haven't see this before. Could you send this to the patch system please?

Guess we were lucky. It is probably an effect of e66eed651fd18a961f11cda62f3b5286c8cc4f9f (list: remove prefetching from regular list iterators), which indirectly stopped asm/processor.h from being pulled.

Now in the patch system (6939/1).

Cheers,

	M.
Signature · 1 line
Reality is an implementation detail.
#3 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

In reply to Russell King - ARM Linux
Quoted 13 lines · Russell King - ARM Linux
Quoted 12 lines · Marc Zyngier

ARM build fails with the following symptom:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function 'spin_unlock_wait':
include/linux/spinlock.h:360: error: implicit declaration of function 'cpu_relax' make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1

Quoted 6 lines
Quoted 3 lines

Fix it by including <asm/processor.h>.

Wonder why we haven't see this before. Could you send this to the patch system please?

Hmm, this doesn't fix the problem:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function ?spin_unlock_wait?:
include/linux/spinlock.h:360: error: implicit declaration of function ?cpu_relax?

My guess is that it does for you because you're building SMP, but the above also happens with UP. So, I don't think this is the right fix.

I think its time to use git bisect to try and find what broke this and why.

#4 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

Quoted 32 lines · Russell King - ARM Linux
Quoted 13 lines · Russell King - ARM Linux
Quoted 12 lines · Marc Zyngier

ARM build fails with the following symptom:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function 'spin_unlock_wait':
include/linux/spinlock.h:360: error: implicit declaration of function 'cpu_relax' make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1

Quoted 6 lines
Quoted 3 lines

Fix it by including <asm/processor.h>.

Wonder why we haven't see this before. Could you send this to the patch system please?

Hmm, this doesn't fix the problem:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function ?spin_unlock_wait?:
include/linux/spinlock.h:360: error: implicit declaration of function ?cpu_relax?

Quoted 4 lines

My guess is that it does for you because you're building SMP, but the above also happens with UP. So, I don't think this is the right fix.

I think its time to use git bisect to try and find what broke this and why.

Odd... It seems to build just fine here with UP:

$ grep SMP .config
CONFIG_BROKEN_ON_SMP=y
# CONFIG_SMP is not set
$ time make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j4 all
  CHK     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
<stdin>:1554: warning: #warning syscall sendmmsg not implemented
  CC      init/main.o
  CHK     include/generated/compile.h
  HOSTCC  usr/gen_init_cpio
[...]
	M.
Signature · 1 line
Reality is an implementation detail.
#5 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

Quoted 39 lines · Marc Zyngier
Quoted 11 lines · Russell King - ARM Linux

Hmm, this doesn't fix the problem:

CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29,
from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/arm/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function ?spin_unlock_wait?:
include/linux/spinlock.h:360: error: implicit declaration of function ?cpu_relax?

Quoted 4 lines

My guess is that it does for you because you're building SMP, but the above also happens with UP. So, I don't think this is the right fix.

I think its time to use git bisect to try and find what broke this and why.

Odd... It seems to build just fine here with UP:

$ grep SMP .config
CONFIG_BROKEN_ON_SMP=y
# CONFIG_SMP is not set
$ time make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j4 all
  CHK     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
Quoted 8 lines
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
<stdin>:1554: warning: #warning syscall sendmmsg not implemented
  CC      init/main.o
  CHK     include/generated/compile.h
  HOSTCC  usr/gen_init_cpio
[...]

For what platform? I've tried a few and getting the same error message.

#6 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

Quoted 32 lines · Russell King - ARM Linux
Quoted 22 lines · Marc Zyngier

Odd... It seems to build just fine here with UP:

$ grep SMP .config
CONFIG_BROKEN_ON_SMP=y
# CONFIG_SMP is not set
$ time make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j4 all
  CHK     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
Quoted 8 lines
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
<stdin>:1554: warning: #warning syscall sendmmsg not implemented
  CC      init/main.o
  CHK     include/generated/compile.h
  HOSTCC  usr/gen_init_cpio
[...]
Quoted 1 line

For what platform? I've tried a few and getting the same error message.

Found it, my for-next tree has the prefetching change but not this:

commit d974d905cbfc1039a73ba0c7eea3f4d4e13c0624

Author: Stephen Rothwell <[email protected]>
Date:   Fri May 20 15:48:17 2011 +1000

spinlock_up.h: include asm/processor.h in for cpu_relax

which fixes the UP build problem.

#7 lore raw

PATCH 1/1 ARM: fix missing 'cpu_relax()' declaration

Quoted 37 lines · Russell King - ARM Linux
Quoted 32 lines · Russell King - ARM Linux
Quoted 22 lines · Marc Zyngier

Odd... It seems to build just fine here with UP:

$ grep SMP .config
CONFIG_BROKEN_ON_SMP=y
# CONFIG_SMP is not set
$ time make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j4 all
  CHK     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
Quoted 8 lines
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
<stdin>:1554: warning: #warning syscall sendmmsg not implemented
  CC      init/main.o
  CHK     include/generated/compile.h
  HOSTCC  usr/gen_init_cpio
[...]
Quoted 1 line

For what platform? I've tried a few and getting the same error message.

Found it, my for-next tree has the prefetching change but not this:

Quoted 8 lines

commit d974d905cbfc1039a73ba0c7eea3f4d4e13c0624

Author: Stephen Rothwell <[email protected]>
Date:   Fri May 20 15:48:17 2011 +1000

spinlock_up.h: include asm/processor.h in for cpu_relax

which fixes the UP build problem.

Makes sense. Thanks for solving the mystery!

	M.
Signature · 1 line
Reality is an implementation detail.