Skip to contentSkip to conversation

tools/libxl: Add iothread support for COLO

PATCH Superseded Zhang Chen 2 participants 7 messages Jun 10, 2019 – Jul 9, 2019

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

PATCH 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 |  2 ++
 tools/xl/xl_parse.c         |  4 ++++
 3 files changed, 17 insertions(+), 3 deletions(-)
tools/libxl/libxl_dm.c +11 -3
index f4fc96415d..6bb400efdf 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_compare_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_compare_iothread));
                     }
                 }
                 ioemu_nics++;
tools/libxl/libxl_types.idl +2 -0
index b61399ce36..f0435a5177 100644
@@ -727,10 +727,12 @@ 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),
     ("colo_compare_notify_dev", string),
+    ("colo_compare_iothread", string),
     ("colo_sock_sec_redirector0_id", string),
     ("colo_sock_sec_redirector0_ip", string),
     ("colo_sock_sec_redirector0_port", string),
tools/xl/xl_parse.c +4 -0
index e105bda2bb..cd16856910 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)) {
@@ -529,6 +531,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token)
         replace_string(&nic->colo_compare_out, oparg);
     } else if (MATCH_OPTION("colo_compare_notify_dev", token, oparg)) {
         replace_string(&nic->colo_compare_notify_dev, oparg);
+    } else if (MATCH_OPTION("colo_compare_iothread", token, oparg)) {
+        replace_string(&nic->colo_compare_iothread, oparg);
     } else if (MATCH_OPTION("colo_sock_sec_redirector0_id", token, oparg)) {
         replace_string(&nic->colo_sock_sec_redirector0_id, oparg);
     } else if (MATCH_OPTION("colo_sock_sec_redirector0_ip", 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

Hi All,

Please give me some comments on this patch. This patch just add some missed parameter in qemu side.

Thanks
Zhang Chen

Quoted 101 lines

-----Original Message-----
From: Zhang, Chen
Sent: Monday, June 10, 2019 4:34 PM
To: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; xen- [email protected]
Cc: Zhang Chen <[email protected]>; Zhang, Chen <[email protected]>
Subject: [PATCH] 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 |  2 ++
 tools/xl/xl_parse.c         |  4 ++++
 3 files changed, 17 insertions(+), 3 deletions(-)
tools/libxl/libxl_dm.c index renamed from tools/libxl/libxl_dm.c +0 -0

f4fc96415d..6bb400efdf 100644

tools/libxl/libxl_dm.c +13 -3
@@ -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_compare_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_compare_iothread));
                     }
                 }
                 ioemu_nics++;
tools/libxl/libxl_types.idl index renamed from tools/libxl/libxl_types.idl +0 -0

b61399ce36..f0435a5177 100644

tools/libxl/libxl_types.idl +2 -0
@@ -727,10 +727,12 @@ 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),
     ("colo_compare_notify_dev", string),
+    ("colo_compare_iothread", string),
     ("colo_sock_sec_redirector0_id", string),
     ("colo_sock_sec_redirector0_ip", string),
     ("colo_sock_sec_redirector0_port", string), diff --git a/tools/xl/xl_parse.c

b/tools/xl/xl_parse.c index e105bda2bb..cd16856910 100644

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)) { @@ -
529,6 +531,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config
**config, char *token)
         replace_string(&nic->colo_compare_out, oparg);
     } else if (MATCH_OPTION("colo_compare_notify_dev", token, oparg)) {
         replace_string(&nic->colo_compare_notify_dev, oparg);
tools/xl/xl_parse.c +2 -1
+    } else if (MATCH_OPTION("colo_compare_iothread", token, oparg)) {
+        replace_string(&nic->colo_compare_iothread, oparg);
     } else if (MATCH_OPTION("colo_sock_sec_redirector0_id", token, oparg)) {
         replace_string(&nic->colo_sock_sec_redirector0_id, oparg);
     } else if (MATCH_OPTION("colo_sock_sec_redirector0_ip", token, oparg)) {
--
Quoted 1 line

2.17.GIT

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

#2 lore raw

Ping~ Anyone have comments?

Thanks
Zhang Chen

Quoted 117 lines

-----Original Message-----
From: Zhang, Chen
Sent: Friday, June 21, 2019 2:00 PM
To: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; xen- [email protected]
Cc: Zhang Chen <[email protected]>
Subject: RE: [PATCH] tools/libxl: Add iothread support for COLO

Hi All,

Please give me some comments on this patch. This patch just add some missed parameter in qemu side.

Thanks
Zhang Chen

Quoted 85 lines

-----Original Message-----
From: Zhang, Chen
Sent: Monday, June 10, 2019 4:34 PM
To: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; xen- [email protected]
Cc: Zhang Chen <[email protected]>; Zhang, Chen <[email protected]>
Subject: [PATCH] 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 |  2 ++
 tools/xl/xl_parse.c         |  4 ++++
 3 files changed, 17 insertions(+), 3 deletions(-)
tools/libxl/libxl_dm.c index renamed from tools/libxl/libxl_dm.c +0 -0

f4fc96415d..6bb400efdf 100644

tools/libxl/libxl_dm.c +14 -3
@@ -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_compare_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_compare_iothread));
                     }
                 }
                 ioemu_nics++;
