Skip to contentSkip to conversation

libxl: Fix the bug introduced in commit "libxl: use correct type modifier for vuart_gfn"

PATCH Superseded Bhupinder Thakur 3 participants 15 messages Oct 25, 2017 – Oct 30, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 libxl: Fix the bug introduced in commit "libxl: use correct type modifier for vuart_gfn"

In libxl__device_vuart_add vuart_gfn is getting stored as a hex value:

Quoted 1 line

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

However, xenstore reads this value as a decimal value and tries to map the wrong address and fails.

This patch introduces a new format specifier "PRIu_xen_pfn" which formats the value as a decimal value.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Andrew Cooper <[email protected]>

 tools/libxl/libxl_console.c       | 2 +-
 xen/include/public/arch-arm.h     | 1 +
 xen/include/public/arch-x86/xen.h | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
tools/libxl/libxl_console.c +1 -1
index c05dc28..6bfc0e5 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("%"PRI_xen_pfn, state->vuart_gfn));
+    flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->vuart_gfn));
     flexarray_append(ro_front, "limit");
     flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT));
     flexarray_append(ro_front, "type");
xen/include/public/arch-arm.h +1 -0
index 5708cd2..05fd11c 100644
@@ -274,6 +274,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);
 
 typedef uint64_t xen_pfn_t;
 #define PRI_xen_pfn PRIx64
+#define PRIu_xen_pfn PRIu64
 
 /* Maximum number of virtual CPUs in legacy multi-processor guests. */
 /* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */
xen/include/public/arch-x86/xen.h +1 -0
index ff91831..3b0b1d6 100644
@@ -75,6 +75,7 @@ __DeFiNe__ __DECL_REG_LO16(name) e ## name
 #ifndef __ASSEMBLY__
 typedef unsigned long xen_pfn_t;
 #define PRI_xen_pfn "lx"
+#define PRIu_xen_pfn "lu"
 #endif
 
 #define XEN_HAVE_PV_GUEST_ENTRY 1
Signature · 7 lines
2.7.4


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

PATCH v2 2/5 libxl: Change the type of console_mfn to xen_pfn_t

Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/libxl/libxl_console.c  | 2 +-
 tools/libxl/libxl_dom.c      | 2 +-
 tools/libxl/libxl_internal.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
tools/libxl/libxl_console.c +1 -1
index 6bfc0e5..f2ca689 100644
@@ -329,7 +329,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
         flexarray_append(ro_front, "port");
         flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
         flexarray_append(ro_front, "ring-ref");
-        flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
+        flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->console_mfn));
     } else {
         flexarray_append(front, "state");
         flexarray_append(front, GCSPRINTF("%d", XenbusStateInitialising));
tools/libxl/libxl_dom.c +1 -1
index ef834e6..a58e74f 100644
@@ -869,7 +869,7 @@ out:
 static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
                                 libxl_domain_build_info *info,
                                 int store_evtchn, unsigned long *store_mfn,
-                                int console_evtchn, unsigned long *console_mfn,
+                                int console_evtchn, xen_pfn_t *console_mfn,
                                 domid_t store_domid, domid_t console_domid)
 {
     struct hvm_info_table *va_hvm;
tools/libxl/libxl_internal.h +1 -1
index 45e6df6..f52aeb3 100644
@@ -1128,7 +1128,7 @@ typedef struct {
 
     uint32_t console_port;
     uint32_t console_domid;
-    unsigned long console_mfn;
+    xen_pfn_t console_mfn;
     char *console_tty;
 
     char *saved_state;
Signature · 7 lines
2.7.4


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

Re: [PATCH 2/5 v2] libxl: Change the type of console_mfn to xen_pfn_t

Quoted 6 lines · Bhupinder Thakur

Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t.

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

#3 lore raw

Re: [PATCH 2/5 v2] libxl: Change the type of console_mfn to xen_pfn_t

In reply to Bhupinder Thakur
Quoted 25 lines · Bhupinder Thakur

Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/libxl/libxl_console.c  | 2 +-
 tools/libxl/libxl_dom.c      | 2 +-
 tools/libxl/libxl_internal.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
tools/libxl/libxl_console.c +0 -0
index 6bfc0e5..f2ca689 100644

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

Quoted 5 lines
tools/libxl/libxl_console.c +1 -1
@@ -329,7 +329,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
         flexarray_append(ro_front, "port");
         flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
         flexarray_append(ro_front, "ring-ref");
-        flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
+        flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->console_mfn));

