Skip to contentSkip to conversation

Support for kernel 6.1 / CI updates

PATCH New Jan Kiszka 1 participant 9 messages Nov 22, 2022

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

cover Support for kernel 6.1 / CI updates

Make sure that we can build against kernels up to (upcoming) 6.1. Furthermore, update CI accordingly and also do some chore work for it. See patches for details.

Jan

CC Gunter Grau <[email protected]>

Jan Kiszka (8):
drivers/testing/heapcheck: Replace prandom_u32 with custom
implementation
drivers/net/pcnet32: Adjust for kernel 6.1 drivers/net/freescale: Drop NAPI traces drivers/net/freescale: Convert direct dev_addr access
ci: Update latest kernels to v6.x
ci: Fold DOVETAIL_URL into PIPELINE_KERNEL
ci: Exclude master branch from builds
ci: Mark build jobs interruptible

 .gitlab-ci.yml                                | 29 +++++++------------
 kernel/drivers/net/drivers/freescale/fec.h    |  1 -
 .../drivers/net/drivers/freescale/fec_main.c  | 24 +--------------
 kernel/drivers/net/drivers/pcnet32.c          |  5 ++--
 kernel/drivers/testing/heapcheck.c            | 14 +++++++--
 5 files changed, 27 insertions(+), 46 deletions(-)
Signature · 1 line
2.35.3
author
#1 lore raw

PATCH 1/8 drivers/testing/heapcheck: Replace prandom_u32 with custom implementation

From: Jan Kiszka <[email protected]>

prandom_u32 was dropped from 6.1, but get_random_u32 is not oob-safe. So we only use it for initializing a seed and then rely on our own version of next_pseudo_random32. The latter is still available via linux/prandom.h, but given that there are no more in-tree users, it could be dropped at any point in the future.

---
 kernel/drivers/testing/heapcheck.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
kernel/drivers/testing/heapcheck.c +12 -2
index 1b97d1d024..fc6e91d3ad 100644
@@ -53,6 +53,8 @@ static struct runstats *statistics;
 
 static int nrstats;
 
+static unsigned int random_seed;
+
 static inline void breathe(int loops)
 {
 	if ((loops % 1000) == 0)
@@ -68,6 +70,12 @@ static inline void do_swap(void *left, void *right)
 	memcpy(right, trans, sizeof(struct chunk));
 }
 