tools/libxl/libxl_types.idl +0 -0

index
b61399ce36..f0435a5177 100644

tools/libxl/libxl_types.idl +2 -0
@@ -727,10 +727,12 @@ 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),
     ("colo_compare_notify_dev", string),
+    ("colo_compare_iothread", string),
     ("colo_sock_sec_redirector0_id", string),
     ("colo_sock_sec_redirector0_ip", string),
     ("colo_sock_sec_redirector0_port", string), diff --git

a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index
e105bda2bb..cd16856910 100644

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

Quoted 3 lines
tools/xl/xl_parse.c +0 -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))

{

Quoted 12 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)) {
@@ -
529,6 +531,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config
**config, char *token)
         replace_string(&nic->colo_compare_out, oparg);
     } else if (MATCH_OPTION("colo_compare_notify_dev", token, oparg)) {
         replace_string(&nic->colo_compare_notify_dev, oparg);
Quoted 8 lines
Quoted 8 lines
tools/xl/xl_parse.c +2 -0
+    } else if (MATCH_OPTION("colo_compare_iothread", token, oparg)) {
+        replace_string(&nic->colo_compare_iothread, oparg);
     } else if (MATCH_OPTION("colo_sock_sec_redirector0_id", token, oparg)) {
         replace_string(&nic->colo_sock_sec_redirector0_id, oparg);
     } else if (MATCH_OPTION("colo_sock_sec_redirector0_ip", token,

oparg)) {
--
2.17.GIT

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

#3 lore raw
In reply to Zhang Chen

Hi,

Thanks for the patch, I've got plenty of question.

Quoted 20 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.

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

---
 tools/libxl/libxl_dm.c      | 14 +++++++++++---
 tools/libxl/libxl_types.idl |  2 ++
 tools/xl/xl_parse.c         |  4 ++++
 3 files changed, 17 insertions(+), 3 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index f4fc96415d..6bb400efdf 100644

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc, · line 1636

Quoted 8 lines
tools/libxl/libxl_dm.c +5 -0
@@ -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));

This creates an iothread object, but it isn't used anywhere. What the purpose of it?
Also, iothreads have options like "poll-grow", I don't know if you want to have that configurable or just keep the default values, just something to keep in mind.

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc, · line 1645

Quoted 11 lines
tools/libxl/libxl_dm.c +4 -2
+                    }
                     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_compare_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",

So, now iothread are mandatory? It would also mean that libxl cann't use QEMU older that 2.11, I think.
Can't QEMU creates an iothread automatically if none are provided?

Also, it looks like that if one of the colo-compare option is missing, the colo-compare object isn't created at all with no warning for the users of libxl.

