Skip to contentSkip to conversation

tools/libxl: Add iothread support for COLO

PATCH Superseded Zhang Chen 2 participants 5 messages Jul 26, 2019

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

PATCH v2 1/1 tools/libxl: Add iothread support for COLO

From: Zhang Chen <[email protected]>

Xen COLO and KVM COLO shared lots of code in Qemu. KVM COLO has added the iothread support, so we add it on Xen.

Detail:
https://wiki.qemu.org/Features/COLO

---
 tools/libxl/libxl_dm.c      | 14 +++++++++++---
 tools/libxl/libxl_types.idl |  1 +
 tools/xl/xl_parse.c         |  2 ++
 3 files changed, 14 insertions(+), 3 deletions(-)
tools/libxl/libxl_dm.c +11 -3
index f4fc96415d..95cb30f9e6 100644
@@ -1629,17 +1629,25 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                                      nics[i].colo_filter_redirector1_queue,
                                      nics[i].colo_filter_redirector1_outdev));
                     }
+                    if (nics[i].colo_iothread) {
+                        flexarray_append(dm_args, "-object");
+                        flexarray_append(dm_args,
+                           GCSPRINTF("iothread,id=%s",
+                                     nics[i].colo_iothread));
+                    }
                     if (nics[i].colo_compare_pri_in &&
                         nics[i].colo_compare_sec_in &&
                         nics[i].colo_compare_out &&
-                        nics[i].colo_compare_notify_dev) {
+                        nics[i].colo_compare_notify_dev &&
+                        nics[i].colo_iothread) {
                         flexarray_append(dm_args, "-object");
                         flexarray_append(dm_args,
-                           GCSPRINTF("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%s,notify_dev=%s",
+                           GCSPRINTF("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%s,notify_dev=%s,iothread=%s",
                                      nics[i].colo_compare_pri_in,
                                      nics[i].colo_compare_sec_in,
                                      nics[i].colo_compare_out,
-                                     nics[i].colo_compare_notify_dev));
+                                     nics[i].colo_compare_notify_dev,
+                                     nics[i].colo_iothread));
                     }
                 }
                 ioemu_nics++;
