Skip to contentSkip to conversation

Xen: CI changes for new toolchain baseline

PATCH RESEND Superseded Andrew Cooper 4 participants 10 messages Mar 20, 2025 – Mar 27, 2025 1 message not in the archive

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#1 lore raw

PATCH 2/3 Xen: Update compiler checks

In reply to Andrew Cooper

We didn't really have a Clang check before, so add one while adjusting the GCC check.

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 xen/include/xen/compiler.h | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
xen/include/xen/compiler.h +4 -12
index b118e4ba62eb..cc955be32664 100644
@@ -1,18 +1,10 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#error Sorry, your compiler is too old/not recognized.
-#elif CONFIG_CC_IS_GCC
-# if defined(CONFIG_ARM_32) && CONFIG_GCC_VERSION < 40900
-#  error Sorry, your version of GCC is too old - please use 4.9 or newer.
-# elif defined(CONFIG_ARM_64) && CONFIG_GCC_VERSION < 50100
-/*
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
- * https://lore.kernel.org/r/[email protected]
- */
-#  error Sorry, your version of GCC is too old - please use 5.1 or newer.
-# endif
+#if CONFIG_CC_IS_GCC && CONFIG_GCC_VERSION < 50100
+# error Sorry, your version of GCC is too old - please use 5.1 or newer
+#elif CONFIG_CC_IS_CLANG && CONFIG_CLANG_VERSION < 110000
+# error Sorry, your version of Clang is too old - please use 11 or newer
 #endif
 
 #define barrier()     __asm__ __volatile__("": : :"memory")
Signature · 1 line
2.39.5
#0 lore raw

cover Xen: CI changes for new toolchain baseline

Prep work to allow us to start making changes based on the toolchain requirements.

https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1726628670
https://cirrus-ci.com/build/5232741505040384

Andrew Cooper (3):
CI: Update build tests based on new minimum toolchain requirements
Xen: Update compiler checks
CHANGELOG: Minimum toolchain requirements

 CHANGELOG.md                         |  3 ++
 automation/build/centos/7.dockerfile | 72 ----------------------------
 automation/gitlab-ci/build.yaml      | 30 ++++--------
 xen/include/xen/compiler.h           | 16 ++-----
 4 files changed, 17 insertions(+), 104 deletions(-)
 delete mode 100644 automation/build/centos/7.dockerfile

base-commit: 6e5fed7cb67c9f84653cdbd3924b8a119ef653be

Signature · 1 line
2.39.5
#3 lore raw

PATCH 3/3 CHANGELOG: Minimum toolchain requirements

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)
CHANGELOG.md +3 -0
index 9a5919585d43..4e333e608a96 100644
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - The minimum toolchain requirements have been increased to either:
+   - GCC 5.1 and Binutils 2.25, or
+   - Clang/LLVM 11
 
 ### Added
  - On x86:
Signature · 1 line
2.39.5
#9 lore raw

Re: [PATCH 1/3] CI: Update build tests based on new minimum toolchain requirements

In reply to a message not in the archive

Test, to try and figure out what inumbo is choking on.

~Andrew

Quoted 153 lines · Andrew Cooper

Drop CentOS 7 entirely. It's way to old now.

Ubuntu 22.04 is the oldest Ubuntu with a suitable version of Clang, so swap the 16.04 clang builds for 22.04.

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/build/centos/7.dockerfile | 72 ----------------------------
 automation/gitlab-ci/build.yaml      | 30 ++++--------
 2 files changed, 10 insertions(+), 92 deletions(-)
 delete mode 100644 automation/build/centos/7.dockerfile
