blkif: add indirect descriptors interface to public headers
PATCH 1/1 blkif: add indirect descriptors interface to public headers
Indirect descriptors introduce a new block operation (BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays of blkif_request_segment_aligned, this way we can send more segments in a request.
This interface is already implemented in Linux >= 3.11.
--- xen/include/public/io/blkif.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)
xen/include/public/io/blkif.h +51 -0
@@ -468,6 +468,30 @@#define BLKIF_OP_DISCARD 5/* +* Recognized if "feature-max-indirect-segments" in present in the backend +* xenbus info. The "feature-max-indirect-segments" node contains the maximum +* number of segments allowed by the backend per request. If the node is +* present, the frontend might use blkif_request_indirect structs in order to +* issue requests with more than BLKIF_MAX_SEGMENTS_PER_REQUEST (11). The +* maximum number of indirect segments is fixed by the backend, but the +* frontend can issue requests with any number of indirect segments as long as +* it's less than the number provided by the backend. The indirect_grefs field +* in blkif_request_indirect should be filled by the frontend with the +* grant references of the pages that are holding the indirect segments. +* This pages are filled with an array of blkif_request_segment_aligned +* that hold the information about the segments. The number of indirect +* pages to use is determined by the maximum number of segments +* an indirect request contains. Every indirect page can contain a maximum +* of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)), +* so to calculate the number of indirect pages to use we have to do +* ceil(indirect_segments/512). +* +* If a backend does not recognize BLKIF_OP_INDIRECT, it should *not* +* create the "feature-max-indirect-segments" node! +*/ +#define BLKIF_OP_INDIRECT 6 + +/* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE. * NB. This could be 12 if the ring indexes weren't stored in the same page.
@@ -475,6 +499,11 @@#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11/* +* Maximum number of indirect pages to use per request. +*/ +#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 + +/* * NB. first_sect and last_sect in blkif_request_segment, as well as * sector_number in blkif_request, are always expressed in 512-byte units. * However they must be properly aligned to the real sector size of the
@@ -517,6 +546,28 @@ struct blkif_request_discard { };typedef struct blkif_request_discard blkif_request_discard_t ; +struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ +uint64_t id;/* private guest value, echoed in resp */ +blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ +blkif_vdev_t handle;/* same as for read/write requests */ +grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST ]; +#ifdef __i386__ +uint64_t pad;/* Make it 64 byte aligned on i386 */ +#endif +}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect; +uint16_t _pad;/* padding to make it 8 bytes, so it's cache-aligned */ +}; +struct blkif_response {uint64_t id;/* copied from request */ uint8_t operation;/* copied from request */
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 77 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Roger Pau Monne
Sent: 12 November 2013 10:37
To: [email protected]
Cc: Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersIndirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.This interface is already implemented in Linux >= 3.11.
Signed-off-by Roger Pau Monné <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>--- xen/include/public/io/blkif.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)xen/include/public/io/blkif.h +2
-0@@ -468,6 +468,30 @@#define BLKIF_OP_DISCARD 5/* +* Recognized if "feature-max-indirect-segments" in present in the backend +* xenbus info. The "feature-max-indirect-segments" node contains the maximum
+ * number of segments allowed by the backend per request. If the node is
+ * present, the frontend might useblkif_request_indirectstructs in order to
+ * issue requests with more thanBLKIF_MAX_SEGMENTS_PER_REQUEST(11). The
+ * maximum number of indirect segments is fixed by the backend, but the
+ * frontend can issue requests with any number of indirect segments as long as
+ * it's less than the number provided by the backend. Theindirect_grefsfield
+ * inblkif_request_indirectshould be filled by the frontend with the
+ * grant references of the pages that are holding the indirect segments.
+ * This pages are filled with an array ofblkif_request_segment_aligned
+ * that hold the information about the segments. The number of indirect
+ * pages to use is determined by the maximum number of segments
+ * an indirect request contains. Every indirect page can contain a maximum
+ * of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)),
+ * so to calculate the number of indirect pages to use we have to do
+ *ceil(indirect_segments/512).
+ *
+ * If a backend does not recognizeBLKIF_OP_INDIRECT, it should *not*
+ * create the "feature-max-indirect-segments" node!
+ */xen/include/public/io/blkif.h +8
-0+#define BLKIF_OP_INDIRECT 6 + +/* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE. * NB. This could be 12 if the ring indexes weren't stored in the same page. @@ -475,6 +499,11 @@#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11/* +* Maximum number of indirect pages to use per request. +*/ +#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 + +/* * NB. first_sect and last_sect in blkif_request_segment, as well as * sector_number in blkif_request, are always expressed in 512-byte units. * However they must be properly aligned to the real sector size of the
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 7 lines
xen/include/public/io/blkif.h +4
-0@@ -517,6 +546,28 @@ struct blkif_request_discard { };typedef struct blkif_request_discard blkif_request_discard_t ; +struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */
This is going to be a problem. What alignment boundary are you expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Paul
Quoted 26 lines
xen/include/public/io/blkif.h +18
-0+uint64_t id;/* private guest value, echoed in resp */ +blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ +blkif_vdev_t handle;/* same as for read/write requests */ +grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST ]; +#ifdef __i386__ +uint64_t pad;/* Make it 64 byte aligned on i386 */ +#endif +}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect; +uint16_t _pad;/* padding to make it 8 bytes, so it's cache-aligned */ +}; +struct blkif_response {uint64_t id;/* copied from request */
uint8_toperation; /* copied from request */
--
1.7.7.5 (Apple Git-26)
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 80 lines · Paul Durrant
Quoted 80 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Roger Pau Monne
Sent: 12 November 2013 10:37
To: [email protected]
Cc: Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersIndirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.This interface is already implemented in Linux >= 3.11.
Signed-off-by Roger Pau Monné <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>--- xen/include/public/io/blkif.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)xen/include/public/io/blkif.h +2
-0@@ -468,6 +468,30 @@#define BLKIF_OP_DISCARD 5/* +* Recognized if "feature-max-indirect-segments" in present in the backend +* xenbus info. The "feature-max-indirect-segments" node contains the maximum
+ * number of segments allowed by the backend per request. If the node is
+ * present, the frontend might useblkif_request_indirectstructs in order to
+ * issue requests with more thanBLKIF_MAX_SEGMENTS_PER_REQUEST(11). The
+ * maximum number of indirect segments is fixed by the backend, but the
+ * frontend can issue requests with any number of indirect segments as long as
+ * it's less than the number provided by the backend. Theindirect_grefsfield
+ * inblkif_request_indirectshould be filled by the frontend with the
+ * grant references of the pages that are holding the indirect segments.
+ * This pages are filled with an array ofblkif_request_segment_aligned
+ * that hold the information about the segments. The number of indirect
+ * pages to use is determined by the maximum number of segments
+ * an indirect request contains. Every indirect page can contain a maximum
+ * of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)),
+ * so to calculate the number of indirect pages to use we have to do
+ *ceil(indirect_segments/512).
+ *
+ * If a backend does not recognizeBLKIF_OP_INDIRECT, it should *not*
+ * create the "feature-max-indirect-segments" node!
+ */xen/include/public/io/blkif.h +8
-0+#define BLKIF_OP_INDIRECT 6 + +/* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE. * NB. This could be 12 if the ring indexes weren't stored in the same page. @@ -475,6 +499,11 @@#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11/* +* Maximum number of indirect pages to use per request. +*/ +#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 + +/* * NB. first_sect and last_sect in blkif_request_segment, as well as * sector_number in blkif_request, are always expressed in 512-byte units. * However they must be properly aligned to the real sector size of the @@ -517,6 +546,28 @@ struct blkif_request_discard { };typedef struct blkif_request_discard blkif_request_discard_t ;
Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
The blkif request structure have always been a train wreck of ABI incompatibilities. The existing code in the backend for handling the existing structures should handle this in a similar way.
Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 559
Quoted 8 lines
xen/include/public/io/blkif.h +7
-0+uint64_t id;/* private guest value, echoed in resp */ +blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ +blkif_vdev_t handle;/* same as for read/write requests */ +grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST ]; +#ifdef __i386__ +uint64_t pad;/* Make it 64 byte aligned on i386 */ +#endif
This last field looks a bit odd though. Why is it needed?
Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 567
Quoted 8 lines
xen/include/public/io/blkif.h +8
-0+}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect;
Missing uint8_t padding here?
Quoted 2 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 569
Quoted 2 lines
xen/include/public/io/blkif.h +2
-0+uint16_t _pad;/* padding to make it 8 bytes, so it's cache-aligned */ +};
David
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 109 lines
-----Original Message-----
From: David Vrabel
Sent: 12 November 2013 14:12
To: Paul Durrant
Cc: Roger Pau Monne; [email protected]; Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 9 lines · Paul Durrant
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Roger Pau Monne
Sent: 12 November 2013 10:37
To: [email protected]
Cc: Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 4 lines
Quoted 4 lines
Indirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments ina
Quoted 19 lines
Quoted 19 lines
request.
This interface is already implemented in Linux >= 3.11.
Signed-off-by Roger Pau Monné <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>--- xen/include/public/io/blkif.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)xen/include/public/io/blkif.h +0
-0@@ -468,6 +468,30 @@#define BLKIF_OP_DISCARD 5Quoted 2 lines
xen/include/public/io/blkif.h line 471
Quoted 2 lines
xen/include/public/io/blkif.h +1
-0/* +* Recognized if "feature-max-indirect-segments" in present in the backend
Quoted 3 lines
Quoted 3 lines
xen/include/public/io/blkif.h +1
-0+* xenbus info. The "feature-max-indirect-segments" node contains the maximum
+ * number of segments allowed by the backend per request. If the nodeis
Quoted 1 line
Quoted 1 line
+ * present, the frontend might use
blkif_request_indirectstructs inorder to
Quoted 1 line
Quoted 1 line
+ * issue requests with more than
BLKIF_MAX_SEGMENTS_PER_REQUESTQuoted 2 lines
Quoted 2 lines
(11). The
+ * maximum number of indirect segments is fixed by the backend, butthe
Quoted 10 lines
Quoted 10 lines
+ * frontend can issue requests with any number of indirect segments as long as
+ * it's less than the number provided by the backend. Theindirect_grefsfield
+ * inblkif_request_indirectshould be filled by the frontend with the
+ * grant references of the pages that are holding the indirect segments.
+ * This pages are filled with an array ofblkif_request_segment_aligned
+ * that hold the information about the segments. The number of indirect
+ * pages to use is determined by the maximum number of segments
+ * an indirect request contains. Every indirect page can contain amaximum
Quoted 1 line
Quoted 1 line
+ * of 512 segments
(PAGE_SIZE/sizeof(blkif_request_segment_aligned)),
Quoted 4 lines
Quoted 4 lines
+ * so to calculate the number of indirect pages to use we have to do
+ *ceil(indirect_segments/512).
+ *
+ * If a backend does not recognizeBLKIF_OP_INDIRECT, it should *not*Quoted 8 lines
xen/include/public/io/blkif.h
Quoted 8 lines
+ * create the "feature-max-indirect-segments" node!
+ */xen/include/public/io/blkif.h +3
-0+#define BLKIF_OP_INDIRECT 6 + +/* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE. * NB. This could be 12 if the ring indexes weren't stored in the same page.
Quoted 11 lines
xen/include/public/io/blkif.h line 508
Quoted 11 lines
xen/include/public/io/blkif.h +5
-0@@ -475,6 +499,11 @@#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11/* +* Maximum number of indirect pages to use per request. +*/ +#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 + +/* * NB. first_sect and last_sect in blkif_request_segment, as well as * sector_number in blkif_request, are always expressed in 512-byte units.
Quoted 5 lines
Quoted 5 lines
xen/include/public/io/blkif.h +0
-0* However they must be properly aligned to the real sector size of the @@ -517,6 +546,28 @@ struct blkif_request_discard { };typedef struct blkif_request_discard blkif_request_discard_t ;Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 4 lines
The blkif request structure have always been a train wreck of ABI incompatibilities. The existing code in the backend for handling the existing structures should handle this in a similar way.
You mean the abi translation code? Why would we want to invoke that for a new data structure, when sticking a 32-bit pad here would solve the problem?
Paul
Quoted 22 lines
Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 559
Quoted 8 lines
xen/include/public/io/blkif.h +7
-0+uint64_t id;/* private guest value, echoed in resp */ +blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ +blkif_vdev_t handle;/* same as for read/write requests */ +grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST ]; +#ifdef __i386__ +uint64_t pad;/* Make it 64 byte aligned on i386 */ +#endif This last field looks a bit odd though. Why is it needed?
Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 567
Quoted 8 lines
xen/include/public/io/blkif.h +8
-0+}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect;Missing
uint8_tpadding here?
Quoted 4 lines
Quoted 2 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 569
Quoted 2 lines
xen/include/public/io/blkif.h +2
-0+uint16_t _pad;/* padding to make it 8 bytes, so it's cache-aligned */ +};David
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 12 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 8 lines · Paul Durrant
xen/include/public/io/blkif.h struct blkif_request_discard { · line 559
Quoted 8 lines
xen/include/public/io/blkif.h +4
-0+uint64_t id;/* private guest value, echoed in resp */ +blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ +blkif_vdev_t handle;/* same as for read/write requests */ + grant_ref_tindirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
xen/include/public/io/blkif.h +3
-0+#ifdef __i386__ +uint64_t pad;/* Make it 64 byte aligned on i386 */ +#endif This last field looks a bit odd though. Why is it needed?
On 64-bit there's a 32 bit hole before "id" and another one at the end of the structure. In order for the structure size to be as specified in the comment, both these holes need to be accounted for.
Quoted 10 lines
Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 567
Quoted 8 lines
xen/include/public/io/blkif.h +8
-0+}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect;Missing
uint8_tpadding here?
Note that there are _two_ uint8_t-s.
Jan
Quoted 13 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 8 lines · Paul Durrant
xen/include/public/io/blkif.h struct blkif_request_discard { · line 559
Quoted 8 lines
xen/include/public/io/blkif.h +4
-0+uint64_t id;/* private guest value, echoed in resp */ +blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ +blkif_vdev_t handle;/* same as for read/write requests */ + grant_ref_tindirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
xen/include/public/io/blkif.h +3
-0+#ifdef __i386__ +uint64_t pad;/* Make it 64 byte aligned on i386 */ +#endif This last field looks a bit odd though. Why is it needed?
Quoted 4 lines
On 64-bit there's a 32 bit hole before "id" and another one at the end of the structure. In order for the structure size to be as specified in the comment, both these holes need to be accounted for.
Ok.
Quoted 11 lines
Quoted 10 lines
Quoted 8 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 567
Quoted 8 lines
xen/include/public/io/blkif.h +8
-0+}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect;Missing
uint8_tpadding here?
Quoted 1 line
Note that there are _two_ uint8_t-s.
Doh. That's poor style though. A line per field, please.
David
Quoted 14 lines · David Vrabel
Quoted 13 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 8 lines · Paul Durrant
xen/include/public/io/blkif.h struct blkif_request_discard { · line 567
Quoted 8 lines
xen/include/public/io/blkif.h +8
-0+}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect;Missing
uint8_tpadding here?
Quoted 3 lines
Quoted 1 line
Note that there are _two_ uint8_t-s.
Doh. That's poor style though. A line per field, please.
I've mainly did it that way because that's how blkif_request_segment is currently defined in blkif.h, but I can split it in two lines.
Quoted 16 lines
Quoted 1 line
Quoted 1 line · Roger Pau Monné
Quoted 14 lines · David Vrabel
Quoted 13 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 8 lines · Paul Durrant
xen/include/public/io/blkif.h struct blkif_request_discard { · line 567
Quoted 8 lines
xen/include/public/io/blkif.h +8
-0+}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect;Missing
uint8_tpadding here?
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Note that there are _two_ uint8_t-s.
Doh. That's poor style though. A line per field, please.
I've mainly did it that way because that's how
blkif_request_segmentis currently defined inblkif.h, but I can split it in two lines.
In fact I'd prefer if it was kept in line with the other one. So _if_ you want to adjust the new one, please also adjust the old one.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · Roger Pau Monné
Quoted 16 lines · David Vrabel
Quoted 14 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 8 lines · Paul Durrant
Review
Quoted 8 lines
(quoted diff) +8
-0+}; +typedef struct blkif_request_indirect blkif_request_indirect_t; + +struct blkif_request_segment_aligned { + grant_ref_t gref; /* reference to I/O buffer frame */ + /* @first_sect: first sector in frame to transfer (inclusive). */ + /* @last_sect: last sector in frame to transfer (inclusive). */ + uint8_t first_sect, last_sect;Missing
uint8_tpadding here?Note that there are _two_ uint8_t-s.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Doh. That's poor style though. A line per field, please.
I've mainly did it that way because that's how
blkif_request_segmentis currently defined inblkif.h, but I can split it in two lines.In fact I'd prefer if it was kept in line with the other one. So _if_ you want to adjust the new one, please also adjust the old one.
I'm fine with leaving them as they are, but I can also change both if requested/needed for this to go in.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 80 lines · Paul Durrant
Quoted 80 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Roger Pau Monne
Sent: 12 November 2013 10:37
To: [email protected]
Cc: Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersIndirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.This interface is already implemented in Linux >= 3.11.
Signed-off-by Roger Pau Monné <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>--- xen/include/public/io/blkif.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)xen/include/public/io/blkif.h +2
-0@@ -468,6 +468,30 @@#define BLKIF_OP_DISCARD 5/* +* Recognized if "feature-max-indirect-segments" in present in the backend +* xenbus info. The "feature-max-indirect-segments" node contains the maximum
+ * number of segments allowed by the backend per request. If the node is
+ * present, the frontend might useblkif_request_indirectstructs in order to
+ * issue requests with more thanBLKIF_MAX_SEGMENTS_PER_REQUEST(11). The
+ * maximum number of indirect segments is fixed by the backend, but the
+ * frontend can issue requests with any number of indirect segments as long as
+ * it's less than the number provided by the backend. Theindirect_grefsfield
+ * inblkif_request_indirectshould be filled by the frontend with the
+ * grant references of the pages that are holding the indirect segments.
+ * This pages are filled with an array ofblkif_request_segment_aligned
+ * that hold the information about the segments. The number of indirect
+ * pages to use is determined by the maximum number of segments
+ * an indirect request contains. Every indirect page can contain a maximum
+ * of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)),
+ * so to calculate the number of indirect pages to use we have to do
+ *ceil(indirect_segments/512).
+ *
+ * If a backend does not recognizeBLKIF_OP_INDIRECT, it should *not*
+ * create the "feature-max-indirect-segments" node!
+ */xen/include/public/io/blkif.h +8
-0+#define BLKIF_OP_INDIRECT 6 + +/* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE. * NB. This could be 12 if the ring indexes weren't stored in the same page. @@ -475,6 +499,11 @@#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11/* +* Maximum number of indirect pages to use per request. +*/ +#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 + +/* * NB. first_sect and last_sect in blkif_request_segment, as well as * sector_number in blkif_request, are always expressed in 512-byte units. * However they must be properly aligned to the real sector size of the @@ -517,6 +546,28 @@ struct blkif_request_discard { };typedef struct blkif_request_discard blkif_request_discard_t ;
Quoted 7 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct blkif_request_indirect {
uint8_t indirect_op;
uint16_t nr_segments;
#ifdef CONFIG_X86_64
uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
#endif
uint64_t id;
blkif_sector_t sector_number;
blkif_vdev_t handle;
uint16_t _pad2;
grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; #ifdef CONFIG_X86_64
uint32_t _pad3; /* make it 64 byte aligned */
#else
uint64_t _pad3; /* make it 64 byte aligned */
#endif
} __attribute__((__packed__));
Wheew.
Quoted 36 lines
Paul
Quoted 26 lines
xen/include/public/io/blkif.h +18
-0+uint64_t id;/* private guest value, echoed in resp */ +blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ +blkif_vdev_t handle;/* same as for read/write requests */ +grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST ]; +#ifdef __i386__ +uint64_t pad;/* Make it 64 byte aligned on i386 */ +#endif +}; +typedef struct blkif_request_indirect blkif_request_indirect_t ; + +struct blkif_request_segment_aligned { +grant_ref_t gref;/* reference to I/O buffer frame */ +/* @first_sect: first sector in frame to transfer (inclusive). */ +/* @last_sect: last sector in frame to transfer (inclusive). */ +uint8_t first_sect, last_sect; +uint16_t _pad;/* padding to make it 8 bytes, so it's cache-aligned */ +}; +struct blkif_response {uint64_t id;/* copied from request */
uint8_toperation; /* copied from request */
--
1.7.7.5 (Apple Git-26)Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 6 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Quoted 6 lines
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));
That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some Intel standard?).
For ARM we reference the specific standard[0]. It is up to the guest OS to make sure that it's version of the headers lay things out following that standard (NB Linux blkif.h is currently buggy on ARM in this regard, Julien has the details).
Ian.
[0]
http://xenbits.xen.org/docs/unstable/hypercall/arm/include,public,arch-arm.h.html#incontents_arm_abi
Quoted 12 lines · Ian Campbell
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 6 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface headers.
Right. I had hit that at some point with putting in a u64 and seeing it mushroom up while if I did two u32 it padded it nicely.
Perhaps that is what we should do? The Linux struct has the same size whether it be 64-bit or 32-bit.
Quoted 5 lines
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some Intel standard?).
Or perhaps just mention the size of the structure and offset?
Quoted 11 lines
For ARM we reference the specific standard[0]. It is up to the guest OS to make sure that it's version of the headers lay things out following that standard (NB Linux
blkif.his currently buggy on ARM in this regard, Julien has the details).Ian.
[0]
http://xenbits.xen.org/docs/unstable/hypercall/arm/include,public,arch-arm.h.html#incontents_arm_abi
Quoted 20 lines · Konrad Rzeszutek Wilk
Quoted 19 lines · Ian Campbell
Quoted 16 lines · Konrad Rzeszutek Wilk
Quoted 6 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));
Quoted 6 lines
Quoted 1 line
That attribute packed isn't allowed in the public interface headers.
Right. I had hit that at some point with putting in a u64 and seeing it mushroom up while if I did two u32 it padded it nicely.
Perhaps that is what we should do?
What you should do is make the struct declare something which matches the required ABI. I don't really care how it is achieved on the Linux side.
Quoted 10 lines
The Linux struct has the same size
whether it be 64-bit or 32-bit.Quoted 5 lines
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some Intel standard?).
Or perhaps just mention the size of the structure and offset?
You'd need to do that for every field of every struct. Which is really why documentation of struct layout ABIs exist...
Ian.
Quoted 28 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 10 lines · Konrad Rzeszutek Wilk
Quoted 6 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Quoted 6 lines
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));
Quoted 7 lines
That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some Intel standard?).
Can we go for types aligned on their size then rather than gcc brokenness.
Paul
Quoted 10 lines
For ARM we reference the specific standard[0]. It is up to the guest OS to make sure that it's version of the headers lay things out following that standard (NB Linux
blkif.his currently buggy on ARM in this regard, Julien has the details).Ian.
[0]
http://xenbits.xen.org/docs/unstable/hypercall/arm/include,public,arch-
arm.h.html#incontents_arm_abi
Quoted 30 lines · Paul Durrant
Quoted 30 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 10 lines · Konrad Rzeszutek Wilk
Quoted 6 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Quoted 6 lines
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface headers.
Quoted 7 lines
Quoted 5 lines
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some Intel standard?).
Can we go for types aligned on their size then rather than gcc brokenness.
We should go for some existing well defined ABI spec not make up our own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Quoted 14 lines
Paul
Quoted 10 lines
For ARM we reference the specific standard[0]. It is up to the guest OS to make sure that it's version of the headers lay things out following that standard (NB Linux
blkif.his currently buggy on ARM in this regard, Julien has the details).Ian.
[0]
http://xenbits.xen.org/docs/unstable/hypercall/arm/include,public,arch-
arm.h.html#incontents_arm_abi
Quoted 48 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); JanBeulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 29 lines
Quoted 28 lines
public headers
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 6 lines
xen/include/public/io/blkif.h struct blkif_request_discard { · line 552
Quoted 4 lines
xen/include/public/io/blkif.h +4
-0+struct blkif_request_indirect { +uint8_t operation;/* BLKIF_OP_INDIRECT */ +uint8_t indirect_op;/* BLKIF_OP_{READ/WRITE} */ +uint16_t nr_segments;/* number of segments */ This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Quoted 6 lines
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some Intel standard?).
Quoted 8 lines
Quoted 1 line
Can we go for types aligned on their size then rather than gcc brokenness.
We should go for some existing well defined ABI spec not make up our own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
Paul
Quoted 15 lines
Quoted 14 lines
Paul
Quoted 10 lines
For ARM we reference the specific standard[0]. It is up to the guest OS to make sure that it's version of the headers lay things out following that standard (NB Linux
blkif.his currently buggy on ARM in this regard, Julien has the details).Ian.
[0]
http://xenbits.xen.org/docs/unstable/hypercall/arm/include,public,arch-
arm.h.html#incontents_arm_abi
Quoted 53 lines · Paul Durrant
Quoted 53 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); JanBeulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 23 lines
Quoted 23 lines
public headers
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 6 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT */ + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE} */ + uint16_t nr_segments; /* number of segments */This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Quoted 6 lines
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface headers.
Quoted 7 lines
Quoted 5 lines
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some Intel standard?).
Can we go for types aligned on their size then rather than gcc brokenness.
We should go for some existing well defined ABI spec not make up our own.
Quoted 7 lines
Quoted 3 lines
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
I am talking about the general case for all xen/include/public headers, not these structs specifically.
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed.
Ian.
Quoted 74 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); JanBeulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 8 lines
Quoted 8 lines
to
Quoted 7 lines
Quoted 7 lines
public headers
Quoted 3 lines · Konrad Rzeszutek Wilk
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT */ + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE}*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
uint16_tnr_segments; /* number of segments*/
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 8 lines
Quoted 7 lines
We should go for some existing well defined ABI spec not make up our own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Quoted 7 lines
Quoted 3 lines
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
I am talking about the general case for all xen/include/public headers, not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 5 lines
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
Paul
Quoted 84 lines · Paul Durrant
Quoted 74 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); JanBeulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 8 lines
Quoted 8 lines
to
Quoted 7 lines
Quoted 7 lines
public headers
Quoted 3 lines · Konrad Rzeszutek Wilk
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT */ + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE}*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
uint16_tnr_segments; /* number of segments*/
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 8 lines
Quoted 7 lines
We should go for some existing well defined ABI spec not make up our own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Quoted 7 lines
Quoted 3 lines
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
I am talking about the general case for all xen/include/public headers, not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 7 lines
Quoted 5 lines
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed, the ABI of this new structures is defined by the way gcc generates it's layout (different on i386 or amd64), it's not pretty, but it's how the blkif protocol is defined. Doing something different now just for struct blkif_request_indirect seems even worse.
Quoted 103 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 72 lines
Quoted 56 lines
to
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); JanBeulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 8 lines
Quoted 8 lines
to
Quoted 7 lines
Quoted 7 lines
public headers
Quoted 3 lines · Konrad Rzeszutek Wilk
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT */ + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE}*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
uint16_tnr_segments; /* number of segments*/
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 8 lines
Quoted 7 lines
We should go for some existing well defined ABI spec not make up our own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Quoted 7 lines
Quoted 3 lines
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
I am talking about the general case for all xen/include/public headers, not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 5 lines
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed.
Quoted 7 lines
Quoted 1 line
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed, the ABI of this new structures is defined by the way gcc generates it's layout (different on i386 or amd64), it's not pretty, but it's how the blkif protocol is defined. Doing something different now just for struct
blkif_request_indirectseems even worse.
I don't see where it's defined that the protocol always uses the gcc ABI? And if that's the case then why the need for __attribute__((__packed__)) all over the linux header?
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 105 lines · Paul Durrant
Quoted 105 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 73 lines
Quoted 56 lines
to
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org); JanBeulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 8 lines
Quoted 8 lines
to
Quoted 7 lines
Quoted 7 lines
public headers
Quoted 3 lines · Konrad Rzeszutek Wilk
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT */ + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE}*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
uint16_tnr_segments; /* number of segments*/
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it did:
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86 these headers are to be treated as using the <WHATEVER> ABI (gcc? Some
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 8 lines
Quoted 7 lines
We should go for some existing well defined ABI spec not make up our own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Quoted 7 lines
Quoted 3 lines
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
I am talking about the general case for all xen/include/public headers, not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 5 lines
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
Quoted 7 lines
Quoted 5 lines
I don't understand why or how this patch should be fixed, the ABI of this new structures is defined by the way gcc generates it's layout (different on i386 or amd64), it's not pretty, but it's how the blkif protocol is defined. Doing something different now just for struct
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the gcc ABI? And if that's the case then why the need for __attribute__((__packed__)) all over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in Linux blkif.h header, but it's Linux copy of the header, so it's arguably that Linux can define those as wanted, as long as they have the same layout as the one generated by a pristine copy of blkif.h from the Xen tree (as it is now).
__attribute__((__packed__)) should only be needed in blkback in order to define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 139 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 14 lines
Quoted 14 lines
to
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 1 line
Quoted 1 line
to
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org);Jan
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 8 lines
Quoted 8 lines
to
Quoted 7 lines
Quoted 7 lines
public headers
Quoted 3 lines · Konrad Rzeszutek Wilk
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT */ + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE}*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
uint16_tnr_segments; /* number of segmentsQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
*/
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it
did:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI (gcc?
Some
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not make up
our
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Quoted 7 lines
Quoted 3 lines
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
I am talking about the general case for all xen/include/public headers, not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 5 lines
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
Quoted 7 lines
Quoted 5 lines
I don't understand why or how this patch should be fixed, the ABI of this new structures is defined by the way gcc generates it's layout (different on i386 or amd64), it's not pretty, but it's how the blkif protocol is defined. Doing something different now just for struct
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the gcc ABI?
And if that's the case then why the need for __attribute__((__packed__)) all over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in Linux
blkif.hheader, but it's Linux copy of the header, so it's arguably that Linux can define those as wanted, as long as they have the same layout as the one generated by a pristine copy ofblkif.hfrom the Xen tree (as it is now).
Quoted 3 lines
__attribute__((__packed__)) should only be needed in blkback in order to define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
Yes, agreed. So can we have a comment in the patch stating the ABI and the fact that it's different in x86 and x64 builds and hence frontends need to be careful about correctly setting the xenstore key?
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 139 lines · Paul Durrant
Quoted 139 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 14 lines
Quoted 14 lines
to
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 1 line
Quoted 1 line
to
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org);Jan
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 8 lines
Quoted 8 lines
to
Quoted 7 lines
Quoted 7 lines
public headers
Quoted 3 lines · Konrad Rzeszutek Wilk
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /* BLKIF_OP_INDIRECT */
+ uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE}*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of segments
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
*/
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are you
expecting the next field to start on? AFAIK 32-bit gcc will 4-byte align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it
did:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface headers.
Since compilers do differ in their packing, and guests may be using various pragmas, it might be useful to write down that for x86
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI (gcc?
Some
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not make up
our
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Quoted 7 lines
Quoted 3 lines
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
I am talking about the general case for all xen/include/public headers, not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 5 lines
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
Quoted 7 lines
Quoted 5 lines
I don't understand why or how this patch should be fixed, the ABI of this new structures is defined by the way gcc generates it's layout (different on i386 or amd64), it's not pretty, but it's how the blkif protocol is defined. Doing something different now just for struct
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the gcc ABI?
And if that's the case then why the need for __attribute__((__packed__)) all over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in Linux
blkif.hheader, but it's Linux copy of the header, so it's arguably that Linux can define those as wanted, as long as they have the same layout as the one generated by a pristine copy ofblkif.hfrom the Xen tree (as it is now).
Quoted 5 lines
Quoted 3 lines
__attribute__((__packed__)) should only be needed in blkback in order to define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
Yes, agreed. So can we have a comment in the patch stating the ABI and the fact that it's different in x86 and x64 builds and hence frontends need to be careful about correctly setting the xenstore key?
There's already a comment describing the "protocol" xenstore node, and the possible values are in protocols.h. Adding a comment describing that the layout of this structures should match the gcc ABI should probably be set in a more generic header (like xen.h?), since I guess there might be other cases for this.
From my POV, if we are going to add a comment regarding the ABI, it should be done in a different patch, since it's not related to the inclusion of indirect descriptors, it has always been there.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 171 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:52
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 27 lines
Quoted 27 lines
to
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 14 lines
Quoted 14 lines
to
Quoted 11 lines
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 1 line
Quoted 1 line
to
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 9 lines
Quoted 9 lines
Jan
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 4 lines
Quoted 4 lines
to
Quoted 3 lines
Quoted 3 lines
public headers
On Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek Wilk
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /* BLKIF_OP_INDIRECT*/
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE}
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of segments
*/
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit gcc will 4-
byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah it
Quoted 8 lines
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests may be
using
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that for x86
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI (gcc?
Some
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not make
up
Quoted 8 lines
Quoted 8 lines
our
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
own.
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for this
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's no
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all xen/include/public
headers,
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 3 lines
There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and
perhaps
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
I don't understand why or how this patch should be fixed, the ABI of this new structures is defined by the way gcc generates it's layout (different on i386 or amd64), it's not pretty, but it's how the blkif protocol is defined. Doing something different now just for struct
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the gcc ABI?
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 9 lines
Quoted 9 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in Linux
blkif.hheader, but it's Linux copy of the header, so it's arguably that Linux can define those as wanted, as long as they have the same layout as the one generated by a pristine copy ofblkif.hfrom the Xen tree (as it is now).__attribute__((__packed__)) should only be needed in blkback in order
to
Quoted 4 lines
Quoted 2 lines
define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
Yes, agreed. So can we have a comment in the patch stating the ABI and
Quoted 9 lines
the fact that it's different in x86 and x64 builds and hence frontends need to be careful about correctly setting the xenstore key?
There's already a comment describing the "protocol" xenstore node, and the possible values are in
protocols.h. Adding a comment describing that the layout of this structures should match the gcc ABI should probably be set in a more generic header (likexen.h?), since I guess there might be other cases for this.
I agree that it's a broader issue, but I think the comments should go in the individual protocol headers as that's where developers are going to look when they are attempting to implement frontends or backends.
Quoted 3 lines
From my POV, if we are going to add a comment regarding the ABI, it should be done in a different patch, since it's not related to the inclusion of indirect descriptors, it has always been there.
Ok, but it would be good if at least blkif were updated. Deferring it will probably mean it's just forgotten (again).
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 173 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; KeirQuoted 13 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 4 lines
Jan
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
Quoted 4 lines
Quoted 4 lines
to
Quoted 3 lines
Quoted 3 lines
public headers
On Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek Wilk
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /* BLKIF_OP_INDIRECT*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of segments
*/
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit gcc will
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly,
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests may
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that for
x86
Quoted 8 lines
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI (gcc?
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not make
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto specified
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for this
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's no
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all xen/include/public
headers,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 1 line
There should be a well specified default for the struct layout.
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable padding and
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed, the ABI
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how the
blkif
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
protocol is defined. Doing something different now just for struct
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it's arguablythat
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the Xen tree(as
Quoted 2 lines
it is now).
Quoted 8 lines
Quoted 1 line
__attribute__((__packed__)) should only be needed in blkback in order
to
Quoted 2 lines
define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
Yes, agreed. So can we have a comment in the patch stating the ABI and the fact that it's different in x86 and x64 builds and hence frontends need to be careful about correctly setting the xenstore key?
Thr layout and size of the structure should be the same size on 32 and 64 bit builds.
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 187 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:24
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 178 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; KeirQuoted 13 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 4 lines
Jan
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
Quoted 4 lines
Quoted 4 lines
to
Quoted 3 lines
Quoted 3 lines
public headers
On Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek Wilk
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /* BLKIF_OP_INDIRECT*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of segments
*/
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit gcc will
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly,
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests may
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that for
x86
Quoted 8 lines
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI (gcc?
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not make
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto specified
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for this
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's no
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all xen/include/public
headers,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 1 line
There should be a well specified default for the struct layout.
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable padding and
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed, the ABI
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how the
blkif
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
protocol is defined. Doing something different now just for struct
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it's arguablythat
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the Xen tree(as
Quoted 3 lines
it is now).
__attribute__((__packed__)) should only be needed in blkback in order
to
Quoted 2 lines
define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
Quoted 7 lines
Quoted 3 lines
Yes, agreed. So can we have a comment in the patch stating the ABI and the fact that it's different in x86 and x64 builds and hence frontends need to be careful about correctly setting the xenstore key?
Thr layout and size of the structure should be the same size on 32 and 64 bit builds.
As the header stands, that is not true.
Paul
Quoted 4 lines
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 214 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:24
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 23 lines
public headers
Quoted 20 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 38 lines
Quoted 38 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 4 lines
Jan
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
Quoted 4 lines
Quoted 4 lines
to
Quoted 3 lines
Quoted 3 lines
public headers
On Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek Wilk
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+struct blkif_request_indirect {
+ uint8_t operation; /* BLKIF_OP_INDIRECT*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of
segments
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary
are
Quoted 2 lines
Quoted 2 lines
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit gcc
will
Quoted 5 lines
Quoted 5 lines
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Oh no. I thought that the Linux one had this set
correctly,
Quoted 9 lines
Quoted 9 lines
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
struct blkif_request_indirect {
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public
interface
Quoted 3 lines
Quoted 3 lines
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests
may
Quoted 2 lines
Quoted 2 lines
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that
for
Quoted 3 lines
Quoted 3 lines
x86
Quoted 2 lines
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI
(gcc?
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not
make
Quoted 5 lines
Quoted 5 lines
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto
specified
Quoted 5 lines
Quoted 5 lines
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for
this
Quoted 6 lines
Quoted 6 lines
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's no
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all
xen/include/public
Quoted 7 lines
Quoted 7 lines
headers,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 1 line
There should be a well specified default for the struct
layout.
Quoted 4 lines
Quoted 4 lines
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable padding
and
Quoted 7 lines
Quoted 7 lines
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed, the
ABI
Quoted 6 lines
Quoted 6 lines
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how the
blkif
Quoted 1 line
Quoted 1 line
Quoted 1 line
protocol is defined. Doing something different now just for
struct
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it'sarguably
Quoted 4 lines
Quoted 4 lines
that
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the Xentree
Quoted 4 lines
Quoted 4 lines
(as
Quoted 3 lines
it is now).
__attribute__((__packed__)) should only be needed in blkback in
order
Quoted 5 lines
Quoted 5 lines
to
Quoted 2 lines
define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
Yes, agreed. So can we have a comment in the patch stating the ABI
and
Quoted 1 line
Quoted 1 line
the fact that it's different in x86 and x64 builds and hence
frontends
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
need to be careful about correctly setting the xenstore key?
Thr layout and size of the structure should be the same size on 32
and 64 bit
Quoted 2 lines
builds.
As the header stands, that is not true.
Which one? The one in Linux or the non-existing one in Xen repo for which this patch was adding?
If it is the Linux one which of the fields is messed up? The whole struct (including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
Quoted 7 lines
Paul
Quoted 4 lines
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 232 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:34
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 214 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:24
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 23 lines
public headers
Quoted 20 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 38 lines
Quoted 38 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 4 lines
Jan
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
Quoted 4 lines
Quoted 4 lines
to
Quoted 3 lines
Quoted 3 lines
public headers
On Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek Wilk
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+struct blkif_request_indirect {
+ uint8_t operation; /* BLKIF_OP_INDIRECT*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of
segments
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary
are
Quoted 2 lines
Quoted 2 lines
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit gcc
will
Quoted 5 lines
Quoted 5 lines
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Oh no. I thought that the Linux one had this set
correctly,
Quoted 9 lines
Quoted 9 lines
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
struct blkif_request_indirect {
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public
interface
Quoted 3 lines
Quoted 3 lines
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests
may
Quoted 2 lines
Quoted 2 lines
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that
for
Quoted 3 lines
Quoted 3 lines
x86
Quoted 2 lines
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI
(gcc?
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not
make
Quoted 5 lines
Quoted 5 lines
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto
specified
Quoted 5 lines
Quoted 5 lines
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for
this
Quoted 6 lines
Quoted 6 lines
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's no
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all
xen/include/public
Quoted 7 lines
Quoted 7 lines
headers,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the default.
Quoted 1 line
There should be a well specified default for the struct
layout.
Quoted 4 lines
Quoted 4 lines
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable padding
and
Quoted 7 lines
Quoted 7 lines
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed, the
ABI
Quoted 6 lines
Quoted 6 lines
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how the
blkif
Quoted 1 line
Quoted 1 line
Quoted 1 line
protocol is defined. Doing something different now just for
struct
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses the
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__)) in
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it'sarguably
Quoted 4 lines
Quoted 4 lines
that
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the Xentree
Quoted 4 lines
Quoted 4 lines
(as
Quoted 3 lines
it is now).
__attribute__((__packed__)) should only be needed in blkback in
order
Quoted 5 lines
Quoted 5 lines
to
Quoted 2 lines
define the i386 and amd64 version of those structures and handle correctly requests from an i386 DomU on an amd64 Dom0 for example.
Yes, agreed. So can we have a comment in the patch stating the ABI
and
Quoted 1 line
Quoted 1 line
the fact that it's different in x86 and x64 builds and hence
frontends
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
need to be careful about correctly setting the xenstore key?
Thr layout and size of the structure should be the same size on 32
and 64 bit
Quoted 2 lines
builds.
As the header stands, that is not true.
Quoted 7 lines
Which one? The one in Linux or the non-existing one in Xen repo for which this patch was adding?
If it is the Linux one which of the fields is messed up? The whole struct (including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
How can this possibly be the same between 32-bit and 64-bit builds (unless CONFIG_X86_64 is defined in both cases)? And the fact that nr_segments won't be naturally aligned is pretty bad too.
struct blkif_request_indirect {
uint8_t indirect_op;
uint16_t nr_segments;
#ifdef CONFIG_X86_64
uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
#endif
uint64_t id;
blkif_sector_t sector_number;
blkif_vdev_t handle;
uint16_t _pad2;
grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];#ifdef CONFIG_X86_64
uint32_t _pad3; /* make it 64 byte aligned */
#else
uint64_t _pad3; /* make it 64 byte aligned */
#endif
} __attribute__((__packed__));
Paul
Quoted 8 lines
Quoted 7 lines
Paul
Quoted 4 lines
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 285 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:34
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 21 lines
public headers
Quoted 18 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:24
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 8 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
interface to
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 21 lines
Quoted 21 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
interface
Quoted 1 line
Quoted 1 line
to
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk;Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Beulich;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
Quoted 4 lines
Quoted 4 lines
to
Quoted 3 lines
public headers
On Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek
Wilk
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /*
BLKIF_OP_INDIRECTQuoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of
segments
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment
boundary
Quoted 3 lines
Quoted 3 lines
are
Quoted 2 lines
Quoted 2 lines
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit
gcc
Quoted 26 lines
Quoted 26 lines
will
Quoted 5 lines
Quoted 5 lines
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Oh no. I thought that the Linux one had this set
correctly,
Quoted 9 lines
Quoted 9 lines
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
struct blkif_request_indirect {
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public
interface
Quoted 3 lines
Quoted 3 lines
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests
may
Quoted 2 lines
Quoted 2 lines
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that
for
Quoted 2 lines
Quoted 2 lines
x86
Quoted 1 line
these
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI
(gcc?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
standard?).
Can we go for types aligned on their size then rather
than
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not
make
Quoted 5 lines
Quoted 5 lines
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto
specified
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for
this
Quoted 2 lines
Quoted 2 lines
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's
no
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all
xen/include/public
Quoted 5 lines
Quoted 5 lines
headers,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the
default.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
There should be a well specified default for the struct
layout.
Quoted 4 lines
Quoted 4 lines
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable
padding
Quoted 8 lines
Quoted 8 lines
and
Quoted 7 lines
Quoted 7 lines
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed,
the
Quoted 5 lines
Quoted 5 lines
ABI
Quoted 4 lines
Quoted 4 lines
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how
the
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
blkif
Quoted 1 line
Quoted 1 line
Quoted 1 line
protocol is defined. Doing something different now just for
struct
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__))
in
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it'sarguably
Quoted 4 lines
Quoted 4 lines
that
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the XenQuoted 8 lines
Quoted 8 lines
tree
Quoted 4 lines
Quoted 4 lines
(as
Quoted 3 lines
it is now).
__attribute__((__packed__)) should only be needed in blkback in
order
Quoted 2 lines
Quoted 2 lines
to
Quoted 1 line
define the i386 and amd64 version of those structures and
handle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
correctly requests from an i386 DomU on an amd64 Dom0 for
example.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Yes, agreed. So can we have a comment in the patch stating the
ABI
Quoted 5 lines
Quoted 5 lines
and
Quoted 1 line
Quoted 1 line
the fact that it's different in x86 and x64 builds and hence
frontends
Quoted 2 lines
Quoted 1 line
need to be careful about correctly setting the xenstore key?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Thr layout and size of the structure should be the same size on 32
and 64 bit
Quoted 2 lines
builds.
As the header stands, that is not true.
Which one? The one in Linux or the non-existing one in Xen repo for
which
Quoted 3 lines
this patch was adding?
If it is the Linux one which of the fields is messed up? The whole
struct
Quoted 3 lines
(including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
How can this possibly be the same between 32-bit and 64-bit builds (unless
CONFIG_X86_64is defined in both cases)? And the fact thatnr_segmentswon't be naturally aligned is pretty bad too.struct blkif_request_indirect { uint8_t indirect_op; uint16_t nr_segments; #ifdef CONFIG_X86_64 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */ #endif uint64_t id; blkif_sector_t sector_number; blkif_vdev_t handle; uint16_t _pad2;
grant_ref_tindirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
#ifdefCONFIG_X86_64
uint32_t_pad3; /* make it 64 byte aligned */
#else
uint64_t_pad3; /* make it 64 byte aligned */
#endif
} __attribute__((__packed__));
Quoted 10 lines
Paul
Quoted 8 lines
Quoted 7 lines
Paul
Quoted 4 lines
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
I must be really thick here but I am not seeing it. Could you explain to me exactly why we would not get the same size?
Please keep in mins that there is an extra uint8_t tacked on the start of this (as this is part of another struct).
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 300 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:58
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 276 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:34
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 21 lines
public headers
Quoted 18 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:24
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 8 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
interface to
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 21 lines
Quoted 21 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
interface
Quoted 1 line
Quoted 1 line
to
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk;Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
On Tue, 2013-11-12 at 15:16 +0000, Paul Durrant wrote:
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Beulich;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
Quoted 4 lines
Quoted 4 lines
to
public headersOn Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek
Wilk
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /*
BLKIF_OP_INDIRECTQuoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
Quoted 1 line
+ uint16_t nr_segments; /* number of
segments
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment
boundary
Quoted 3 lines
Quoted 3 lines
are
Quoted 2 lines
Quoted 2 lines
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit
gcc
Quoted 26 lines
Quoted 26 lines
will
Quoted 5 lines
Quoted 5 lines
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Oh no. I thought that the Linux one had this set
correctly,
Quoted 9 lines
Quoted 9 lines
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
struct blkif_request_indirect {
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public
interface
Quoted 3 lines
Quoted 3 lines
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests
may
Quoted 2 lines
Quoted 2 lines
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that
for
Quoted 2 lines
Quoted 2 lines
x86
Quoted 1 line
these
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI
(gcc?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
Quoted 4 lines
Quoted 4 lines
standard?).
Can we go for types aligned on their size then rather
than
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
Quoted 2 lines
Quoted 2 lines
We should go for some existing well defined ABI spec not
make
Quoted 5 lines
Quoted 5 lines
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto
specified
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for
this
Quoted 2 lines
Quoted 2 lines
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's
no
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all
xen/include/public
Quoted 5 lines
Quoted 5 lines
headers,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the
default.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
There should be a well specified default for the struct
layout.
Quoted 4 lines
Quoted 4 lines
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable
padding
Quoted 8 lines
Quoted 8 lines
and
Quoted 7 lines
Quoted 7 lines
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed,
the
Quoted 5 lines
Quoted 5 lines
ABI
Quoted 4 lines
Quoted 4 lines
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how
the
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
blkif
Quoted 1 line
Quoted 1 line
Quoted 1 line
protocol is defined. Doing something different now just for
struct
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__))
in
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it'sarguably
Quoted 4 lines
Quoted 4 lines
that
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the XenQuoted 8 lines
Quoted 8 lines
tree
Quoted 4 lines
Quoted 4 lines
(as
Quoted 3 lines
it is now).
__attribute__((__packed__)) should only be needed in blkback in
order
Quoted 2 lines
Quoted 2 lines
to
Quoted 1 line
define the i386 and amd64 version of those structures and
handle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
correctly requests from an i386 DomU on an amd64 Dom0 for
example.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Yes, agreed. So can we have a comment in the patch stating the
ABI
Quoted 5 lines
Quoted 5 lines
and
Quoted 1 line
Quoted 1 line
the fact that it's different in x86 and x64 builds and hence
frontends
Quoted 2 lines
Quoted 1 line
need to be careful about correctly setting the xenstore key?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Thr layout and size of the structure should be the same size on 32
and 64 bit
Quoted 2 lines
builds.
As the header stands, that is not true.
Which one? The one in Linux or the non-existing one in Xen repo for
which
Quoted 3 lines
this patch was adding?
If it is the Linux one which of the fields is messed up? The whole
struct
Quoted 3 lines
(including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
How can this possibly be the same between 32-bit and 64-bit builds (unless
CONFIG_X86_64is defined in both cases)? And the fact thatnr_segmentswon't be naturally aligned is pretty bad too.struct blkif_request_indirect { uint8_t indirect_op; uint16_t nr_segments; #ifdef CONFIG_X86_64 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */ #endif uint64_t id; blkif_sector_t sector_number; blkif_vdev_t handle; uint16_t _pad2;Quoted 1 line
grant_ref_tindirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
Quoted 13 lines
#ifdef
CONFIG_X86_64
uint32_t_pad3; /* make it 64 byte aligned */
#else
uint64_t_pad3; /* make it 64 byte aligned */
#endif
} __attribute__((__packed__));Paul
Quoted 3 lines
Quoted 3 lines
Paul
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
I must be really thick here but I am not seeing it. Could you explain to me exactly why we would not get the same size?
Maybe I'm misunderstanding this but by my reading this section:
uint8_t indirect_op;uint16_t nr_segments;
#ifdef CONFIG_X86_64uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
#endifuint64_t id;
would be 11 bytes long in a 32-bit build and 15 bytes long in a 64-bit build (as it's part of a packed struct).
Quoted 2 lines
Please keep in mins that there is an extra
uint8_ttacked on the start of this (as this is part of another struct).
Ok. That explains the alignment bit - not at all obvious though.
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 6 lines
Quoted 3 lines
I must be really thick here but I am not seeing it. Could you explain to me exactly why we would not get the same size?
Maybe I'm misunderstanding this but by my reading this section:
Quoted 8 lines
uint8_tindirect_op;uint16_tnr_segments;
#ifdefCONFIG_X86_64uint32_t_pad1; /*offsetof(blkif_...,u.indirect.id)== 8 */
#endifuint64_tid;would be 11 bytes long in a 32-bit build and 15 bytes long in a 64-bit build (as it's part of a packed struct).
Damm! I somehow thought we had it done _Right_ so it would be the same exact and offset on both 64-bit and 32-bit. ARGH!
konrad@phenom:/tmp$ ./blk-interface-64 RING TOTAL SIZE 2368 Each entry 64 Each request 60 64-bit op:0, indirect_op=1, nr_segment=2,id=8 sector_number=16 gref[0] == (24) gref[1] == (28) gref[2] == (32) gref[3] == (36) gref[4] == (40) gref[5] == (44) gref[6] == (48) gref[7] == (52) konrad@phenom:/tmp$ ./blk-interface-32 konrad@phenom:/tmp$ ./blk-interface RING TOTAL SIZE 1792 Each entry 48 Each request 48 32-bit op:0, indirect_op=1, nr_segment=2,id=4 sector_number=8 gref[0] == (12) gref[1] == (16) gref[2] == (20) gref[3] == (24) gref[4] == (28) gref[5] == (32) gref[6] == (36) gref[7] == (40)
Attached is the simple test program.
#include <stdio.h>
#include <sys/types.h>
#include <stddef.h>
/* These are only 64-bit defined */
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
typedef __signed__ long __s64;
typedef unsigned long __u64;
typedef __u8 uint8_t;
typedef __u16 uint16_t;
typedef __u32 uint32_t;
#if defined(__GNUC__)
typedef __u64 uint64_t;
//typedef __u64 u_int64_t;
//typedef __s64 int64_t;
#endif
typedef uint16_t blkif_vdev_t;
typedef uint64_t blkif_sector_t;
typedef uint32_t grant_ref_t;
/*
* Maximum scatter/gather segments per request.
* This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE.
* NB. This could be 12 if the ring indexes weren't stored in the same page. */
#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
//#define CONFIG_X86_64 1
struct blkif_request_rw {
uint8_t nr_segments; /* number of segments */
blkif_vdev_t handle; /* only for read/write requests */
#ifdef CONFIG_X86_64
uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */
#endif
uint64_t id; /* private guest value, echoed in resp */
blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
struct blkif_request_segment {
grant_ref_t gref; /* reference to I/O buffer frame */
/* @first_sect: first sector in frame to transfer (inclusive). */
/* @last_sect: last sector in frame to transfer (inclusive). */
uint8_t first_sect, last_sect;
} seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
} __attribute__((__packed__));#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
/* so 64 bytes under 64-bit */
struct blkif_request_indirect {
uint8_t indirect_op; /* BLKIF_OP_* (usually READ or WRITE */ // 1
uint16_t nr_segments;
#ifdef CONFIG_X86_64
uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */ // 2
#endif
uint64_t id; /* private guest value, echoed in resp */
blkif_sector_t sector_number;
grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];#ifdef CONFIG_X86_64
uint32_t _pad3; /* make it 64 byte aligned */
#else
uint64_t _pad3; /* make it 64 byte aligned */
#endif
} __attribute__((__packed__));
struct blkif_request {
uint8_t operation; /* BLKIF_OP_??? */
union {
/* struct blkif_request_rw rw; */
struct blkif_request_indirect indirect;
} u;
} __attribute__((__packed__));struct blkif_response {
uint64_t id; /* copied from request */ uint8_t operation; /* copied from request */ int16_t status; /* BLKIF_RSP_??? */
};
typedef unsigned int RING_IDX; /* 4 bytes */
union blkif_sring_entry {
struct blkif_request req;
struct blkif_response rsp;
};struct blkif_ring {
/* 8 */
RING_IDX req_prod, req_event; /* #1 front writest req_prod,
blkback updates req_event by interal reqs_cons consumed + 1 */
/* 8 */
RING_IDX rsp_prod, rsp_event; /* #2 blkback writes rsp_prod, and #4 blkfront updates rsp_event
by its internal rsp_cons + 1 */
uint8_t pad[48];
/* 48 + 16 = 64 */
union blkif_sring_entry ring[36]; /* variable-length */
};
void main(void)
{
int i;
printf("RING TOTAL SIZE\t\t%d\n", sizeof(struct blkif_ring));
printf("Each entry\t\t%d\n", sizeof(union blkif_sring_entry));
printf("Each request\t\t%d\n", sizeof(struct blkif_request));
printf("%s\n",
#ifdef CONFIG_X86_64
"64-bit"
#else
"32-bit"
#endif
);
printf("op:%d, indirect_op=%d, nr_segment=%d,id=%d sector_number=%d\n",
offsetof(struct blkif_request, operation),
offsetof(struct blkif_request, u.indirect.indirect_op),
offsetof(struct blkif_request, u.indirect.nr_segments),
offsetof(struct blkif_request, u.indirect.id),
offsetof(struct blkif_request, u.indirect.sector_number));
for (i = 0; i < BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST; i++) {
printf("gref[%d] == (%d)\n", i, offsetof(struct blkif_request, u.indirect.indirect_grefs[i]));
}
return;
}Quoted 310 lines · Paul Durrant
Quoted 300 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:58
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 276 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:34
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 21 lines
public headers
Quoted 18 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:24
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 8 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
interface to
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 21 lines
Quoted 21 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
interface
Quoted 1 line
Quoted 1 line
to
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk;Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
Quoted 8 lines
public headers
On Tue, 2013-11-12 at 15:16 +0000, Paul Durrant wrote:
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Beulich;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
Quoted 4 lines
to
public headersOn Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek
Wilk
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /*
BLKIF_OP_INDIRECTQuoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
+ uint16_t nr_segments; /* number of
segments
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/
Quoted 2 lines
This is going to be a problem. What alignment
boundary
Quoted 3 lines
Quoted 3 lines
are
Quoted 2 lines
Quoted 2 lines
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit
gcc
Quoted 26 lines
Quoted 26 lines
will
Quoted 5 lines
Quoted 5 lines
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Oh no. I thought that the Linux one had this set
correctly,
Quoted 9 lines
Quoted 9 lines
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
struct blkif_request_indirect {
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public
interface
Quoted 3 lines
Quoted 3 lines
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests
may
Quoted 2 lines
Quoted 2 lines
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that
for
Quoted 2 lines
Quoted 2 lines
x86
Quoted 1 line
these
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI
(gcc?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
Quoted 4 lines
standard?).
Can we go for types aligned on their size then rather
than
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
Quoted 2 lines
We should go for some existing well defined ABI spec not
make
Quoted 5 lines
Quoted 5 lines
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto
specified
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for
this
Quoted 2 lines
Quoted 2 lines
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's
no
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
compatibility issue here.
I am talking about the general case for all
xen/include/public
Quoted 5 lines
Quoted 5 lines
headers,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the
default.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
There should be a well specified default for the struct
layout.
Quoted 4 lines
Quoted 4 lines
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable
padding
Quoted 8 lines
Quoted 8 lines
and
Quoted 7 lines
Quoted 7 lines
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed,
the
Quoted 5 lines
Quoted 5 lines
ABI
Quoted 4 lines
Quoted 4 lines
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how
the
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
blkif
Quoted 1 line
Quoted 1 line
Quoted 1 line
protocol is defined. Doing something different now just for
struct
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__))
in
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it'sarguably
Quoted 4 lines
Quoted 4 lines
that
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the XenQuoted 8 lines
Quoted 8 lines
tree
Quoted 4 lines
Quoted 4 lines
(as
Quoted 3 lines
it is now).
__attribute__((__packed__)) should only be needed in blkback in
order
Quoted 2 lines
Quoted 2 lines
to
Quoted 1 line
define the i386 and amd64 version of those structures and
handle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
correctly requests from an i386 DomU on an amd64 Dom0 for
example.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Yes, agreed. So can we have a comment in the patch stating the
ABI
Quoted 5 lines
Quoted 5 lines
and
Quoted 1 line
Quoted 1 line
the fact that it's different in x86 and x64 builds and hence
frontends
Quoted 2 lines
Quoted 1 line
need to be careful about correctly setting the xenstore key?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Thr layout and size of the structure should be the same size on 32
and 64 bit
Quoted 2 lines
builds.
As the header stands, that is not true.
Which one? The one in Linux or the non-existing one in Xen repo for
which
Quoted 3 lines
this patch was adding?
If it is the Linux one which of the fields is messed up? The whole
struct
Quoted 3 lines
(including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
How can this possibly be the same between 32-bit and 64-bit builds (unless
CONFIG_X86_64is defined in both cases)? And the fact thatnr_segmentswon't be naturally aligned is pretty bad too.struct blkif_request_indirect { uint8_t indirect_op; uint16_t nr_segments; #ifdef CONFIG_X86_64 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */ #endif uint64_t id; blkif_sector_t sector_number; blkif_vdev_t handle; uint16_t _pad2;Quoted 1 line
grant_ref_tindirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
Quoted 13 lines
#ifdef
CONFIG_X86_64
uint32_t_pad3; /* make it 64 byte aligned */
#else
uint64_t_pad3; /* make it 64 byte aligned */
#endif
} __attribute__((__packed__));Paul
Quoted 3 lines
Quoted 3 lines
Paul
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
I must be really thick here but I am not seeing it. Could you explain to me exactly why we would not get the same size?
Quoted 8 lines
Maybe I'm misunderstanding this but by my reading this section:
uint8_tindirect_op;uint16_tnr_segments;
#ifdefCONFIG_X86_64uint32_t_pad1; /*offsetof(blkif_...,u.indirect.id)== 8 */
#endifuint64_tid;
This is done so that:
offsetof(struct blkif_request, id) == offsetof(struct blkif_request_discard, id) == offsetof(struct blkif_request_indirect, id)
It's the same that's already done for struct blkif_request_discard.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 330 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 15 November 2013 08:02
To: Paul Durrant; Konrad Rzeszutek Wilk; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to public headersQuoted 6 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:58
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptors interfaceto
Quoted 137 lines
Quoted 137 lines
public headers
Quoted 134 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:34
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 21 lines
public headers
Quoted 18 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 14 November 2013 16:24
To: Paul Durrant; Roger Pau Monne; Ian Campbell
Cc: [email protected]; Keir (Xen.org); Jan Beulich
Subject: RE: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 11 lines
public headers
Quoted 8 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:27
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
interface to
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Roger Pau Monné [mailto:[email protected]]
Sent: 14 November 2013 10:06
To: Paul Durrant; Ian Campbell
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 21 lines
Quoted 21 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
to
Quoted 8 lines
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 11:11
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected];Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Quoted 2 lines
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
interface
Quoted 1 line
Quoted 1 line
to
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
public headers
On Wed, 2013-11-13 at 11:07 +0000, Paul Durrant wrote:
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk;Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Keir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(Xen.org);
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
interface
Quoted 9 lines
Quoted 9 lines
to
public headersOn Tue, 2013-11-12 at 15:16 +0000, Paul Durrant wrote:
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Beulich;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirectdescriptors
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
interface
to
public headersOn Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek
Wilk
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+struct blkif_request_indirect {
+ uint8_t operation; /*
BLKIF_OP_INDIRECTQuoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ uint8_t indirect_op; /*
BLKIF_OP_{READ/WRITE}
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
*/
+ uint16_t nr_segments; /* number ofsegments
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/
This is going to be a problem. What alignment
boundary
Quoted 3 lines
Quoted 3 lines
are
Quoted 2 lines
Quoted 2 lines
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit
gcc
Quoted 19 lines
Quoted 19 lines
will
Quoted 5 lines
Quoted 5 lines
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Oh no. I thought that the Linux one had this set
correctly,
Quoted 9 lines
Quoted 9 lines
ah it
Quoted 8 lines
did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
struct blkif_request_indirect {
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public
interface
Quoted 2 lines
Quoted 2 lines
headers.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Since compilers do differ in their packing, and guests
may
Quoted 2 lines
Quoted 2 lines
be using
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that
for
Quoted 3 lines
Quoted 3 lines
x86
Quoted 2 lines
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER>
ABI
Quoted 159 lines
Quoted 149 lines
Quoted 134 lines
Quoted 7 lines
Quoted 7 lines
(gcc?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Some
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Intel
standard?).Can we go for types aligned on their size then rather
than
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
gcc
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
brokenness.
We should go for some existing well defined ABI spec not
make
Quoted 5 lines
Quoted 5 lines
up
Quoted 4 lines
our
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
own.
In effect the x86 ABI has historically been de-facto
specified
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
as the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for
this
Quoted 2 lines
Quoted 2 lines
struct,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
do we need to support an x86 variant? After all there's
no
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
backwards
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
compatibility issue here.
I am talking about the general case for all
xen/include/public
Quoted 5 lines
Quoted 5 lines
headers,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
not these structs specifically.
Ah ok. Then yes I guess the x86 gcc ABI has to be the
default.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
There should be a well specified default for the struct
layout.
Quoted 4 lines
Quoted 4 lines
If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
particular structs diverge from this (and being consistent
across 32-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 64-bit is a good reason to do so) then suitable
padding
Quoted 8 lines
Quoted 8 lines
and
Quoted 7 lines
Quoted 7 lines
perhaps
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
#ifdefs might be needed.
Yes, agreed. This patch therefore needs to be fixed.
I don't understand why or how this patch should be fixed,
the
Quoted 5 lines
Quoted 5 lines
ABI
Quoted 4 lines
Quoted 4 lines
of
Quoted 1 line
Quoted 1 line
Quoted 1 line
this new structures is defined by the way gcc generates it's
layout
Quoted 1 line
Quoted 1 line
Quoted 1 line
(different on i386 or amd64), it's not pretty, but it's how
the
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
blkif
Quoted 1 line
Quoted 1 line
Quoted 1 line
protocol is defined. Doing something different now just for
struct
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
blkif_request_indirectseems even worse.I don't see where it's defined that the protocol always uses
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
gcc ABI?
Quoted 1 line
And if that's the case then why the need for
__attribute__((__packed__)) all
Quoted 3 lines
over the linux header?
AFAIK there's no need for all the __attribute__((__packed__))
in
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Linux
Quoted 1 line
blkif.hheader, but it's Linux copy of the header, so it'sarguably
Quoted 4 lines
Quoted 4 lines
that
Quoted 1 line
Linux can define those as wanted, as long as they have the same
layout
Quoted 1 line
as the one generated by a pristine copy of
blkif.hfrom the XenQuoted 8 lines
Quoted 8 lines
tree
Quoted 4 lines
Quoted 4 lines
(as
Quoted 3 lines
it is now).
__attribute__((__packed__)) should only be needed in blkback in
order
Quoted 2 lines
Quoted 2 lines
to
Quoted 1 line
define the i386 and amd64 version of those structures and
handle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
correctly requests from an i386 DomU on an amd64 Dom0 for
example.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Yes, agreed. So can we have a comment in the patch stating the
ABI
Quoted 5 lines
Quoted 5 lines
and
Quoted 1 line
Quoted 1 line
the fact that it's different in x86 and x64 builds and hence
frontends
Quoted 2 lines
Quoted 1 line
need to be careful about correctly setting the xenstore key?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Thr layout and size of the structure should be the same size on 32
and 64 bit
Quoted 2 lines
builds.
As the header stands, that is not true.
Which one? The one in Linux or the non-existing one in Xen repo for
which
Quoted 3 lines
this patch was adding?
If it is the Linux one which of the fields is messed up? The whole
struct
Quoted 3 lines
(including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
How can this possibly be the same between 32-bit and 64-bit builds (unless
CONFIG_X86_64is defined in both cases)? And the fact thatnr_segmentswon't be naturally aligned is pretty bad too.struct blkif_request_indirect { uint8_t indirect_op; uint16_t nr_segments; #ifdef CONFIG_X86_64 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */ #endif uint64_t id; blkif_sector_t sector_number; blkif_vdev_t handle; uint16_t _pad2;Quoted 1 line
grant_ref_tindirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
Quoted 13 lines
#ifdef
CONFIG_X86_64
uint32_t_pad3; /* make it 64 byte aligned */
#else
uint64_t_pad3; /* make it 64 byte aligned */
#endif
} __attribute__((__packed__));Paul
Quoted 3 lines
Quoted 3 lines
Paul
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
I don't understand what the xenstore key has to do with this?
Quoted 2 lines
Paul
I must be really thick here but I am not seeing it. Could you explain to me exactly why we would not get the same size?
Quoted 8 lines
Maybe I'm misunderstanding this but by my reading this section:
uint8_tindirect_op;uint16_tnr_segments;
#ifdefCONFIG_X86_64uint32_t_pad1; /*offsetof(blkif_...,u.indirect.id)== 8 */
#endifuint64_tid;
Quoted 6 lines
This is done so that:
offsetof(struct blkif_request, id)==offsetof(struct blkif_request_discard, id)==offsetof(struct blkif_request_indirect, id)It's the same that's already done for struct
blkif_request_discard.
But, as I understand it, you could remove the pad and all the packed attributes and achieve the same effect - hence the patch that you submitted to Xen. So, we just need a definition of what the ABIs mean. How about tacking on the following patch?
xen/include/public/io/blkif.h +1 -1
@@ -254,7 +254,7 @@* Default Value: XEN_IO_PROTO_ABI_NATIVE * * The machine ABI rules governing the format of all ring request and -* response structures. +* response structures. See public/io/protocols.h for more information. * * ring-page-order * Values: <uint32_t>
xen/include/public/io/protocols.h +4 -0
@@ -23,6 +23,10 @@#ifndef __XEN_PROTOCOLS_H__#define __XEN_PROTOCOLS_H__ +/* +* These ABIs are the ones used by GCC. Note that this means 8 byte +* values are assumed to be only 4 byte aligned when using x86_32. +*/ #define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi"#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"#define XEN_IO_PROTO_ABI_ARM "arm-abi"
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
xen/include/public/io/protocols.h line 28
Quoted 11 lines
xen/include/public/io/protocols.h +3
-0@@ -23,6 +23,10 @@#ifndef __XEN_PROTOCOLS_H__#define __XEN_PROTOCOLS_H__ +/* +* These ABIs are the ones used by GCC. Note that this means 8 byte +* values are assumed to be only 4 byte aligned when using x86_32.
Apparently the gcc ABI on x86 is the System V ABI, hence I think these are the references:
http://www.sco.com/developers/devspecs/abi386-4.pdf
http://www.sco.com/developers/gabi/
I'd suggest putting these into arch-x86.h or somewhere towards the top level of the headers, since they should apply to all hypercall parameter structs and not just the I/O interfaces.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 4 lines
If it is the Linux one which of the fields is messed up? The whole struct (including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
How can this possibly be the same between 32-bit and 64-bit builds (unless
CONFIG_X86_64is defined in both cases)? And the fact thatnr_segmentswon't be naturally aligned is pretty bad too.
D'oh, I missed the pad at the end, so they are the same size but that doesn't stop the layout being different and hence needing to make sure the ABI is set correctly in xenstore.
Paul
Quoted 9 lines · Paul Durrant
Quoted 7 lines
Quoted 4 lines
If it is the Linux one which of the fields is messed up? The whole struct (including the extra uint8 cmd) should be exactly 64 bytes.
I am pretty sure we double checked that.
How can this possibly be the same between 32-bit and 64-bit builds (unless
CONFIG_X86_64is defined in both cases)? And the fact thatnr_segmentswon't be naturally aligned is pretty bad too.D'oh, I missed the pad at the end, so they are the same size but that doesn't stop the layout being different and hence needing to make sure the ABI is set correctly in xenstore.
You already need to set the correct ABI in xenstore, or nothing is going to work, normal non-indirect requests also have different sizes and offsets.
Quoted 68 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 13 November 2013 09:27
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]; Keir(Xen.org);
Quoted 2 lines
Jan Beulich; Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface to
Quoted 8 lines
public headers
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Ian Campbell
Sent: 12 November 2013 14:29
To: Konrad Rzeszutek Wilk
Cc: Paul Durrant; [email protected]; Keir (Xen.org);Jan
Quoted 3 lines
Beulich;
Quoted 2 lines
Quoted 2 lines
Roger Pau Monne
Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptorsinterface
Quoted 7 lines
to
Quoted 6 lines
Quoted 6 lines
public headers
Quoted 2 lines · Konrad Rzeszutek Wilk
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2
-0+struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
uint8_tindirect_op; /* BLKIF_OP_{READ/WRITE}*/Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
uint16_tnr_segments; /* number of segments*/Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This is going to be a problem. What alignment boundary are
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
expecting the next field to start on? AFAIK 32-bit gcc will
4-byte
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
align it, 32-bit MSVC will 8-byte align it.
Quoted 1 line
Oh no. I thought that the Linux one had this set correctly, ah
it did:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
struct
blkif_request_indirect{
[...]
} __attribute__((__packed__));That attribute packed isn't allowed in the public interface
headers.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since compilers do differ in their packing, and guests may be
using
Quoted 1 line
Quoted 1 line
Quoted 1 line
various pragmas, it might be useful to write down that for x86
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
headers are to be treated as using the <WHATEVER> ABI (gcc? Some
Intel
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
standard?).
Can we go for types aligned on their size then rather than gcc
brokenness.
Quoted 4 lines
We should go for some existing well defined ABI spec not make up our own.
Quoted 7 lines
Quoted 3 lines
In effect the x86 ABI has historically been de-facto specified as the gcc ABI.
Since the linux headers seem to hardcode the x64 ABI for this struct, do we need to support an x86 variant? After all there's no backwards compatibility issue here.
It was merged in 3.11 and now 3.12 has been released. Also it also in FreeBSD. So there is backwards computability with that to think of. Or did you mean 32 vs 64 size and offset? That should be the same.
Quoted 21 lines
Paul
Quoted 4 lines
Quoted 4 lines
Paul
Quoted 1 line
For ARM we reference the specific standard[0]. It is up to the
guest OS
Quoted 1 line
Quoted 1 line
Quoted 1 line
to make sure that it's version of the headers lay things out
following
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
that standard (NB Linux
blkif.his currently buggy on ARM in this regard, Julien has the details).Ian.
[0]
http://xenbits.xen.org/docs/unstable/hypercall/arm/include,public,arch-
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
arm.h.html#incontents_arm_abi
Quoted 7 lines · Roger Pau Monne
Indirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.This interface is already implemented in Linux >= 3.11.
Ping?
I think all comments regarding this patch have been resolved.
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Roger Pau Monné
Quoted 6 lines · Roger Pau Monne
Indirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.
Quoted 5 lines
Quoted 1 line
This interface is already implemented in Linux >= 3.11.
Ping?
I think all comments regarding this patch have been resolved.
So do I; I continue to have this in my to-be-applied list, pending the necessary ack from Keir.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Roger Pau Monné
Quoted 6 lines · Roger Pau Monne
Indirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
This interface is already implemented in Linux >= 3.11.
Ping?
I think all comments regarding this patch have been resolved.
So do I; I continue to have this in my to-be-applied list, pending the necessary ack from Keir.
I also had it in my queue and was thinking of applying it.
There are some implicit holes in the struct on 64-bit though (e.g. between nr_segments and id). Perhaps you could add to your list making these more explicit as a general clean up, at least with a doc comment, if not an actual pad field? (Might be worth waiting for dissenting opinions on that though)
Julien, IIRC you found an issue with the blk struct alignments on ARM (not related to this patch -- it just reminded me). That was a Linux side thing, right? Did you send a fix?
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 27 lines · Ian Campbell
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Roger Pau Monné
Quoted 6 lines · Roger Pau Monne
Indirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.Quoted 8 lines
Quoted 5 lines
Quoted 1 line
This interface is already implemented in Linux >= 3.11.
Ping?
I think all comments regarding this patch have been resolved.
So do I; I continue to have this in my to-be-applied list, pending the necessary ack from Keir.
I also had it in my queue and was thinking of applying it.
There are some implicit holes in the struct on 64-bit though (e.g. between
nr_segmentsand id). Perhaps you could add to your list making these more explicit as a general clean up, at least with a doc comment, if not an actual pad field? (Might be worth waiting for dissenting opinions on that though)
Quoted 3 lines
Julien, IIRC you found an issue with the blk struct alignments on ARM (not related to this patch -- it just reminded me). That was a Linux side thing, right? Did you send a fix?
Yes, on ARM (32 and 64 bits), the structure are aligned on 64 bits. Linux headers use packed attribute. So the header on the Xen and Linux doesn't provide the same structure.
I didn't yet send a fix yet, because we only support Linux for now and we will likely broke compatibility with older Linux. Do we want the fix now?
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 2 lines · Julien Grall
I didn't yet send a fix yet, because we only support Linux for now and we will likely broke compatibility with older Linux. Do we want the fix now?
Yes, the sooner we fix Linux to use the defined ABI on ARM the better, there is no benefit in waiting and letting it get more entrenched.
Ian.
Keir Fraser
Acked-byQuoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Roger Pau Monné
Quoted 6 lines · Roger Pau Monne
Indirect descriptors introduce a new block operation (
BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays ofblkif_request_segment_aligned, this way we can send more segments in a request.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
This interface is already implemented in Linux >= 3.11.
Ping?
I think all comments regarding this patch have been resolved.
So do I; I continue to have this in my to-be-applied list, pending the necessary ack from Keir.
Quoted 1 line
Jan