RT kernel build issue if RT_BASIC is enabled

Issues related to applications and software problems
mkumar81
Posts: 6
Joined: 2017/05/25 16:30:47

RT kernel build issue if RT_BASIC is enabled

Post by mkumar81 » 2017/05/25 16:54:15

Hi,
I'm trying to build the RT kernel source RPM from the link "http://vault.centos.org/7.3.1611/rt/Sou ... l7.src.rpm".
In default "CONFIG_PREEMPT_RT_FULL" is enabled. But when "CONFIG_PREEMPT_RTB" is enabled there is a COMPILATION ISSUE, I have to apply the below source patch to fix the build.
There are two RT source RPMs in the repository, both seems to have the same issue.
This seems a kernel source bug, please clarify. Please also let me know if there is a patch available that fix the issue or if I'm doing anything wrong.
The way I update the kernel config was using "make oldconfig" and "make menuconfig"
rt-basic-patch.txt
(2.49 KiB) Downloaded 95 times
Patch used to fix the build issue with PREEMT_RTB enabled
---------------------------------------------------------------------------
MCP Custom Changes - 5/8/2017
The following changes are to support compiling Linux with the basic realtime preemption scheme.
Without these changes, compilation errors occurred when building Linux with RT basic.

Code: Select all

diff -uNr linux-3.10.0.x86_64/include/drm/drm_backport.h linux-patch-dir/include/drm/drm_backport.h
--- linux-3.10.0.x86_64/include/drm/drm_backport.h	2016-12-14 15:12:03.000000000 -0500
+++ linux-patch-dir/include/drm/drm_backport.h	2017-05-08 10:25:08.453144931 -0400
@@ -164,9 +164,17 @@
 }
 
 #define cpu_relax_lowlatency() cpu_relax()
-#ifndef CONFIG_PREEMPT_RT_FULL
-#define pagefault_disabled()   in_atomic()
-#endif
+/*
+ * MCP Custom Change
+ * Comment out the definition of pagefault_disabled.
+ * Without this line being commented out, the compiler
+ * complains because pagefault_disabled() is defined in two places.
+ * One place is here as a macro. The other place is in include/sched.h
+ * as a function definition.
+ */
+//#ifndef CONFIG_PREEMPT_RT_FULL
+//#define pagefault_disabled()   in_atomic()
+//#endif
 
 static inline int arch_phys_wc_index(int handle)
 {
diff -uNr linux-3.10.0.x86_64/kernel/sched/core.c linux-patch-dir/kernel/sched/core.c
--- linux-3.10.0.x86_64/kernel/sched/core.c	2016-12-14 15:12:03.000000000 -0500
+++ linux-patch-dir/kernel/sched/core.c	2017-05-08 10:23:23.955151340 -0400
@@ -5519,7 +5519,15 @@
 #if defined(CONFIG_PREEMPT_RT_BASE)
 	/* As we have the actual cpumask trimmed down to nr_cpu_ids bits, we need
 	   to zero the remaining bits to avoid garbage being sent to userspace */
-	memset(mask, 0, sizeof(mask));
+
+    /* MCP Custom Change
+     * Comment out this memset.
+     * Without it being commented out, the compiler complains that the sizeof
+     * argument is referencing the size of a pointer rather than the underlying
+     * data type. This is correct since the data type of mask is typedef'd to
+     * a pointer.
+     */
+	//memset(mask, 0, sizeof(mask));
 #endif
 	if ((len * BITS_PER_BYTE) < nr_cpu_ids)
 		return -EINVAL;
diff -uNr linux-3.10.0.x86_64/net/core/dev.c linux-patch-dir/net/core/dev.c
--- linux-3.10.0.x86_64/net/core/dev.c	2016-12-14 15:12:03.000000000 -0500
+++ linux-patch-dir/net/core/dev.c	2017-05-08 10:21:58.075156608 -0400
@@ -2935,7 +2935,11 @@
 	__this_cpu_inc(xmit_recursion);
 }
 
-static inline int xmit_rec_dec(void)
+/* MCP Custom Change 
+ * Change return type from int to void
+ * so that the compiler doesn't complain. This looks like an typo.
+ */
+static inline void xmit_rec_dec(void)
 {
 	__this_cpu_dec(xmit_recursion);
 }
Last edited by mkumar81 on 2017/06/05 18:38:01, edited 2 times in total.

mkumar81
Posts: 6
Joined: 2017/05/25 16:30:47

Re: RT kernel build issue if RT_BASIC is enabled

Post by mkumar81 » 2017/05/30 17:48:25

Hi,

Could anyone look into this build issue and confirm it's a genuine issue with official RT release?

Thanks,
Muthu

duffsterlp
Posts: 1
Joined: 2017/06/02 19:23:55

Re: RT kernel build issue if RT_BASIC is enabled

Post by duffsterlp » 2017/06/04 20:59:35

I am running into the same issue.

The source kernel I used is here: http://vault.centos.org/7.3.1611/rt/Sou ... l7.src.rpm
I changed CONFIG_PREEMPT_RT_FULL to CONFIG_PREEMPT_RTB under:
Processor Types and Features -> Preemption Model
When I do an rpmbuild to generate the binary RPM, I get the following compilation error.

Code: Select all

kernel/sched/core.c: In function 'SYSC_sched_getaffinity':
kernel/sched/core.c:5522:24: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
  memset(mask, 0, sizeof(mask));

hughesjr
Site Admin
Posts: 254
Joined: 2004/12/05 01:51:26
Location: Corpus Christi, Texas, USA
Contact:

Re: RT kernel build issue if RT_BASIC is enabled

Post by hughesjr » 2017/06/05 11:22:10

I did build this, but it is NOT officially supported.

The packages built as is .. here is the build logs and built binaries:

https://buildlogs.centos.org/c7-rt/kernel-rt/

I can build a newer version of the kernel-rt (and the add on packages) into that area if you like, BUT, they will not be officially supported.

mkumar81
Posts: 6
Joined: 2017/05/25 16:30:47

Re: RT kernel build issue if RT_BASIC is enabled

Post by mkumar81 » 2017/06/05 17:13:26

@hughesjr thanks for trying. I downloaded your source rpm from the shared path and it lookslike you didn't modify the kernel config from CONFIG_PREEMPT_RT_FULL to CONFIG_PREEMPT_RTB under:
Processor Types and Features -> Preemption Model.
The issue is only if we enable "CONFIG_PREEMPT_RTB".

hughesjr
Site Admin
Posts: 254
Joined: 2004/12/05 01:51:26
Location: Corpus Christi, Texas, USA
Contact:

Re: RT kernel build issue if RT_BASIC is enabled

Post by hughesjr » 2017/06/05 17:13:58

BTW, I built the kernel config as it comes from Red Hat sources, for the RT kernel. I assume that is the way they build it as well. If you modify the config file for a different (unsupported by them for RHEL) option, I'm not sure why you would expect that build.

mkumar81
Posts: 6
Joined: 2017/05/25 16:30:47

Re: RT kernel build issue if RT_BASIC is enabled

Post by mkumar81 » 2017/06/05 17:16:35

@duffsterlp Thanks a lot for trying.
Yes that is one of the build error. Do we have any official patch for this? Is there any official fix?
[OR]
a discussion on the best fix for all the 3 build errors would be great too. In my original post I've shared the patch I used.

Thanks for your time.

mkumar81
Posts: 6
Joined: 2017/05/25 16:30:47

Re: RT kernel build issue if RT_BASIC is enabled

Post by mkumar81 » 2017/06/05 17:23:00

@hughesjr doing a kernel config change should never break a build when the config changes are done following the rules. There is no point using a source build if it breaks when there is just a kernel config changes. I've done numerous changes to non-RT build, most of it just inserting drivers in kernel itself instead of an installable kernel modules. Everything has worked fine.
When RT is supported, there are 3 different options for the RT (FULL, RTB and LL), and I believe everything should build without issues when there is any of it is chosen. That is the only change I did.

# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT__LL is not set
# CONFIG_PREEMPT_RTB is not set
CONFIG_PREEMPT_RT_FULL=y

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: RT kernel build issue if RT_BASIC is enabled

Post by TrevorH » 2017/06/05 18:19:37

If changing the config options on the kernel breaks the build then you need to complain to Redhat who provide the source and spec files for the kernel packages.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

mkumar81
Posts: 6
Joined: 2017/05/25 16:30:47

Re: RT kernel build issue if RT_BASIC is enabled

Post by mkumar81 » 2017/06/05 18:24:33

@TrevorH Is there an official Issue/Bug report link for RedHat that you can share with me that handles these kind of build issues?

Post Reply