automation/build/centos/7.dockerfile deleted +0 -72
deleted file mode 100644
index f41dda732084..000000000000
@@ -1,72 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 centos:7
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="[email protected]"
-
-RUN mkdir /build
-WORKDIR /build
-
-RUN <<EOF
-    set -e
-
-    # Fix up Yum config now that mirror.centos.org doesn't exist
-    sed -e 's/mirror.centos.org/vault.centos.org/g' \
-        -e 's/^#.*baseurl=https\?/baseurl=https/g' \
-        -e 's/^mirrorlist=https\?/#mirrorlist=https/g' \
-        -i /etc/yum.repos.d/*.repo
-
-    # Add the EPEL repo to get dev86
-    yum -y install epel-release
-
-    # Update everything (Base container is out of date)
-    yum -y update
-
-    DEPS=(
-        # Xen
-        binutils
-        gcc
-        make
-        python
-        # Kconfig
-        bison
-        flex
-        # Flask
-        checkpolicy
-
-        # Tools (general)
-        git
-        gzip
-        patch
-        perl
-        pkgconfig
-        wget
-        # libxenguest dombuilder
-        bzip2-devel
-        lz4-devel
-        lzo-devel
-        xz-devel
-        zlib-devel
-        zstd-devel
-        # libacpi
-        acpica-tools
-        # libxl
-        libuuid-devel
-        yajl-devel
-        # RomBIOS
-        dev86
-        # Header Check
-        gcc-c++
-        # xentop
-        ncurses-devel
-        # Python bindings
-        python-devel
-
-        # Stubdom download/extract
-        bzip2
-    )
-
-    yum -y install "${DEPS[@]}"
-
-    yum clean all
-    rm -rf /var/cache/yum
-EOF
automation/gitlab-ci/build.yaml +10 -20
index f633068c312b..2513908b059b 100644
@@ -545,16 +545,6 @@ archlinux-gcc-debug:
     CONTAINER: archlinux:current
   allow_failure: true
 
-centos-7-gcc:
-  extends: .gcc-x86-64-build
-  variables:
-    CONTAINER: centos:7
-
-centos-7-gcc-debug:
-  extends: .gcc-x86-64-build-debug
-  variables:
-    CONTAINER: centos:7
-
 debian-12-x86_64-gcc-ibt:
   extends: .gcc-x86-64-build
   variables:
@@ -607,16 +597,6 @@ fedora-41-x86_64-gcc-debug:
   variables:
     CONTAINER: fedora:41-x86_64
 
-ubuntu-16.04-x86_64-clang:
-  extends: .clang-x86-64-build
-  variables:
-    CONTAINER: ubuntu:16.04-x86_64
-
-ubuntu-16.04-x86_64-clang-debug:
-  extends: .clang-x86-64-build-debug
-  variables:
-    CONTAINER: ubuntu:16.04-x86_64
-
 ubuntu-16.04-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
@@ -637,6 +617,16 @@ ubuntu-20.04-x86_64-gcc:
   variables:
     CONTAINER: ubuntu:20.04-x86_64
 
+ubuntu-22.04-x86_64-clang:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: ubuntu:22.04-x86_64
+
+ubuntu-22.04-x86_64-clang-debug:
+  extends: .clang-x86-64-build-debug
+  variables:
+    CONTAINER: ubuntu:22.04-x86_64
+
 ubuntu-22.04-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
#4 lore raw

Re: [PATCH 3/3] CHANGELOG: Minimum toolchain requirements

In reply to Andrew Cooper
Quoted 18 lines · Andrew Cooper

---
CC: Anthony PERARD<[email protected]>
CC: Michal Orzel<[email protected]>
CC: Jan Beulich<[email protected]>
CC: Julien Grall<[email protected]>
CC: Roger Pau Monné<[email protected]>
CC: Stefano Stabellini<[email protected]>
CC: Oleksii Kurochko<[email protected]>

---
  CHANGELOG.md | 3 +++
  1 file changed, 3 insertions(+)
CHANGELOG.md +0 -0
index 9a5919585d43..4e333e608a96 100644

CHANGELOG.md The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · line 12

Quoted 6 lines
CHANGELOG.md +3 -0
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
  ### Changed
+ - The minimum toolchain requirements have been increased to either:
+   - GCC 5.1 and Binutils 2.25, or
+   - Clang/LLVM 11

I think we want here to specify for which architectures it was done as RISC-V, for example, uses different versions:
- GCC 12.2 or later
- GNU Binutils 2.39 or later
And for clang the version will be 17 as:
f873029386dd415cd9caa78f600a593d9570c9ae("[BOLT] Add minimal RISC-V 64-bit support")

  $ git tag --contains f873029386dd415cd9caa78f600a593d9570c9ae
    llvmorg-17.0.0
  ...
I have some patch to build Xen RISC-V using clang-17 but I haven't sent to upstream yet as I am not
really sure that if we need (or why we need) clang support just from the start.

~ Oleksii

Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] Xen: Update compiler checks

In reply to Andrew Cooper
Quoted 4 lines · Andrew Cooper

We didn't really have a Clang check before, so add one while adjusting the GCC check.

Quoted 42 lines

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 xen/include/xen/compiler.h | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
xen/include/xen/compiler.h +4 -12
index b118e4ba62eb..cc955be32664 100644
@@ -1,18 +1,10 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#error Sorry, your compiler is too old/not recognized.
-#elif CONFIG_CC_IS_GCC
-# if defined(CONFIG_ARM_32) && CONFIG_GCC_VERSION < 40900
-#  error Sorry, your version of GCC is too old - please use 4.9 or newer.
-# elif defined(CONFIG_ARM_64) && CONFIG_GCC_VERSION < 50100
-/*
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
- * https://lore.kernel.org/r/[email protected]
- */
-#  error Sorry, your version of GCC is too old - please use 5.1 or newer.
-# endif
+#if CONFIG_CC_IS_GCC && CONFIG_GCC_VERSION < 50100
+# error Sorry, your version of GCC is too old - please use 5.1 or newer
+#elif CONFIG_CC_IS_CLANG && CONFIG_CLANG_VERSION < 110000
+# error Sorry, your version of Clang is too old - please use 11 or newer
 #endif
 
 #define barrier()     __asm__ __volatile__("": : :"memory")
