Merge ~mfo/ubuntu/+source/xen:lp1956166v2 into ubuntu/+source/xen:ubuntu/focal-devel

Proposed by Mauricio Faria de Oliveira
Status: Merged
Merged at revision: 3dc1816e8b4773401502e20c76d88c16d24ca72a
Proposed branch: ~mfo/ubuntu/+source/xen:lp1956166v2
Merge into: ubuntu/+source/xen:ubuntu/focal-devel
Diff against target: 80 lines (+58/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/lp1956166-0006-fix-ftbfs-arm-lzo-unaligned.h.patch (+50/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Review via email: mp+426503@code.launchpad.net

Description of the change

This is an incremental fix for LP#1956166, which addresses
a FTBFS on arm64/armhf introduced with the previous MR [1].

[1] https://code.launchpad.net/~mfo/ubuntu/+source/xen/+git/xen/+merge/426221

To post a comment you must log in.
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (3.4 KiB)

The fixup patch does NOT change the generated assembly code
for the 3 functions in xen/common/lzo.c on both amd64/arm64:
- amd64: between the first patch (*ubuntu2.1) and this fixup (*ubuntu2.2), and
- arm64: between the original package (*ubuntu2) and this fixup (*ubuntu2.2).

Details:

$ wget https://launchpad.net/~mfo/+archive/ubuntu/lp1956166/+files/xen-hypervisor-4.11-amd64_4.11.3+24-g14b62ab3e5-1ubuntu2.1_amd64.deb
$ wget https://launchpad.net/~mfo/+archive/ubuntu/lp1956166/+files/xen-hypervisor-4.11-amd64_4.11.3+24-g14b62ab3e5-1ubuntu2.2_amd64.deb

$ https://launchpad.net/ubuntu/+archive/primary/+files/xen-hypervisor-4.11-arm64_4.11.3+24-g14b62ab3e5-1ubuntu2_arm64.deb
$ wget https://launchpad.net/~mfo/+archive/ubuntu/lp1956166/+files/xen-hypervisor-4.11-arm64_4.11.3+24-g14b62ab3e5-1ubuntu2.2_arm64.deb

$ ls -1
xen-hypervisor-4.11-amd64_4.11.3+24-g14b62ab3e5-1ubuntu2.1_amd64.deb
xen-hypervisor-4.11-amd64_4.11.3+24-g14b62ab3e5-1ubuntu2.2_amd64.deb
xen-hypervisor-4.11-arm64_4.11.3+24-g14b62ab3e5-1ubuntu2.2_arm64.deb
xen-hypervisor-4.11-arm64_4.11.3+24-g14b62ab3e5-1ubuntu2_arm64.deb

$ for ARCH in amd64 arm64; do
  for VERSION in 4.11.3+24-g14b62ab3e5-1ubuntu2{,.1,.2}; do

    DEB="xen-hypervisor-4.11-${ARCH}_${VERSION}_${ARCH}.deb"
    [ -f "$DEB" ] || continue

    DIR="xen-4.11-${ARCH}-${VERSION}"
    DIS="xen-4.11-${ARCH}-${VERSION}.disass"
    OBJDUMP='objdump'
    [ "$ARCH" != 'arm64' ] || OBJDUMP='aarch64-linux-gnu-objdump'

    dpkg-deb -x $DEB $DIR
    gunzip $DIR/usr/lib/debug/xen-syms-4.11.4-pre.gz
    $OBJDUMP -d $DIR/usr/lib/debug/xen-syms-4.11.4-pre > $DIS

    for FUNC in lzo1x_1_do_compress lzo1x_1_compress lzo1x_decompress_safe; do
      sed -n "/<${FUNC}>:/,/^\$/p" $DIS | cut -d: -f2- > $DIS.func-$FUNC
    done

  done
done

$ md5sum xen-4.11-amd64-*.func-* | sort
163d549302aad6dfd82f7669e2f2aa65 xen-4.11-amd64-4.11.3+24-g14b62ab3e5-1ubuntu2.1.disass.func-lzo1x_1_compress
163d549302aad6dfd82f7669e2f2aa65 xen-4.11-amd64-4.11.3+24-g14b62ab3e5-1ubuntu2.2.disass.func-lzo1x_1_compress
de4dc27fc2584edc6a33183abe34cc24 xen-4.11-amd64-4.11.3+24-g14b62ab3e5-1ubuntu2.1.disass.func-lzo1x_1_do_compress
de4dc27fc2584edc6a33183abe34cc24 xen-4.11-amd64-4.11.3+24-g14b62ab3e5-1ubuntu2.2.disass.func-lzo1x_1_do_compress
e68052e9060777fd445056132b4de031 xen-4.11-amd64-4.11.3+24-g14b62ab3e5-1ubuntu2.1.disass.func-lzo1x_decompress_safe
e68052e9060777fd445056132b4de031 xen-4.11-amd64-4.11.3+24-g14b62ab3e5-1ubuntu2.2.disass.func-lzo1x_decompress_safe

$ md5sum xen-4.11-arm64-*.func-* | sort
4cd4f9d881190842449f23f8e2ac0dd1 xen-4.11-arm64-4.11.3+24-g14b62ab3e5-1ubuntu2.2.disass.func-lzo1x_decompress_safe
4cd4f9d881190842449f23f8e2ac0dd1 xen-4.11-arm64-4.11.3+24-g14b62ab3e5-1ubuntu2.disass.func-lzo1x_decompress_safe
c100e134e2086017d15021b8ef38be7e xen-4.11-arm64-4.11.3+24-g14b62ab3e5-1ubuntu2.2.disass.func-lzo1x_1_do_compress
c100e134e2086017d15021b8ef38be7e xen-4.11-arm64-4.11.3+24-g14b62ab3e5-1ubuntu2.disass.func-lzo1x_1_do_compress
e3e70b078204d5171b4d45d1f8fc1845 xen-4.11-arm64-4.11.3+24-g14b62ab3e5-1ubuntu2.2.disass.func-lzo1x_1_compress
e3e70b078204d5171b4d45d1f8fc1845 xen-4.11-arm64-4.11.3+24-g14b62ab3e5-1ubuntu2.disass....

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

FTBFS offending commit:

 /git/xen$ gl1 -1 --format=quote 7c9f81687ad6
 commit 7c9f81687ad6 ("introduce unaligned.h")

 /git/xen$ git describe --contains 7c9f81687ad6
 4.15.0-rc1~280

In upstream/4.15, lzo.c was no longer built on arm, just on x86,
but downstream/4.11, it still is.

 ~/git/xen$ gl1 -1 --format=quote c492e19fdd05
 commit c492e19fdd05 ("xen: remove tmem from hypervisor")

 ~/git/xen$ git show c492e19fdd05
 diff --git a/xen/common/Makefile b/xen/common/Makefile
 ...
 -obj-$(CONFIG_TMEM) += lzo.o
 ...
 -lzo-y := lzo
 -lzo-$(CONFIG_TMEM) :=
 -obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma $(lzo-y) unlzo unlz4 earlycpio,$(n).init.o)
 +obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma lzo unlzo unlz4 earlycpio,$(n).init.o)

 /git/xen$ git describe --contains c492e19fdd05
 4.13.0-rc1~972

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Sorry you had to hit this bump, but I'm sure you will from now on always test build all arches :-)