What's the difference between `colo_iothread' and
`colo_compare_iothread' ?

If a user only as the choice of a iothread id, why not have libxl create one on its own instead?

Thanks,

Signature · 6 lines
Anthony PERARD

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

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: Tuesday, July 2, 2019 7:52 PM
To: Zhang, Chen <[email protected]>
Cc: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; xen- [email protected]; Zhang Chen <[email protected]>
Subject: Re: [Xen-devel] [PATCH] tools/libxl: Add iothread support for COLO

Quoted 3 lines

Hi,

Thanks for the patch, I've got plenty of question.

OK~ Very happy to discuss about that.

Quoted 32 lines · Zhang Chen

tools/libxl/libxl_dm.c static int

Quoted 20 lines

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 |  2 ++
 tools/xl/xl_parse.c         |  4 ++++
 3 files changed, 17 insertions(+), 3 deletions(-)
tools/libxl/libxl_dm.c index renamed from tools/libxl/libxl_dm.c +0 -0

f4fc96415d..6bb400efdf 100644

tools/libxl/libxl_dm.c +0 -0
@@ -1629,17 +1629,25 @@ static int

libxl__build_device_model_args_new(libxl__gc *gc,

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc, · line 1636

Quoted 8 lines
tools/libxl/libxl_dm.c +5 -0
                                      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));
Quoted 2 lines

This creates an iothread object, but it isn't used anywhere. What the purpose of it?

No, colo compare use the iothread by the "colo_compare_iothread".

Quoted 3 lines

Also, iothreads have options like "poll-grow", I don't know if you want to have that configurable or just keep the default values, just something to keep in mind.

Keep default.

Quoted 11 lines

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc,

Quoted 11 lines
tools/libxl/libxl_dm.c +3 -2
+                    }
                     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_compare_iothread) {
                         flexarray_append(dm_args, "-object");
                         flexarray_append(dm_args,
-                           GCSPRINTF("colo-
Quoted 8 lines

compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%s,notify_dev=%s",

tools/libxl/libxl_dm.c static int · line 1647

Quoted 3 lines
tools/libxl/libxl_dm.c +3 -0
+
+ GCSPRINTF("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%
+ s,notify_dev=%s,iothread=%s",

So, now iothread are mandatory? It would also mean that libxl cann't use QEMU older that 2.11, I think.
Can't QEMU creates an iothread automatically if none are provided?

In current COLO design, iothread are mandatory, it's from Qemu maintainer's comments to make
Colo-compare thread independent with Qemu main loop for better performance.
I think libxl can use upstream Qemu to run COLO.
Qemu can't creates iothread automatically, because it needs user input ID for iothread, then it will be used to other qemu module(need the ID).

Quoted 6 lines

Also, it looks like that if one of the colo-compare option is missing, the colo- compare object isn't created at all with no warning for the users of libxl.

What's the difference between colo_iothread' and colo_compare_iothread' ?

"Colo_iothread" is iothread ID, "colo_compare_iothread" is colo compare used iothread's ID. In current COLO case, two ID must same.
But for future or other case, it can different(maybe RX/TX use two iothread in future).

Quoted 2 lines

If a user only as the choice of a iothread id, why not have libxl create one on its own instead?

Because user also need input the iothread ID to colo-compare module. So we integrated the job here.

Thanks
Zhang Chen

Quoted 5 lines

Thanks,

--
Anthony PERARD

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

#5 lore raw
Quoted 53 lines · Chen
Quoted 16 lines · Zhang Chen

tools/libxl/libxl_dm.c static int

Quoted 5 lines
tools/libxl/libxl_dm.c index renamed from tools/libxl/libxl_dm.c +0 -0

f4fc96415d..6bb400efdf 100644

tools/libxl/libxl_dm.c +0 -0
@@ -1629,17 +1629,25 @@ static int

libxl__build_device_model_args_new(libxl__gc *gc,

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc, · line 1636

Quoted 8 lines
tools/libxl/libxl_dm.c +5 -0
                                      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));
Quoted 2 lines

This creates an iothread object, but it isn't used anywhere. What the purpose of it?

No, colo compare use the iothread by the "colo_compare_iothread".

Quoted 11 lines

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc,

Quoted 11 lines
tools/libxl/libxl_dm.c +3 -2
+                    }
                     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_compare_iothread) {
                         flexarray_append(dm_args, "-object");
                         flexarray_append(dm_args,
-                           GCSPRINTF("colo-
Quoted 8 lines

compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%s,notify_dev=%s",

tools/libxl/libxl_dm.c static int · line 1647

Quoted 3 lines
tools/libxl/libxl_dm.c +3 -0
+
+ GCSPRINTF("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outdev=%
+ s,notify_dev=%s,iothread=%s",

So, now iothread are mandatory? It would also mean that libxl cann't use QEMU older that 2.11, I think.
Can't QEMU creates an iothread automatically if none are provided?

In current COLO design, iothread are mandatory, it's from Qemu maintainer's comments to make
Colo-compare thread independent with Qemu main loop for better performance.
I think libxl can use upstream Qemu to run COLO.
Qemu can't creates iothread automatically, because it needs user input ID for iothread, then it will be used to other qemu module(need the ID).

Quoted 6 lines

Also, it looks like that if one of the colo-compare option is missing, the colo- compare object isn't created at all with no warning for the users of libxl.

What's the difference between colo_iothread' and colo_compare_iothread' ?

Quoted 8 lines

"Colo_iothread" is iothread ID, "colo_compare_iothread" is colo compare used iothread's ID. In current COLO case, two ID must same.
But for future or other case, it can different(maybe RX/TX use two iothread in future).

Quoted 2 lines

If a user only as the choice of a iothread id, why not have libxl create one on its own instead?

Because user also need input the iothread ID to colo-compare module.

What's a "colo-compare module"? Is it something outside of QEMU? If not, then I don't think users of libxl needs to provide a name for this iothread. Instead of adding "colo*_iothread" could you do something like the following?

char *colo_compare_iothread_id = GCSPRINTF("colo-compare-iothread-%d", i); flexarray_append_pair(dm_args, "-object",

                      GCSPRINTF("iothread,id=%s", colo_compare_iothread_id);
// then use `colo_compare_iothread_id' when generating the
// "colo-compare" option list:
flexarray_append(dm_args, GCSPRINTF("colo-compare,...,iothread=%s",
                                    ..., colo_compare_iothread_id));

