Skip to contentSkip to conversation

Fix Xen compilation

PATCH In review Bertrand Marquis 3 participants 10 messages Nov 9, 2020 – Nov 16, 2020

lore
Share & tools
lore
#0 lore raw

cover Fix Xen compilation

This serie contain 2 patches to fix Xen compilation:
- on arm32 by adding a patch already merged in Xen master to fix gcc10 compilation issues.
- on x86 to fix an issue happening when compiling xen-tools with older xen versions.

Those would be good candidates to include in gatesgarth.

Bertrand Marquis (2):
xen: Fix python libraries installation on multilib
xen: Fix xenpmd compilation error on arm32

 ...ls-xenpmd-Fix-gcc10-snprintf-warning.patch | 60 +++++++++++++++++++
 recipes-extended/xen/xen-tools.inc            |  2 +
 recipes-extended/xen/xen-tools_4.14.bb        |  1 +
 recipes-extended/xen/xen-tools_git.bb         |  1 +
 4 files changed, 64 insertions(+)
 create mode 100644 recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 xen: Fix python libraries installation on multilib

Fix install path for xen python libraries when multilib configuration is activated (which is mandatory to compile xen for x86_64). Depending on the version of Xen, the libraries are installed on lib or on the nonarch lib directory so add both.

Change-Id I1f7f81a4e9e1420bce55d1e4bfe03d98ac2c93a3
---
 recipes-extended/xen/xen-tools.inc | 2 ++
 1 file changed, 2 insertions(+)
recipes-extended/xen/xen-tools.inc +2 -0
index 736a766..0c69fec 100644
@@ -496,7 +496,9 @@ FILES_${PN}-pygrub = "\
     ${libdir}/xen/bin/pygrub \
     "
 
+# Depending on the version of Xen libdir or nonarch libdir is used
 FILES_${PN}-python = "\
+    ${libdir}/${PYTHON_DIR} \
     ${nonarch_libdir}/${PYTHON_DIR} \
     "
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 xen: Fix xenpmd compilation error on arm32

Add patch merged in current Xen master to solve compilation errors on xenmpd when Xen is compiled for arm32.

Change-Id Ifd94aa30e1b3a1016156ead395688f594ad2711d
---
 ...ls-xenpmd-Fix-gcc10-snprintf-warning.patch | 60 +++++++++++++++++++
 recipes-extended/xen/xen-tools_4.14.bb        |  1 +
 recipes-extended/xen/xen-tools_git.bb         |  1 +
 3 files changed, 62 insertions(+)
 create mode 100644 recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch
recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch new file +60 -0
new file mode 100644
index 0000000..0a136c9
@@ -0,0 +1,60 @@
+From 0dfddb2116e3757f77a691a3fe335173088d69dc Mon Sep 17 00:00:00 2001
+Message-Id: <0dfddb2116e3757f77a691a3fe335173088d69dc.1604734077.git.bertrand.marquis@arm.com>
+From: Bertrand Marquis <[email protected]>
+Date: Thu, 15 Oct 2020 10:16:09 +0100
+Subject: [PATCH] tools/xenpmd: Fix gcc10 snprintf warning
+
+Add a check for snprintf return code and ignore the entry if we get an
+error. This should in fact never happen and is more a trick to make gcc
+happy and prevent compilation errors.
+
+This is solving the following gcc warning when compiling for arm32 host
+platforms with optimization activated:
+xenpmd.c:92:37: error: '%s' directive output may be truncated writing
+between 4 and 2147483645 bytes into a region of size 271
+[-Werror=format-truncation=]
+
+This is also solving the following Debian bug:
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
+
+Signed-off-by: Bertrand Marquis <[email protected]>
+Acked-by: Wei Liu <[email protected]>
+---
+Upstream-status: Backport from 4.15
+---
+ tools/xenpmd/xenpmd.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
+index 35fd1c931a..12b82cf43e 100644
+--- a/tools/xenpmd/xenpmd.c
++++ b/tools/xenpmd/xenpmd.c
+@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
+     FILE *file = 0;
+     struct dirent *dir_entries;
+     char file_name[284];
++    int ret;
+     
+     do 
+     {
+@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
+         if ( strlen(dir_entries->d_name) < 4 )
+             continue;
+         if ( battery_info_type == BIF ) 
+-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
++            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+                      dir_entries->d_name);
+         else 
+-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
++            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+                      dir_entries->d_name);
++        /* This should not happen but is needed to pass gcc checks */
++        if (ret < 0)
++            continue;
++        file_name[sizeof(file_name) - 1] = '\0';
+         file = fopen(file_name, "r");
+     } while ( !file );
+ 
+-- 
+2.17.1
+
recipes-extended/xen/xen-tools_4.14.bb +1 -0
index 4119190..73a52bc 100644
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
     file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \
+    file://0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen-tools_git.bb +1 -0
index 71aeeed..1f6be1d 100644
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
     file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \
+    file://0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
Signature · 1 line
2.17.1
Reviewed-by on v1 2/2
#3 lore raw

Re: [meta-virtualization] [PATCH 2/2] xen: Fix xenpmd compilation error on arm32

Quoted 5 lines · Bertrand Marquis

Add patch merged in current Xen master to solve compilation errors on xenmpd when Xen is compiled for arm32.

Quoted 104 lines

Change-Id: Ifd94aa30e1b3a1016156ead395688f594ad2711d

---
 ...ls-xenpmd-Fix-gcc10-snprintf-warning.patch | 60 +++++++++++++++++++
 recipes-extended/xen/xen-tools_4.14.bb        |  1 +
 recipes-extended/xen/xen-tools_git.bb         |  1 +
 3 files changed, 62 insertions(+)
 create mode 100644 recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch
recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch new file +60 -0
new file mode 100644
index 0000000..0a136c9
@@ -0,0 +1,60 @@
+From 0dfddb2116e3757f77a691a3fe335173088d69dc Mon Sep 17 00:00:00 2001
+Message-Id: <0dfddb2116e3757f77a691a3fe335173088d69dc.1604734077.git.bertrand.marquis@arm.com>
+From: Bertrand Marquis <[email protected]>
+Date: Thu, 15 Oct 2020 10:16:09 +0100
+Subject: [PATCH] tools/xenpmd: Fix gcc10 snprintf warning
+
+Add a check for snprintf return code and ignore the entry if we get an
+error. This should in fact never happen and is more a trick to make gcc
+happy and prevent compilation errors.
+
+This is solving the following gcc warning when compiling for arm32 host
+platforms with optimization activated:
+xenpmd.c:92:37: error: '%s' directive output may be truncated writing
+between 4 and 2147483645 bytes into a region of size 271
+[-Werror=format-truncation=]
+
+This is also solving the following Debian bug:
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
+
+Signed-off-by: Bertrand Marquis <[email protected]>
+Acked-by: Wei Liu <[email protected]>
+---
+Upstream-status: Backport from 4.15
+---
+ tools/xenpmd/xenpmd.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
+index 35fd1c931a..12b82cf43e 100644
+--- a/tools/xenpmd/xenpmd.c
++++ b/tools/xenpmd/xenpmd.c
+@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
+     FILE *file = 0;
+     struct dirent *dir_entries;
+     char file_name[284];
++    int ret;
+
+     do
+     {
+@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
+         if ( strlen(dir_entries->d_name) < 4 )
+             continue;
+         if ( battery_info_type == BIF )
+-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
++            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+                      dir_entries->d_name);
+         else
+-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
++            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+                      dir_entries->d_name);
++        /* This should not happen but is needed to pass gcc checks */
++        if (ret < 0)
++            continue;
++        file_name[sizeof(file_name) - 1] = '\0';
+         file = fopen(file_name, "r");
+     } while ( !file );
+
+--
+2.17.1
+
recipes-extended/xen/xen-tools_4.14.bb +1 -0
index 4119190..73a52bc 100644
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
     file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \
+    file://0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen-tools_git.bb +1 -1
index 71aeeed..1f6be1d 100644
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
     file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \
+    file://0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
--

2.17.1

#4 lore raw

Re: [meta-virtualization] [PATCH 1/2] xen: Fix python libraries installation on multilib

In reply to Bertrand Marquis
Quoted 5 lines · Bertrand Marquis

Fix install path for xen python libraries when multilib configuration is activated (which is mandatory to compile xen for x86_64). Depending on the version of Xen, the libraries are installed on lib or on the nonarch lib directory so add both.

Thanks, Bertrand -- I have positive results for this with compile-tests with both Xen 4.14 and 4.15 for x86_64.

Quoted 11 lines
Change-Id I1f7f81a4e9e1420bce55d1e4bfe03d98ac2c93a3
---
 recipes-extended/xen/xen-tools.inc | 2 ++
 1 file changed, 2 insertions(+)
