From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alrqy-0002eN-39 for qemu-devel@nongnu.org; Fri, 01 Apr 2016 01:42:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alrqu-000698-Qu for qemu-devel@nongnu.org; Fri, 01 Apr 2016 01:42:40 -0400 Received: from [59.151.112.132] (port=35892 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alrqs-0005wk-4C for qemu-devel@nongnu.org; Fri, 01 Apr 2016 01:42:36 -0400 References: <1459326950-17708-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> <1459326950-17708-2-git-send-email-zhangchen.fnst@cn.fujitsu.com> <20160330092529.GB2471@work-vm> <56FC8035.8090201@cn.fujitsu.com> <20160331092351.GD2265@work-vm> <56FE02E5.8010305@redhat.com> From: Li Zhijian Message-ID: <56FE0A10.3010108@cn.fujitsu.com> Date: Fri, 1 Apr 2016 13:41:36 +0800 MIME-Version: 1.0 In-Reply-To: <56FE02E5.8010305@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2 1/3] colo-compare: introduce colo compare initlization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang , "Dr. David Alan Gilbert" , Zhang Chen Cc: Gui jianfeng , Yang Hongyang , "eddie.dong" , zhanghailiang , qemu devel On 04/01/2016 01:11 PM, Jason Wang wrote: > > > On 03/31/2016 05:24 PM, Dr. David Alan Gilbert wrote: >> * Zhang Chen (zhangchen.fnst@cn.fujitsu.com) wrote: >>> >>> On 03/30/2016 05:25 PM, Dr. David Alan Gilbert wrote: >>>> * Zhang Chen (zhangchen.fnst@cn.fujitsu.com) wrote: >>>>> packet come from primary char indev will be send to >>>>> outdev - packet come from secondary char dev will be drop >>>> Please put in the description an example of how you invoke >>>> the filter on the primary and secondary. >>> OK. >>> colo-compare get packet from chardev(primary_in,secondary_in), >>> and output to other chardev(outdev), so, we can use it with the >>> help of filter-mirror and filter-redirector. like that: >> Wow, this is a bit more complicated than I expected - I was expecting just one >> socket. So let me draw this out; see comments below. >> >>> primary: >>> -netdev >>> tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown >>> -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66 >>> -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait >>> -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait >>> -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait >>> -chardev socket,id=compare0-0,host=3.3.3.3,port=9001 >>> -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait >>> -chardev socket,id=compare_out0,host=3.3.3.3,port=9005 >>> -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0 >>> -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out >>> -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0 >>> -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0 >> ----> mirror0: socket:secondary:9003 >> | >> mirror-m0 <-- e1000 >> | >> v >> redirector-redire1 ---> compare0 socket:primary:9001 (to compare0-0) >> >> -----< compare0-0 socket:primary:9001 (to compare0) >> | primary_in >> | >> compare-comp0 -----> compare_out0 socket:primary:9005 >> | >> | secondary_in >> -----< compare1 socket:secondary:9004 >> >> tap <-- redirector-redire0 <--- compare_out socket:primary:9005 (from compare_out0) >> >> >>> secondary: >>> -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down >>> script=/etc/qemu-ifdown >>> -device e1000,netdev=hn0,mac=52:a4:00:12:78:66 >>> -chardev socket,id=red0,host=3.3.3.3,port=9003 >>> -chardev socket,id=red1,host=3.3.3.3,port=9004 >>> -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 >>> -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 >> ----> red0 socket::9003 >> | >> tap <-- redirector-f1 <-- >> e1000 >> --> redirector-f2 --> >> | >> ----< red1 socket::9004 >> >> OK, so I think we need to find a way to fix two things: >> a) There must be an easier way of connecting two filters within the same >> qemu than going up to the kernel's socket code, around it's TCP stack >> and back. Is there a better type of chardev to use we can short circuit >> with - it shouldn't need to leave QEMU (although I can see it's easier >> for debugging like this). Jason/Dan - any ideas? > > Looks like there's no such type of chardev. I think we could start with > tcp socket chardev first and do necessary optimization on top. In fact, > there's also advantages, with tcp sockets, the colo-compare codes could > even be an independent program out of qemu. > > For the chardev type, this also reminds me one thing. Since > mirror/redirector can only work for tcp socket, we may need inspect the > chardev types and fail if not a tcp socket like what vhost-user did. > > >> >> b) We should only need one socket for the connection between primary and >> secondary - I'm not sure how to change it to let it do that. > > Looks like we can (e.g for secondary): > > -device e1000,netdev=hn0,mac=52:a4:00:12:78:66 > -chardev socket,id=red0,host=3.3.3.3,port=9003 > -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 > -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red0 > > If not, probably a bug. Right, but firstly, 'chardev socket' need to enable 'mux=on' if we want two filter reference the same socket. Thanks > >> c) You need to be able to turn off nagling (socket no delay) on the sockets; >> I found a noticeable benefit of doing this on the connection between primary >> and secondary in my world. > > Right. > >> >> Dave >> > > > > > . >