From nobody Sun Feb 8 16:54:52 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623898523062728.0971003495491; Wed, 16 Jun 2021 19:55:23 -0700 (PDT) Received: from localhost ([::1]:59662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltiBd-0005L3-Pi for importer@patchew.org; Wed, 16 Jun 2021 22:55:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAV-0003NB-8T for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:11 -0400 Received: from mga02.intel.com ([134.134.136.20]:12080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAR-0000WF-4R for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:11 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 19:53:59 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.238.157.59]) by orsmga001.jf.intel.com with ESMTP; 16 Jun 2021 19:53:57 -0700 IronPort-SDR: 65gGfd1kQEoC1I+Nw1ODBhLSnrO8cebNuHKWoHm6z41SKw6hZLkmJWRUIUUJUTz/MdRruSWgju M5nKEUFEPzJg== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="193414073" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193414073" IronPort-SDR: HzGyDcsrEos6HP8Fkf24V/WvQeIVvu1YvENReHsUfYxpmNSkI/J+ZRfcELzACw9+nGILHNrni4 ipGkzwP1tx/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="485121914" From: Lei Rao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com, lukasstraub2@web.de Subject: [PATCH 1/7] Some minor optimizations for COLO Date: Thu, 17 Jun 2021 10:47:09 +0800 Message-Id: <1623898035-18533-2-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1623898035-18533-1-git-send-email-lei.rao@intel.com> References: <1623898035-18533-1-git-send-email-lei.rao@intel.com> 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; Received-SPF: pass client-ip=134.134.136.20; envelope-from=lei.rao@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: like.xu.linux@gmail.com, "Rao, Lei" , qemu-devel@nongnu.org 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: "Rao, Lei" Signed-off-by: Lei Rao Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 2 +- net/colo-compare.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 79fa1f6..616dc00 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -152,7 +152,7 @@ static void primary_vm_do_failover(void) * kick COLO thread which might wait at * qemu_sem_wait(&s->colo_checkpoint_sem). */ - colo_checkpoint_notify(migrate_get_current()); + colo_checkpoint_notify(s); =20 /* * Wake up COLO thread which may blocked in recv() or send(), diff --git a/net/colo-compare.c b/net/colo-compare.c index b100e7b..4a64a5d 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -170,7 +170,7 @@ static bool packet_matches_str(const char *str, return false; } =20 - return !memcmp(str, buf, strlen(str)); + return !memcmp(str, buf, packet_len); } =20 static void notify_remote_frame(CompareState *s) --=20 1.8.3.1 From nobody Sun Feb 8 16:54:52 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162389860039462.76182833718963; Wed, 16 Jun 2021 19:56:40 -0700 (PDT) Received: from localhost ([::1]:37500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltiCs-0000yk-9c for importer@patchew.org; Wed, 16 Jun 2021 22:56:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAX-0003Oa-5e for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:12085) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAT-0000Yo-45 for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:12 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 19:54:03 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.238.157.59]) by orsmga001.jf.intel.com with ESMTP; 16 Jun 2021 19:54:00 -0700 IronPort-SDR: olMT3FqYWu2/KVqyTmGfBSNMdazmTAsU20cMThmhcJgi4m6jMG3qz2ZolUPbMfGYkMFrtNUCZT xxmGKUYaW7kw== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="193414076" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193414076" IronPort-SDR: 3HgTLM7SF6E9fgxNSInw3sVFZtv2KLBhBYc24Q7TqJvdcRgcWfzMZWO9xw4GUX6LqPf2G1wOe/ dDY5stQ9twpA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="485121944" From: Lei Rao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com, lukasstraub2@web.de Subject: [PATCH 2/7] Fixed qemu crash when guest power off in COLO mode Date: Thu, 17 Jun 2021 10:47:10 +0800 Message-Id: <1623898035-18533-3-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1623898035-18533-1-git-send-email-lei.rao@intel.com> References: <1623898035-18533-1-git-send-email-lei.rao@intel.com> 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; Received-SPF: pass client-ip=134.134.136.20; envelope-from=lei.rao@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: like.xu.linux@gmail.com, "Rao, Lei" , qemu-devel@nongnu.org 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: "Rao, Lei" This patch fixes the following: qemu-system-x86_64: invalid runstate transition: 'shutdown' -> 'running' Aborted (core dumped) The gdb bt as following: 0 __GI_raise (sig=3Dsig@entry=3D6) at ../sysdeps/unix/sysv/linux/raise.c:50 1 0x00007faa3d613859 in __GI_abort () at abort.c:79 2 0x000055c5a21268fd in runstate_set (new_state=3DRUN_STATE_RUNNING) at vl= .c:723 3 0x000055c5a1f8cae4 in vm_prepare_start () at /home/workspace/colo-qemu/c= pus.c:2206 4 0x000055c5a1f8cb1b in vm_start () at /home/workspace/colo-qemu/cpus.c:22= 13 5 0x000055c5a2332bba in migration_iteration_finish (s=3D0x55c5a4658810) at= migration/migration.c:3376 6 0x000055c5a2332f3b in migration_thread (opaque=3D0x55c5a4658810) at migr= ation/migration.c:3527 7 0x000055c5a251d68a in qemu_thread_start (args=3D0x55c5a5491a70) at util/= qemu-thread-posix.c:519 8 0x00007faa3d7e9609 in start_thread (arg=3D) at pthread_cr= eate.c:477 9 0x00007faa3d710293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clon= e.S:95 Signed-off-by: Lei Rao --- migration/migration.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 4228635..c2c84c7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3561,7 +3561,9 @@ static void migration_iteration_finish(MigrationState= *s) case MIGRATION_STATUS_CANCELLED: case MIGRATION_STATUS_CANCELLING: if (s->vm_was_running) { - vm_start(); + if (!runstate_check(RUN_STATE_SHUTDOWN)) { + vm_start(); + } } else { if (runstate_check(RUN_STATE_FINISH_MIGRATE)) { runstate_set(RUN_STATE_POSTMIGRATE); --=20 1.8.3.1 From nobody Sun Feb 8 16:54:53 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623898722962973.9424285705345; Wed, 16 Jun 2021 19:58:42 -0700 (PDT) Received: from localhost ([::1]:43172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltiEr-0004mE-VY for importer@patchew.org; Wed, 16 Jun 2021 22:58:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAc-0003T2-Pn for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:20 -0400 Received: from mga02.intel.com ([134.134.136.20]:12066) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAT-0000Pu-1N for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:18 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 19:54:06 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.238.157.59]) by orsmga001.jf.intel.com with ESMTP; 16 Jun 2021 19:54:04 -0700 IronPort-SDR: 2it6plXCZEjHRbPVY6bPcQ8tKdiPVXZ6bW1ubxuJE8FqevzURahJvZotMPZ6vStyYy6kygclgh JUvt2hWz8XPg== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="193414084" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193414084" IronPort-SDR: 3agVnx3SfQgMNv0FLsMirnDU7soUnThECDK5jd17giBh4hJnHZH8yq98d028u4mpwnQ9EDukU1 +5xAZwUdHzXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="485121960" From: Lei Rao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com, lukasstraub2@web.de Subject: [PATCH 3/7] Fixed SVM hang when do failover before PVM crash Date: Thu, 17 Jun 2021 10:47:11 +0800 Message-Id: <1623898035-18533-4-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1623898035-18533-1-git-send-email-lei.rao@intel.com> References: <1623898035-18533-1-git-send-email-lei.rao@intel.com> 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; Received-SPF: pass client-ip=134.134.136.20; envelope-from=lei.rao@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: like.xu.linux@gmail.com, "Rao, Lei" , qemu-devel@nongnu.org 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: "Rao, Lei" This patch fixed as follows: Thread 1 (Thread 0x7f34ee738d80 (LWP 11212)): #0 __pthread_clockjoin_ex (threadid=3D139847152957184, thread_return=3D= 0x7f30b1febf30, clockid=3D, abstime=3D, block= =3D) at pthread_join_common.c:145 #1 0x0000563401998e36 in qemu_thread_join (thread=3D0x563402d66610) at = util/qemu-thread-posix.c:587 #2 0x00005634017a79fa in process_incoming_migration_co (opaque=3D0x0) a= t migration/migration.c:502 #3 0x00005634019b59c9 in coroutine_trampoline (i0=3D63395504, i1=3D2206= 8) at util/coroutine-ucontext.c:115 #4 0x00007f34ef860660 in ?? () at ../sysdeps/unix/sysv/linux/x86_64/__s= tart_context.S:91 from /lib/x86_64-linux-gnu/libc.so.6 #5 0x00007f30b21ee730 in ?? () #6 0x0000000000000000 in ?? () Thread 13 (Thread 0x7f30b3dff700 (LWP 11747)): #0 __lll_lock_wait (futex=3Dfutex@entry=3D0x56340218ffa0 , private=3D0) at lowlevellock.c:52 #1 0x00007f34efa000a3 in _GI__pthread_mutex_lock (mutex=3D0x56340218ff= a0 ) at ../nptl/pthread_mutex_lock.c:80 #2 0x0000563401997f99 in qemu_mutex_lock_impl (mutex=3D0x56340218ffa0 = , file=3D0x563401b7a80e "migration/colo.c", line=3D806) = at util/qemu-thread-posix.c:78 #3 0x0000563401407144 in qemu_mutex_lock_iothread_impl (file=3D0x56340= 1b7a80e "migration/colo.c", line=3D806) at /home/workspace/colo-qemu/cpus.c= :1899 #4 0x00005634017ba8e8 in colo_process_incoming_thread (opaque=3D0x5634= 02d664c0) at migration/colo.c:806 #5 0x0000563401998b72 in qemu_thread_start (args=3D0x5634039f8370) at = util/qemu-thread-posix.c:519 #6 0x00007f34ef9fd609 in start_thread (arg=3D) at pthre= ad_create.c:477 #7 0x00007f34ef924293 in clone () at ../sysdeps/unix/sysv/linux/x86_64= /clone.S:95 The QEMU main thread is holding the lock: (gdb) p qemu_global_mutex $1 =3D {lock =3D {_data =3D {lock =3D 2, __count =3D 0, __owner =3D 112= 12, __nusers =3D 9, __kind =3D 0, __spins =3D 0, __elision =3D 0, __list = =3D {_prev =3D 0x0, __next =3D 0x0}}, __size =3D "\002\000\000\000\000\000\000\000\314+\000\000\t", '\000' <= repeats 26 times>, __align =3D 2}, file =3D 0x563401c07e4b "util/main-loop.= c", line =3D 240, initialized =3D true} From the call trace, we can see it is a deadlock bug. and the QEMU main thr= ead holds the global mutex to wait until the COLO thread ends. and the colo= thread wants to acquire the global mutex, which will cause a deadlock. So, we shou= ld release the qemu_global_mutex before waiting colo thread ends. Signed-off-by: Lei Rao Reviewed-by: Li Zhijian --- migration/migration.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index c2c84c7..6debb8b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -593,8 +593,10 @@ static void process_incoming_migration_co(void *opaque) mis->have_colo_incoming_thread =3D true; qemu_coroutine_yield(); =20 + qemu_mutex_unlock_iothread(); /* Wait checkpoint incoming thread exit before free resource */ qemu_thread_join(&mis->colo_incoming_thread); + qemu_mutex_lock_iothread(); /* We hold the global iothread lock, so it is safe here */ colo_release_ram_cache(); } --=20 1.8.3.1 From nobody Sun Feb 8 16:54:53 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623898672206124.32142892437093; Wed, 16 Jun 2021 19:57:52 -0700 (PDT) Received: from localhost ([::1]:41030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltiE3-0003Kq-6r for importer@patchew.org; Wed, 16 Jun 2021 22:57:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAb-0003Rm-I6 for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:12080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAW-0000WF-8H for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:17 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 19:54:10 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.238.157.59]) by orsmga001.jf.intel.com with ESMTP; 16 Jun 2021 19:54:07 -0700 IronPort-SDR: bLHgxVLaxY6IjAXUhryxHK7/wdUYJpefBB35+NoA7J90rUP6/a79YDZKVjIcvnsIZBWwxkABxI jAKNzWxhY2Ow== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="193414092" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193414092" IronPort-SDR: 8V5XrbXKSKf/yNBj5igBXZvG6SM3Safgj0GJNfUBgCu7SkZcOr6gqG1JcThSAMB3X9mX/J1H7o mnr7xS9MVdwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="485121984" From: Lei Rao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com, lukasstraub2@web.de Subject: [PATCH 4/7] colo: fixed 'Segmentation fault' when the simplex mode PVM poweroff Date: Thu, 17 Jun 2021 10:47:12 +0800 Message-Id: <1623898035-18533-5-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1623898035-18533-1-git-send-email-lei.rao@intel.com> References: <1623898035-18533-1-git-send-email-lei.rao@intel.com> 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; Received-SPF: pass client-ip=134.134.136.20; envelope-from=lei.rao@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: like.xu.linux@gmail.com, "Rao, Lei" , qemu-devel@nongnu.org, Like Xu 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: "Rao, Lei" When a PVM completed its SVM failover steps and begins to run in the simplex mode, QEMU would encounter a 'Segmentation fault' if the guest poweroff with the following calltrace: Program received signal SIGSEGV, Segmentation fault. This is because primary_vm_do_failover() would call "qemu_file_shutdown (s->rp_state.from_dst_file);" and later the migration_shutdown() would do it again. So, we should set the s->rp_state.from_dst_file to NULL. Signed-off-by: Like Xu Signed-off-by: Lei Rao --- migration/colo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 616dc00..c25e488 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -156,14 +156,15 @@ static void primary_vm_do_failover(void) =20 /* * Wake up COLO thread which may blocked in recv() or send(), - * The s->rp_state.from_dst_file and s->to_dst_file may use the - * same fd, but we still shutdown the fd for twice, it is harmless. + * The s->to_dst_file may use the same fd, but we still shutdown + * the fd for twice, it is harmless. */ if (s->to_dst_file) { qemu_file_shutdown(s->to_dst_file); } if (s->rp_state.from_dst_file) { qemu_file_shutdown(s->rp_state.from_dst_file); + s->rp_state.from_dst_file =3D NULL; } =20 old_state =3D failover_set_state(FAILOVER_STATUS_ACTIVE, --=20 1.8.3.1 From nobody Sun Feb 8 16:54:53 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623898528413718.0477822437009; Wed, 16 Jun 2021 19:55:28 -0700 (PDT) Received: from localhost ([::1]:60092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltiBj-0005cr-8D for importer@patchew.org; Wed, 16 Jun 2021 22:55:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAk-0003Zv-Tz for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:26 -0400 Received: from mga02.intel.com ([134.134.136.20]:12085) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAY-0000Yo-On for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:26 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 19:54:13 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.238.157.59]) by orsmga001.jf.intel.com with ESMTP; 16 Jun 2021 19:54:11 -0700 IronPort-SDR: +9Lprl/cebPdlpkzmcYtTaBIw8nJqyRTYX9xisL95y+dBf5h7DRhVIelfSD3g8MJhYfr+uwtoH 7+Jj7CjmzCLA== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="193414095" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193414095" IronPort-SDR: rSJPXVuu+SCD/waiHj0I0/14nN3XuKv3e0jkbcR+tkHm+QLZZiBZZ8FO5rHMgkSxfwcXfibKmq 1j5MMu/5+CBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="485121991" From: Lei Rao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com, lukasstraub2@web.de Subject: [PATCH 5/7] Removed the qemu_fclose() in colo_process_incoming_thread Date: Thu, 17 Jun 2021 10:47:13 +0800 Message-Id: <1623898035-18533-6-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1623898035-18533-1-git-send-email-lei.rao@intel.com> References: <1623898035-18533-1-git-send-email-lei.rao@intel.com> 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; Received-SPF: pass client-ip=134.134.136.20; envelope-from=lei.rao@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: like.xu.linux@gmail.com, "Rao, Lei" , qemu-devel@nongnu.org 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: "Rao, Lei" After the live migration, the related fd will be cleanup in migration_incoming_state_destroy(). So, the qemu_close() in colo_process_incoming_thread is not necessary. Signed-off-by: Lei Rao --- migration/colo.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index c25e488..e2ab349 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -919,11 +919,6 @@ out: /* Hope this not to be too long to loop here */ qemu_sem_wait(&mis->colo_incoming_sem); qemu_sem_destroy(&mis->colo_incoming_sem); - /* Must be called after failover BH is completed */ - if (mis->to_src_file) { - qemu_fclose(mis->to_src_file); - mis->to_src_file =3D NULL; - } =20 rcu_unregister_thread(); return NULL; --=20 1.8.3.1 From nobody Sun Feb 8 16:54:53 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623898791759958.9051963578848; Wed, 16 Jun 2021 19:59:51 -0700 (PDT) Received: from localhost ([::1]:45308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltiFy-0006Co-Oy for importer@patchew.org; Wed, 16 Jun 2021 22:59:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAk-0003Yu-FA for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:26 -0400 Received: from mga02.intel.com ([134.134.136.20]:12080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAc-0000WF-4O for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:26 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 19:54:17 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.238.157.59]) by orsmga001.jf.intel.com with ESMTP; 16 Jun 2021 19:54:14 -0700 IronPort-SDR: snXQSQqCYLZBe/+boKdEPUW3n+AYBHxdjDEOASyhH+CsBcFUW4vAORZ/ctAUc8yT0sz3xk62m3 PbXKZBkHyJsw== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="193414098" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193414098" IronPort-SDR: U2XXZSvjLVnOy5UnOL/Nkyrw1MawMgJpgjS79vxS1sY3QKpnTuuYf6a6Y5wJOD6/mXjgHBubtf ABYGVhJFrJOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="485122000" From: Lei Rao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com, lukasstraub2@web.de Subject: [PATCH 6/7] Changed the last-mode to none of first start COLO Date: Thu, 17 Jun 2021 10:47:14 +0800 Message-Id: <1623898035-18533-7-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1623898035-18533-1-git-send-email-lei.rao@intel.com> References: <1623898035-18533-1-git-send-email-lei.rao@intel.com> 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; Received-SPF: pass client-ip=134.134.136.20; envelope-from=lei.rao@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: like.xu.linux@gmail.com, "Rao, Lei" , qemu-devel@nongnu.org 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: "Rao, Lei" When we first stated the COLO, the last-mode is as follows: { "execute": "query-colo-status" } {"return": {"last-mode": "primary", "mode": "primary", "reason": "none"}} The last-mode is unreasonable. After the patch, will be changed to the following: { "execute": "query-colo-status" } {"return": {"last-mode": "none", "mode": "primary", "reason": "none"}} Signed-off-by: Lei Rao --- migration/colo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index e2ab349..69a2501 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -206,7 +206,7 @@ void colo_do_failover(void) vm_stop_force_state(RUN_STATE_COLO); } =20 - switch (get_colo_mode()) { + switch (last_colo_mode =3D get_colo_mode()) { case COLO_MODE_PRIMARY: primary_vm_do_failover(); break; @@ -531,8 +531,7 @@ static void colo_process_checkpoint(MigrationState *s) Error *local_err =3D NULL; int ret; =20 - last_colo_mode =3D get_colo_mode(); - if (last_colo_mode !=3D COLO_MODE_PRIMARY) { + if (get_colo_mode() !=3D COLO_MODE_PRIMARY) { error_report("COLO mode must be COLO_MODE_PRIMARY"); return; } @@ -830,8 +829,7 @@ void *colo_process_incoming_thread(void *opaque) migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COLO); =20 - last_colo_mode =3D get_colo_mode(); - if (last_colo_mode !=3D COLO_MODE_SECONDARY) { + if (get_colo_mode() !=3D COLO_MODE_SECONDARY) { error_report("COLO mode must be COLO_MODE_SECONDARY"); return NULL; } --=20 1.8.3.1 From nobody Sun Feb 8 16:54:53 2026 Delivered-To: importer@patchew.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623898606252261.90087064450245; Wed, 16 Jun 2021 19:56:46 -0700 (PDT) Received: from localhost ([::1]:37754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltiCz-00018w-7v for importer@patchew.org; Wed, 16 Jun 2021 22:56:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAl-0003b2-CS for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:27 -0400 Received: from mga02.intel.com ([134.134.136.20]:12066) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltiAg-0000Pu-2l for qemu-devel@nongnu.org; Wed, 16 Jun 2021 22:54:27 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 19:54:20 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.238.157.59]) by orsmga001.jf.intel.com with ESMTP; 16 Jun 2021 19:54:18 -0700 IronPort-SDR: TOhPJaXEAt4Ug5M3bfszuDBzELSgUaNud409i9qG1wkT36ugi5UsgmFHiFqqibPCXq8uiKOqFs 7Xb8lHq4t2LQ== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="193414107" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193414107" IronPort-SDR: IDvcIGLkx1skp1pYjbHntnJ4fQmmmADRggrUMosnv+QiTwA2vE7AES7KTqTsfKNmLEZHjJs8HQ jsPAzJENfpyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="485122013" From: Lei Rao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com, lukasstraub2@web.de Subject: [PATCH 7/7] Optimized the function of fill_connection_key. Date: Thu, 17 Jun 2021 10:47:15 +0800 Message-Id: <1623898035-18533-8-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1623898035-18533-1-git-send-email-lei.rao@intel.com> References: <1623898035-18533-1-git-send-email-lei.rao@intel.com> 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; Received-SPF: pass client-ip=134.134.136.20; envelope-from=lei.rao@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: like.xu.linux@gmail.com, "Rao, Lei" , qemu-devel@nongnu.org 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: "Rao, Lei" Remove some unnecessary code to improve the performance of the filter-rewriter module. Signed-off-by: Lei Rao Reviewed-by: Zhang Chen --- net/colo-compare.c | 2 +- net/colo.c | 31 ++++++++++++------------------- net/colo.h | 6 +++--- net/filter-rewriter.c | 10 +--------- 4 files changed, 17 insertions(+), 32 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 4a64a5d..6a1354d 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -264,7 +264,7 @@ static int packet_enqueue(CompareState *s, int mode, Co= nnection **con) pkt =3D NULL; return -1; } - fill_connection_key(pkt, &key); + fill_connection_key(pkt, &key, 0); =20 conn =3D connection_get(s->connection_track_table, &key, diff --git a/net/colo.c b/net/colo.c index 3a3e6e8..5e7232c 100644 --- a/net/colo.c +++ b/net/colo.c @@ -83,19 +83,26 @@ int parse_packet_early(Packet *pkt) return 0; } =20 -void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, Packet *p= kt) +void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, + Packet *pkt, int reverse) { + if (reverse) { + key->src =3D pkt->ip->ip_dst; + key->dst =3D pkt->ip->ip_src; + key->src_port =3D ntohs(tmp_ports & 0xffff); + key->dst_port =3D ntohs(tmp_ports >> 16); + } else { key->src =3D pkt->ip->ip_src; key->dst =3D pkt->ip->ip_dst; key->src_port =3D ntohs(tmp_ports >> 16); key->dst_port =3D ntohs(tmp_ports & 0xffff); + } } =20 -void fill_connection_key(Packet *pkt, ConnectionKey *key) +void fill_connection_key(Packet *pkt, ConnectionKey *key, int reverse) { - uint32_t tmp_ports; + uint32_t tmp_ports =3D 0; =20 - memset(key, 0, sizeof(*key)); key->ip_proto =3D pkt->ip->ip_p; =20 switch (key->ip_proto) { @@ -106,29 +113,15 @@ void fill_connection_key(Packet *pkt, ConnectionKey *= key) case IPPROTO_SCTP: case IPPROTO_UDPLITE: tmp_ports =3D *(uint32_t *)(pkt->transport_header); - extract_ip_and_port(tmp_ports, key, pkt); break; case IPPROTO_AH: tmp_ports =3D *(uint32_t *)(pkt->transport_header + 4); - extract_ip_and_port(tmp_ports, key, pkt); break; default: break; } -} - -void reverse_connection_key(ConnectionKey *key) -{ - struct in_addr tmp_ip; - uint16_t tmp_port; - - tmp_ip =3D key->src; - key->src =3D key->dst; - key->dst =3D tmp_ip; =20 - tmp_port =3D key->src_port; - key->src_port =3D key->dst_port; - key->dst_port =3D tmp_port; + extract_ip_and_port(tmp_ports, key, pkt, reverse); } =20 Connection *connection_new(ConnectionKey *key) diff --git a/net/colo.h b/net/colo.h index d91cd24..5f4d502 100644 --- a/net/colo.h +++ b/net/colo.h @@ -89,9 +89,9 @@ typedef struct Connection { uint32_t connection_key_hash(const void *opaque); int connection_key_equal(const void *opaque1, const void *opaque2); int parse_packet_early(Packet *pkt); -void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, Packet *p= kt); -void fill_connection_key(Packet *pkt, ConnectionKey *key); -void reverse_connection_key(ConnectionKey *key); +void extract_ip_and_port(uint32_t tmp_ports, ConnectionKey *key, + Packet *pkt, int reverse); +void fill_connection_key(Packet *pkt, ConnectionKey *key, int reverse); Connection *connection_new(ConnectionKey *key); void connection_destroy(void *opaque); Connection *connection_get(GHashTable *connection_track_table, diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index cb3a96c..bf05023 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -279,15 +279,7 @@ static ssize_t colo_rewriter_receive_iov(NetFilterStat= e *nf, */ if (pkt && is_tcp_packet(pkt)) { =20 - fill_connection_key(pkt, &key); - - if (sender =3D=3D nf->netdev) { - /* - * We need make tcp TX and RX packet - * into one connection. - */ - reverse_connection_key(&key); - } + fill_connection_key(pkt, &key, sender =3D=3D nf->netdev); =20 /* After failover we needn't change new TCP packet */ if (s->failover_mode && --=20 1.8.3.1