From nobody Sun Feb 8 12:31:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1586576933; cv=none; d=zohomail.com; s=zohoarc; b=NyUk6adIkCQYzKQDlw7lDsUjw5ME8UG88vyWz6ST6b/6FafuZd1GW16NPmrDWvJDi+e/LPyMqV4F7zElcXh2T1pFn6xEl8WK1jnbe5K6BA1DJAzqllhlUHotFlruy0L0X/9bGjcFkeWbSPS0f87y44N8XAmTyEbJa9Lh3j8rAUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586576933; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=G/HVJnkLmXwfPZr+27YzLmM3xqnUIa3OBpTOv8K9cRQ=; b=frsPTEmJHCY67mE8P+vPNvKuY8jAQcH2FgdbmEKccwq0Em/HPAmTJMoZ+gsLxrTTgOm5sfcxQMRLun37cQFeVUbAEz/MbHNMbx+bzW28motwivvQbzB/KP3rwgdmTO+CCc6SxN2eJ7Ef+dxSkIuV3xJRha550xHQgWN8yMOQebI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586576933876646.435886455714; Fri, 10 Apr 2020 20:48:53 -0700 (PDT) Received: from localhost ([::1]:48346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jN78W-0000mN-It for importer@patchew.org; Fri, 10 Apr 2020 23:48:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45016) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jN77k-0008HU-GN for qemu-devel@nongnu.org; Fri, 10 Apr 2020 23:48:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jN77i-0004iJ-T1 for qemu-devel@nongnu.org; Fri, 10 Apr 2020 23:48:04 -0400 Received: from mga18.intel.com ([134.134.136.126]:21814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jN77i-0004dC-LG for qemu-devel@nongnu.org; Fri, 10 Apr 2020 23:48:02 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 20:47:54 -0700 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga004.fm.intel.com with ESMTP; 10 Apr 2020 20:47:53 -0700 IronPort-SDR: UmaOYiwJDWlmgCAMY29YowU/lMIxJjIhwswUyS3S/AGNRekUEGT3p+8PhnwcepDnSroET6T1tW XGrRmpAS8v/Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False IronPort-SDR: AUpLOOfYT3rdJ3PWZE3Suzr/hsRNXleNudOXJ7f1bWKmxzKybPKIezLLz8ocRcxtWBRdTjKxxE wALHplis7E6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,368,1580803200"; d="scan'208";a="276368261" From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 1/2] net/colo-compare.c: Expose compare "max_queue_size" to users Date: Sat, 11 Apr 2020 11:38:23 +0800 Message-Id: <20200411033824.19389-2-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200411033824.19389-1-chen.zhang@intel.com> References: <20200411033824.19389-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 134.134.136.126 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen This patch allow users to set the "max_queue_size" according to their environment. Signed-off-by: Zhang Chen --- 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 10c0239f9d..def60ff2ea 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -54,6 +54,7 @@ static NotifierList colo_compare_notifiers =3D static QemuMutex event_mtx; static QemuCond event_complete_cond; static int event_unhandled_count; +static uint32_t max_queue_size; =20 /* * + CompareState ++ @@ -193,7 +194,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_ac= k) { - if (g_queue_get_length(queue) <=3D MAX_QUEUE_SIZE) { + if (g_queue_get_length(queue) <=3D max_queue_size) { if (pkt->ip->ip_p =3D=3D IPPROTO_TCP) { fill_pkt_tcp_info(pkt, max_ack); g_queue_insert_sorted(queue, @@ -1051,6 +1052,37 @@ out: error_propagate(errp, local_err); } =20 +static void get_max_queue_size(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + uint32_t value =3D 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 =3D 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 =3D value; + +out: + error_propagate(errp, local_err); +} + static void compare_pri_rs_finalize(SocketReadState *pri_rs) { CompareState *s =3D container_of(pri_rs, CompareState, pri_rs); @@ -1167,6 +1199,11 @@ static void colo_compare_complete(UserCreatable *uc,= Error **errp) s->expired_scan_cycle =3D REGULAR_PACKET_CHECK_MS; } =20 + if (!max_queue_size) { + /* Set default queue size to 1024 */ + max_queue_size =3D MAX_QUEUE_SIZE; + } + if (find_and_check_chardev(&chr, s->pri_indev, errp) || !qemu_chr_fe_init(&s->chr_pri_in, chr, errp)) { return; @@ -1270,6 +1307,10 @@ static void colo_compare_init(Object *obj) compare_get_expired_scan_cycle, compare_set_expired_scan_cycle, NULL, NULL, NULL); =20 + object_property_add(obj, "max_queue_size", "uint32", + get_max_queue_size, + set_max_queue_size, NULL, NULL, NULL); + s->vnet_hdr =3D false; object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr, compare_set_vnet_hdr, NULL); diff --git a/qemu-options.hx b/qemu-options.hx index 16debd03cb..107ff3e71b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4615,7 +4615,7 @@ SRST stored. The file format is libpcap, so it can be analyzed with tools such as tcpdump or Wireshark. =20 - ``-object colo-compare,id=3Did,primary_in=3Dchardevid,secondary_in=3Dc= hardevid,outdev=3Dchardevid,iothread=3Did[,vnet_hdr_support][,notify_dev=3D= id][,compare_timeout=3D@var{ms}][,expired_scan_cycle=3D@var{ms}`` + ``-object colo-compare,id=3Did,primary_in=3Dchardevid,secondary_in=3Dc= hardevid,outdev=3Dchardevid,iothread=3Did[,vnet_hdr_support][,notify_dev=3D= id][,compare_timeout=3D@var{ms}][,expired_scan_cycle=3D@var{ms}][,max_queue= _size=3D@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 @@ -4627,7 +4627,8 @@ SRST vnet\_hdr\_len. Then compare\_timeout=3D@var{ms} determines the maximum delay colo-compare wait for the packet. The expired\_scan\_cycle=3D@var{ms} to set the period of scanning - expired primary node network packets. + expired primary node network packets. The max\_queue\_size=3D@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. =20 --=20 2.17.1 From nobody Sun Feb 8 12:31:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1586576997; cv=none; d=zohomail.com; s=zohoarc; b=YELNwNhBOrdPAmwGQ+UGnJSeVZC5bV7Kd6W303i1mAbp4DJ+GwridcAADrnC98b+vO61lxTdnYdQG2IjA0CkLEsR7+vlzEs8aBDKIiK+L1xCKO/Y5obSleYxy2+fW8CNX5ivzvX8ISqACvgmqxgMyPwXZWjhyTkgzIKS1v25KW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586576997; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=5uG9Cevneam1F7SZzNEBBIfdKxBAshzPyZWPso+nRDA=; b=H/LR34tuQ6j6quyaRFkads20rPtiQR6f3Cu1/lpDKR7U6PNonPeQsYmDzqJew3kx8nW+SbFrRUiqIE4jerim6oc25M/dZ5y8P3XkSmOoHbgbwFz+NnfCgaIzdCIh52IvanE1BKclf/TDZB2BTYyc0+9e5MPgk+Y47/lA6Bk06JQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586576997688827.3502376091222; Fri, 10 Apr 2020 20:49:57 -0700 (PDT) Received: from localhost ([::1]:48354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jN79Y-0002G6-GF for importer@patchew.org; Fri, 10 Apr 2020 23:49:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45017) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jN77k-0008HX-Ih for qemu-devel@nongnu.org; Fri, 10 Apr 2020 23:48:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jN77j-0004ii-9w for qemu-devel@nongnu.org; Fri, 10 Apr 2020 23:48:04 -0400 Received: from mga18.intel.com ([134.134.136.126]:21812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jN77j-0004c4-2i for qemu-devel@nongnu.org; Fri, 10 Apr 2020 23:48:03 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 20:47:56 -0700 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga004.fm.intel.com with ESMTP; 10 Apr 2020 20:47:54 -0700 IronPort-SDR: 6OhTH1+zAHU/s8VIHlNYEpWMrvY3nQ2bvDYhkzwTsNZV25IzalioGV79drotW0JQjBfFvjbcrK bTWOnzOLbSow== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False IronPort-SDR: Ye86VTGOXlF0h8x7lUd3o4oigxRU0K/Ar3mN/ChhX4bHEllVMRhVuqKpTWc6BnMcxmtXkHxbPl 0omecEp+Ya0g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,368,1580803200"; d="scan'208";a="276368264" From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 2/2] qemu-options.hx: Clean up and fix typo for colo-compare Date: Sat, 11 Apr 2020 11:38:24 +0800 Message-Id: <20200411033824.19389-3-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200411033824.19389-1-chen.zhang@intel.com> References: <20200411033824.19389-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 134.134.136.126 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen Fix some typo and optimized some descriptions. Signed-off-by: Zhang Chen --- qemu-options.hx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 107ff3e71b..84368f15be 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4616,24 +4616,24 @@ SRST tools such as tcpdump or Wireshark. =20 ``-object colo-compare,id=3Did,primary_in=3Dchardevid,secondary_in=3Dc= hardevid,outdev=3Dchardevid,iothread=3Did[,vnet_hdr_support][,notify_dev=3D= id][,compare_timeout=3D@var{ms}][,expired_scan_cycle=3D@var{ms}][,max_queue= _size=3D@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=3D@var{ms} determines the - maximum delay colo-compare wait for the packet. - The expired\_scan\_cycle=3D@var{ms} to set the period of scanning - expired primary node network packets. The max\_queue\_size=3D@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=3D@var{ms} determines the maximum time of the + colo-compare hold the packet. The expired\_scan\_cycle=3D@var{ms} + is to set the period of scanning expired primary node network pack= ets. + The max\_queue\_size=3D@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. =20 - 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. =20 :: =20 --=20 2.17.1