Skip to contentSkip to conversation

potential problem with qdisk backend

DISCUSSION Juergen Gross 3 participants 4 messages May 6, 2016 – May 16, 2016

lore
Share & tools
lore
#0 lore raw

Looking at the qdisk backend implementation I wondered whether blkif_get_x86_32_req() is really correct, especially for the BLKIF_OP_DISCARD case. The Linux kernel based blk backend seems to distinguish 32- and 64-bit layouts of blkif_request_discard while qemu treats them to be the same.

Am I completely wrong here?

Juergen

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

#1 lore raw
Quoted 7 lines · Juergen Gross

Looking at the qdisk backend implementation I wondered whether blkif_get_x86_32_req() is really correct, especially for the BLKIF_OP_DISCARD case. The Linux kernel based blk backend seems to distinguish 32- and 64-bit layouts of blkif_request_discard while qemu treats them to be the same.

Am I completely wrong here?

Adding some maintainers.

Juergen

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

#3 lore raw
In reply to Juergen Gross
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 06.05.16 at 13:41, <[email protected]> wrote:

Looking at the qdisk backend implementation I wondered whether blkif_get_x86_32_req() is really correct, especially for the BLKIF_OP_DISCARD case. The Linux kernel based blk backend seems to distinguish 32- and 64-bit layouts of blkif_request_discard while qemu treats them to be the same.

I agree, this can't work well.

Jan

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

#2 lore raw
In reply to Juergen Gross
Quoted 10 lines · Juergen Gross
Quoted 7 lines · Juergen Gross

Looking at the qdisk backend implementation I wondered whether blkif_get_x86_32_req() is really correct, especially for the BLKIF_OP_DISCARD case. The Linux kernel based blk backend seems to distinguish 32- and 64-bit layouts of blkif_request_discard while qemu treats them to be the same.

Am I completely wrong here?

Adding some maintainers.

Yes, it seems to me that the internal alignment of the fields in struct blkif_request_discard (as declared by xen/include/public/io/blkif.h) differs between x86_32 and x86_64. The two different alignments are both specified explicitly in Linux, by using __packed__ and explicit padding.

On the other hand QEMU uses Xen's declaration of struct blkif_request_discard without paying attention to the word size in the guest. As a consequence it will work correctly only if the guest bitness and the dom0 bitness match.

The discard struct should have two implementations in QEMU, like blkif_x86_32_request and blkif_x86_64_request.

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