Bug 8372

Summary: linux-yocto-rt 4.1 kernel build fails for qemumips
Product: [Yocto Project Subprojects] Kernel Reporter: Maxin B. John <maxin.john>
Component: linux-yoctoAssignee: Bruce Ashfield <bruce.ashfield>
Status: VERIFIED FIXED QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: Medium CC: bogdanx.a.voiculescu
Version: 1.9   
Target Milestone: 2.0   
Hardware: Other   
OS: mips   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Maxin B. John 2015-09-22 12:39:48 UTC
linux-yocto-rt-4.1.6 build for "qemumips" fails with following error (master branch):

 | In file included from /home/maxin/poky/build/tmp/work-shared/qemumips/kernel-source/kernel/pid_namespace.c:11:0:
| /home/maxin/poky/build/tmp/work-shared/qemumips/kernel-source/include/linux/pid.h: In function 'get_pid':
| /home/maxin/poky/build/tmp/work-shared/qemumips/kernel-source/include/linux/pid.h:78:3: error: implicit declaration of function 'atomic_inc' [-Werror=implicit-function-declaration]
|    atomic_inc(&pid->count);
|    ^
|   GZIP    kernel/config_data.gz
|   CC      kernel/seccomp.o
|   CC      kernel/trace/trace_events_trigger.o
|   CC      kernel/relay.o
|   CC      drivers/md/dm-linear.o
|   CC      fs/btrfs/orphan.o
|   CC      drivers/md/dm-stripe.o
|   CC      kernel/utsname_sysctl.o
| cc1: some warnings being treated as errors
| /home/maxin/poky/build/tmp/work-shared/qemumips/kernel-source/scripts/Makefile.build:258: recipe for target 'kernel/pid_namespace.o' failed

How to recreate the build error:

# git clone git://git.yoctoproject.org/poky
# cd poky
# source oe-init-build-env

edit these entries in the "conf/local.conf"
 1)  MACHINE ??= "qemumips"
 2)  PREFERRED_PROVIDER_virtual/kernel="linux-yocto-rt"

# bitbake virtual/kernel
Comment 1 Maxin B. John 2015-09-22 12:43:27 UTC
This patch fixes the build error for qemumips and qemuarm. It might be a good idea to cherry pick this fix:

http://marc.info/?l=linux-rt-users&m=143749706301597&w=3



From: Grygorii Strashko <Grygorii.Strashko@linaro.org>

This patch fixes build error:
  CC      kernel/pid_namespace.o
In file included from kernel/pid_namespace.c:11:0:
include/linux/pid.h: In function 'get_pid':
include/linux/pid.h:78:3: error: implicit declaration of function 'atomic_inc' \
[-Werror=implicit-function-declaration]  atomic_inc(&pid->count);
   ^
which happens when
 CONFIG_PROVE_LOCKING=n
 CONFIG_DEBUG_SPINLOCK=n
 CONFIG_DEBUG_MUTEXES=n
 CONFIG_DEBUG_LOCK_ALLOC=n

Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
---
 include/linux/pid.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/pid.h b/include/linux/pid.h
index 23705a53..2cc64b7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -2,6 +2,7 @@
 #define _LINUX_PID_H
 
 #include <linux/rcupdate.h>
+#include <linux/atomic.h>
 
 enum pid_type
 {
-- 
2.4.6
Comment 2 Bruce Ashfield 2015-09-24 15:38:58 UTC
This is already in place .. but there's an issue with the tree that
we are sorting out. It broke the builds for standard kernels, and now
I'm seeing that it also hit the RT branches. 

Once I sort this out, these will work again.

(I've been building, booting and running latency tests on the
qemu machines since 4.1 was introduced).

(In reply to comment #1)
> This patch fixes the build error for qemumips and qemuarm. It might be a
> good idea to cherry pick this fix:
> 
> http://marc.info/?l=linux-rt-users&m=143749706301597&w=3
> 
> 
> 
> From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
> 
> This patch fixes build error:
>   CC      kernel/pid_namespace.o
> In file included from kernel/pid_namespace.c:11:0:
> include/linux/pid.h: In function 'get_pid':
> include/linux/pid.h:78:3: error: implicit declaration of function
> 'atomic_inc' \
> [-Werror=implicit-function-declaration]  atomic_inc(&pid->count);
>    ^
> which happens when
>  CONFIG_PROVE_LOCKING=n
>  CONFIG_DEBUG_SPINLOCK=n
>  CONFIG_DEBUG_MUTEXES=n
>  CONFIG_DEBUG_LOCK_ALLOC=n
> 
> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
> ---
>  include/linux/pid.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/pid.h b/include/linux/pid.h
> index 23705a53..2cc64b7 100644
> --- a/include/linux/pid.h
> +++ b/include/linux/pid.h
> @@ -2,6 +2,7 @@
>  #define _LINUX_PID_H
>  
>  #include <linux/rcupdate.h>
> +#include <linux/atomic.h>
>  
>  enum pid_type
>  {
> -- 
> 2.4.6
Comment 3 Bruce Ashfield 2015-10-01 14:46:17 UTC
Author: Bruce Ashfield <bruce.ashfield@windriver.com>
Date:   Thu Sep 24 18:17:54 2015 -0400

    linux-yocto/4.1: rt update to 4.1.x-rt8
    
    The -rt build suffered the same breakage in master as the standard
    kernel builds: due to a bad git history merge, existing patches were
    dropped from branches.
    
    This meant that we were missing the -rt changes, which re-introduced
    some failures with linux-yocto-rt.
    
    With these SRCREV updates, we have the latest 4.1.x-rt and all
    architectures build.
    
    (From OE-Core rev: 96db930d8add6623168ec5e638769d5c0f348265)
    
    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
    Signed-off-by: Ross Burton <ross.burton@intel.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Comment 4 Bogdan Alexandru Voiculescu 2015-11-16 15:13:07 UTC
Verified on master:
Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "mips-poky-linux"
MACHINE           = "qemumips"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0"
TUNE_FEATURES     = "o32 bigendian fpu-hard mips32r2"
TARGET_FPU        = ""
meta
meta-yocto
meta-yocto-bsp    = "master:fc45deac89ef63ca1c44e763c38ced7dfd72cbe1"