+static inline unsigned int pseudo_random(void)
+{
+	random_seed = random_seed * 1664525 + 1013904223;
+	return random_seed;
+}
+
 static void random_shuffle(void *vbase, size_t nmemb)
 {
 	struct {
@@ -76,7 +84,7 @@ static void random_shuffle(void *vbase, size_t nmemb)
 	unsigned int j, k;
 
 	for (j = nmemb; j > 0; j--) {
-		k = (unsigned int)(prandom_u32() % nmemb) + 1;
+		k = (unsigned int)(pseudo_random() % nmemb) + 1;
 		if (j == k)
 			continue;
 		do_swap(&base[j - 1], &base[k - 1]);
@@ -166,6 +174,8 @@ static int test_seq(size_t heap_size, size_t block_size, int flags)
 	bool done_frag;
 	void *mem, *p;
 
+	random_seed = get_random_u32();
+
 	maxblocks = heap_size / block_size;
 
 	mem = vmalloc(heap_size);
@@ -224,7 +234,7 @@ static int test_seq(size_t heap_size, size_t block_size, int flags)
 		}
 		chunks[n].ptr = p;
 		if (flags & RTTST_HEAPCHECK_PATTERN) {
-			chunks[n].pattern = (enum pattern)(prandom_u32() % 3);
+			chunks[n].pattern = (enum pattern)(pseudo_random() % 3);
 			fill_pattern(chunks[n].ptr, block_size, chunks[n].pattern);
 		}
 		breathe(n);
Signature · 1 line
2.35.3
author
#2 lore raw

PATCH 2/8 drivers/net/pcnet32: Adjust for kernel 6.1

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Align with mainline regarding DMA mask setting to allow compilation against recent kernels up to 6.1.

---
 kernel/drivers/net/drivers/pcnet32.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/drivers/net/drivers/pcnet32.c +3 -2
index 4fd5ba0b4a..eebb66ecb5 100644
@@ -520,10 +520,11 @@ static int pcnet32_probe_pci(struct pci_dev *pdev,
 		return -ENODEV;
 	}
 
-	if (!dma_supported(&pdev->dev, PCNET32_DMA_MASK)) {
+	err = dma_set_mask(&pdev->dev, PCNET32_DMA_MASK);
+	if (err) {
 		printk(KERN_ERR PFX
 		       "architecture does not support 32bit PCI busmaster DMA\n");
-		return -ENODEV;
+		return err;
 	}
 
 	return pcnet32_probe1(ioaddr, pdev->irq, 1, pdev);
Signature · 1 line
2.35.3
author
#3 lore raw

PATCH 3/8 drivers/net/freescale: Drop NAPI traces

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

This is an RTnet driver, so it has no need to interact with NAPI as the kernel provides. Cleaning up also fixes building over 6.1.

---
 kernel/drivers/net/drivers/freescale/fec.h    |  1 -
 .../drivers/net/drivers/freescale/fec_main.c  | 22 -------------------
 2 files changed, 23 deletions(-)
kernel/drivers/net/drivers/freescale/fec.h +0 -1
index 002085a373..0e25662967 100644
@@ -571,7 +571,6 @@ struct fec_enet_private {
 	int	wol_flag;
 	u32	quirks;
 
-	struct	napi_struct napi;
 	int	csum_flags;
 
 	struct work_struct tx_timeout_work;
kernel/drivers/net/drivers/freescale/fec_main.c +0 -22
index 0080505397..21d98e44df 100644
@@ -1227,25 +1227,6 @@ fec_rt_interrupt(rtdm_irq_t *irqh)
 	return ret;
 }
 
-static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
-{
-	struct net_device *ndev = napi->dev;
-	struct fec_enet_private *fep = netdev_priv(ndev);
-	int done = 0;
-
-	do {
-		done += fec_enet_rx(ndev, budget - done);
-		fec_enet_tx(ndev);
-	} while ((done < budget) && fec_enet_collect_events(fep));
-
-	if (done < budget) {
-		napi_complete_done(napi, done);
-		writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
-	}
-
-	return done;
-}
-
 /* ------------------------------------------------------------------------- */
 static void fec_get_mac(struct net_device *ndev)
 {
@@ -2661,7 +2642,6 @@ __fec_enet_open(struct net_device *ndev)
 	if (fep->quirks & FEC_QUIRK_ERR006687)
 		imx6q_cpuidle_fec_irqs_used();
 
-	napi_enable(&fep->napi);
 	phy_start(ndev->phydev);
 	netif_tx_start_all_queues(ndev);
 
@@ -2712,7 +2692,6 @@ fec_enet_close(struct net_device *ndev)
 	phy_stop(ndev->phydev);
 
 	if (netif_device_present(ndev)) {
-		napi_disable(&fep->napi);
 		netif_tx_disable(ndev);
 		fec_stop(ndev);
 	}
@@ -3045,7 +3024,6 @@ static int fec_enet_init(struct net_device *ndev)
 	ndev->ethtool_ops = &fec_enet_ethtool_ops;
 
 	writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK);
-	netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, NAPI_POLL_WEIGHT);
 
 	if (fep->quirks & FEC_QUIRK_HAS_VLAN)
 		/* enable hw VLAN support */
Signature · 1 line
2.35.3
author
#4 lore raw

PATCH 4/8 drivers/net/freescale: Convert direct dev_addr access

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

This was forgotten in 5af4f16609c1.

---
 kernel/drivers/net/drivers/freescale/fec_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/drivers/net/drivers/freescale/fec_main.c +1 -1
index 21d98e44df..5abf5e8220 100644
@@ -2798,7 +2798,7 @@ fec_set_mac_address(struct net_device *ndev, void *p)
 	if (addr) {
 		if (!is_valid_ether_addr(addr->sa_data))
 			return -EADDRNOTAVAIL;
-		memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
+		eth_hw_addr_set(ndev, addr->sa_data);
 	}
 
 	/* Add netif status check here to avoid system hang in below case:
Signature · 1 line
2.35.3
author
#5 lore raw

PATCH 5/8 ci: Update latest kernels to v6.x

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

This also gives a chance to prepare the sorting rule for the transition v6.9 -> v6.10. It was likely not even correct when it was once introduced for ipipe rules.

---
 .gitlab-ci.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
.gitlab-ci.yml +7 -7
index 03d3382117..19775fb7c4 100644
@@ -37,7 +37,7 @@ variables:
     - apt update
     - ARCH_PACKAGES="PACKAGES_${ARCH}"
     - apt install -y ${PACKAGES} ${!ARCH_PACKAGES}
-    - REV=$(git ls-remote --tags --head --refs ${PIPELINE_KERNEL} | sed -e "s/.*[[:space:]]refs\/\(tags\|heads\)\///" | grep "${PIPELINE_REV}" | sort -r -n -t - -k 5 -k 6 | head -1)
+    - REV=$(git ls-remote --tags --head --refs ${PIPELINE_KERNEL} | sed -e "s/.*[[:space:]]refs\/\(tags\|heads\)\///" | grep "${PIPELINE_REV}" | sort -r -n -k 1.4 | head -1)
     - test -n "${REV}" || REV="${PIPELINE_REV}"
     - test -n "${PIPELINE_KERNEL}" && echo "Checking out ${REV}..." && git clone --depth 1 --branch ${REV} ${PIPELINE_KERNEL} ${KDIR}
     - case "${ARCH}" in
@@ -179,11 +179,11 @@ variables:
     paths:
       - .ccache
 
-arm-5.xx-latest:
+arm-6.xx-latest:
   extends: .build
   variables:
     ARCH: arm
-    PIPELINE_REV: "v5\\.[0-9][0-9].*-dovetail-rebase"
+    PIPELINE_REV: "v6\\.[0-9].*-dovetail-rebase"
     PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: multi_v7_defconfig
 
@@ -203,11 +203,11 @@ arm-5.10-head:
     PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: multi_v7_defconfig
 
-arm64-5.xx-latest:
+arm64-6.xx-latest:
   extends: .build
   variables:
     ARCH: arm64
-    PIPELINE_REV: "v5\\.[0-9][0-9].*-dovetail-rebase"
+    PIPELINE_REV: "v6\\.[0-9].*-dovetail-rebase"
     PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: defconfig
 
@@ -227,11 +227,11 @@ arm64-5.10-head:
     PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: defconfig
 
-x86-5.xx-latest:
+x86-6.xx-latest:
   extends: .build
   variables:
     ARCH: x86
-    PIPELINE_REV: "v5\\.[0-9][0-9].*-dovetail-rebase"
+    PIPELINE_REV: "v6\\.[0-9].*-dovetail-rebase"
     PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: x86_64_defconfig
 
Signature · 1 line
2.35.3
author
#6 lore raw

PATCH 6/8 ci: Fold DOVETAIL_URL into PIPELINE_KERNEL

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Avoids having to set PIPELINE_KERNEL for every job while it is the same for them all by now.

---
 .gitlab-ci.yml | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
.gitlab-ci.yml +1 -10
index 19775fb7c4..0dd68d7571 100644
@@ -20,7 +20,7 @@ variables:
   KDIR: "/tmp/kernel"
   USE_CCACHE: "1"
   CCACHE_MAXSIZE: "1G"
-  DOVETAIL_URL: "https://source.denx.de/Xenomai/linux-dovetail.git"
+  PIPELINE_KERNEL: "https://source.denx.de/Xenomai/linux-dovetail.git"
   GCC_VERSION: "10"
   PACKAGES: "u-boot-tools git make bc bison libelf-dev autotools-dev \
              autoconf autogen libtool pkg-config ccache flex libssl-dev \
@@ -184,7 +184,6 @@ arm-6.xx-latest:
   variables:
     ARCH: arm
     PIPELINE_REV: "v6\\.[0-9].*-dovetail-rebase"
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: multi_v7_defconfig
 
 arm-5.15-head:
@@ -192,7 +191,6 @@ arm-5.15-head:
   variables:
     ARCH: arm
     PIPELINE_REV: v5.15.y-dovetail-rebase
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: multi_v7_defconfig
 
 arm-5.10-head:
@@ -200,7 +198,6 @@ arm-5.10-head:
   variables:
     ARCH: arm
     PIPELINE_REV: v5.10.y-dovetail-rebase
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: multi_v7_defconfig
 
 arm64-6.xx-latest:
@@ -208,7 +205,6 @@ arm64-6.xx-latest:
   variables:
     ARCH: arm64
     PIPELINE_REV: "v6\\.[0-9].*-dovetail-rebase"
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: defconfig
 
 arm64-5.15-head:
@@ -216,7 +212,6 @@ arm64-5.15-head:
   variables:
     ARCH: arm64
     PIPELINE_REV: v5.15.y-dovetail-rebase
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: defconfig
 
 arm64-5.10-head:
@@ -224,7 +219,6 @@ arm64-5.10-head:
   variables:
     ARCH: arm64
     PIPELINE_REV: v5.10.y-dovetail-rebase
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: defconfig
 
 x86-6.xx-latest:
@@ -232,7 +226,6 @@ x86-6.xx-latest:
   variables:
     ARCH: x86
     PIPELINE_REV: "v6\\.[0-9].*-dovetail-rebase"
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: x86_64_defconfig
 
 x86-5.15-head:
@@ -240,7 +233,6 @@ x86-5.15-head:
   variables:
     ARCH: x86
     PIPELINE_REV: v5.15.y-dovetail-rebase
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: x86_64_defconfig
 
 x86-5.10-head:
@@ -248,7 +240,6 @@ x86-5.10-head:
   variables:
     ARCH: x86
     PIPELINE_REV: v5.10.y-dovetail-rebase
-    PIPELINE_KERNEL: ${DOVETAIL_URL}
     KERNEL_DEFCONFIG: x86_64_defconfig
 
 i386-userland:
Signature · 1 line
2.35.3
author
#7 lore raw

PATCH 7/8 ci: Exclude master branch from builds

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

According to our workflow, it was always already tested via 'next'.

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.gitlab-ci.yml +2 -1
index 0dd68d7571..2b62f1a736 100644
@@ -33,6 +33,8 @@ variables:
 
 .build:
   stage: build
+  rules:
+    - if: $CI_COMMIT_BRANCH != "master"
   before_script:
     - apt update
     - ARCH_PACKAGES="PACKAGES_${ARCH}"
@@ -65,7 +67,6 @@ variables:
     - ln -s /usr/lib/ccache/${CROSS_COMPILE}gcc-${GCC_VERSION} /usr/lib/ccache/${CROSS_COMPILE}gcc
     - export PATH=/usr/lib/ccache:$PATH
     - ${CROSS_COMPILE}gcc --version
-
   script:
     - export CCACHE_DIR=$(pwd)/.ccache
     - pushd ${KDIR}
Signature · 1 line
2.35.3
author
#8 lore raw

PATCH 8/8 ci: Mark build jobs interruptible

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

That should give the auto-cancel option its desired power.

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)
.gitlab-ci.yml +1 -0
index 2b62f1a736..4d207dbd61 100644
@@ -175,6 +175,7 @@ variables:
     - ./configure --enable-smp ${CONFIGURE_OPTS}
     - make -j $(nproc)
     - ccache -s
+  interruptible: true
   cache:
     key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
     paths:
Signature · 1 line
2.35.3