Skip to contentSkip to conversation

ARM32 - build-issues with xen/arm: vpl011: Add a new vuart node in the xenstore

DISCUSSION Konrad Rzeszutek Wilk 4 participants 7 messages Oct 5, 2017 – Oct 13, 2017

lore
Share & tools
lore
#0 lore raw

I get this when compiling under ARM32 (Ubuntu 15.04, gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2):

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

     flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
     ^

;

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw
Quoted 8 lines · Konrad Rzeszutek Wilk

I get this when compiling under ARM32 (Ubuntu 15.04, gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2):

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

     flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
     ^

;

My Wheezy 32bit chroot didn't catch this, sigh.

Does the following patch work?

From ae531197382bf0bc003606a9712075bdd22cfc24 Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Thu, 5 Oct 2017 10:35:28 +0100
Subject: [PATCH] libxl: use correct type modifier for vuart_gfn
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes compilation error like:

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

      flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
---
 tools/libxl/libxl_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_console.c +1 -1
index 13ecf128e2..c05dc28b99 100644
@@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "port");
     flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port));
     flexarray_append(ro_front, "ring-ref");
-    flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
+    flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));
     flexarray_append(ro_front, "limit");
     flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT));
     flexarray_append(ro_front, "type");
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Hi Wei,

Quoted 10 lines · Wei Liu
Quoted 8 lines · Konrad Rzeszutek Wilk

I get this when compiling under ARM32 (Ubuntu 15.04, gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2):

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

     flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
     ^

;

Quoted 4 lines

My Wheezy 32bit chroot didn't catch this, sigh.

Does the following patch work?

I verified that with this fix, the arm32 toolstack compiles fine.

Quoted 34 lines

From ae531197382bf0bc003606a9712075bdd22cfc24 Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Thu, 5 Oct 2017 10:35:28 +0100
Subject: [PATCH] libxl: use correct type modifier for vuart_gfn
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes compilation error like:

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

      flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
---
 tools/libxl/libxl_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_console.c +1 -2
index 13ecf128e2..c05dc28b99 100644
@@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "port");
     flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port));
     flexarray_append(ro_front, "ring-ref");
-    flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
+    flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));
     flexarray_append(ro_front, "limit");
     flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT));
     flexarray_append(ro_front, "type");
--
Quoted 2 lines

2.11.0

Regards,
Bhupinder

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 13 lines · Bhupinder Thakur

Hi Wei,

Quoted 10 lines · Wei Liu
Quoted 8 lines · Konrad Rzeszutek Wilk

I get this when compiling under ARM32 (Ubuntu 15.04, gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2):

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

     flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
     ^

;

Quoted 7 lines
Quoted 4 lines

My Wheezy 32bit chroot didn't catch this, sigh.

Does the following patch work?

I verified that with this fix, the arm32 toolstack compiles fine.

Thanks. I will commit this shortly.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
In reply to Wei Liu
Quoted 39 lines · Wei Liu
Quoted 8 lines · Konrad Rzeszutek Wilk

I get this when compiling under ARM32 (Ubuntu 15.04, gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2):

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

     flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
     ^

;

My Wheezy 32bit chroot didn't catch this, sigh.

Does the following patch work?

From ae531197382bf0bc003606a9712075bdd22cfc24 Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Thu, 5 Oct 2017 10:35:28 +0100
Subject: [PATCH] libxl: use correct type modifier for vuart_gfn
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes compilation error like:

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

      flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
---
 tools/libxl/libxl_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_console.c +0 -0
index 13ecf128e2..c05dc28b99 100644

tools/libxl/libxl_console.c int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, · line 379

Quoted 5 lines
tools/libxl/libxl_console.c +1 -1
@@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "port");
     flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port));
     flexarray_append(ro_front, "ring-ref");
-    flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
+    flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));

Unfortunately, this is causing an issue as PRI_xen_pfn formats the value as a hexadecimal value but xenconsole later reads it as a decimal value and tries to map it, which fails and therefore vuart console initialization fails.

Earlier, I verified only 32-bit compilation but did not test the change. It was a miss from my side. I have tested now with the format string changed to PRIu64 and the vuart console is working fine.

