Skip to contentSkip to conversation

enable PPC in test-meson-builds on ubuntu

PATCH Applied Bruce Richardson 6 participants 10 messages Aug 31, 2023 – Oct 11, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover enable PPC in test-meson-builds on ubuntu

To help developers catch errors as soon as possible, we want to ensure that as wide a variety of builds are done by test-meson-builds as possible. Unfortunately, for those using Ubuntu, the shipped version of GCC compiler for PowerPC on that system is not correctly detected by the script. We fix this by detecting if Ubuntu is in use, and pointing to the correct cross-file in that case.

On enabling those PPC builds on my system, a couple of other build issues we encountered. These are fixed by the set before enabling the build in the script.

Bruce Richardson (3):
vhost: fix build for powerpc
build: fix failures due to incompatible IPSec lib
devtools: enable testing ppc builds on ubuntu

 devtools/test-meson-builds.sh       | 3 +++
 drivers/crypto/ipsec_mb/meson.build | 5 +++++
 lib/vhost/vduse.c                   | 9 ++++++---
 3 files changed, 14 insertions(+), 3 deletions(-)

--
2.39.2

#1 lore raw

PATCH 1/3 vhost: fix build for powerpc

When building on Ubuntu using the packaged powerpc compiler[1], a warning is issued about the print format of the __u64 values.

../../lib/vhost/vduse.c: In function ‘vduse_vring_setup’:
../../lib/vhost/vhost.h:676:17: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ {aka ‘long unsigned int’} [-Werror=format=]

  676 |                 "VHOST_CONFIG: (%s) " fmt, prefix, ##args)
      |                 ^~~~~~~~~~~~~~~~~~~~~

Changing the format specifier to %lx, or to use PRIx64 breaks other builds, so the safest solution is to explicitly typecast the printed values to match the format string.

[1] powerpc64le-linux-gnu-gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0

Fixes a9120db8b98b ("vhost: add VDUSE device startup")
---
 lib/vhost/vduse.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
lib/vhost/vduse.c +6 -3
index 73ed424232..e2b6d35d37 100644
@@ -162,9 +162,12 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "VQ %u info:\n", index);
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tnum: %u\n", vq_info.num);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdesc_addr: %llx\n", vq_info.desc_addr);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdriver_addr: %llx\n", vq_info.driver_addr);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdevice_addr: %llx\n", vq_info.device_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdesc_addr: %llx\n",
+			(unsigned long long)vq_info.desc_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdriver_addr: %llx\n",
+			(unsigned long long)vq_info.driver_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdevice_addr: %llx\n",
+			(unsigned long long)vq_info.device_addr);
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tavail_idx: %u\n", vq_info.split.avail_index);
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tready: %u\n", vq_info.ready);
 
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 1/3] vhost: fix build for powerpc

+PPC maintainer

Quoted 48 lines · Bruce Richardson

When building on Ubuntu using the packaged powerpc compiler[1], a warning is issued about the print format of the __u64 values.

../../lib/vhost/vduse.c: In function ‘vduse_vring_setup’:
../../lib/vhost/vhost.h:676:17: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ {aka ‘long unsigned int’} [-Werror=format=]

  676 |                 "VHOST_CONFIG: (%s) " fmt, prefix, ##args)
      |                 ^~~~~~~~~~~~~~~~~~~~~

Changing the format specifier to %lx, or to use PRIx64 breaks other builds, so the safest solution is to explicitly typecast the printed values to match the format string.

[1] powerpc64le-linux-gnu-gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0

Fixes a9120db8b98b ("vhost: add VDUSE device startup")
---
 lib/vhost/vduse.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
lib/vhost/vduse.c +6 -3
index 73ed424232..e2b6d35d37 100644
@@ -162,9 +162,12 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "VQ %u info:\n", index);
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tnum: %u\n", vq_info.num);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdesc_addr: %llx\n", vq_info.desc_addr);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdriver_addr: %llx\n", vq_info.driver_addr);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdevice_addr: %llx\n", vq_info.device_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdesc_addr: %llx\n",
+			(unsigned long long)vq_info.desc_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdriver_addr: %llx\n",
+			(unsigned long long)vq_info.driver_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdevice_addr: %llx\n",
+			(unsigned long long)vq_info.device_addr);
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tavail_idx: %u\n", vq_info.split.avail_index);
 	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tready: %u\n", vq_info.ready);
 
Signature · 1 line
2.39.2
#3 lore raw

Re: [PATCH 1/3] vhost: fix build for powerpc

Quoted 25 lines · Bruce Richardson

+PPC maintainer

Quoted 22 lines · Bruce Richardson

When building on Ubuntu using the packaged powerpc compiler[1], a warning is issued about the print format of the __u64 values.

../../lib/vhost/vduse.c: In function ‘vduse_vring_setup’:
../../lib/vhost/vhost.h:676:17: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ {aka ‘long unsigned int’} [-Werror=format=]

   676 |                 "VHOST_CONFIG: (%s) " fmt, prefix, ##args)
       |                 ^~~~~~~~~~~~~~~~~~~~~

Changing the format specifier to %lx, or to use PRIx64 breaks other builds, so the safest solution is to explicitly typecast the printed values to match the format string.

[1] powerpc64le-linux-gnu-gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0

Fixes a9120db8b98b ("vhost: add VDUSE device startup")

---

Acked-by on v1 1/3
#4 lore raw

Re: [PATCH 1/3] vhost: fix build for powerpc

In reply to Bruce Richardson
Quoted 35 lines · Bruce Richardson

When building on Ubuntu using the packaged powerpc compiler[1], a warning is issued about the print format of the __u64 values.

