Skip to contentSkip to conversation

xen: use native disk xenbus protocol if possible

PATCH In review Juergen Gross 3 participants 5 messages Jun 29, 2016 – Aug 30, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen: use native disk xenbus protocol if possible

The qdisk implementation is using the native xenbus protocol only in case of no protocol specified at all. As using the explicit 32- or 64-bit protocol is slower than the native one due to copying requests not by memcpy but element for element, this is not optimal.

Correct this by using the native protocol in case word sizes of frontend and backend match.

---
V2: use native protocol in case of unknown protocol specified as
requested by Anthony Perard

---
 hw/block/xen_disk.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
hw/block/xen_disk.c +10 -8
index 90aca73..d0aae67 100644
@@ -975,14 +975,16 @@ static int blk_connect(struct XenDevice *xendev)
         blkdev->feature_persistent = !!pers;
     }
 
-    blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
-    if (blkdev->xendev.protocol) {
-        if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
-            blkdev->protocol = BLKIF_PROTOCOL_X86_32;
-        }
-        if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
-            blkdev->protocol = BLKIF_PROTOCOL_X86_64;
-        }
+    if (!blkdev->xendev.protocol) {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_NATIVE) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_X86_32;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_X86_64;
+    } else {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
     }
 
     blkdev->sring = xengnttab_map_grant_ref(blkdev->xendev.gnttabdev,
Signature · 1 line
2.6.6
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Juergen Gross

The qdisk implementation is using the native xenbus protocol only in case of no protocol specified at all. As using the explicit 32- or 64-bit protocol is slower than the native one due to copying requests not by memcpy but element for element, this is not optimal.

Correct this by using the native protocol in case word sizes of frontend and backend match.

Thanks,

Quoted 39 lines

---
V2: use native protocol in case of unknown protocol specified as
requested by Anthony Perard

---
 hw/block/xen_disk.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
hw/block/xen_disk.c +10 -8
index 90aca73..d0aae67 100644
@@ -975,14 +975,16 @@ static int blk_connect(struct XenDevice *xendev)
         blkdev->feature_persistent = !!pers;
     }
 
-    blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
-    if (blkdev->xendev.protocol) {
-        if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
-            blkdev->protocol = BLKIF_PROTOCOL_X86_32;
-        }
-        if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
-            blkdev->protocol = BLKIF_PROTOCOL_X86_64;
-        }
+    if (!blkdev->xendev.protocol) {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_NATIVE) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_X86_32;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_X86_64;
+    } else {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
     }
 
     blkdev->sring = xengnttab_map_grant_ref(blkdev->xendev.gnttabdev,
Signature · 1 line
2.6.6
Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw
Quoted 6 lines · Anthony PERARD
Quoted 5 lines · Juergen Gross

The qdisk implementation is using the native xenbus protocol only in case of no protocol specified at all. As using the explicit 32- or 64-bit protocol is slower than the native one due to copying requests not by memcpy but element for element, this is not optimal.

Quoted 6 lines
Quoted 4 lines

Correct this by using the native protocol in case word sizes of frontend and backend match.

Added to my queue

Quoted 35 lines
Quoted 35 lines

---
V2: use native protocol in case of unknown protocol specified as
requested by Anthony Perard

---
 hw/block/xen_disk.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
hw/block/xen_disk.c +10 -8
index 90aca73..d0aae67 100644
@@ -975,14 +975,16 @@ static int blk_connect(struct XenDevice *xendev)
         blkdev->feature_persistent = !!pers;
     }
 
-    blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
-    if (blkdev->xendev.protocol) {
-        if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
-            blkdev->protocol = BLKIF_PROTOCOL_X86_32;
-        }
-        if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
-            blkdev->protocol = BLKIF_PROTOCOL_X86_64;
-        }
+    if (!blkdev->xendev.protocol) {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_NATIVE) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_X86_32;
+    } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
+        blkdev->protocol = BLKIF_PROTOCOL_X86_64;
+    } else {
+        blkdev->protocol = BLKIF_PROTOCOL_NATIVE;
     }
 
Quoted 8 lines
Quoted 4 lines
hw/block/xen_disk.c +0 -0
     blkdev->sring = xengnttab_map_grant_ref(blkdev->xendev.gnttabdev,
Signature · 1 line
2.6.6
Signature · 1 line
Anthony PERARD

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

#3 lore raw
Quoted 7 lines · Stefano Stabellini
Quoted 6 lines · Anthony PERARD
Quoted 5 lines · Juergen Gross

The qdisk implementation is using the native xenbus protocol only in case of no protocol specified at all. As using the explicit 32- or 64-bit protocol is slower than the native one due to copying requests not by memcpy but element for element, this is not optimal.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Correct this by using the native protocol in case word sizes of frontend and backend match.

Added to my queue

Any plans to push it?

Juergen

#4 lore raw
Quoted 11 lines · Juergen Gross
Quoted 10 lines · Stefano Stabellini
Quoted 9 lines · Anthony PERARD
Quoted 8 lines · Juergen Gross

The qdisk implementation is using the native xenbus protocol only in case of no protocol specified at all. As using the explicit 32- or 64-bit protocol is slower than the native one due to copying requests not by memcpy but element for element, this is not optimal.

Correct this by using the native protocol in case word sizes of frontend and backend match.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Added to my queue

Any plans to push it?

Yes, I am sorry. I should have done it earlier. A QEMU release should be imminent (latest is v2.7.0-rc5), I'll send a pull request right after.