Regards,
Bhupinder

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 49 lines · Bhupinder Thakur
Quoted 38 lines · Wei Liu
Quoted 8 lines · Konrad Rzeszutek Wilk

I get this when compiling under ARM32 (Ubuntu 15.04, gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2):

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

     flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
     ^

;

My Wheezy 32bit chroot didn't catch this, sigh.

Does the following patch work?

From ae531197382bf0bc003606a9712075bdd22cfc24 Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Thu, 5 Oct 2017 10:35:28 +0100
Subject: [PATCH] libxl: use correct type modifier for vuart_gfn
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes compilation error like:

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

      flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
---
 tools/libxl/libxl_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_console.c +0 -0
index 13ecf128e2..c05dc28b99 100644

tools/libxl/libxl_console.c int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, · line 379

Quoted 5 lines
tools/libxl/libxl_console.c +1 -1
@@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "port");
     flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port));
     flexarray_append(ro_front, "ring-ref");
-    flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
+    flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));

Unfortunately, this is causing an issue as PRI_xen_pfn formats the value as a hexadecimal value but xenconsole later reads it as a decimal value and tries to map it, which fails and therefore vuart console initialization fails.

Quoted 3 lines

Earlier, I verified only 32-bit compilation but did not test the change. It was a miss from my side. I have tested now with the format string changed to PRIu64 and the vuart console is working fine.

That however, would break x86.

andrewcoop@andrewcoop:/local/xen.git/xen$ git grep 'define PRI_xen_pfn' -- :/
include/public/arch-arm.h:276:#define PRI_xen_pfn PRIx64
include/public/arch-x86/xen.h:77:#define PRI_xen_pfn "lx"

The best way to fix this is to introduce a new define for both architectures which is PRIu64 and "lu" as appropriate.

Suggestions:

PRI_xen_pfn_dec
PRIu_xen_pfn

Neither are great, but the latter does follow the PRI nomenclature.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
Quoted 63 lines · Andrew Cooper
Quoted 49 lines · Bhupinder Thakur
Quoted 38 lines · Wei Liu
Quoted 8 lines · Konrad Rzeszutek Wilk

I get this when compiling under ARM32 (Ubuntu 15.04, gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2):

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

     flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
     ^

;

My Wheezy 32bit chroot didn't catch this, sigh.

Does the following patch work?

From ae531197382bf0bc003606a9712075bdd22cfc24 Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Thu, 5 Oct 2017 10:35:28 +0100
Subject: [PATCH] libxl: use correct type modifier for vuart_gfn
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes compilation error like:

libxl_console.c: In function ‘libxl__device_vuart_add’:
libxl_console.c:379:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘xen_pfn_t’ [-Werror=format=]

      flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
---
 tools/libxl/libxl_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_console.c +0 -0
index 13ecf128e2..c05dc28b99 100644

tools/libxl/libxl_console.c int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, · line 379

Quoted 5 lines
tools/libxl/libxl_console.c +1 -1
@@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "port");
     flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port));
     flexarray_append(ro_front, "ring-ref");
-    flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn));
+    flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));

Unfortunately, this is causing an issue as PRI_xen_pfn formats the value as a hexadecimal value but xenconsole later reads it as a decimal value and tries to map it, which fails and therefore vuart console initialization fails.

Quoted 3 lines

Earlier, I verified only 32-bit compilation but did not test the change. It was a miss from my side. I have tested now with the format string changed to PRIu64 and the vuart console is working fine.

That however, would break x86.

andrewcoop@andrewcoop:/local/xen.git/xen$ git grep 'define PRI_xen_pfn' -- :/
include/public/arch-arm.h:276:#define PRI_xen_pfn PRIx64
include/public/arch-x86/xen.h:77:#define PRI_xen_pfn "lx"

The best way to fix this is to introduce a new define for both architectures which is PRIu64 and "lu" as appropriate.

Quoted 6 lines

Suggestions:

PRI_xen_pfn_dec
PRIu_xen_pfn

Neither are great, but the latter does follow the PRI nomenclature.

Thanks. I will introduce this new format specifier.

Regards,
Bhupinder

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel