Skip to contentSkip to conversation

Remove PAGE_SIZE from public headers

PATCH In review [email protected] 5 participants 13 messages Oct 19, 2016 – Oct 21, 2016

lore
Share & tools
lore
#0 lore raw

v2 cover Remove PAGE_SIZE from public headers

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

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

#1 lore raw

PATCH v2 1/2 usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE

Do not reference PAGE_SIZE directly: it could be undefined, or it could have different values in the frontend or in the backend.

Define USBIF_RING_SIZE as 4096, assuming all users of usbif.h have 4K page granularity. Replace PAGE_SIZE with USBIF_RING_SIZE.

---
 xen/include/public/io/usbif.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/include/public/io/usbif.h +3 -2
index 4053c24..c6a5863 100644
@@ -170,6 +170,7 @@ enum usb_spec_version {
 
 #define USBIF_MAX_SEGMENTS_PER_REQUEST (16)
 #define USBIF_MAX_PORTNR	31
+#define USBIF_RING_SIZE	4096
 
 /*
  * RING for transferring urbs.
@@ -226,7 +227,7 @@ struct usbif_urb_response {
 typedef struct usbif_urb_response usbif_urb_response_t;
 
 DEFINE_RING_TYPES(usbif_urb, struct usbif_urb_request, struct usbif_urb_response);
-#define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, PAGE_SIZE)
+#define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, USBIF_RING_SIZE)
 
 /*
  * RING for notifying connect/disconnect events to frontend
@@ -248,6 +249,6 @@ struct usbif_conn_response {
 typedef struct usbif_conn_response usbif_conn_response_t;
 
 DEFINE_RING_TYPES(usbif_conn, struct usbif_conn_request, struct usbif_conn_response);
-#define USB_CONN_RING_SIZE __CONST_RING_SIZE(usbif_conn, PAGE_SIZE)
+#define USB_CONN_RING_SIZE __CONST_RING_SIZE(usbif_conn, USBIF_RING_SIZE)
 
 #endif /* __XEN_PUBLIC_IO_USBIF_H__ */
Signature · 7 lines
1.9.1


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

PATCH v2 2/2 vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

Do not reference PAGE_SIZE directly: it could be undefined, or it could have different values in the frontend or in the backend.

Define VSCSIIF_PAGE_SIZE as 4096, assuming all users of vscsiif.h have 4K page granularity. Replace PAGE_SIZE with VSCSIIF_PAGE_SIZE.

---
 xen/include/public/io/vscsiif.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/include/public/io/vscsiif.h +2 -1
index 0a4709f..d0bd3b5 100644
@@ -248,6 +248,7 @@
  */
 #define VSCSIIF_MAX_COMMAND_SIZE         16
 #define VSCSIIF_SENSE_BUFFERSIZE         96
+#define VSCSIIF_PAGE_SIZE              4096
 
 struct scsiif_request_segment {
     grant_ref_t gref;
@@ -256,7 +257,7 @@ struct scsiif_request_segment {
 };
 typedef struct scsiif_request_segment vscsiif_segment_t;
 
-#define VSCSIIF_SG_PER_PAGE (PAGE_SIZE / sizeof(struct scsiif_request_segment))
+#define VSCSIIF_SG_PER_PAGE (VSCSIIF_PAGE_SIZE / sizeof(struct scsiif_request_segment))
 
 /* Size of one request is 252 bytes */
 struct vscsiif_request {
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw
In reply to [email protected]
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

Juergen

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

#4 lore raw
Quoted 15 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

What do people think about this?

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

#5 lore raw
Quoted 26 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

Quoted 6 lines

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

~Andrew

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

#6 lore raw
Quoted 32 lines · Andrew Cooper
Quoted 31 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

Quoted 7 lines
Quoted 1 line

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

Indeed, you are right. Since you are at it, feel like acking the current patches? :-)

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

#7 lore raw
Quoted 33 lines · Stefano Stabellini
Quoted 32 lines · Andrew Cooper
Quoted 31 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

Indeed, you are right. Since you are at it, feel like acking the current patches? :-)

Good point. Acked-by: Andrew Cooper <[email protected]>, although you also need a release ack at this point.

~Andrew

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

#8 lore raw
Quoted 38 lines · Andrew Cooper
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Andrew Cooper
Quoted 26 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

Quoted 6 lines

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

Indeed, you are right. Since you are at it, feel like acking the current patches? :-)

Good point. Acked-by: Andrew Cooper <[email protected]>, although you also need a release ack at this point.

Wei, I also need a release ack for

http://marc.info/?l=xen-devel&m=147690490302553

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

#9 lore raw
Quoted 44 lines · Stefano Stabellini
Quoted 43 lines · Andrew Cooper
Quoted 41 lines · Stefano Stabellini
Quoted 32 lines · Andrew Cooper
Quoted 31 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

Quoted 6 lines
Quoted 1 line

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

Indeed, you are right. Since you are at it, feel like acking the current patches? :-)

Quoted 6 lines
Quoted 2 lines

Good point. Acked-by: Andrew Cooper <[email protected]>, although you also need a release ack at this point.

Wei, I also need a release ack for

http://marc.info/?l=xen-devel&m=147690490302553

Presumably you want to apply that to our QEMU tree? If so:

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

#10 lore raw
Quoted 48 lines · Wei Liu
Quoted 47 lines · Stefano Stabellini
Quoted 45 lines · Andrew Cooper
Quoted 33 lines · Stefano Stabellini
Quoted 32 lines · Andrew Cooper
Quoted 31 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

Indeed, you are right. Since you are at it, feel like acking the current patches? :-)

Good point. Acked-by: Andrew Cooper <[email protected]>, although you also need a release ack at this point.

Quoted 7 lines
Quoted 3 lines

Wei, I also need a release ack for

http://marc.info/?l=xen-devel&m=147690490302553

Presumably you want to apply that to our QEMU tree? If so:

I sent a pull request to qemu with the patch and applied it to staging.

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

Acked-by
#11 lore raw
In reply to Andrew Cooper
Quoted 38 lines · Andrew Cooper
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Andrew Cooper
Quoted 26 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

Quoted 6 lines

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

Indeed, you are right. Since you are at it, feel like acking the current patches? :-)

Good point. Acked-by: Andrew Cooper <[email protected]>, although you also need a release ack at this point.

And applied.

Quoted 1 line

~Andrew

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

#12 lore raw
Quoted 44 lines · Wei Liu
Quoted 43 lines · Andrew Cooper
Quoted 41 lines · Stefano Stabellini
Quoted 32 lines · Andrew Cooper
Quoted 31 lines · Stefano Stabellini
Quoted 14 lines · Juergen Gross
Quoted 5 lines · On 19/10/16 21:21, [email protected] wrote:

Reference to PAGE_SIZE slipped in to two public header files. QEMU build on ARM64 is broken by this. PAGE_SIZE should not be used because it could be undefined or it could be defined differently on different operating systems.

Quoted 8 lines

Stefano Stabellini (2):
usbif.h: replace PAGE_SIZE with USBIF_RING_SIZE vscsiif.h: replace PAGE_SIZE with VSCSIIF_PAGE_SIZE

 xen/include/public/io/usbif.h   | 5 +++--
 xen/include/public/io/vscsiif.h | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)
Quoted 7 lines

In principle I'm okay with these changes. But wouldn't it be better to add

#define XEN_RING_PAGE_SIZE 4096

to xen/include/public/io/ring.h instead of having each interface file its own definition?

I would prefer to avoid having to spell out the page size for all the io interfaces, because the same interfaces should work fine with other page granularities, if the grant table hypercalls supported them.

However in reality frontend and backend would have to agree on the page granularity to use beforehand. Some sort of consensus protocol is required. When that protocol is introduced, we could get rid of #define XEN_RING_PAGE_SIZE 4096.

Quoted 6 lines
Quoted 1 line

What do people think about this?

Not all current rings are 4k in size, and not all future rings should be implicitly restricted to 4k.

-1 to this introducing XEN_RING_PAGE_SIZE. It will be more confusing than helpful.

Indeed, you are right. Since you are at it, feel like acking the current patches? :-)

Quoted 8 lines
Quoted 3 lines

Good point. Acked-by: Andrew Cooper <[email protected]>, although you also need a release ack at this point.

And applied.

Thanks. Please backport to stable trees.

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