Signature · 1 line
2.39.5
Reviewed-by
#10 lore raw

Re: [PATCH 1/3] CI: Update build tests based on new minimum toolchain requirements

In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Andrew Cooper

Drop CentOS 7 entirely. It's way to old now.

Ubuntu 22.04 is the oldest Ubuntu with a suitable version of Clang, so swap the 16.04 clang builds for 22.04.

Thanks,

Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
#5 lore raw

Re: [PATCH 3/3] CHANGELOG: Minimum toolchain requirements

In reply to Oleksii Kurochko
Quoted 33 lines · Oleksii Kurochko
Quoted 18 lines · Andrew Cooper

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)
CHANGELOG.md +0 -0
index 9a5919585d43..4e333e608a96 100644

CHANGELOG.md The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · line 12

Quoted 6 lines
CHANGELOG.md +3 -0
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - The minimum toolchain requirements have been increased to either:
+   - GCC 5.1 and Binutils 2.25, or
+   - Clang/LLVM 11

I think we want here to specify for which architectures it was done as RISC-V, for example, uses different versions:
- GCC 12.2 or later
- GNU Binutils 2.39 or later
And for clang the version will be 17 as:
f873029386dd415cd9caa78f600a593d9570c9ae("[BOLT] Add minimal RISC-V 64-bit support")

Quoted 5 lines
  $ git tag --contains f873029386dd415cd9caa78f600a593d9570c9ae
    llvmorg-17.0.0
  ...
I have some patch to build Xen RISC-V using clang-17 but I haven't sent to upstream yet as I am not
really sure that if we need (or why we need) clang support just from the start.

The same reason why we got an almost-nothing build in CI first, and are currently looking for a "hello world" message on boot.

Keeping it working as you go is much easier than retrofitting at a later point, and supporting more than 1 of any $THING (not just compilers) is good to prevent accidental reliance on an implementation specific property.

The only question is what version of Clang exists in Debian bookworm, as that affects how easy/hard it is to add to CI.

According to https://packages.debian.org/search?keywords=clang, bookworm has Clang 14, while trixie has Clang 19.

