From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfMa1-00049N-Q0 for qemu-devel@nongnu.org; Thu, 01 Sep 2016 03:38:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfMZx-000748-L9 for qemu-devel@nongnu.org; Thu, 01 Sep 2016 03:38:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfMZx-000741-Fl for qemu-devel@nongnu.org; Thu, 01 Sep 2016 03:38:29 -0400 References: <1471421428-26379-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> <1471421428-26379-7-git-send-email-zhangchen.fnst@cn.fujitsu.com> <31cb7123-0b74-df62-d269-a06b4fd7c0b3@redhat.com> From: Jason Wang Message-ID: <106eca86-525f-62b9-b864-85c1ccb2bb3e@redhat.com> Date: Thu, 1 Sep 2016 15:38:22 +0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V12 06/10] colo-compare: introduce packet comparison thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhang Chen , qemu devel Cc: Li Zhijian , Wen Congyang , zhanghailiang , "eddie . dong" , "Dr . David Alan Gilbert" On 2016=E5=B9=B409=E6=9C=8801=E6=97=A5 12:50, Zhang Chen wrote: >>> + sprintf(thread_name, "colo-compare %d", compare_id); >>> + qemu_thread_create(&s->thread, thread_name, >>> + colo_compare_thread, s, >>> + QEMU_THREAD_JOINABLE); >>> + compare_id++; >>> + >>> + /* A regular timer to kick any packets that the secondary=20 >>> doesn't match */ >>> + s->timer =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, /* Only when guest= =20 >>> runs */ >>> + check_old_packet_regular, s); >>> + timer_mod(s->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + >>> + REGULAR_PACKET_CHECK_MS); >> >> I still think we need to make sure the timer were processed in colo=20 >> thread. Since check_old_packet_regular may iterate conn_list which=20 >> may be modified by colo thread at the same time. > > Make sense, but in here we just read the conn_list, maybe we should=20 > add a lock for it? > Because of we don't have a easy way to make timer's handler run in=20 > colo thread, > the handler run in main-loop. Maybe this job we can do it later. > > Thanks > Zhang Chen=20 A lock is ok for this series. But need to add a TODO here and we=20 something like patch 1 to make sure timer could be processed other than=20 main loop in the future. Thanks