tools/libxl/libxl_types.idl +1 -0
index b61399ce36..eda958eb4b 100644
@@ -727,6 +727,7 @@ libxl_device_nic = Struct("device_nic", [
     ("colo_filter_redirector1_queue", string),
     ("colo_filter_redirector1_indev", string),
     ("colo_filter_redirector1_outdev", string),
+    ("colo_iothread", string),
     ("colo_compare_pri_in", string),
     ("colo_compare_sec_in", string),
     ("colo_compare_out", string),
tools/xl/xl_parse.c +2 -0
index e105bda2bb..0b8189f375 100644
@@ -521,6 +521,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)
         replace_string(&nic->colo_filter_redirector1_indev, oparg);
     } else if (MATCH_OPTION("colo_filter_redirector1_outdev", token, oparg)) {
         replace_string(&nic->colo_filter_redirector1_outdev, oparg);
+    } else if (MATCH_OPTION("colo_iothread", token, oparg)) {
+        replace_string(&nic->colo_iothread, oparg);
     } else if (MATCH_OPTION("colo_compare_pri_in", token, oparg)) {
         replace_string(&nic->colo_compare_pri_in, oparg);
     } else if (MATCH_OPTION("colo_compare_sec_in", token, oparg)) {
Signature · 7 lines
2.17.GIT


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 4 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Xen COLO and KVM COLO shared lots of code in Qemu. KVM COLO has added the iothread support, so we add it on Xen.

It would be useful to expand the comment of the commit and explain why the change is required. I would add the following:

The colo-compare object in QEMU now requires an `iothread' property since QEMU 2.11.

Quoted 23 lines

Detail:
https://wiki.qemu.org/Features/COLO

---

tools/libxl/libxl_types.idl +1 -0
index b61399ce36..eda958eb4b 100644
@@ -727,6 +727,7 @@ libxl_device_nic = Struct("device_nic", [
     ("colo_filter_redirector1_queue", string),
     ("colo_filter_redirector1_indev", string),
     ("colo_filter_redirector1_outdev", string),
+    ("colo_iothread", string),
     ("colo_compare_pri_in", string),
     ("colo_compare_sec_in", string),
     ("colo_compare_out", string),
tools/xl/xl_parse.c +0 -0
index e105bda2bb..0b8189f375 100644

tools/xl/xl_parse.c int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token) · line 528

Quoted 8 lines
tools/xl/xl_parse.c +2 -0
@@ -521,6 +521,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)
         replace_string(&nic->colo_filter_redirector1_indev, oparg);
     } else if (MATCH_OPTION("colo_filter_redirector1_outdev", token, oparg)) {
         replace_string(&nic->colo_filter_redirector1_outdev, oparg);
+    } else if (MATCH_OPTION("colo_iothread", token, oparg)) {
+        replace_string(&nic->colo_iothread, oparg);
     } else if (MATCH_OPTION("colo_compare_pri_in", token, oparg)) {
         replace_string(&nic->colo_compare_pri_in, oparg);
     } else if (MATCH_OPTION("colo_compare_sec_in", token, oparg)) {

What I had in mind while reviewing the v1 of the patch was to remove both colo_iothread' and colo_compare_iothread' from the libxl API and xl config option. I don't think there are useful. Why did you keep `colo_iothread'?

Thanks,

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw
Quoted 12 lines

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: Friday, July 26, 2019 9:48 PM
To: Zhang, Chen <[email protected]>
Cc: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; xen- [email protected]; Zhang Chen <[email protected]>
Subject: Re: [PATCH V2] tools/libxl: Add iothread support for COLO

Quoted 2 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Quoted 9 lines
Quoted 2 lines

Xen COLO and KVM COLO shared lots of code in Qemu. KVM COLO has added the iothread support, so we add it on Xen.

It would be useful to expand the comment of the commit and explain why the change is required. I would add the following:

The colo-compare object in QEMU now requires an `iothread' property since QEMU 2.11.

Make sense. I will add it in next version.

Quoted 34 lines

tools/xl/xl_parse.c int parse_nic_config(libxl_device_nic *nic,

Quoted 23 lines

Detail:
https://wiki.qemu.org/Features/COLO

---

tools/libxl/libxl_types.idl +1 -0
index b61399ce36..eda958eb4b 100644
@@ -727,6 +727,7 @@ libxl_device_nic = Struct("device_nic", [
     ("colo_filter_redirector1_queue", string),
     ("colo_filter_redirector1_indev", string),
     ("colo_filter_redirector1_outdev", string),
+    ("colo_iothread", string),
     ("colo_compare_pri_in", string),
     ("colo_compare_sec_in", string),
     ("colo_compare_out", string),
tools/xl/xl_parse.c index renamed from tools/xl/xl_parse.c +0 -0

e105bda2bb..0b8189f375 100644

tools/xl/xl_parse.c +0 -0
@@ -521,6 +521,8 @@ int parse_nic_config(libxl_device_nic *nic,

XLU_Config **config, char *token)

tools/xl/xl_parse.c int parse_nic_config(libxl_device_nic *nic, · line 522

Quoted 2 lines
tools/xl/xl_parse.c +0 -0
         replace_string(&nic->colo_filter_redirector1_indev, oparg);
     } else if (MATCH_OPTION("colo_filter_redirector1_outdev", token, oparg))

{

tools/xl/xl_parse.c int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token) · line 528

Quoted 6 lines
tools/xl/xl_parse.c +2 -0
         replace_string(&nic->colo_filter_redirector1_outdev, oparg);
+    } else if (MATCH_OPTION("colo_iothread", token, oparg)) {
+        replace_string(&nic->colo_iothread, oparg);
     } else if (MATCH_OPTION("colo_compare_pri_in", token, oparg)) {
         replace_string(&nic->colo_compare_pri_in, oparg);
     } else if (MATCH_OPTION("colo_compare_sec_in", token, oparg)) {
Quoted 3 lines

What I had in mind while reviewing the v1 of the patch was to remove both colo_iothread' and colo_compare_iothread' from the libxl API and xl config option. I don't think there are useful. Why did you keep `colo_iothread'?

Oh, it looks I misunderstood your means.
Do you think we just need hard code the iothread name here? For example the "iothread-1"?

Thanks
Zhang Chen

Quoted 5 lines

Thanks,

--
Anthony PERARD

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

#3 lore raw
Quoted 5 lines · Chen
Quoted 5 lines

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: Friday, July 26, 2019 9:48 PM

Quoted 8 lines
Quoted 4 lines · Zhang Chen

What I had in mind while reviewing the v1 of the patch was to remove both colo_iothread' and colo_compare_iothread' from the libxl API and xl config option. I don't think there are useful. Why did you keep `colo_iothread'?

Oh, it looks I misunderstood your means.
Do you think we just need hard code the iothread name here? For example the "iothread-1"?

Yes, it would be better to hard code for now, but with a name which better describe where the iothread is used, how about "colo-compare-iothread-1" ?

Thanks,

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw
Quoted 20 lines

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: Friday, July 26, 2019 10:34 PM
To: Zhang, Chen <[email protected]>
Cc: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; xen- [email protected]; Zhang Chen <[email protected]>
Subject: Re: [PATCH V2] tools/libxl: Add iothread support for COLO

Quoted 9 lines · Chen
Quoted 9 lines

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: Friday, July 26, 2019 9:48 PM

On Fri, Jul 26, 2019 at 02:43:00PM +0800, Zhang Chen wrote:
What I had in mind while reviewing the v1 of the patch was to remove both colo_iothread' and colo_compare_iothread' from the libxl API and xl config option. I don't think there are useful. Why did you keep

Quoted 9 lines

`colo_iothread'?

Quoted 4 lines

Oh, it looks I misunderstood your means.
Do you think we just need hard code the iothread name here? For example the "iothread-1"?

Yes, it would be better to hard code for now, but with a name which better describe where the iothread is used, how about "colo-compare-iothread-1" ?

It is fine for me.
Thanks your comments.

Thanks
Zhang Chen

Quoted 4 lines

Thanks,

--
Anthony PERARD

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