diff options
author | royger <royger@FreeBSD.org> | 2015-06-12 07:50:34 +0000 |
---|---|---|
committer | royger <royger@FreeBSD.org> | 2015-06-12 07:50:34 +0000 |
commit | ecdfc8f10abb6d2e0917e148f37aafc2b8ed76f8 (patch) | |
tree | 483a8786fad7d4b3904187bc6501c46fd5d0ea5a /sys/xen | |
parent | a75e86bc6b9dac6636dba259df0fb6c5b731d445 (diff) | |
download | FreeBSD-src-ecdfc8f10abb6d2e0917e148f37aafc2b8ed76f8.zip FreeBSD-src-ecdfc8f10abb6d2e0917e148f37aafc2b8ed76f8.tar.gz |
xen-blk{front/back}: remove broken FreeBSD extensions
The FreeBSD extension adds a new request type, called blkif_segment_block
which has a size of 112bytes for both i386 and amd64. This is fine on
amd64, since requests have a size of 112B there also. But this is not true
for i386, where requests have a size of 108B. So on i386 we basically
overrun the ring slot when queuing a request of type blkif_segment_block_t,
which is very bad.
Remove this extension (including a cleanup of the public blkif.h header
file) from blkfront and blkback.
Sponsored by: Citrix Systems R&D
Tested-by: cperciva
Diffstat (limited to 'sys/xen')
-rw-r--r-- | sys/xen/blkif.h | 8 | ||||
-rw-r--r-- | sys/xen/interface/io/blkif.h | 42 |
2 files changed, 6 insertions, 44 deletions
diff --git a/sys/xen/blkif.h b/sys/xen/blkif.h index 48b71ea..8a19d5d 100644 --- a/sys/xen/blkif.h +++ b/sys/xen/blkif.h @@ -46,7 +46,7 @@ struct blkif_x86_32_request { blkif_vdev_t handle; /* only for read/write requests */ 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 seg[BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK]; + struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; }; struct blkif_x86_32_response { uint64_t id; /* copied from request */ @@ -64,7 +64,7 @@ struct blkif_x86_64_request { blkif_vdev_t handle; /* only for read/write requests */ uint64_t __attribute__((__aligned__(8))) id; blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ - struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK]; + struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; }; struct blkif_x86_64_response { uint64_t __attribute__((__aligned__(8))) id; @@ -114,7 +114,7 @@ enum blkif_protocol { static void inline blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_request_t *src) { - int i, n = BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK; + int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; dst->operation = src->operation; dst->nr_segments = src->nr_segments; dst->handle = src->handle; @@ -129,7 +129,7 @@ static void inline blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_reque static void inline blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_request_t *src) { - int i, n = BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK; + int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; dst->operation = src->operation; dst->nr_segments = src->nr_segments; dst->handle = src->handle; diff --git a/sys/xen/interface/io/blkif.h b/sys/xen/interface/io/blkif.h index 9155662..b725776 100644 --- a/sys/xen/interface/io/blkif.h +++ b/sys/xen/interface/io/blkif.h @@ -457,21 +457,9 @@ #define BLKIF_OP_DISCARD 5 /* - * Maximum scatter/gather segments associated with a request header block. - * 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. - */ -#define BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK 11 - -/* - * Maximum scatter/gather segments associated with a segment block. - */ -#define BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK 14 - -/* * Maximum scatter/gather segments per request (header + segment blocks). */ -#define BLKIF_MAX_SEGMENTS_PER_REQUEST 255 +#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 /* * NB. first_sect and last_sect in blkif_request_segment, as well as @@ -512,22 +500,11 @@ struct blkif_request { blkif_vdev_t handle; /* only for read/write requests */ uint64_t id; /* private guest value, echoed in resp */ blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ - blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK]; + blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; }; typedef struct blkif_request blkif_request_t; /* - * A segment block is a ring request structure that contains only - * segment data. - * - * sizeof(struct blkif_segment_block) <= sizeof(struct blkif_request) - */ -struct blkif_segment_block { - blkif_request_segment_t seg[BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK]; -}; -typedef struct blkif_segment_block blkif_segment_block_t; - -/* * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request) */ @@ -564,21 +541,6 @@ typedef struct blkif_response blkif_response_t; */ DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response); -/* - * Index to, and treat as a segment block, an entry in the ring. - */ -#define BLKRING_GET_SEG_BLOCK(_r, _idx) \ - (((blkif_segment_block_t *)RING_GET_REQUEST(_r, _idx))->seg) - -/* - * The number of ring request blocks required to handle an I/O - * request containing _segs segments. - */ -#define BLKIF_SEGS_TO_BLOCKS(_segs) \ - ((((_segs - BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK) \ - + (BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK - 1)) \ - / BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK) + /*header_block*/1) - #define VDISK_CDROM 0x1 #define VDISK_REMOVABLE 0x2 #define VDISK_READONLY 0x4 |