So, how hard a limit is Clang-17?  Is Clang-14 doable or not?

Alternatively, we could start adding some trixie containers.  We have passed the toolchain freeze (was 15th March), so the build container should be stable now, even if it isn't quite released yet.

~Andrew

#6 lore raw

Re: [PATCH 3/3] CHANGELOG: Minimum toolchain requirements

Quoted 45 lines · Andrew Cooper
Quoted 31 lines · Oleksii Kurochko
Quoted 18 lines · Andrew Cooper

---
CC: Anthony PERARD<[email protected]>
CC: Michal Orzel<[email protected]>
CC: Jan Beulich<[email protected]>
CC: Julien Grall<[email protected]>
CC: Roger Pau Monné<[email protected]>
CC: Stefano Stabellini<[email protected]>
CC: Oleksii Kurochko<[email protected]>

---
  CHANGELOG.md | 3 +++
  1 file changed, 3 insertions(+)
CHANGELOG.md +0 -0
index 9a5919585d43..4e333e608a96 100644

CHANGELOG.md The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · line 12

Quoted 6 lines
CHANGELOG.md +3 -0
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
  ### Changed
+ - The minimum toolchain requirements have been increased to either:
+   - GCC 5.1 and Binutils 2.25, or
+   - Clang/LLVM 11

I think we want here to specify for which architectures it was done as RISC-V, for example, uses different versions:
- GCC 12.2 or later
- GNU Binutils 2.39 or later
And for clang the version will be 17 as:

Quoted 6 lines
   f873029386dd415cd9caa78f600a593d9570c9ae("[BOLT] Add minimal RISC-V 64-bit support")
   $ git tag --contains f873029386dd415cd9caa78f600a593d9570c9ae
     llvmorg-17.0.0
   ...

I have some patch to build Xen RISC-V using clang-17 but I haven't sent to upstream yet as I am not really sure that if we need (or why we need) clang support just from the start.

The same reason why we got an almost-nothing build in CI first, and are currently looking for a "hello world" message on boot.

Keeping it working as you go is much easier than retrofitting at a later point, and supporting more than 1 of any $THING (not just compilers) is good to prevent accidental reliance on an implementation specific property.

Quoted 7 lines

The only question is what version of Clang exists in Debian bookworm, as that affects how easy/hard it is to add to CI.

According tohttps://packages.debian.org/search?keywords=clang, bookworm has Clang 14, while trixie has Clang 19.

So, how hard a limit is Clang-17?  Is Clang-14 doable or not?