../../lib/vhost/vduse.c: In function ‘vduse_vring_setup’:
../../lib/vhost/vhost.h:676:17: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ {aka ‘long unsigned int’} [-Werror=format=]

   676 |                 "VHOST_CONFIG: (%s) " fmt, prefix, ##args)
       |                 ^~~~~~~~~~~~~~~~~~~~~

Changing the format specifier to %lx, or to use PRIx64 breaks other builds, so the safest solution is to explicitly typecast the printed values to match the format string.

[1] powerpc64le-linux-gnu-gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0

Fixes a9120db8b98b ("vhost: add VDUSE device startup")
---
  lib/vhost/vduse.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
lib/vhost/vduse.c +0 -2
index 73ed424232..e2b6d35d37 100644
@@ -162,9 +162,12 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 
  	VHOST_LOG_CONFIG(dev->ifname, INFO, "VQ %u info:\n", index);
  	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tnum: %u\n", vq_info.num);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdesc_addr: %llx\n", vq_info.desc_addr);
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdriver_addr: %llx\n", vq_info.driver_addr);

lib/vhost/vduse.c vduse_vring_setup(struct virtio_net *dev, unsigned int index) · line 173

Quoted 10 lines
lib/vhost/vduse.c +6 -1
-	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdevice_addr: %llx\n", vq_info.device_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdesc_addr: %llx\n",
+			(unsigned long long)vq_info.desc_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdriver_addr: %llx\n",
+			(unsigned long long)vq_info.driver_addr);
+	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tdevice_addr: %llx\n",
+			(unsigned long long)vq_info.device_addr);
  	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tavail_idx: %u\n", vq_info.split.avail_index);
  	VHOST_LOG_CONFIG(dev->ifname, INFO, "\tready: %u\n", vq_info.ready);
 

It is surprising PRIx64 does not work on other architectures. I don't see a better solution, so:

Thanks,
Maxime

#5 lore raw

PATCH 2/3 crypto/ipsec_mb: fix build failures due to incompatible lib

In reply to Bruce Richardson

When cross-compiling for PowerPC on Ubuntu, the x86 IPSec_MB library was getting found by the build system for use in the PPC build. This led to failures at compile time due to the library not being linkable.

We can avoid these failures by checking the discovered library for compatibility at configuration time. This needs a version check as it is supported only from version 0.60 of meson onwards.

Fixes c75542ae4200 ("crypto/ipsec_mb: introduce IPsec_mb framework")
---
 drivers/crypto/ipsec_mb/meson.build | 5 +++++
 1 file changed, 5 insertions(+)
drivers/crypto/ipsec_mb/meson.build +5 -0
index 3057e6fd10..87bf965554 100644
@@ -16,6 +16,11 @@ lib = cc.find_library('IPSec_MB', required: false)
 if not lib.found()
     build = false
     reason = 'missing dependency, "libIPSec_MB"'
+# if the lib is found, check it's the right format
+elif meson.version().version_compare('>=0.60') and not cc.links(
+        'int main(void) {return 0;}', dependencies: lib)
+    build = false
+    reason = 'incompatible dependency, "libIPSec_MB"'
 else
     ext_deps += lib
 
Signature · 1 line
2.39.2
Acked-by on v1 2/3
#6 lore raw

RE: [PATCH 2/3] crypto/ipsec_mb: fix build failures due to incompatible lib

Quoted 17 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Thursday, August 31, 2023 1:11 PM
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; Ji, Kai <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Akhil Goyal <[email protected]>; Power, Ciara <[email protected]>; Ray Kinsella <[email protected]>; Fan Zhang <[email protected]>
Subject: [PATCH 2/3] crypto/ipsec_mb: fix build failures due to incompatible lib

When cross-compiling for PowerPC on Ubuntu, the x86 IPSec_MB library was getting found by the build system for use in the PPC build. This led to failures at compile time due to the library not being linkable.

Quoted 8 lines

We can avoid these failures by checking the discovered library for compatibility at configuration time. This needs a version check as it is supported only from version 0.60 of meson onwards.

Fixes c75542ae4200 ("crypto/ipsec_mb: introduce IPsec_mb framework")
#7 lore raw

PATCH 3/3 devtools: enable testing ppc builds on ubuntu

In reply to Bruce Richardson

When running PPC builds with the packaged Ubuntu compiler, a different cross-file needs to be used. Adjust the test-meson-builds script to take account of this, so that developers can easier pick up on errors.

---
 devtools/test-meson-builds.sh | 3 +++
 1 file changed, 3 insertions(+)
devtools/test-meson-builds.sh +3 -0
index c41659d28b..605a855999 100755
@@ -282,6 +282,9 @@ build build-loongarch64-generic-gcc $f ABI $use_shared
 
 # IBM POWER
 f=$srcdir/config/ppc/ppc64le-power8-linux-gcc
+if grep -q 'NAME="Ubuntu"' /etc/os-release ; then
+	f=$f-ubuntu
+fi
 build build-ppc64-power8-gcc $f ABI $use_shared
 
 # generic RISC-V

--
2.39.2

#9 lore raw
In reply to Bruce Richardson

31/08/2023 14:10, Bruce Richardson:

Quoted 7 lines

To help developers catch errors as soon as possible, we want to ensure that as wide a variety of builds are done by test-meson-builds as possible. Unfortunately, for those using Ubuntu, the shipped version of GCC compiler for PowerPC on that system is not correctly detected by the script. We fix this by detecting if Ubuntu is in use, and pointing to the correct cross-file in that case.

Quoted 8 lines

On enabling those PPC builds on my system, a couple of other build issues we encountered. These are fixed by the set before enabling the build in the script.

Bruce Richardson (3):
vhost: fix build for powerpc
build: fix failures due to incompatible IPSec lib
devtools: enable testing ppc builds on ubuntu

Applied, thanks.