recipes-extended/xen/xen-tools.inc +0 -0
index 736a766..0c69fec 100644

recipes-extended/xen/xen-tools.inc FILES_${PN}-pygrub = "\ · line 503

Quoted 8 lines
recipes-extended/xen/xen-tools.inc +2 -0
@@ -496,7 +496,9 @@ FILES_${PN}-pygrub = "\
     ${libdir}/xen/bin/pygrub \
     "
 
+# Depending on the version of Xen libdir or nonarch libdir is used
 FILES_${PN}-python = "\
+    ${libdir}/${PYTHON_DIR} \
     ${nonarch_libdir}/${PYTHON_DIR} \
     "

Do you know whether a similar change is also needed for the python nonarch_libdir items in the -dbg package, when building older versions of Xen?

Christopher

Quoted 7 lines
recipes-extended/xen/xen-tools.inc +0 -1
--

2.17.1

#5 lore raw

Re: [meta-virtualization] [PATCH 1/2] xen: Fix python libraries installation on multilib

Hi Christopher,

Quoted 5 lines · Christopher Clark
Quoted 1 line · Bertrand Marquis
Quoted 7 lines
Quoted 4 lines

Fix install path for xen python libraries when multilib configuration is activated (which is mandatory to compile xen for x86_64). Depending on the version of Xen, the libraries are installed on lib or on the nonarch lib directory so add both.

Thanks, Bertrand -- I have positive results for this with compile-tests with both Xen 4.14 and 4.15 for x86_64.

I tried on x86_64 and also on arm32 and arm64 and all compile tests are now passing.

Quoted 15 lines
Quoted 15 lines
Change-Id I1f7f81a4e9e1420bce55d1e4bfe03d98ac2c93a3

---
recipes-extended/xen/xen-tools.inc | 2 ++

1 file changed, 2 insertions(+)
recipes-extended/xen/xen-tools.inc +0 -0
index 736a766..0c69fec 100644
@@ -496,7 +496,9 @@ FILES_${PN}-pygrub = "\
    ${libdir}/xen/bin/pygrub \
    "
 
Quoted 9 lines

recipes-extended/xen/xen-tools.inc FILES_${PN}-pygrub = "\ · line 503

Quoted 5 lines
recipes-extended/xen/xen-tools.inc +2 -0
+# Depending on the version of Xen libdir or nonarch libdir is used
 FILES_${PN}-python = "\
+    ${libdir}/${PYTHON_DIR} \
    ${nonarch_libdir}/${PYTHON_DIR} \
    "

Do you know whether a similar change is also needed for the python nonarch_libdir items in the -dbg package, when building older versions of Xen?

No from my tests this is not needed.
Just after gatesgarth branch is released i will push patches to update Xen SRCREV in both 4.14 and master (which will also allow to remove some patches).
I will also spend some time checking dunfell but right now i have no results i can share.

Cheers
Bertrand

Quoted 10 lines

Christopher

Quoted 7 lines
recipes-extended/xen/xen-tools.inc +0 -1
--

2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Reviewed-by
#6 lore raw

Re: [meta-virtualization] [PATCH 1/2] xen: Fix python libraries installation on multilib

Quoted 13 lines · Bertrand Marquis

Hi Christopher,

Quoted 10 lines · Christopher Clark
Quoted 5 lines · Bertrand Marquis

Fix install path for xen python libraries when multilib configuration is activated (which is mandatory to compile xen for x86_64). Depending on the version of Xen, the libraries are installed on lib or on the nonarch lib directory so add both.

Quoted 7 lines
Quoted 2 lines

Thanks, Bertrand -- I have positive results for this with compile-tests with both Xen 4.14 and 4.15 for x86_64.

I tried on x86_64 and also on arm32 and arm64 and all compile tests are now passing.

Quoted 2 lines
Quoted 2 lines
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines

Change-Id: I1f7f81a4e9e1420bce55d1e4bfe03d98ac2c93a3
---
recipes-extended/xen/xen-tools.inc | 2 ++

1 file changed, 2 insertions(+)
recipes-extended/xen/xen-tools.inc +0 -0
index 736a766..0c69fec 100644
@@ -496,7 +496,9 @@ FILES_${PN}-pygrub = "\
    ${libdir}/xen/bin/pygrub \
    "
 
Quoted 9 lines

recipes-extended/xen/xen-tools.inc FILES_${PN}-pygrub = "\ · line 503