Actually, please consider changing console_mfn to console_pfn.

You can keep my ack if you make such change.

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

#4 lore raw

Re: [PATCH 2/5 v2] libxl: Change the type of console_mfn to xen_pfn_t

Quoted 21 lines · Wei Liu
Quoted 20 lines · Bhupinder Thakur

Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/libxl/libxl_console.c  | 2 +-
 tools/libxl/libxl_dom.c      | 2 +-
 tools/libxl/libxl_internal.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Quoted 11 lines

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

Quoted 10 lines
tools/libxl/libxl_console.c +1 -1
index 6bfc0e5..f2ca689 100644
@@ -329,7 +329,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
         flexarray_append(ro_front, "port");
         flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
         flexarray_append(ro_front, "ring-ref");
-        flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
+        flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->console_mfn));

Actually, please consider changing console_mfn to console_pfn.

If you are going to make this change, then it is a gfn, not a pfn. (console_pfn would be as equally wrong for PV guests as console_mfn is currently wrong for HVM guest.)

~Andrew

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

#5 lore raw

Re: [PATCH 2/5 v2] libxl: Change the type of console_mfn to xen_pfn_t

Hi,

Quoted 34 lines · Andrew Cooper
Quoted 21 lines · Wei Liu
Quoted 20 lines · Bhupinder Thakur

Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/libxl/libxl_console.c  | 2 +-
 tools/libxl/libxl_dom.c      | 2 +-
 tools/libxl/libxl_internal.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Quoted 11 lines

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

Quoted 10 lines
tools/libxl/libxl_console.c +1 -1
index 6bfc0e5..f2ca689 100644
@@ -329,7 +329,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
         flexarray_append(ro_front, "port");
         flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
         flexarray_append(ro_front, "ring-ref");
-        flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
+        flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->console_mfn));

Actually, please consider changing console_mfn to console_pfn.

Quoted 3 lines

If you are going to make this change, then it is a gfn, not a pfn. (console_pfn would be as equally wrong for PV guests as console_mfn is currently wrong for HVM guest.)

Changing console_mfn to console_gfn will require changes in many files. Should I go ahead and change all the files?

Regards,
Bhupinder

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

#6 lore raw

Re: [PATCH 2/5 v2] libxl: Change the type of console_mfn to xen_pfn_t

Quoted 37 lines · Bhupinder Thakur

Hi,

Quoted 34 lines · Andrew Cooper
Quoted 32 lines · Wei Liu
Quoted 25 lines · Bhupinder Thakur

Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/libxl/libxl_console.c  | 2 +-
 tools/libxl/libxl_dom.c      | 2 +-
 tools/libxl/libxl_internal.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
tools/libxl/libxl_console.c +0 -0
index 6bfc0e5..f2ca689 100644

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

Quoted 5 lines
tools/libxl/libxl_console.c +1 -1
@@ -329,7 +329,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
         flexarray_append(ro_front, "port");
         flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
         flexarray_append(ro_front, "ring-ref");
-        flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
+        flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->console_mfn));

Actually, please consider changing console_mfn to console_pfn.

Quoted 7 lines
Quoted 3 lines

If you are going to make this change, then it is a gfn, not a pfn. (console_pfn would be as equally wrong for PV guests as console_mfn is currently wrong for HVM guest.)

Changing console_mfn to console_gfn will require changes in many files. Should I go ahead and change all the files?

$ cd libxl && git grep \\bconsole_mfn | wc -l
14

Not too bad, so please go ahead.

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

#7 lore raw

PATCH v2 3/5 libxc: Fix the data type of mfn parameter passed to xc_map_foreign_range()

In reply to Bhupinder Thakur

Currently the data type of mfn parameter passed to xc_map_foreign_range() is unsigned long. This could be problem for 32-bit arm architectures where the lengh of long is 32 bits while mfn happens to be a 64-bit value.

To avoid truncating a 64-bit value, the type of mfn is changed from "unsigned long" to xen_pfn_t. Also the parameter name "mfn" is changed to "pfn" which is a more accurate indication of what this parameter represents.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/libxc/include/xenctrl_compat.h | 2 +-
 tools/libxc/xc_foreign_memory.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
tools/libxc/include/xenctrl_compat.h +1 -1
index a655e47..5ee72bf 100644
@@ -26,7 +26,7 @@
  */
 void *xc_map_foreign_range(xc_interface *xch, uint32_t dom,
                             int size, int prot,
-                            unsigned long mfn );
+                            xen_pfn_t pfn);
 
 void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot,
                            const xen_pfn_t *arr, int num );
