qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up
@ 2020-06-24  1:20 Zhang Chen
  2020-06-24  1:20 ` [PATCH V2 1/2] net/colo-compare.c: Expose compare "max_queue_size" to users Zhang Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zhang Chen @ 2020-06-24  1:20 UTC (permalink / raw)
  To: Jason Wang; +Cc: Zhang Chen, qemu-dev, Zhang Chen

From: Zhang Chen <chen.zhang@intel.com>

This series make a way to config COLO "max_queue_size" parameters according to
user's scenarios and environments and do some clean up for descriptions.

V2:
 - Rebase on upstream code.

Zhang Chen (2):
  net/colo-compare.c: Expose compare "max_queue_size" to users
  qemu-options.hx: Clean up and fix typo for colo-compare

 net/colo-compare.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 qemu-options.hx    | 33 +++++++++++++++++----------------
 2 files changed, 59 insertions(+), 17 deletions(-)

-- 
2.17.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2 1/2] net/colo-compare.c: Expose compare "max_queue_size" to users
  2020-06-24  1:20 [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang Chen
@ 2020-06-24  1:20 ` Zhang Chen
  2020-06-24  1:20 ` [PATCH V2 2/2] qemu-options.hx: Clean up and fix typo for colo-compare Zhang Chen
  2020-07-03  9:27 ` [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang, Chen
  2 siblings, 0 replies; 5+ messages in thread
From: Zhang Chen @ 2020-06-24  1:20 UTC (permalink / raw)
  To: Jason Wang; +Cc: Zhang Chen, qemu-dev, Zhang Chen

From: Zhang Chen <chen.zhang@intel.com>

This patch allow users to set the "max_queue_size" according
to their environment.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
 net/colo-compare.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 qemu-options.hx    |  5 +++--
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/net/colo-compare.c b/net/colo-compare.c
index f15779dedc..ed9cf5d3c4 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -59,6 +59,7 @@ static bool colo_compare_active;
 static QemuMutex event_mtx;
 static QemuCond event_complete_cond;
 static int event_unhandled_count;
+static uint32_t max_queue_size;
 
 /*
  *  + CompareState ++
@@ -222,7 +223,7 @@ static void fill_pkt_tcp_info(void *data, uint32_t *max_ack)
  */
 static int colo_insert_packet(GQueue *queue, Packet *pkt, uint32_t *max_ack)
 {
-    if (g_queue_get_length(queue) <= MAX_QUEUE_SIZE) {
+    if (g_queue_get_length(queue) <= max_queue_size) {
         if (pkt->ip->ip_p == IPPROTO_TCP) {
             fill_pkt_tcp_info(pkt, max_ack);
             g_queue_insert_sorted(queue,
@@ -1144,6 +1145,37 @@ out:
     error_propagate(errp, local_err);
 }
 
+static void get_max_queue_size(Object *obj, Visitor *v,
+                               const char *name, void *opaque,
+                               Error **errp)
+{
+    uint32_t value = max_queue_size;
+
+    visit_type_uint32(v, name, &value, errp);
+}
+
+static void set_max_queue_size(Object *obj, Visitor *v,
+                               const char *name, void *opaque,
+                               Error **errp)
+{
+    Error *local_err = NULL;
+    uint32_t value;
+
+    visit_type_uint32(v, name, &value, &local_err);
+    if (local_err) {
+        goto out;
+    }
+    if (!value) {
+        error_setg(&local_err, "Property '%s.%s' requires a positive value",
+                   object_get_typename(obj), name);
+        goto out;
+    }
+    max_queue_size = value;
+
+out:
+    error_propagate(errp, local_err);
+}
+
 static void compare_pri_rs_finalize(SocketReadState *pri_rs)
 {
     CompareState *s = container_of(pri_rs, CompareState, pri_rs);
@@ -1261,6 +1293,11 @@ static void colo_compare_complete(UserCreatable *uc, Error **errp)
         s->expired_scan_cycle = REGULAR_PACKET_CHECK_MS;
     }
 
+    if (!max_queue_size) {
+        /* Set default queue size to 1024 */
+        max_queue_size = MAX_QUEUE_SIZE;
+    }
+
     if (find_and_check_chardev(&chr, s->pri_indev, errp) ||
         !qemu_chr_fe_init(&s->chr_pri_in, chr, errp)) {
         return;
@@ -1380,6 +1417,10 @@ static void colo_compare_init(Object *obj)
                         compare_get_expired_scan_cycle,
                         compare_set_expired_scan_cycle, NULL, NULL);
 
+    object_property_add(obj, "max_queue_size", "uint32",
+                        get_max_queue_size,
+                        set_max_queue_size, NULL, NULL);
+
     s->vnet_hdr = false;
     object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr,
                              compare_set_vnet_hdr);
diff --git a/qemu-options.hx b/qemu-options.hx
index 93bde2bbc8..3ee19a4b0d 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4639,7 +4639,7 @@ SRST
         stored. The file format is libpcap, so it can be analyzed with
         tools such as tcpdump or Wireshark.
 
-    ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id][,compare_timeout=@var{ms}][,expired_scan_cycle=@var{ms}``
+    ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id][,compare_timeout=@var{ms}][,expired_scan_cycle=@var{ms}][,max_queue_size=@var{size}]``
         Colo-compare gets packet from primary\_inchardevid and
         secondary\_inchardevid, than compare primary packet with
         secondary packet. If the packets are same, we will output
@@ -4651,7 +4651,8 @@ SRST
         vnet\_hdr\_len. Then compare\_timeout=@var{ms} determines the
         maximum delay colo-compare wait for the packet.
         The expired\_scan\_cycle=@var{ms} to set the period of scanning
-        expired primary node network packets.
+        expired primary node network packets. The max\_queue\_size=@var{size}
+        is to set the max compare queue size depend on user environment.
         If you want to use Xen COLO, will need the notify\_dev to
         notify Xen colo-frame to do checkpoint.
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V2 2/2] qemu-options.hx: Clean up and fix typo for colo-compare
  2020-06-24  1:20 [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang Chen
  2020-06-24  1:20 ` [PATCH V2 1/2] net/colo-compare.c: Expose compare "max_queue_size" to users Zhang Chen
@ 2020-06-24  1:20 ` Zhang Chen
  2020-07-03  9:27 ` [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang, Chen
  2 siblings, 0 replies; 5+ messages in thread
From: Zhang Chen @ 2020-06-24  1:20 UTC (permalink / raw)
  To: Jason Wang; +Cc: Zhang Chen, qemu-dev, Zhang Chen

From: Zhang Chen <chen.zhang@intel.com>

Fix some typo and optimized some descriptions.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
 qemu-options.hx | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 3ee19a4b0d..aa7ffb34db 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4640,24 +4640,24 @@ SRST
         tools such as tcpdump or Wireshark.
 
     ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id][,compare_timeout=@var{ms}][,expired_scan_cycle=@var{ms}][,max_queue_size=@var{size}]``
-        Colo-compare gets packet from primary\_inchardevid and
-        secondary\_inchardevid, than compare primary packet with
-        secondary packet. If the packets are same, we will output
-        primary packet to outdevchardevid, else we will notify
-        colo-frame do checkpoint and send primary packet to
-        outdevchardevid. In order to improve efficiency, we need to put
-        the task of comparison in another thread. If it has the
-        vnet\_hdr\_support flag, colo compare will send/recv packet with
-        vnet\_hdr\_len. Then compare\_timeout=@var{ms} determines the
-        maximum delay colo-compare wait for the packet.
-        The expired\_scan\_cycle=@var{ms} to set the period of scanning
-        expired primary node network packets. The max\_queue\_size=@var{size}
-        is to set the max compare queue size depend on user environment.
-        If you want to use Xen COLO, will need the notify\_dev to
+        Colo-compare gets packet from primary\_in chardevid and
+        secondary\_in, then compare whether the payload of primary packet
+        and secondary packet are the same. If same, it will output
+        primary packet to out\_dev, else it will notify COLO-framework to do
+        checkpoint and send primary packet to out\_dev. In order to
+        improve efficiency, we need to put the task of comparison in
+        another iothread. If it has the vnet\_hdr\_support flag,
+        colo compare will send/recv packet with vnet\_hdr\_len.
+        The compare\_timeout=@var{ms} determines the maximum time of the
+        colo-compare hold the packet. The expired\_scan\_cycle=@var{ms}
+        is to set the period of scanning expired primary node network packets.
+        The max\_queue\_size=@var{size} is to set the max compare queue
+        size depend on user environment.
+        If user want to use Xen COLO, need to add the notify\_dev to
         notify Xen colo-frame to do checkpoint.
 
-        we must use it with the help of filter-mirror and
-        filter-redirector.
+        COLO-compare must be used with the help of filter-mirror,
+        filter-redirector and filter-rewriter.
 
         ::
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up
  2020-06-24  1:20 [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang Chen
  2020-06-24  1:20 ` [PATCH V2 1/2] net/colo-compare.c: Expose compare "max_queue_size" to users Zhang Chen
  2020-06-24  1:20 ` [PATCH V2 2/2] qemu-options.hx: Clean up and fix typo for colo-compare Zhang Chen
@ 2020-07-03  9:27 ` Zhang, Chen
  2020-07-03  9:29   ` Jason Wang
  2 siblings, 1 reply; 5+ messages in thread
From: Zhang, Chen @ 2020-07-03  9:27 UTC (permalink / raw)
  To: Jason Wang; +Cc: qemu-dev, Zhang Chen

Hi Jason,

Maybe missed this updated series?

Thanks
Zhang Chen

> -----Original Message-----
> From: Zhang, Chen <chen.zhang@intel.com>
> Sent: Wednesday, June 24, 2020 9:21 AM
> To: Jason Wang <jasowang@redhat.com>
> Cc: Zhang Chen <zhangckid@gmail.com>; qemu-dev <qemu-
> devel@nongnu.org>; Zhang, Chen <chen.zhang@intel.com>
> Subject: [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to
> users and clean up
> 
> From: Zhang Chen <chen.zhang@intel.com>
> 
> This series make a way to config COLO "max_queue_size" parameters
> according to user's scenarios and environments and do some clean up for
> descriptions.
> 
> V2:
>  - Rebase on upstream code.
> 
> Zhang Chen (2):
>   net/colo-compare.c: Expose compare "max_queue_size" to users
>   qemu-options.hx: Clean up and fix typo for colo-compare
> 
>  net/colo-compare.c | 43
> ++++++++++++++++++++++++++++++++++++++++++-
>  qemu-options.hx    | 33 +++++++++++++++++----------------
>  2 files changed, 59 insertions(+), 17 deletions(-)
> 
> --
> 2.17.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up
  2020-07-03  9:27 ` [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang, Chen
@ 2020-07-03  9:29   ` Jason Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2020-07-03  9:29 UTC (permalink / raw)
  To: Zhang, Chen; +Cc: qemu-dev, Zhang Chen


On 2020/7/3 下午5:27, Zhang, Chen wrote:
> Hi Jason,
>
> Maybe missed this updated series?
>
> Thanks
> Zhang Chen


Nope :)

It's in my queue. Since I only have those two patches so I don't plan to 
send pull request this week.

(Anyway it's not a feature, so we don't need to worry about soft freeze).

Thanks


>
>> -----Original Message-----
>> From: Zhang, Chen <chen.zhang@intel.com>
>> Sent: Wednesday, June 24, 2020 9:21 AM
>> To: Jason Wang <jasowang@redhat.com>
>> Cc: Zhang Chen <zhangckid@gmail.com>; qemu-dev <qemu-
>> devel@nongnu.org>; Zhang, Chen <chen.zhang@intel.com>
>> Subject: [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to
>> users and clean up
>>
>> From: Zhang Chen <chen.zhang@intel.com>
>>
>> This series make a way to config COLO "max_queue_size" parameters
>> according to user's scenarios and environments and do some clean up for
>> descriptions.
>>
>> V2:
>>   - Rebase on upstream code.
>>
>> Zhang Chen (2):
>>    net/colo-compare.c: Expose compare "max_queue_size" to users
>>    qemu-options.hx: Clean up and fix typo for colo-compare
>>
>>   net/colo-compare.c | 43
>> ++++++++++++++++++++++++++++++++++++++++++-
>>   qemu-options.hx    | 33 +++++++++++++++++----------------
>>   2 files changed, 59 insertions(+), 17 deletions(-)
>>
>> --
>> 2.17.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-03  9:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-24  1:20 [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang Chen
2020-06-24  1:20 ` [PATCH V2 1/2] net/colo-compare.c: Expose compare "max_queue_size" to users Zhang Chen
2020-06-24  1:20 ` [PATCH V2 2/2] qemu-options.hx: Clean up and fix typo for colo-compare Zhang Chen
2020-07-03  9:27 ` [PATCH V2 0/2] net/colo-compare.c: Expose "max_queue_size" to users and clean up Zhang, Chen
2020-07-03  9:29   ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).