I think that will be more than enough for now. iothread can't be reused by something else that libxl create, and there can be only one "colo-compare" object in QEMU because the id is hard-coded in libxl.

What do you thing?

(I'm trying to make using COLO with libxl a little bit easier. libxl can be use to hide all the glory details of a QEMU command line.)

Thanks,

Signature · 6 lines
Anthony PERARD

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

-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: Wednesday, July 3, 2019 11:39 AM
To: Zhang, Chen <[email protected]>
Cc: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; xen- [email protected]; Zhang Chen <[email protected]>
Subject: Re: [Xen-devel] [PATCH] tools/libxl: Add iothread support for COLO

Quoted 39 lines · Chen
Quoted 16 lines · Zhang Chen

tools/libxl/libxl_dm.c static int

Quoted 5 lines
tools/libxl/libxl_dm.c index renamed from tools/libxl/libxl_dm.c +0 -0

f4fc96415d..6bb400efdf 100644

tools/libxl/libxl_dm.c +0 -0
@@ -1629,17 +1629,25 @@ static int

libxl__build_device_model_args_new(libxl__gc *gc,

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc, · line 1636

Quoted 8 lines
tools/libxl/libxl_dm.c +5 -0
                                      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));
Quoted 2 lines

This creates an iothread object, but it isn't used anywhere. What the purpose of it?

No, colo compare use the iothread by the "colo_compare_iothread".

Quoted 18 lines

tools/libxl/libxl_dm.c static int libxl__build_device_model_args_new(libxl__gc *gc,

Quoted 11 lines
tools/libxl/libxl_dm.c +3 -2
+                    }
                     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_compare_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" ,

Quoted 4 lines
tools/libxl/libxl_dm.c +4 -0
+
+ GCSPRINTF("colo-compare,id=c1,primary_in=%s,secondary_in=%s,outd
+ ev=%
+ s,notify_dev=%s,iothread=%s",
Quoted 6 lines
Quoted 3 lines

So, now iothread are mandatory? It would also mean that libxl cann't use QEMU older that 2.11, I think.
Can't QEMU creates an iothread automatically if none are provided?

In current COLO design, iothread are mandatory, it's from Qemu maintainer's comments to make Colo-compare thread independent with

Qemu main loop for better performance.

Quoted 2 lines

I think libxl can use upstream Qemu to run COLO.
Qemu can't creates iothread automatically, because it needs user input ID for

iothread, then it will be used to other qemu module(need the ID).

Quoted 4 lines
Quoted 4 lines

Also, it looks like that if one of the colo-compare option is missing, the colo- compare object isn't created at all with no warning for

the users of libxl.

Quoted 2 lines
Quoted 2 lines

What's the difference between `colo_iothread' and

`colo_compare_iothread' ?

Quoted 3 lines
Quoted 1 line

"Colo_iothread" is iothread ID, "colo_compare_iothread" is colo compare

used iothread's ID.

Quoted 2 lines

In current COLO case, two ID must same.
But for future or other case, it can different(maybe RX/TX use two iothread in

future).

Quoted 5 lines
Quoted 3 lines

If a user only as the choice of a iothread id, why not have libxl create one on its own instead?

Because user also need input the iothread ID to colo-compare module.

What's a "colo-compare module"? Is it something outside of QEMU?
If not, then I don't think users of libxl needs to provide a name for this iothread. Instead of adding "colo*_iothread" could you do something like the following?

char *colo_compare_iothread_id = GCSPRINTF("colo-compare-iothread-%d", i); flexarray_append_pair(dm_args, "-object",
GCSPRINTF("iothread,id=%s", colo_compare_iothread_id); // then
use `colo_compare_iothread_id' when generating the // "colo-compare" option list:
flexarray_append(dm_args, GCSPRINTF("colo-compare,...,iothread=%s",

                                    ..., colo_compare_iothread_id));
Quoted 8 lines

I think that will be more than enough for now. iothread can't be reused by something else that libxl create, and there can be only one "colo-compare" object in QEMU because the id is hard-coded in libxl.

What do you thing?

(I'm trying to make using COLO with libxl a little bit easier. libxl can be use to hide all the glory details of a QEMU command line.)

Hi Anthony,

Yes, the colo-compare module is a part of Qemu.
Your idea is good for now, easy to use, I can change it in next version.

Thanks
Zhang Chen

Quoted 5 lines

Thanks,

--
Anthony PERARD

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