From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7cyk-0007hA-Aq for qemu-devel@nongnu.org; Tue, 31 May 2016 02:16:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7cyf-00052j-9x for qemu-devel@nongnu.org; Tue, 31 May 2016 02:16:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7cyf-00052Z-0T for qemu-devel@nongnu.org; Tue, 31 May 2016 02:16:33 -0400 References: <1464180653-12637-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> <574BB14F.6050303@redhat.com> <574D0AEF.7080804@cn.fujitsu.com> From: Jason Wang Message-ID: <574D2C3B.4000603@redhat.com> Date: Tue, 31 May 2016 14:16:27 +0800 MIME-Version: 1.0 In-Reply-To: <574D0AEF.7080804@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH V4 0/4] Introduce COLO-compare List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhang Chen , qemu devel Cc: "eddie . dong" , zhanghailiang , Li Zhijian , "Dr . David Alan Gilbert" On 2016=E5=B9=B405=E6=9C=8831=E6=97=A5 11:54, Zhang Chen wrote: > > > On 05/30/2016 11:19 AM, Jason Wang wrote: >> >> >> On 2016=E5=B9=B405=E6=9C=8825=E6=97=A5 20:50, Zhang Chen wrote: >>> COLO-compare is a part of COLO project. It is used >>> to compare the network package to help COLO decide >>> whether to do checkpoint. >>> >>> the full version in this github: >>> https://github.com/zhangckid/qemu/tree/colo-v2.7-proxy-mode-compare-w= ith-colo-base-may25=20 >>> >>> >>> >>> v4: >>> p4: >>> - add some comments >>> - fix some trace-events >>> - fix tcp compare error >>> p3: >>> - add rcu_read_lock(). >>> - fix trace name >>> - fix jason's other comments >>> - rebase some Dave's branch function >>> p2: >>> - colo_compare_connection() change g_queue_push_head() to >>> - g_queue_push_tail() match to sorted order. >>> - remove QemuMutex conn_list_lock >> >> Looks like conn_list lock is still there. I still prefer to do all=20 >> thing in the comparing thread. Have you tried Fam's suggestion to use=20 >> g_main_context_push_thread_default()? If it does not work, does it=20 >> work simply by replacing all: >> >> g_source_attach(x, NULL); >> >> with >> >> g_souce_attach(x, g_main_context_get_thread_default()); >> >> after call g_main_context_push_thread_default()? >> >> Thanks > > I have tried fam's suggestion it does not work. > > so I tried what you suggestion like that: > > static void *colo_compare_thread(void *opaque) > { > CompareState *s =3D opaque; > GSource *source; > GMainContext *worker_context; > > source =3D g_source_new(&source_funcs, sizeof(DemoSource)); > worker_context =3D g_main_context_new (); > > g_source_attach(source, g_main_context_get_thread_default()); > g_source_set_callback(source, NULL, NULL, NULL); > g_main_context_push_thread_default (worker_context); > qemu_chr_add_handlers(s->chr_pri_in, compare_chr_can_read, > compare_pri_chr_in, NULL, s); > qemu_chr_add_handlers(s->chr_sec_in, compare_chr_can_read, > compare_sec_chr_in, NULL, s); > g_main_context_pop_thread_default (worker_context); g_source_attach() should be done after g_main_context_push_thread_default= () > > > but it does not work too. Do you mean like this? Not exactly the same, but should be worth to try also. My suggestion is=20 to replace all g_source_attach(src, NULL) in qemu source (especially the=20 ones in qemu-char.c) with g_source_attach(src,=20 g_main_context_get_thread_default()). (Maybe not that easy, but better=20 to have a try). You may refer=20 https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html=20 for more docs on this. I believe there should have some solutions on this= . > > Thanks > Zhang Chen > >>> - remove pkt->s >>> - move data structure to colo-base.h >>> - add colo-base.c reuse codes for filter-rewriter >>> - add some filter-rewriter needs struct >>> - depends on previous SocketReadState patch >>> p1: >>> - except move qemu_chr_add_handlers() >>> to colo thread >>> - remove class_finalize >>> - remove secondary arp codes >>> - depends on previous SocketReadState patch >>> >>> v3: >>> - rebase colo-compare to colo-frame v2.7 >>> - fix most of Dave's comments >>> (except RCU) >>> - add TCP,UDP,ICMP and other packet comparison >>> - add trace-event >>> - add some comments >>> - other bug fix >>> - add RFC index >>> - add usage in patch 1/4 >>> >>> v2: >>> - add jhash.h >>> >>> v1: >>> - initial patch >>> >>> >>> Zhang Chen (4): >>> colo-compare: introduce colo compare initialization >>> colo-compare: track connection and enqueue packet >>> colo-compare: introduce packet comparison thread >>> colo-compare: add TCP,UDP,ICMP packet comparison >>> >>> include/qemu/jhash.h | 61 +++++ >>> net/Makefile.objs | 2 + >>> net/colo-base.c | 183 +++++++++++++ >>> net/colo-base.h | 92 +++++++ >>> net/colo-compare.c | 745=20 >>> +++++++++++++++++++++++++++++++++++++++++++++++++++ >>> qemu-options.hx | 34 +++ >>> trace-events | 11 + >>> vl.c | 3 +- >>> 8 files changed, 1130 insertions(+), 1 deletion(-) >>> create mode 100644 include/qemu/jhash.h >>> create mode 100644 net/colo-base.c >>> create mode 100644 net/colo-base.h >>> create mode 100644 net/colo-compare.c >>> >> >> >> >> . >> >