I checked your change and it indeed just makes the backported version match the upstream patch in the sense of being x86 only. Approved and sponsored.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index ddb115c..a9a4cd2 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+xen (4.11.3+24-g14b62ab3e5-1ubuntu2.2) focal; urgency=medium
7+
8+ * Fix FTBFS on armhf/arm64 due to missing <asm/unaligned.h>:
9+ - d/p/lp1956166-0006-fix-ftbfs-arm-lzo-unaligned.h.patch
10+
11+ -- Mauricio Faria de Oliveira <mfo@canonical.com> Thu, 07 Jul 2022 13:53:37 -0300
12+
13 xen (4.11.3+24-g14b62ab3e5-1ubuntu2.1) focal; urgency=medium
14
15 * Add support for zstd compressed kernels for Dom0/DomU on x86 (LP: #1956166)
16diff --git a/debian/patches/lp1956166-0006-fix-ftbfs-arm-lzo-unaligned.h.patch b/debian/patches/lp1956166-0006-fix-ftbfs-arm-lzo-unaligned.h.patch
17new file mode 100644
18index 0000000..d8ac52e
19--- /dev/null
20+++ b/debian/patches/lp1956166-0006-fix-ftbfs-arm-lzo-unaligned.h.patch
21@@ -0,0 +1,50 @@
22+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1956166
23+Description: Fix FTBFS on armhf/arm64 due to <asm/unaligned.h>
24+ Patch lp1956166-0001-introduce-unaligned.h.patch builds fine
25+ on x86, but it fails to build from source on armhf and arm64:
26+ .
27+ lzo.c:100:10: fatal error: asm/unaligned.h: No such file or directory
28+ .
29+ The <asm/unaligned.h> header is only available on x86, but arm
30+ also builds lzo.c in Xen 4.11 ('obj-y' in xen/common/Makefile).
31+ This isn't the case in Xen 4.15 (original release of the patch),
32+ where lzo.c is obj-$(CONFIG_X86)-based.
33+ .
34+ So, make the lzo.c changes in the patch more conditional to x86,
35+ keeping the (local) previous unaligned macro definitions on arm.
36+ .
37+ This keeps the spirit of the upstream patch (which is x86-only),
38+ and is backwards compatible with 4.11 code.
39+Author: Mauricio Faria de Oliveira <mfo@canonical.com>
40+Forwarded: not-needed
41+Last-Update: 2022-07-07
42+---
43+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
44+Index: xen/xen/common/lzo.c
45+===================================================================
46+--- xen.orig/xen/common/lzo.c
47++++ xen/xen/common/lzo.c
48+@@ -97,12 +97,23 @@
49+ #ifdef __XEN__
50+ #include <xen/lib.h>
51+ #include <asm/byteorder.h>
52++#endif
53++
54++#ifdef CONFIG_X86
55++#ifdef __XEN__
56+ #include <asm/unaligned.h>
57+ #else
58+ #define get_unaligned_le16(_p) (*(u16 *)(_p))
59+ #endif
60++#endif
61+
62+ #include <xen/lzo.h>
63++#ifndef CONFIG_X86
64++#define get_unaligned(_p) (*(_p))
65++#define put_unaligned(_val,_p) (*(_p)=_val)
66++#define get_unaligned_le16(_p) (*(u16 *)(_p))
67++#define get_unaligned_le32(_p) (*(u32 *)(_p))
68++#endif
69+
70+ static noinline size_t
71+ lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
72diff --git a/debian/patches/series b/debian/patches/series
73index 29c8653..d942e5b 100644
74--- a/debian/patches/series
75+++ b/debian/patches/series
76@@ -57,3 +57,4 @@ lp1956166-0002-lib-introduce-xxhash.patch
77 lp1956166-0003-x86-Dom0-support-zstd-compressed-kernels.patch
78 lp1956166-0004-libxenguest-add-get_unaligned_le32.patch
79 lp1956166-0005-libxenguest-support-zstd-compressed-kernels.patch
80+lp1956166-0006-fix-ftbfs-arm-lzo-unaligned.h.patch

Subscribers

People subscribed via source and target branches