From nobody Fri Apr 11 19:01:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562040880; cv=none; d=zoho.com; s=zohoarc; b=P13s55WzEE0OU8rR6JZXYUkzM/HBXZS//fiTk8nWQx9pnMRv1qcOEXNJIpi1WnUG7QONruzGq2be0vGKfs8Pd6pBEtTG2uLyjDcgVuW5HbjBwS0YwCV+xwc12vFcPQjGjQcXhhA8fkh3g8GZ3AbkVPiCA5qQfYyfw0ahdKgwb6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562040880; 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:ARC-Authentication-Results; bh=qvNID5FnIZJz3tGij9qavm9DOn1vLn5BTgFdZp5CoVM=; b=PFmQshe6dnnx2JEQEYKWQSZWw7xka8J5BD4vaYbio9uir/O/QfP7TJeYELqHAjyNllUq/iGnr6eFfUwVDaqPSJ7nBayJEwCnNzYu5xXpBPHmjPTVMe5nfJ/W6oslsZdYE1w5MUrxg8EXtlakgLYv5FJjE4ourGdJz3vruX4m4bw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1562040880458859.6264414167135; Mon, 1 Jul 2019 21:14:40 -0700 (PDT) Received: from localhost ([::1]:48544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiABg-0000Xy-Pz for importer@patchew.org; Tue, 02 Jul 2019 00:14:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50530) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hi8aR-00058O-Rr for qemu-devel@nongnu.org; Mon, 01 Jul 2019 22:32:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hi8aQ-0003kM-Gc for qemu-devel@nongnu.org; Mon, 01 Jul 2019 22:32:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60178) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hi8aQ-0003jz-7q for qemu-devel@nongnu.org; Mon, 01 Jul 2019 22:32:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AE7630BBE9B; Tue, 2 Jul 2019 02:32:01 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-232.pek2.redhat.com [10.72.12.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC67868405; Tue, 2 Jul 2019 02:31:59 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 2 Jul 2019 10:31:25 +0800 Message-Id: <1562034689-6539-14-git-send-email-jasowang@redhat.com> In-Reply-To: <1562034689-6539-1-git-send-email-jasowang@redhat.com> References: <1562034689-6539-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 02 Jul 2019 02:32:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/17] COLO-compare: Add new parameter to communicate with remote colo-frame 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 , Jason Wang 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 We add the "notify_dev=3DchardevID" parameter. After that colo-compare can = connect with remote(currently just for Xen, KVM-COLO didn't need it.) colo-frame through= chardev socket, it can notify remote(Xen) colo-frame to handle checkpoint event. Signed-off-by: Zhang Chen Signed-off-by: Jason Wang --- net/colo-compare.c | 21 +++++++++++++++++++++ qemu-options.hx | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 103297b..10fae2b 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -83,6 +83,7 @@ typedef struct CompareState { char *pri_indev; char *sec_indev; char *outdev; + char *notify_dev; CharBackend chr_pri_in; CharBackend chr_sec_in; CharBackend chr_out; @@ -897,6 +898,21 @@ static void compare_set_vnet_hdr(Object *obj, s->vnet_hdr =3D value; } =20 +static char *compare_get_notify_dev(Object *obj, Error **errp) +{ + CompareState *s =3D COLO_COMPARE(obj); + + return g_strdup(s->notify_dev); +} + +static void compare_set_notify_dev(Object *obj, const char *value, Error *= *errp) +{ + CompareState *s =3D COLO_COMPARE(obj); + + g_free(s->notify_dev); + s->notify_dev =3D g_strdup(value); +} + static void compare_pri_rs_finalize(SocketReadState *pri_rs) { CompareState *s =3D container_of(pri_rs, CompareState, pri_rs); @@ -1057,6 +1073,10 @@ static void colo_compare_init(Object *obj) (Object **)&s->iothread, object_property_allow_set_link, OBJ_PROP_LINK_STRONG, NULL); + /* This parameter just for Xen COLO */ + object_property_add_str(obj, "notify_dev", + compare_get_notify_dev, compare_set_notify_dev, + NULL); =20 s->vnet_hdr =3D false; object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr, @@ -1103,6 +1123,7 @@ static void colo_compare_finalize(Object *obj) g_free(s->pri_indev); g_free(s->sec_indev); g_free(s->outdev); + g_free(s->notify_dev); } =20 static const TypeInfo colo_compare_info =3D { diff --git a/qemu-options.hx b/qemu-options.hx index 0d8beb4..c18b790 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4477,7 +4477,7 @@ Dump the network traffic on netdev @var{dev} to the f= ile specified by The file format is libpcap, so it can be analyzed with tools such as tcpdu= mp or Wireshark. =20 -@item -object colo-compare,id=3D@var{id},primary_in=3D@var{chardevid},seco= ndary_in=3D@var{chardevid},outdev=3D@var{chardevid},iothread=3D@var{id}[,vn= et_hdr_support] +@item -object colo-compare,id=3D@var{id},primary_in=3D@var{chardevid},seco= ndary_in=3D@var{chardevid},outdev=3D@var{chardevid},iothread=3D@var{id}[,vn= et_hdr_support][,notify_dev=3D@var{id}] =20 Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@v= ar{chardevid}, than compare primary packet with secondary packet. If the packets are same, we will output primary @@ -4486,11 +4486,15 @@ do checkpoint and send primary packet to outdev@var= {chardevid}. 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. +If you want to use Xen COLO, will need 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. =20 @example =20 +KVM COLO + primary: -netdev tap,id=3Dhn0,vhost=3Doff,script=3D/etc/qemu-ifup,downscript=3D/etc= /qemu-ifdown -device e1000,id=3De0,netdev=3Dhn0,mac=3D52:a4:00:12:78:66 @@ -4514,6 +4518,33 @@ secondary: -object filter-redirector,id=3Df1,netdev=3Dhn0,queue=3Dtx,indev=3Dred0 -object filter-redirector,id=3Df2,netdev=3Dhn0,queue=3Drx,outdev=3Dred1 =20 + +Xen COLO + +primary: +-netdev tap,id=3Dhn0,vhost=3Doff,script=3D/etc/qemu-ifup,downscript=3D/etc= /qemu-ifdown +-device e1000,id=3De0,netdev=3Dhn0,mac=3D52:a4:00:12:78:66 +-chardev socket,id=3Dmirror0,host=3D3.3.3.3,port=3D9003,server,nowait +-chardev socket,id=3Dcompare1,host=3D3.3.3.3,port=3D9004,server,nowait +-chardev socket,id=3Dcompare0,host=3D3.3.3.3,port=3D9001,server,nowait +-chardev socket,id=3Dcompare0-0,host=3D3.3.3.3,port=3D9001 +-chardev socket,id=3Dcompare_out,host=3D3.3.3.3,port=3D9005,server,nowait +-chardev socket,id=3Dcompare_out0,host=3D3.3.3.3,port=3D9005 +-chardev socket,id=3Dnotify_way,host=3D3.3.3.3,port=3D9009,server,nowait +-object filter-mirror,id=3Dm0,netdev=3Dhn0,queue=3Dtx,outdev=3Dmirror0 +-object filter-redirector,netdev=3Dhn0,id=3Dredire0,queue=3Drx,indev=3Dcom= pare_out +-object filter-redirector,netdev=3Dhn0,id=3Dredire1,queue=3Drx,outdev=3Dco= mpare0 +-object iothread,id=3Diothread1 +-object colo-compare,id=3Dcomp0,primary_in=3Dcompare0-0,secondary_in=3Dcom= pare1,outdev=3Dcompare_out0,notify_dev=3Dnofity_way,iothread=3Diothread1 + +secondary: +-netdev tap,id=3Dhn0,vhost=3Doff,script=3D/etc/qemu-ifup,down script=3D/et= c/qemu-ifdown +-device e1000,netdev=3Dhn0,mac=3D52:a4:00:12:78:66 +-chardev socket,id=3Dred0,host=3D3.3.3.3,port=3D9003 +-chardev socket,id=3Dred1,host=3D3.3.3.3,port=3D9004 +-object filter-redirector,id=3Df1,netdev=3Dhn0,queue=3Dtx,indev=3Dred0 +-object filter-redirector,id=3Df2,netdev=3Dhn0,queue=3Drx,outdev=3Dred1 + @end example =20 If you want to know the detail of above command line, you can read --=20 2.5.0