tools/libxc/xc_foreign_memory.c +2 -2
index 4053d26..c1f114a 100644
@@ -33,7 +33,7 @@ void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot,
 
 void *xc_map_foreign_range(xc_interface *xch,
                            uint32_t dom, int size, int prot,
-                           unsigned long mfn)
+                           xen_pfn_t pfn)
 {
     xen_pfn_t *arr;
     int num;
@@ -46,7 +46,7 @@ void *xc_map_foreign_range(xc_interface *xch,
         return NULL;
 
     for ( i = 0; i < num; i++ )
-        arr[i] = mfn + i;
+        arr[i] = pfn + i;
 
     ret = xc_map_foreign_pages(xch, dom, prot, arr, num);
     free(arr);
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 3/5
#8 lore raw

Re: [PATCH 3/5 v2] libxc: Fix the data type of mfn parameter passed to xc_map_foreign_range()

Quoted 9 lines · Bhupinder Thakur

Currently the data type of mfn parameter passed to xc_map_foreign_range() is unsigned long. This could be problem for 32-bit arm architectures where the lengh of long is 32 bits while mfn happens to be a 64-bit value.

To avoid truncating a 64-bit value, the type of mfn is changed from "unsigned long" to xen_pfn_t. Also the parameter name "mfn" is changed to "pfn" which is a more accurate indication of what this parameter represents.

But this should either come before #2 or be squashed into it.

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

#9 lore raw

PATCH v2 4/5 xenconsole: Change the type of ring_ref to xen_pfn_t in console_create_ring

In reply to Bhupinder Thakur

Currently, ring_ref is read as an integer in console_create_ring which could lead to truncation of the value as it is reading a 64-bit value.

The fix is to modify the type of ring_ref to xen_pfn_t and use the correct format specifier to read the value correctly for all architectures.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/console/daemon/io.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
tools/console/daemon/io.c +12 -4
index e22009a..1839973 100644
@@ -19,6 +19,7 @@
 
 #define _GNU_SOURCE
 
+#include <inttypes.h>
 #include "utils.h"
 #include "io.h"
 #include <xenevtchn.h>
@@ -81,6 +82,12 @@ static unsigned int nr_fds;
 
 #define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
 
+#if defined(CONFIG_ARM)
+# define SCNi_xen_pfn SCNi64
+#else
+# define SCNi_xen_pfn "li"
+#endif
+
 struct buffer {
 	char *data;
 	size_t consumed;
@@ -98,7 +105,7 @@ struct console {
 	struct buffer buffer;
 	char *xspath;
 	char *log_suffix;
-	int ring_ref;
+	xen_pfn_t ring_ref;
 	xenevtchn_handle *xce_handle;
 	int xce_pollfd_idx;
 	int event_count;
@@ -661,12 +668,13 @@ static void console_unmap_interface(struct console *con)
  
 static int console_create_ring(struct console *con)
 {
-	int err, remote_port, ring_ref, rc;
+	int err, remote_port, rc;
+	xen_pfn_t ring_ref;
 	char *type, path[PATH_MAX];
 	struct domain *dom = con->d;
 
 	err = xs_gather(xs, con->xspath,
-			"ring-ref", "%u", &ring_ref,
+			"ring-ref", "%"SCNi_xen_pfn, &ring_ref,
 			"port", "%i", &remote_port,
 			NULL);
 
@@ -705,7 +713,7 @@ static int console_create_ring(struct console *con)
 		con->interface = xc_map_foreign_range(
 			xc, dom->domid, XC_PAGE_SIZE,
 			PROT_READ|PROT_WRITE,
-			(unsigned long)ring_ref);
+			ring_ref);
 		if (con->interface == NULL) {
 			err = EINVAL;
 			goto out;
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 4/5
#10 lore raw

Re: [PATCH 4/5 v2] xenconsole: Change the type of ring_ref to xen_pfn_t in console_create_ring

Quoted 7 lines · Bhupinder Thakur

Currently, ring_ref is read as an integer in console_create_ring which could lead to truncation of the value as it is reading a 64-bit value.

The fix is to modify the type of ring_ref to xen_pfn_t and use the correct format specifier to read the value correctly for all architectures.

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

#11 lore raw

PATCH v2 5/5 xenconsole: Define and use a macro XEN_INVALID_PFN instead of -1

In reply to Bhupinder Thakur

xenconsole will use a new macro XEN_INVALID_PFN instead of -1 for initializing ring-ref.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

This patch is as per the review of commit fa1f157
libxl: Fix the bug introduced in commit "libxl: use correct type

 tools/console/daemon/io.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
tools/console/daemon/io.c +7 -5
index 1839973..aa291db 100644
@@ -62,6 +62,8 @@
 /* Duration of each time period in ms */
 #define RATE_LIMIT_PERIOD 200
 
+#define XEN_INVALID_PFN (~(xen_pfn_t)0)
+
 extern int log_reload;
 extern int log_guest;
 extern int log_hv;
@@ -658,12 +660,12 @@ static void console_unmap_interface(struct console *con)
 {
 	if (con->interface == NULL)
 		return;
-	if (xgt_handle && con->ring_ref == -1)
+	if (xgt_handle && con->ring_ref == XEN_INVALID_PFN)
 		xengnttab_unmap(xgt_handle, con->interface, 1);
 	else
 		munmap(con->interface, XC_PAGE_SIZE);
 	con->interface = NULL;
-	con->ring_ref = -1;
+	con->ring_ref = XEN_INVALID_PFN;
 }
  
 static int console_create_ring(struct console *con)
@@ -698,7 +700,7 @@ static int console_create_ring(struct console *con)
 	free(type);
 
 	/* If using ring_ref and it has changed, remap */
-	if (ring_ref != con->ring_ref && con->ring_ref != -1)
+	if (ring_ref != con->ring_ref && con->ring_ref != XEN_INVALID_PFN)
 		console_unmap_interface(con);
 
 	if (!con->interface && xgt_handle && con->use_gnttab) {
@@ -706,7 +708,7 @@ static int console_create_ring(struct console *con)
 		con->interface = xengnttab_map_grant_ref(xgt_handle,
 			dom->domid, GNTTAB_RESERVED_CONSOLE,
 			PROT_READ|PROT_WRITE);
-		con->ring_ref = -1;
+		con->ring_ref = XEN_INVALID_PFN;
 	}
 	if (!con->interface) {
 		/* Fall back to xc_map_foreign_range */
@@ -812,7 +814,7 @@ static int console_init(struct console *con, struct domain *dom, void **data)
 	con->master_pollfd_idx = -1;
 	con->slave_fd = -1;
 	con->log_fd = -1;
-	con->ring_ref = -1;
+	con->ring_ref = XEN_INVALID_PFN;
 	con->local_port = -1;
 	con->remote_port = -1;
 	con->xce_pollfd_idx = -1;
Signature · 7 lines
2.7.4


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

Re: [PATCH 5/5 v2] xenconsole: Define and use a macro XEN_INVALID_PFN instead of -1

Quoted 1 line · Bhupinder Thakur

xenconsole will use a new macro XEN_INVALID_PFN instead of -1 for initializing ring-ref.

Can you please paste in the error if the compilation fails with -1?

The way this series is arranged make me wonder if the compilation is broken half way. We should avoid that.

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

#13 lore raw

Re: [PATCH 5/5 v2] xenconsole: Define and use a macro XEN_INVALID_PFN instead of -1

Hi Wei,

Quoted 7 lines · Wei Liu
Quoted 1 line · Bhupinder Thakur

xenconsole will use a new macro XEN_INVALID_PFN instead of -1 for initializing ring-ref.

Can you please paste in the error if the compilation fails with -1?

The way this series is arranged make me wonder if the compilation is broken half way. We should avoid that.

It is not breaking the compilation. Since the type of ring_ref is changed to xen_pfn_t (which is an unsigned value) assigning -1 appeared to be confusing. For better clarity, XEN_INVALID_PFN is introduced.

Regards,
Bhupinder

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

#14 lore raw

Re: [PATCH 5/5 v2] xenconsole: Define and use a macro XEN_INVALID_PFN instead of -1

Quoted 6 lines · Bhupinder Thakur

Hi Wei,

Quoted 3 lines · Wei Liu
Quoted 1 line · Bhupinder Thakur

xenconsole will use a new macro XEN_INVALID_PFN instead of -1 for initializing ring-ref.

Quoted 8 lines
Quoted 4 lines

Can you please paste in the error if the compilation fails with -1?

The way this series is arranged make me wonder if the compilation is broken half way. We should avoid that.

It is not breaking the compilation. Since the type of ring_ref is changed to xen_pfn_t (which is an unsigned value) assigning -1 appeared to be confusing. For better clarity, XEN_INVALID_PFN is introduced.

I will update the commit message accordingly.

Regards,
Bhupinder

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