Skip to contentSkip to conversation

Enable kernel 5.4

PATCH In review Jan Kiszka 2 participants 13 messages Oct 26, 2020 – Oct 27, 2020

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

cover Enable kernel 5.4

This contains the changes needed to build and run most of Xenomai against kernel 5.4 on x86. Other archs still need porting. Furthermore, we still need to adjust RTnet and Analogy to some kernel changes.

Jan

CC Fino Meng <[email protected]>

Fino Meng (2):
cobalt/kernel: adapt adjtime syscall with upstream kernel cobalt/kernel: fix compile error for incompatible pointer type

Jan Kiszka (9):
cobalt/x86: Account for FPU changes in kernel 5.2 drivers/ipc: Account for renaming of SO_RCVTIMEO/SO_SNDTIMEO driver/net: Update to kernel 5.4
wrappers: Add mmiowb stub for kernels >= 5.2 drivers/analogy: Fix unintended fallthrough drivers/e1000: Fix unintended fallthrough cobalt/posix: Address -Wimplicit-fallthrough testsuite/switchtest: Fix help output
ci: Add x86 5.4 kernel to CI

 .gitlab-ci.yml                                |  8 ++++
 include/cobalt/kernel/compat.h                |  4 +-
 include/cobalt/kernel/stat.h                  |  4 +-
 kernel/cobalt/arch/x86/thread.c               | 46 +++++++++++++++++++
 .../include/asm-generic/xenomai/wrappers.h    | 10 ++++
 kernel/cobalt/posix/compat.c                  |  6 +--
 kernel/cobalt/posix/sched.c                   |  5 +-
 kernel/cobalt/posix/signal.c                  |  2 +-
 kernel/cobalt/posix/signal.h                  |  2 +-
 kernel/cobalt/posix/syscall32.c               |  2 +-
 kernel/cobalt/posix/syscall32.h               |  2 +-
 .../analogy/national_instruments/tio_common.c |  1 +
 kernel/drivers/can/rtcan_raw_dev.c            |  2 +-
 kernel/drivers/can/sja1000/rtcan_peak_pci.c   |  5 ++
 kernel/drivers/ipc/bufp.c                     |  9 ++--
 kernel/drivers/ipc/iddp.c                     |  9 ++--
 kernel/drivers/ipc/xddp.c                     |  5 +-
 kernel/drivers/net/drivers/e1000/e1000_hw.c   |  4 +-
 kernel/drivers/net/drivers/e1000/e1000_main.c |  1 +
 kernel/drivers/net/drivers/e1000e/e1000.h     |  1 -
 kernel/drivers/net/drivers/e1000e/netdev.c    |  4 ++
 kernel/drivers/net/drivers/igb/e1000_82575.c  |  4 +-
 kernel/drivers/net/drivers/igb/e1000_phy.c    |  1 +
 kernel/drivers/net/drivers/igb/igb_main.c     |  2 +-
 kernel/drivers/net/drivers/r8169.c            |  5 +-
 kernel/drivers/net/stack/ipv4/tcp/tcp.c       |  2 +-
 kernel/drivers/net/stack/ipv4/udp/udp.c       |  1 +
 kernel/drivers/net/stack/packet/af_packet.c   |  1 +
 testsuite/switchtest/switchtest.c             |  5 ++
 29 files changed, 124 insertions(+), 29 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 1/11 cobalt/kernel: adapt adjtime syscall with upstream kernel

From: Fino Meng <[email protected]>

compat_timex related definitions moved from compat code into normal timekeeping code. see 4d5f007e in upstream Linux kernel.

[Jan: account for older kernel versions]
---
 include/cobalt/kernel/compat.h                       | 4 ++--
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 4 ++++
 kernel/cobalt/posix/compat.c                         | 4 ++--
 kernel/cobalt/posix/syscall32.c                      | 2 +-
 kernel/cobalt/posix/syscall32.h                      | 2 +-
 5 files changed, 10 insertions(+), 6 deletions(-)
include/cobalt/kernel/compat.h +2 -2
index 05754cba89..c9cb84f721 100644
@@ -105,9 +105,9 @@ int sys32_put_timeval(struct compat_timeval __user *ctv,
 		      const struct timeval *tv);
 
 int sys32_get_timex(struct timex *tx,
-		    const struct compat_timex __user *ctx);
+		    const struct old_timex32 __user *ctx);
 