Quoted 5 lines
recipes-extended/xen/xen-tools.inc +2 -0
+# Depending on the version of Xen libdir or nonarch libdir is used
 FILES_${PN}-python = "\
+    ${libdir}/${PYTHON_DIR} \
    ${nonarch_libdir}/${PYTHON_DIR} \
    "

Do you know whether a similar change is also needed for the python nonarch_libdir items in the -dbg package, when building older versions of Xen?

Quoted 4 lines

No from my tests this is not needed.
Just after gatesgarth branch is released i will push patches to update Xen SRCREV in both 4.14 and master (which will also allow to remove some patches).
I will also spend some time checking dunfell but right now i have no results i can share.

Excellent - thanks.

Christopher

Quoted 19 lines

Cheers
Bertrand

Quoted 10 lines

Christopher

Quoted 7 lines
recipes-extended/xen/xen-tools.inc +0 -1
--

2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#7 lore raw
In reply to Bertrand Marquis
Quoted 6 lines · Bertrand Marquis

This serie contain 2 patches to fix Xen compilation:
- on arm32 by adding a patch already merged in Xen master to fix gcc10 compilation issues.
- on x86 to fix an issue happening when compiling xen-tools with older xen versions.

Reviewed - thanks.

Quoted 1 line

Those would be good candidates to include in gatesgarth.

Agreed.

Christopher

Quoted 18 lines

Bertrand Marquis (2):
xen: Fix python libraries installation on multilib
xen: Fix xenpmd compilation error on arm32

 ...ls-xenpmd-Fix-gcc10-snprintf-warning.patch | 60 +++++++++++++++++++
 recipes-extended/xen/xen-tools.inc            |  2 +
 recipes-extended/xen/xen-tools_4.14.bb        |  1 +
 recipes-extended/xen/xen-tools_git.bb         |  1 +
 4 files changed, 64 insertions(+)
 create mode 100644 recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch

--
2.17.1

#8 lore raw
In reply to Bertrand Marquis

In message: [meta-virtualization] [PATCH 0/2] Fix Xen compilation

Quoted 7 lines · on 09/11/2020 Bertrand Marquis wrote:

This serie contain 2 patches to fix Xen compilation:
- on arm32 by adding a patch already merged in Xen master to fix gcc10 compilation issues.
- on x86 to fix an issue happening when compiling xen-tools with older xen versions.

Those would be good candidates to include in gatesgarth.

merged.

And yes, I haven't branched gatesgarth yet, so they will be part of that.

Bruce

Quoted 19 lines

Bertrand Marquis (2):
xen: Fix python libraries installation on multilib
xen: Fix xenpmd compilation error on arm32

 ...ls-xenpmd-Fix-gcc10-snprintf-warning.patch | 60 +++++++++++++++++++
 recipes-extended/xen/xen-tools.inc            |  2 +
 recipes-extended/xen/xen-tools_4.14.bb        |  1 +
 recipes-extended/xen/xen-tools_git.bb         |  1 +
 4 files changed, 64 insertions(+)
 create mode 100644 recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch
Signature · 1 line
2.17.1
#9 lore raw
Quoted 13 lines · Bruce Ashfield via lists.yoctoproject.org

In message: [meta-virtualization] [PATCH 0/2] Fix Xen compilation

Quoted 6 lines · on 09/11/2020 Bertrand Marquis wrote:

This serie contain 2 patches to fix Xen compilation:
- on arm32 by adding a patch already merged in Xen master to fix gcc10 compilation issues.
- on x86 to fix an issue happening when compiling xen-tools with older xen versions.

Quoted 3 lines
Quoted 1 line

Those would be good candidates to include in gatesgarth.

merged.

Thanks

Quoted 2 lines

And yes, I haven't branched gatesgarth yet, so they will be part of that.

Perfect.

Cheers
Bertrand

Quoted 26 lines

Bruce

Quoted 19 lines

Bertrand Marquis (2):
xen: Fix python libraries installation on multilib
xen: Fix xenpmd compilation error on arm32

...ls-xenpmd-Fix-gcc10-snprintf-warning.patch | 60 +++++++++++++++++++
recipes-extended/xen/xen-tools.inc            |  2 +
recipes-extended/xen/xen-tools_4.14.bb        |  1 +
recipes-extended/xen/xen-tools_git.bb         |  1 +
4 files changed, 64 insertions(+)

create mode 100644 recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch

--
2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.