I think it is pretty hard limit because:
1. I haven't checked all the extension but, for example, we required 'H' extension and the support for it was added in 16.0.0:
[f4c887c3a8406d85f4f942c8350f10026994f4d8("RISCV] Add H extension")

   $ git tag --contains f4c887c3a8406d85f4f942c8350f10026994f4d8
     llvmorg-16.0.0
     ...
2. Minimal support for RISCV-64 was added in clang17:
   f873029386dd415cd9caa78f600a593d9570c9ae("[BOLT] Add minimal RISC-V 64-bit support")
   $ git tag --contains f873029386dd415cd9caa78f600a593d9570c9ae
     llvmorg-17.0.0
     ...
And, actually, the second one reason was the reason why I tried to build with clang17 and suggests to use
it as a baseline.
Quoted 4 lines

Alternatively, we could start adding some trixie containers.  We have passed the toolchain freeze (was 15th March), so the build container should be stable now, even if it isn't quite released yet.

clang has nice script to add any version. I did that in the following way for bookworm docker container:
+ DEPS=(

+        # Clang
+        wget
+        gnupg
+        ca-certificates
+        lsb-release
+        software-properties-common

...

+    update-ca-certificates
+

+    wget -O -https://apt.llvm.org/llvm.sh | bash -s 17
+    wget -O -https://apt.llvm.org/llvm.sh | bash -s 18
+    wget -O -https://apt.llvm.org/llvm.sh | bash -s 19
+    wget -O -https://apt.llvm.org/llvm.sh | bash -s 20

+    # ln -s /usr/bin/clang-17 /usr/bin/clang

~ Oleksii

#7 lore raw

Re: [PATCH 3/3] CHANGELOG: Minimum toolchain requirements

Quoted 66 lines · Oleksii Kurochko
Quoted 44 lines · Andrew Cooper
Quoted 31 lines · Oleksii Kurochko
Quoted 18 lines · Andrew Cooper

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)
CHANGELOG.md +0 -0
index 9a5919585d43..4e333e608a96 100644

CHANGELOG.md The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · line 12

Quoted 6 lines
CHANGELOG.md +3 -0
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - The minimum toolchain requirements have been increased to either:
+   - GCC 5.1 and Binutils 2.25, or
+   - Clang/LLVM 11

I think we want here to specify for which architectures it was done as RISC-V, for example, uses different versions:
- GCC 12.2 or later
- GNU Binutils 2.39 or later
And for clang the version will be 17 as:
f873029386dd415cd9caa78f600a593d9570c9ae("[BOLT] Add minimal RISC-V 64-bit support")

Quoted 5 lines
  $ git tag --contains f873029386dd415cd9caa78f600a593d9570c9ae
    llvmorg-17.0.0
  ...
I have some patch to build Xen RISC-V using clang-17 but I haven't sent to upstream yet as I am not
really sure that if we need (or why we need) clang support just from the start.

The same reason why we got an almost-nothing build in CI first, and are currently looking for a "hello world" message on boot.

Keeping it working as you go is much easier than retrofitting at a later point, and supporting more than 1 of any $THING (not just compilers) is good to prevent accidental reliance on an implementation specific property.

Quoted 7 lines

The only question is what version of Clang exists in Debian bookworm, as that affects how easy/hard it is to add to CI.

According to https://packages.debian.org/search?keywords=clang, bookworm has Clang 14, while trixie has Clang 19.

So, how hard a limit is Clang-17?  Is Clang-14 doable or not?

I think it is pretty hard limit because:
1. I haven't checked all the extension but, for example, we required 'H' extension and the support for it was added in 16.0.0:

   [f4c887c3a8406d85f4f942c8350f10026994f4d8("RISCV] Add H extension")
   $ git tag --contains f4c887c3a8406d85f4f942c8350f10026994f4d8
     llvmorg-16.0.0
     ...
2. Minimal support for RISCV-64 was added in clang17:
   f873029386dd415cd9caa78f600a593d9570c9ae("[BOLT] Add minimal RISC-V 64-bit support")
   $ git tag --contains f873029386dd415cd9caa78f600a593d9570c9ae
     llvmorg-17.0.0
     ...
Quoted 2 lines

And, actually, the second one reason was the reason why I tried to build with clang17 and suggests to use it as a baseline.

That's fine.  It means we can't use Debian bookworm for this purpose.

Quoted 11 lines
Quoted 4 lines

Alternatively, we could start adding some trixie containers.  We have passed the toolchain freeze (was 15th March), so the build container should be stable now, even if it isn't quite released yet.

clang has nice script to add any version. I did that in the following way for bookworm docker container:

(quoted diff) +5 -0
+    DEPS=(
+        # Clang
+        wget
+        gnupg
+        ca-certificates

Review

Quoted 10 lines
(quoted diff) +9 -0
+        lsb-release
+        software-properties-common
...
+    update-ca-certificates
+
+    wget -O - https://apt.llvm.org/llvm.sh | bash -s 17
+    wget -O - https://apt.llvm.org/llvm.sh | bash -s 18
+    wget -O - https://apt.llvm.org/llvm.sh | bash -s 19
+    wget -O - https://apt.llvm.org/llvm.sh | bash -s 20
+    # ln -s /usr/bin/clang-17 /usr/bin/clang

We used to do this.

It backfired spectacularly when rebuilding a container after versions of clang had been dropped, and took out testing on the stable-* trees as a consequence.

Therefore, we don't do this any more.  (Or at least, not in a container marked for blocking failures.)

~Andrew