-int sys32_put_timex(struct compat_timex __user *ctx,
+int sys32_put_timex(struct old_timex32 __user *ctx,
 		    const struct timex *tx);
 
 ssize_t sys32_get_fdset(fd_set *fds, const compat_fd_set __user *cfds,
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +4 -0
index 23993dcc15..de5a992850 100644
@@ -156,4 +156,8 @@ devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
 #error "Xenomai/cobalt requires Linux kernel 3.10 or above"
 #endif /* < 3.10 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
+#define old_timex32		compat_timex
+#endif
+
 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */
kernel/cobalt/posix/compat.c +2 -2
index 17968bff1d..a31ec04578 100644
@@ -81,7 +81,7 @@ int sys32_put_timeval(struct compat_timeval __user *ctv,
 EXPORT_SYMBOL_GPL(sys32_put_timeval);
 
 int sys32_get_timex(struct timex *tx,
-		    const struct compat_timex __user *ctx)
+		    const struct old_timex32 __user *ctx)
 {
 	memset(tx, 0, sizeof(*tx));
 
@@ -112,7 +112,7 @@ int sys32_get_timex(struct timex *tx,
 }
 EXPORT_SYMBOL_GPL(sys32_get_timex);
 
-int sys32_put_timex(struct compat_timex __user *ctx,
+int sys32_put_timex(struct old_timex32 __user *ctx,
 		    const struct timex *tx)
 {
 	if (!access_wok(ctx, sizeof(*ctx)) ||
kernel/cobalt/posix/syscall32.c +1 -1
index faa7ef53a6..c2fd6a1e05 100644
@@ -172,7 +172,7 @@ COBALT_SYSCALL32emu(clock_settime, current,
 }
 
 COBALT_SYSCALL32emu(clock_adjtime, current,
-		    (clockid_t clock_id, struct compat_timex __user *u_tx))
+		    (clockid_t clock_id, struct old_timex32 __user *u_tx))
 {
 	struct timex tx;
 	int ret;
kernel/cobalt/posix/syscall32.h +1 -1
index 34904f96bd..eb3e4bd300 100644
@@ -65,7 +65,7 @@ COBALT_SYSCALL32emu_DECL(clock_settime,
 
 COBALT_SYSCALL32emu_DECL(clock_adjtime,
 			 (clockid_t clock_id,
-			  struct compat_timex __user *u_tx));
+			  struct old_timex32 __user *u_tx));
 
 COBALT_SYSCALL32emu_DECL(clock_nanosleep,
 			 (clockid_t clock_id, int flags,
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 01/11] cobalt/kernel: adapt adjtime syscall with upstream kernel

Quoted 87 lines · Jan Kiszka via Xenomai

From: Fino Meng <[email protected]>

compat_timex related definitions moved from compat code into normal timekeeping code. see 4d5f007e in upstream Linux kernel.

[Jan: account for older kernel versions]
---
  include/cobalt/kernel/compat.h                       | 4 ++--
  kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 4 ++++
  kernel/cobalt/posix/compat.c                         | 4 ++--
  kernel/cobalt/posix/syscall32.c                      | 2 +-
  kernel/cobalt/posix/syscall32.h                      | 2 +-
  5 files changed, 10 insertions(+), 6 deletions(-)
include/cobalt/kernel/compat.h +2 -2
index 05754cba89..c9cb84f721 100644
@@ -105,9 +105,9 @@ int sys32_put_timeval(struct compat_timeval __user *ctv,
  		      const struct timeval *tv);
 
  int sys32_get_timex(struct timex *tx,
-		    const struct compat_timex __user *ctx);
+		    const struct old_timex32 __user *ctx);
 
-int sys32_put_timex(struct compat_timex __user *ctx,
+int sys32_put_timex(struct old_timex32 __user *ctx,
  		    const struct timex *tx);
 
  ssize_t sys32_get_fdset(fd_set *fds, const compat_fd_set __user *cfds,
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +4 -0
index 23993dcc15..de5a992850 100644
@@ -156,4 +156,8 @@ devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
  #error "Xenomai/cobalt requires Linux kernel 3.10 or above"
  #endif /* < 3.10 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
+#define old_timex32		compat_timex
+#endif
+
  #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */
kernel/cobalt/posix/compat.c +2 -2
index 17968bff1d..a31ec04578 100644
@@ -81,7 +81,7 @@ int sys32_put_timeval(struct compat_timeval __user *ctv,
  EXPORT_SYMBOL_GPL(sys32_put_timeval);
 
  int sys32_get_timex(struct timex *tx,
-		    const struct compat_timex __user *ctx)
+		    const struct old_timex32 __user *ctx)
  {
  	memset(tx, 0, sizeof(*tx));
 
@@ -112,7 +112,7 @@ int sys32_get_timex(struct timex *tx,
  }
  EXPORT_SYMBOL_GPL(sys32_get_timex);
 
-int sys32_put_timex(struct compat_timex __user *ctx,
+int sys32_put_timex(struct old_timex32 __user *ctx,
  		    const struct timex *tx)
  {
  	if (!access_wok(ctx, sizeof(*ctx)) ||
kernel/cobalt/posix/syscall32.c +1 -1
index faa7ef53a6..c2fd6a1e05 100644
@@ -172,7 +172,7 @@ COBALT_SYSCALL32emu(clock_settime, current,
  }
 
  COBALT_SYSCALL32emu(clock_adjtime, current,
-		    (clockid_t clock_id, struct compat_timex __user *u_tx))
+		    (clockid_t clock_id, struct old_timex32 __user *u_tx))
  {
  	struct timex tx;
  	int ret;
kernel/cobalt/posix/syscall32.h +0 -0
index 34904f96bd..eb3e4bd300 100644

kernel/cobalt/posix/syscall32.h COBALT_SYSCALL32emu_DECL(clock_settime, · line 71

Quoted 8 lines
kernel/cobalt/posix/syscall32.h +1 -1
@@ -65,7 +65,7 @@ COBALT_SYSCALL32emu_DECL(clock_settime,
 
  COBALT_SYSCALL32emu_DECL(clock_adjtime,
  			 (clockid_t clock_id,
-			  struct compat_timex __user *u_tx));
+			  struct old_timex32 __user *u_tx));
 
  COBALT_SYSCALL32emu_DECL(clock_nanosleep,
  			 (clockid_t clock_id, int flags,

After 5.4 is ready, i will try to verify it on arm, meanwhile, i also need to have a look how musl works for xenomai.

chensong

author
#3 lore raw

PATCH 2/11 cobalt/kernel: fix compile error for incompatible pointer type

In reply to Jan Kiszka

From: Fino Meng <[email protected]>

---
 include/cobalt/kernel/stat.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/cobalt/kernel/stat.h +3 -1
index b857cd19f3..d252e1429f 100644
@@ -58,7 +58,9 @@ do { \
 #define xnstat_exectime_set_current(sched, new_account) \
 ({ \
 	xnstat_exectime_t *__prev; \
-	__prev = (xnstat_exectime_t *)atomic_long_xchg(&(sched)->current_account, (long)(new_account)); \
+	__prev = (xnstat_exectime_t *) \
+		atomic_long_xchg((atomic_long_t *)&(sched)->current_account, \
+				 (long)(new_account)); \
 	__prev; \
 })
 
Signature · 1 line
2.26.2
author
#4 lore raw

PATCH 3/11 cobalt/x86: Account for FPU changes in kernel 5.2

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Since that version, the FPU is only updated when returning to userspace. This breaks the thread switching expectations of Xenomai because there is no update happening when returning to a thread in primary mode or when switching in a primary-mode kernel thread.

Account for that by
- saving the context when switching out an in-kernel Xenomai thread
- restoring the context after switching in a Xenomai thread
- invalidate the FPU state variables after returning to a preempted Linux kernel thread that uses the FPU

---
 kernel/cobalt/arch/x86/thread.c | 46 +++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
kernel/cobalt/arch/x86/thread.c +46 -0
index ba807ac1ed..1ed6acb46b 100644
@@ -215,6 +215,21 @@ void xnarch_switch_to(struct xnthread *out, struct xnthread *in)
 		 */
 		clts();
 #endif /* ! IPIPE_X86_FPU_EAGER */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+	if (!xnthread_test_state(out, XNROOT | XNUSER) &&
+	    !test_thread_flag(TIF_NEED_FPU_LOAD)) {
+		/*
+		 * This compensates that switch_fpu_prepare ignores kernel
+		 * threads.
+		 */
+		struct fpu *prev_fpu = &prev->thread.fpu;
+
+		if (!copy_fpregs_to_fpstate(prev_fpu))
+			prev_fpu->last_cpu = -1;
+		else
+			prev_fpu->last_cpu = smp_processor_id();
+	}
+#endif
 
 	next = in_tcb->core.host_task;
 #ifndef IPIPE_X86_FPU_EAGER
@@ -260,6 +275,29 @@ void xnarch_switch_to(struct xnthread *out, struct xnthread *in)
 #ifndef IPIPE_X86_FPU_EAGER
 	stts();
 #endif /* ! IPIPE_X86_FPU_EAGER */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+	/* 
+	 * Refresh 'in', we switch the stacks. However, there might be no
+	 * current thread at this point.
+	 */
+	in = xnthread_current();
+	if (in && !xnthread_test_state(in, XNROOT) &&
+	    test_thread_flag(TIF_NEED_FPU_LOAD)) {
+		/*
+		 * This is open-coded switch_fpu_return but without a test for
+		 * PF_KTHREAD, i.e including kernel threads.
+		 */
+		struct fpu *fpu = &current->thread.fpu;
+		int cpu = smp_processor_id();
+
+		if (!fpregs_state_valid(fpu, cpu)) {
+			copy_kernel_to_fpregs(&fpu->state);
+			fpregs_activate(fpu);
+			fpu->last_cpu = cpu;
+		}
+		clear_thread_flag(TIF_NEED_FPU_LOAD);
+	}
+#endif
 }
 
 #ifndef IPIPE_X86_FPU_EAGER
@@ -472,7 +510,11 @@ void xnarch_leave_root(struct xnthread *root)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
 	/* restore current's fpregs */
 	__cpu_invalidate_fpregs_state();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+	switch_fpu_finish(&current->thread.fpu);
+#else
 	switch_fpu_finish(&current->thread.fpu, smp_processor_id());
+#endif
 #else
 	/* mark current thread as not owning the FPU anymore */
 	if (fpregs_active())
@@ -488,6 +530,10 @@ void xnarch_switch_fpu(struct xnthread *from, struct xnthread *to)
 		return;
 
 	copy_kernel_to_fpregs(&to_tcb->kfpu->state);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+	/* redo the invalidation done by kernel_fpu_begin */
+	__cpu_invalidate_fpregs_state();
+#endif
 	kernel_fpu_disable();
 }
 #endif /* ! IPIPE_X86_FPU_EAGER */
Signature · 1 line
2.26.2
author
#5 lore raw

PATCH 4/11 drivers/ipc: Account for renaming of SO_RCVTIMEO/SO_SNDTIMEO

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Use the *_OLD defines for the 2038-wise unconverted socket options.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 2 ++
 kernel/drivers/ipc/bufp.c                            | 8 ++++----
 kernel/drivers/ipc/iddp.c                            | 8 ++++----
 kernel/drivers/ipc/xddp.c                            | 4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +2 -0
index de5a992850..b910138395 100644
@@ -158,6 +158,8 @@ devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
 #define old_timex32		compat_timex
+#define SO_RCVTIMEO_OLD		SO_RCVTIMEO
+#define SO_SNDTIMEO_OLD		SO_SNDTIMEO
 #endif
 
 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */
kernel/drivers/ipc/bufp.c +4 -4
index 45c917eb07..9410973f2c 100644
@@ -830,14 +830,14 @@ static int __bufp_setsockopt(struct bufp_socket *sk,
 	if (sopt.level == SOL_SOCKET) {
 		switch (sopt.optname) {
 
-		case SO_RCVTIMEO:
+		case SO_RCVTIMEO_OLD:
 			ret = rtipc_get_timeval(fd, &tv, sopt.optval, sopt.optlen);
 			if (ret)
 				return ret;
 			sk->rx_timeout = rtipc_timeval_to_ns(&tv);
 			break;
 
-		case SO_SNDTIMEO:
+		case SO_SNDTIMEO_OLD:
 			ret = rtipc_get_timeval(fd, &tv, sopt.optval, sopt.optlen);
 			if (ret)
 				return ret;
@@ -922,14 +922,14 @@ static int __bufp_getsockopt(struct bufp_socket *sk,
 	if (sopt.level == SOL_SOCKET) {
 		switch (sopt.optname) {
 
-		case SO_RCVTIMEO:
+		case SO_RCVTIMEO_OLD:
 			rtipc_ns_to_timeval(&tv, sk->rx_timeout);
 			ret = rtipc_put_timeval(fd, sopt.optval, &tv, len);
 			if (ret)
 				return ret;
 			break;
 
-		case SO_SNDTIMEO:
+		case SO_SNDTIMEO_OLD:
 			rtipc_ns_to_timeval(&tv, sk->tx_timeout);
 			ret = rtipc_put_timeval(fd, sopt.optval, &tv, len);
 			if (ret)
kernel/drivers/ipc/iddp.c +4 -4
index 2a80eba65a..5bb2b85337 100644
@@ -712,14 +712,14 @@ static int __iddp_setsockopt(struct iddp_socket *sk,
 	if (sopt.level == SOL_SOCKET) {
 		switch (sopt.optname) {
 
-		case SO_RCVTIMEO:
+		case SO_RCVTIMEO_OLD:
 			ret = rtipc_get_timeval(fd, &tv, sopt.optval, sopt.optlen);
 			if (ret)
 				return ret;
 			sk->rx_timeout = rtipc_timeval_to_ns(&tv);
 			break;
 
-		case SO_SNDTIMEO:
+		case SO_SNDTIMEO_OLD:
 			ret = rtipc_get_timeval(fd, &tv, sopt.optval, sopt.optlen);
 			if (ret)
 				return ret;
@@ -805,14 +805,14 @@ static int __iddp_getsockopt(struct iddp_socket *sk,
 	if (sopt.level == SOL_SOCKET) {
 		switch (sopt.optname) {
 
-		case SO_RCVTIMEO:
+		case SO_RCVTIMEO_OLD:
 			rtipc_ns_to_timeval(&tv, sk->rx_timeout);
 			ret = rtipc_put_timeval(fd, sopt.optval, &tv, len);
 			if (ret)
 				return ret;
 			break;
 
-		case SO_SNDTIMEO:
+		case SO_SNDTIMEO_OLD:
 			rtipc_ns_to_timeval(&tv, sk->tx_timeout);
 			ret = rtipc_put_timeval(fd, sopt.optval, &tv, len);
 			if (ret)
kernel/drivers/ipc/xddp.c +2 -2
index 57275d0c60..2bf26fcaa8 100644
@@ -867,7 +867,7 @@ static int __xddp_setsockopt(struct xddp_socket *sk,
 	if (sopt.level == SOL_SOCKET) {
 		switch (sopt.optname) {
 
-		case SO_RCVTIMEO:
+		case SO_RCVTIMEO_OLD:
 			ret = rtipc_get_timeval(fd, &tv, sopt.optval, sopt.optlen);
 			if (ret)
 				return ret;
@@ -976,7 +976,7 @@ static int __xddp_getsockopt(struct xddp_socket *sk,
 	if (sopt.level == SOL_SOCKET) {
 		switch (sopt.optname) {
 
-		case SO_RCVTIMEO:
+		case SO_RCVTIMEO_OLD:
 			rtipc_ns_to_timeval(&tv, sk->timeout);
 			ret = rtipc_put_timeval(fd, sopt.optval, &tv, len);
 			if (ret)
Signature · 1 line
2.26.2
author
#6 lore raw

PATCH 5/11 driver/net: Update to kernel 5.4

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

linux/pci-aspm.h has been folded into linux/pci.h in that version. Account for that in drivers that actually need it.

Furthermore, our implementation of SO_SNDTIMEO is now SO_SNDTIMEO_OLD until 2038 has been addressed.

---
 kernel/drivers/net/drivers/e1000e/e1000.h  | 1 -
 kernel/drivers/net/drivers/e1000e/netdev.c | 4 ++++
 kernel/drivers/net/drivers/igb/igb_main.c  | 1 -
 kernel/drivers/net/drivers/r8169.c         | 5 ++++-
 kernel/drivers/net/stack/ipv4/tcp/tcp.c    | 2 +-
 5 files changed, 9 insertions(+), 4 deletions(-)
kernel/drivers/net/drivers/e1000e/e1000.h +0 -1
index 2de681422f..7454c6350a 100644
@@ -38,7 +38,6 @@
 #include <linux/io.h>
 #include <linux/netdevice.h>
 #include <linux/pci.h>
-#include <linux/pci-aspm.h>
 #include <linux/crc32.h>
 #include <linux/if_vlan.h>
 
kernel/drivers/net/drivers/e1000e/netdev.c +4 -0
index baeb6aa09d..5beaf2b552 100644
@@ -53,6 +53,10 @@
 #include <linux/aer.h>
 #include <linux/prefetch.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
+#include <linux/pci-aspm.h>
+#endif
+
 #include "e1000.h"
 
 #define RT_E1000E_NUM_RXD	64
kernel/drivers/net/drivers/igb/igb_main.c +0 -1
index 2c9d51e7f2..37d891a620 100644
@@ -42,7 +42,6 @@
 #include <linux/if.h>
 #include <linux/if_vlan.h>
 #include <linux/pci.h>
-#include <linux/pci-aspm.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/ip.h>
kernel/drivers/net/drivers/r8169.c +4 -1
index 619ecc0434..6255fcb3f2 100644
@@ -69,7 +69,6 @@ RTL8169_VERSION "2.2"	<2004/08/09>
  */
 
 #include <linux/module.h>
-#include <linux/pci-aspm.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -79,6 +78,10 @@ RTL8169_VERSION "2.2"	<2004/08/09>
 #include <linux/timer.h>
 #include <linux/init.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
+#include <linux/pci-aspm.h>
+#endif
+
 #include <rtnet_port.h>	/*** RTnet ***/
 
 #define RTL8169_VERSION "2.2-04"
kernel/drivers/net/stack/ipv4/tcp/tcp.c +1 -1
index b8263e5d23..8fef3ae5b5 100644
@@ -1762,7 +1762,7 @@ static int rt_tcp_setsockopt(struct rtdm_fd *fd, struct tcp_socket *ts,
 	    */
 		return 0;
 
-	case SO_SNDTIMEO:
+	case SO_SNDTIMEO_OLD:
 		if (optlen < sizeof(tv))
 			return -EINVAL;
 		if (rtdm_copy_from_user(fd, &tv, optval, sizeof(tv)))
Signature · 1 line
2.26.2
author
#7 lore raw

PATCH 6/11 wrappers: Add mmiowb stub for kernels >= 5.2

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

This was folded into spin_unlock, thus obsoleted. Keep it for older kernels.

---
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 4 ++++
 1 file changed, 4 insertions(+)
kernel/cobalt/include/asm-generic/xenomai/wrappers.h +4 -0
index b910138395..e266d5acf8 100644
@@ -162,4 +162,8 @@ devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
 #define SO_SNDTIMEO_OLD		SO_SNDTIMEO
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+#define mmiowb()		do { } while (0)
+#endif
+
 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */
Signature · 1 line
2.26.2
author
#8 lore raw

PATCH 7/11 drivers/analogy: Fix unintended fallthrough

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Apparently not desired but likely harmless.

---
 kernel/drivers/analogy/national_instruments/tio_common.c | 1 +
 1 file changed, 1 insertion(+)
kernel/drivers/analogy/national_instruments/tio_common.c +1 -0
index feb6f41ca6..bcce728eb5 100644
@@ -1666,6 +1666,7 @@ static int ni_tio_input_cmd(struct ni_gpct *counter, struct a4l_cmd_desc *cmd)
 	case TRIG_EXT:
 		a4l_mite_dma_arm(counter->mite_chan);
 		retval = ni_tio_arm(counter, 1, cmd->start_arg);
+		break;
 	case TRIG_OTHER:
 		a4l_mite_dma_arm(counter->mite_chan);
 		break;
Signature · 1 line
2.26.2
author
#9 lore raw

PATCH 8/11 drivers/e1000: Fix unintended fallthrough

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Not desired here according ancient git logs.

---
 kernel/drivers/net/drivers/e1000/e1000_main.c | 1 +
 1 file changed, 1 insertion(+)
kernel/drivers/net/drivers/e1000/e1000_main.c +1 -0
index 329c69c7b8..3df35e033c 100644
@@ -396,6 +396,7 @@ e1000_release_hw_control(struct e1000_adapter *adapter)
 		swsm = E1000_READ_REG(&adapter->hw, SWSM);
 		E1000_WRITE_REG(&adapter->hw, SWSM,
 				swsm & ~E1000_SWSM_DRV_LOAD);
+		break;
 	case e1000_ich8lan:
 		extcnf = E1000_READ_REG(&adapter->hw, CTRL_EXT);
 		E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
Signature · 1 line
2.26.2
author
#10 lore raw

PATCH 9/11 cobalt/posix: Address -Wimplicit-fallthrough

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

A compatible keyword is "fallthrough", use that and add it one missing spot in cobalt_sched_policy_param. Doesn't make all gcc versions happy yet, but that's a compiler issue. At least gcc-9 is fine.

---
 kernel/cobalt/posix/compat.c                 | 2 +-
 kernel/cobalt/posix/sched.c                  | 5 +++--
 kernel/cobalt/posix/signal.c                 | 2 +-
 kernel/cobalt/posix/signal.h                 | 2 +-
 kernel/drivers/can/rtcan_raw_dev.c           | 2 +-
 kernel/drivers/can/sja1000/rtcan_peak_pci.c  | 5 +++++
 kernel/drivers/ipc/bufp.c                    | 1 +
 kernel/drivers/ipc/iddp.c                    | 1 +
 kernel/drivers/ipc/xddp.c                    | 1 +
 kernel/drivers/net/drivers/e1000/e1000_hw.c  | 4 +++-
 kernel/drivers/net/drivers/igb/e1000_82575.c | 4 +++-
 kernel/drivers/net/drivers/igb/e1000_phy.c   | 1 +
 kernel/drivers/net/drivers/igb/igb_main.c    | 1 +
 kernel/drivers/net/stack/ipv4/udp/udp.c      | 1 +
 kernel/drivers/net/stack/packet/af_packet.c  | 1 +
 15 files changed, 25 insertions(+), 8 deletions(-)
kernel/cobalt/posix/compat.c +1 -1
index a31ec04578..e53e72e0cd 100644
@@ -392,7 +392,7 @@ int sys32_put_siginfo(void __user *u_si, const struct siginfo *si,
 	case SI_QUEUE:
 	case SI_MESGQ:
 		ret |= __xn_put_user(ptr_to_compat(si->si_ptr), &u_p->si_ptr);
-		/* falldown wanted. */
+		/* fallthrough */
 	case SI_USER:
 		ret |= __xn_put_user(si->si_pid, &u_p->si_pid);
 		ret |= __xn_put_user(si->si_uid, &u_p->si_uid);
kernel/cobalt/posix/sched.c +3 -2
index 7e457a9a8c..798a172d7f 100644
@@ -58,6 +58,7 @@ cobalt_sched_policy_param(union xnsched_policy_param *param,
 		 * levels. Otherwise, SCHED_NORMAL is scheduled by
 		 * xnsched_class_rt at priority level #0.
 		 */
+		/* fallthrough */
 	case SCHED_WEAK:
 #ifdef CONFIG_XENO_OPT_SCHED_WEAK
 		if (prio < XNSCHED_WEAK_MIN_PRIO ||
@@ -75,7 +76,7 @@ cobalt_sched_policy_param(union xnsched_policy_param *param,
 		tslice = ts2ns(&param_ex->sched_rr_quantum);
 		if (tslice == XN_INFINITE && tslice_r)
 			tslice = *tslice_r;
-		/* falldown wanted */
+		/* fallthrough */
 	case SCHED_FIFO:
 		if (prio < XNSCHED_FIFO_MIN_PRIO ||
 		    prio > XNSCHED_FIFO_MAX_PRIO)
@@ -248,7 +249,7 @@ int set_tp_config(int cpu, union sched_config *config, size_t len)
 	case sched_tp_install:
 		if (config->tp.nr_windows > 0)
 			break;
-		/* Fallback wanted. */
+		/* fallthrough */
 	case sched_tp_uninstall:
 		gps = NULL;
 		goto set_schedule;
kernel/cobalt/posix/signal.c +1 -1
index e75ce2b693..75514d84fd 100644
@@ -234,7 +234,7 @@ static int signal_put_siginfo(void __user *u_si, const struct siginfo *si,
 	case SI_QUEUE:
 	case SI_MESGQ:
 		ret |= __xn_put_user(si->si_ptr, &u_p->si_ptr);
-		/* falldown wanted. */
+		/* fallthrough */
 	case SI_USER:
 		ret |= __xn_put_user(si->si_pid, &u_p->si_pid);
 		ret |= __xn_put_user(si->si_uid, &u_p->si_uid);
kernel/cobalt/posix/signal.h +1 -1
index a4edc094f8..e506842e71 100644
@@ -49,7 +49,7 @@ void cobalt_copy_siginfo(int code,
 	case SI_QUEUE:
 	case SI_MESGQ:
 		dst->si_value = src->si_value;
-		/* falldown wanted. */
+		/* fallthrough */
 	case SI_USER:
 		dst->si_pid = src->si_pid;
 		dst->si_uid = src->si_uid;
kernel/drivers/can/rtcan_raw_dev.c +1 -1
index 0f4f52fa28..c72c3ced51 100644
@@ -374,7 +374,7 @@ int rtcan_raw_ioctl_dev(struct rtdm_fd *fd, int request, void *arg)
     case SIOCGCANBAUDRATE:
     case SIOCGCANCUSTOMBITTIME:
 	    get = 1;
-	    /* Falldown wanted. */
+	    /* fallthrough */
     case SIOCSCANMODE:
     case SIOCSCANCTRLMODE:
     case SIOCSCANBAUDRATE:
kernel/drivers/can/sja1000/rtcan_peak_pci.c +5 -0
index 50f573ee6d..bc6439b8fe 100644
@@ -142,6 +142,7 @@ static void rtcan_peak_pci_del_chan(struct rtcan_device *dev,
 	printk("Removing %s %s device %s\n",
 	       peak_pci_board_name, dev->ctrl_name, dev->name);
 	rtcan_sja1000_unregister(dev);
+	/* fallthrough */
     case 5:
 	pita_icr_high = readw(board->conf_addr + PITA_ICR + 2);
 	if (board->channel == CHANNEL_SLAVE) {
@@ -150,13 +151,17 @@ static void rtcan_peak_pci_del_chan(struct rtcan_device *dev,
 	    pita_icr_high &= ~0x0002;
 	}
 	writew(pita_icr_high, board->conf_addr + PITA_ICR + 2);
+	/* fallthrough */
     case 4:
 	iounmap((void *)board->base_addr);
+	/* fallthrough */
     case 3:
 	if (board->channel != CHANNEL_SLAVE)
 	    iounmap((void *)board->conf_addr);
+	/* fallthrough */
     case 2:
 	rtcan_dev_free(dev);
+	/* fallthrough */
     case 1:
 	break;
     }
kernel/drivers/ipc/bufp.c +1 -0
index 9410973f2c..d45480f94d 100644
@@ -1032,6 +1032,7 @@ static int bufp_ioctl(struct rtdm_fd *fd,
 	COMPAT_CASE(_RTIOC_BIND):
 		if (rtdm_in_rt_context())
 			return -ENOSYS;	/* Try downgrading to NRT */
+		/* fallthrough */
 	default:
 		ret = __bufp_ioctl(fd, request, arg);
 	}
kernel/drivers/ipc/iddp.c +1 -0
index 5bb2b85337..f31b9bb661 100644
@@ -915,6 +915,7 @@ static int iddp_ioctl(struct rtdm_fd *fd,
 	COMPAT_CASE(_RTIOC_BIND):
 		if (rtdm_in_rt_context())
 			return -ENOSYS;	/* Try downgrading to NRT */
+		/* fallthrough */
 	default:
 		ret = __iddp_ioctl(fd, request, arg);
 	}
kernel/drivers/ipc/xddp.c +1 -0
index 2bf26fcaa8..c9236a229a 100644
@@ -1078,6 +1078,7 @@ static int xddp_ioctl(struct rtdm_fd *fd,
 	COMPAT_CASE(_RTIOC_BIND):
 		if (rtdm_in_rt_context())
 			return -ENOSYS;	/* Try downgrading to NRT */
+		/* fallthrough */
 	default:
 		ret = __xddp_ioctl(fd, request, arg);
 	}
kernel/drivers/net/drivers/e1000/e1000_hw.c +3 -1
index d97465336c..9c57215373 100644
@@ -126,6 +126,7 @@ e1000_set_phy_type(struct e1000_hw *hw)
             hw->phy_type = e1000_phy_igp;
             break;
         }
+        /* fallthrough */
     case IGP03E1000_E_PHY_ID:
         hw->phy_type = e1000_phy_igp_3;
         break;
@@ -139,7 +140,7 @@ e1000_set_phy_type(struct e1000_hw *hw)
             hw->phy_type = e1000_phy_gg82563;
             break;
         }
-        /* Fall Through */
+        /* fallthrough */
     default:
         /* Should never have loaded on this device */
         hw->phy_type = e1000_phy_undefined;
@@ -5869,6 +5870,7 @@ e1000_rar_set(struct e1000_hw *hw,
     case e1000_80003es2lan:
         if (hw->leave_av_bit_off == TRUE)
             break;
+        /* fallthrough */
     default:
         /* Indicate to hardware the Address is Valid. */
         rar_high |= E1000_RAH_AV;
kernel/drivers/net/drivers/igb/e1000_82575.c +3 -1
index 3b3c01b47f..45bd52a9e2 100644
@@ -607,7 +607,8 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
 			dev_spec->sgmii_active = true;
 			break;
 		}
-		/* fall through for I2C based SGMII */
+		/* for I2C based SGMII: */
+		/* fallthrough */
 	case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES:
 		/* read media type from SFP EEPROM */
 		ret_val = igb_set_sfp_media_type_82575(hw);
@@ -1669,6 +1670,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
 	case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX:
 		/* disable PCS autoneg and support parallel detect only */
 		pcs_autoneg = false;
+		/* fallthrough */
 	default:
 		if (hw->mac.type == e1000_82575 ||
 		    hw->mac.type == e1000_82576) {
kernel/drivers/net/drivers/igb/e1000_phy.c +1 -0
index 4b0c432797..41f3afcd50 100644
@@ -682,6 +682,7 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw)
 			phy_data |= M88E1000_PSCR_AUTO_X_1000T;
 			break;
 		}
+		/* fallthrough */
 	case 0:
 	default:
 		phy_data |= M88E1000_PSCR_AUTO_X_MODE;
kernel/drivers/net/drivers/igb/igb_main.c +1 -0
index 37d891a620..01960a6c26 100644
@@ -3550,6 +3550,7 @@ bool igb_has_link(struct igb_adapter *adapter)
 	case e1000_media_type_copper:
 		if (!hw->mac.get_link_status)
 			return true;
+		/* fallthrough */
 	case e1000_media_type_internal_serdes:
 		hw->mac.ops.check_for_link(hw);
 		link_active = !hw->mac.get_link_status;
kernel/drivers/net/stack/ipv4/udp/udp.c +1 -0
index c26b4bd813..407354f4bf 100644
@@ -427,6 +427,7 @@ ssize_t rt_udp_recvmsg(struct rtdm_fd *fd, struct user_msghdr *u_msg,
 		switch (ret) {
 		default:
 			ret = -EBADF; /* socket has been closed */
+			/* fallthrough */
 		case -EWOULDBLOCK:
 		case -ETIMEDOUT:
 		case -EINTR:
kernel/drivers/net/stack/packet/af_packet.c +1 -0
index b8de8a0b6a..961b3e4019 100644
@@ -331,6 +331,7 @@ static ssize_t rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr *u_msg,
 		switch (ret) {
 		default:
 			ret = -EBADF; /* socket has been closed */
+			/* fallthrough */
 		case -EWOULDBLOCK:
 		case -ETIMEDOUT:
 		case -EINTR:
Signature · 1 line
2.26.2
author
#11 lore raw

PATCH 10/11 testsuite/switchtest: Fix help output

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

As the Xenomai libs hook into the option parser and hijack --help, we need to provide application_usage() in order to get the full help printed.

Needs eventually a better fix, i.e. the removal of the implicit parser hook.

---
 testsuite/switchtest/switchtest.c | 5 +++++
 1 file changed, 5 insertions(+)
testsuite/switchtest/switchtest.c +5 -0
index 015bde653a..f2a5c1601a 100644
@@ -1062,6 +1062,11 @@ static void usage(FILE *fd, const char *progname)
 	fprintf(fd, "\n\n");
 }
 
+void application_usage(void)
+{
+	usage(stdout, get_program_name());
+}
+
 static sigjmp_buf jump;
 
 static void illegal_instruction(int sig)
Signature · 1 line
2.26.2
author
#12 lore raw

PATCH 11/11 ci: Add x86 5.4 kernel to CI

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

---
 .gitlab-ci.yml | 8 ++++++++
 1 file changed, 8 insertions(+)
.gitlab-ci.yml +8 -0
index d76c9e25e6..87532a3376 100644
@@ -205,6 +205,14 @@ arm64-4.14-release:
     IPIPE_KERNEL: ${IPIPE_MIRROR_URL}/ipipe-arm64.git
     KERNEL_DEFCONFIG: defconfig
 
+x86-5.4-head:
+  extends: .build
+  variables:
+    ARCH: x86
+    IPIPE_REV: ipipe-x86-5.4.y
+    IPIPE_KERNEL: ${IPIPE_MIRROR_URL}/ipipe-x86.git
+    KERNEL_DEFCONFIG: x86_64_defconfig
+
 x86-4.19-cip-head:
   extends: .build
   variables:
Signature · 1 line
2.26.2