From patchwork Tue Jun 8 08:23:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 12305841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C9E2C47082 for ; Tue, 8 Jun 2021 08:36:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC00D6127A for ; Tue, 8 Jun 2021 08:36:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC00D6127A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXDg-0003YM-2Z for qemu-devel@archiver.kernel.org; Tue, 08 Jun 2021 04:36:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8W-0003ug-C6 for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:00 -0400 Received: from mga07.intel.com ([134.134.136.100]:62324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8Q-000084-Ln for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:00 -0400 IronPort-SDR: HZ7yR/q0iNPUb7ioaxlqdzvlPCGZgn+9KgWQKvvfeanj4Ic0htRGzHupG+qcJMa7V0LuZiK3Tk Iz5oilOEneuw== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="268653426" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="268653426" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:47 -0700 IronPort-SDR: BHYD0t4/L+vKEtGbRTDjPJhoAN6Mcuh2dPB3VGZu7qNaANrkNf+jko2bXG0lG58OIIq0BiY1go 86D0O7j5EOCA== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862900" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:39 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 1/7] Remove some duplicate trace code. Date: Tue, 8 Jun 2021 16:23:25 +0800 Message-Id: <20210608082331.1949117-2-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=134.134.136.100; envelope-from=chen.zhang@intel.com; helo=mga07.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, 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: Lukas Straub , Li Zhijian , "Rao, Lei" , Li Zhijian , Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" There is the same trace code in the colo_compare_packet_payload. Signed-off-by: Lei Rao Reviewed-by: Li Zhijian Reviewed-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub Signed-off-by: Zhang Chen --- net/colo-compare.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 9d1ad99941..c142c08dc6 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -590,19 +590,6 @@ static int colo_packet_compare_other(Packet *spkt, Packet *ppkt) uint16_t offset = ppkt->vnet_hdr_len; trace_colo_compare_main("compare other"); - if (trace_event_get_state_backends(TRACE_COLO_COMPARE_IP_INFO)) { - char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20]; - - strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src)); - strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_dst)); - strcpy(sec_ip_src, inet_ntoa(spkt->ip->ip_src)); - strcpy(sec_ip_dst, inet_ntoa(spkt->ip->ip_dst)); - - trace_colo_compare_ip_info(ppkt->size, pri_ip_src, - pri_ip_dst, spkt->size, - sec_ip_src, sec_ip_dst); - } - if (ppkt->size != spkt->size) { trace_colo_compare_main("Other: payload size of packets are different"); return -1; From patchwork Tue Jun 8 08:23:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 12305835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09B89C4743E for ; Tue, 8 Jun 2021 08:34:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9C4EB61285 for ; Tue, 8 Jun 2021 08:33:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C4EB61285 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXBO-0006l1-Md for qemu-devel@archiver.kernel.org; Tue, 08 Jun 2021 04:33:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8W-0003vK-O3 for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:00 -0400 Received: from mga12.intel.com ([192.55.52.136]:25331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8P-0000Dh-E4 for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:00 -0400 IronPort-SDR: wslG2XT47xsVf+pJNZyEP2ib/ZNrqoFwfsKV4qQuCQ5tmQahsjAgyYXsRv1DsfzsA9HZENBK0Y tzakdVIw0mrg== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="184485394" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="184485394" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:44 -0700 IronPort-SDR: jb9ugDyoX9c52Vq+XLWABnrseESUN9IXresqbIz8iCqDJ2Z/mA96DzLY85TA9V/ohuAiYVsxDT lTud7PZSv2eQ== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862909" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:42 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 2/7] Fix the qemu crash when guest shutdown during checkpoint Date: Tue, 8 Jun 2021 16:23:26 +0800 Message-Id: <20210608082331.1949117-3-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.136; envelope-from=chen.zhang@intel.com; helo=mga12.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, SPF_HELO_PASS=-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: Lukas Straub , Li Zhijian , "Rao, Lei" , Li Zhijian , Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" This patch fixes the following: qemu-system-x86_64: invalid runstate transition: 'colo' ->'shutdown' Aborted (core dumped) Signed-off-by: Lei Rao Reviewed-by: Li Zhijian Reviewed-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub Signed-off-by: Zhang Chen --- softmmu/runstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/softmmu/runstate.c b/softmmu/runstate.c index ce8977c6a2..15640572c0 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -126,6 +126,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_RESTORE_VM, RUN_STATE_PRELAUNCH }, { RUN_STATE_COLO, RUN_STATE_RUNNING }, + { RUN_STATE_COLO, RUN_STATE_SHUTDOWN}, { RUN_STATE_RUNNING, RUN_STATE_DEBUG }, { RUN_STATE_RUNNING, RUN_STATE_INTERNAL_ERROR }, From patchwork Tue Jun 8 08:23:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 12305837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA2DBC47082 for ; Tue, 8 Jun 2021 08:33:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60C4F6124B for ; Tue, 8 Jun 2021 08:33:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60C4F6124B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXBO-0006fl-D6 for qemu-devel@archiver.kernel.org; Tue, 08 Jun 2021 04:33:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8R-0003sO-PP for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:30:59 -0400 Received: from mga12.intel.com ([192.55.52.136]:25338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8P-0000EH-EG for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:30:55 -0400 IronPort-SDR: FWPuwzNA/fR3cPwqzOITRmyFT29I0JsL02DJEtBtfz9b8pyc6ONWCUYsc/Ap2p6n+N1su5FFZe tkNSBSF2i6ww== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="184485404" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="184485404" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:46 -0700 IronPort-SDR: BAE7xntlEDvS4kTL7uZ14gUH12qIwPBScty4HXKHuXk+vnGh/LTgG13CZJX7dceknsUFAOiHGB sL/GxNvcFnrw== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862922" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:44 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 3/7] Optimize the function of filter_send Date: Tue, 8 Jun 2021 16:23:27 +0800 Message-Id: <20210608082331.1949117-4-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.136; envelope-from=chen.zhang@intel.com; helo=mga12.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, SPF_HELO_PASS=-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: Lukas Straub , Li Zhijian , "Rao, Lei" , Li Zhijian , Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" The iov_size has been calculated in filter_send(). we can directly return the size.In this way, this is no need to repeat calculations in filter_redirector_receive_iov(); Signed-off-by: Lei Rao Reviewed-by: Li Zhijian Reviewed-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub Signed-off-by: Zhang Chen --- net/filter-mirror.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/filter-mirror.c b/net/filter-mirror.c index f8e65007c0..f20240cc9f 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -88,7 +88,7 @@ static int filter_send(MirrorState *s, goto err; } - return 0; + return size; err: return ret < 0 ? ret : -EIO; @@ -159,7 +159,7 @@ static ssize_t filter_mirror_receive_iov(NetFilterState *nf, int ret; ret = filter_send(s, iov, iovcnt); - if (ret) { + if (ret < 0) { error_report("filter mirror send failed(%s)", strerror(-ret)); } @@ -182,10 +182,10 @@ static ssize_t filter_redirector_receive_iov(NetFilterState *nf, if (qemu_chr_fe_backend_connected(&s->chr_out)) { ret = filter_send(s, iov, iovcnt); - if (ret) { + if (ret < 0) { error_report("filter redirector send failed(%s)", strerror(-ret)); } - return iov_size(iov, iovcnt); + return ret; } else { return 0; } From patchwork Tue Jun 8 08:23:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 12305843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9D63C4743E for ; Tue, 8 Jun 2021 08:36:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72FC661182 for ; Tue, 8 Jun 2021 08:36:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72FC661182 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXEI-0004mv-Jo for qemu-devel@archiver.kernel.org; Tue, 08 Jun 2021 04:36:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8R-0003sK-6k for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:30:59 -0400 Received: from mga14.intel.com ([192.55.52.115]:24323) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8P-0000Fj-5u for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:30:54 -0400 IronPort-SDR: SzIKaCG/iVE5W1hlGtMz3CITxSaBQKCDlX7ayxHZr3Sqvmr/5vz0ZRZ8/thBlYrrMr/WuGo30k eqxGR/0EEn+A== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="204614532" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="204614532" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:48 -0700 IronPort-SDR: LQi1dH16Ksl2bRyglsTwj2+QGIBDLu6iARlKU6Ky3hYGmRiJZNh60W0jPqWs3HeTMr8mWkiyua z9sDFEqsc74w== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862931" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:46 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 4/7] Remove migrate_set_block_enabled in checkpoint Date: Tue, 8 Jun 2021 16:23:28 +0800 Message-Id: <20210608082331.1949117-5-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.115; envelope-from=chen.zhang@intel.com; helo=mga14.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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: Lukas Straub , Li Zhijian , "Rao, Lei" , Li Zhijian , Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" We can detect disk migration in migrate_prepare, if disk migration is enabled in COLO mode, we can directly report an error.and there is no need to disable block migration at every checkpoint. Signed-off-by: Lei Rao Signed-off-by: Zhang Chen Reviewed-by: Li Zhijian Reviewed-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub --- migration/colo.c | 6 ------ migration/migration.c | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index e498fdb125..79fa1f6619 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -435,12 +435,6 @@ static int colo_do_checkpoint_transaction(MigrationState *s, if (failover_get_state() != FAILOVER_STATUS_NONE) { goto out; } - - /* Disable block migration */ - migrate_set_block_enabled(false, &local_err); - if (local_err) { - goto out; - } qemu_mutex_lock_iothread(); #ifdef CONFIG_REPLICATION diff --git a/migration/migration.c b/migration/migration.c index 1885860d7b..d059cf70b9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2214,6 +2214,10 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, } if (blk || blk_inc) { + if (migrate_colo_enabled()) { + error_setg(errp, "No disk migration is required in COLO mode"); + return false; + } if (migrate_use_block() || migrate_use_block_incremental()) { error_setg(errp, "Command options are incompatible with " "current migration capabilities"); From patchwork Tue Jun 8 08:23:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 12305849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E671C47082 for ; Tue, 8 Jun 2021 08:38:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 501026127A for ; Tue, 8 Jun 2021 08:38:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 501026127A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXFO-0008M2-IB for qemu-devel@archiver.kernel.org; Tue, 08 Jun 2021 04:38:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8X-0003wu-GT for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:01 -0400 Received: from mga14.intel.com ([192.55.52.115]:24324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8Q-0000K7-8E for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:01 -0400 IronPort-SDR: zMGOmJOEiYNSqHbId9Dq9wFF2xNxriVDLh1BClVrgiqI8OWvx0zxL9oDNp5V4iDoKuLqhw0LEE PqmE6+hB7Q4g== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="204614535" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="204614535" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:50 -0700 IronPort-SDR: +dbTlDJPeoyNW5Z9BBvQCcLcSeei2fS0z1cQhvZxybqAcOH7jvb6YG74ZSwDT6fTTMdvaHBkRv dqKKGda/AsfA== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862942" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:48 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 5/7] Add a function named packet_new_nocopy for COLO. Date: Tue, 8 Jun 2021 16:23:29 +0800 Message-Id: <20210608082331.1949117-6-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.115; envelope-from=chen.zhang@intel.com; helo=mga14.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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: Zhang Chen , "Rao, Lei" , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" Use the packet_new_nocopy instead of packet_new in the filter-rewriter module. There will be one less memory copy in the processing of each network packet. Signed-off-by: Lei Rao Signed-off-by: Zhang Chen Reviewed-by: Zhang Chen --- net/colo.c | 25 +++++++++++++++++-------- net/colo.h | 1 + net/filter-rewriter.c | 3 +-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/net/colo.c b/net/colo.c index ef00609848..3a3e6e89a0 100644 --- a/net/colo.c +++ b/net/colo.c @@ -157,19 +157,28 @@ void connection_destroy(void *opaque) Packet *packet_new(const void *data, int size, int vnet_hdr_len) { - Packet *pkt = g_slice_new(Packet); + Packet *pkt = g_slice_new0(Packet); pkt->data = g_memdup(data, size); pkt->size = size; pkt->creation_ms = qemu_clock_get_ms(QEMU_CLOCK_HOST); pkt->vnet_hdr_len = vnet_hdr_len; - pkt->tcp_seq = 0; - pkt->tcp_ack = 0; - pkt->seq_end = 0; - pkt->header_size = 0; - pkt->payload_size = 0; - pkt->offset = 0; - pkt->flags = 0; + + return pkt; +} + +/* + * packet_new_nocopy will not copy data, so the caller can't release + * the data. And it will be released in packet_destroy. + */ +Packet *packet_new_nocopy(void *data, int size, int vnet_hdr_len) +{ + Packet *pkt = g_slice_new0(Packet); + + pkt->data = data; + pkt->size = size; + pkt->creation_ms = qemu_clock_get_ms(QEMU_CLOCK_HOST); + pkt->vnet_hdr_len = vnet_hdr_len; return pkt; } diff --git a/net/colo.h b/net/colo.h index 573ab91785..d91cd245c4 100644 --- a/net/colo.h +++ b/net/colo.h @@ -101,6 +101,7 @@ bool connection_has_tracked(GHashTable *connection_track_table, ConnectionKey *key); void connection_hashtable_reset(GHashTable *connection_track_table); Packet *packet_new(const void *data, int size, int vnet_hdr_len); +Packet *packet_new_nocopy(void *data, int size, int vnet_hdr_len); void packet_destroy(void *opaque, void *user_data); void packet_destroy_partial(void *opaque, void *user_data); diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index 10fe3939b1..cb3a96cde1 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -270,8 +270,7 @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf, vnet_hdr_len = nf->netdev->vnet_hdr_len; } - pkt = packet_new(buf, size, vnet_hdr_len); - g_free(buf); + pkt = packet_new_nocopy(buf, size, vnet_hdr_len); /* * if we get tcp packet From patchwork Tue Jun 8 08:23:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 12305847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1492C47082 for ; Tue, 8 Jun 2021 08:37:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7591C6127A for ; Tue, 8 Jun 2021 08:37:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7591C6127A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXF5-0007VO-LC for qemu-devel@archiver.kernel.org; Tue, 08 Jun 2021 04:37:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8Y-0003zp-Di for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:02 -0400 Received: from mga14.intel.com ([192.55.52.115]:24323) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8R-0000Fj-Lr for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:02 -0400 IronPort-SDR: yC61eIi7hO3mwyeWAbAd5gGjPcpP54YrUk0Zxod99wZ8HT3bJXknL5bnCXxiBkzCvpSp8TYoev X/ObpOEyAK8A== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="204614542" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="204614542" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:52 -0700 IronPort-SDR: pO2RaeENCvA3pr5faR7y/SNb/eqfnwB77wsNwGL9zgEqipxl27v0D1UAzny3PXnUalq2feimTZ F4/1PTQN0qhA== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862950" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:50 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 6/7] Add the function of colo_compare_cleanup Date: Tue, 8 Jun 2021 16:23:30 +0800 Message-Id: <20210608082331.1949117-7-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.115; envelope-from=chen.zhang@intel.com; helo=mga14.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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: Zhang Chen , "Rao, Lei" , Lukas Straub , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" This patch fixes the following: #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007f6ae4559859 in __GI_abort () at abort.c:79 #2 0x0000559aaa386720 in error_exit (err=16, msg=0x559aaa5973d0 <__func__.16227> "qemu_mutex_destroy") at util/qemu-thread-posix.c:36 #3 0x0000559aaa3868c5 in qemu_mutex_destroy (mutex=0x559aabffe828) at util/qemu-thread-posix.c:69 #4 0x0000559aaa2f93a8 in char_finalize (obj=0x559aabffe800) at chardev/char.c:285 #5 0x0000559aaa23318a in object_deinit (obj=0x559aabffe800, type=0x559aabfd7d20) at qom/object.c:606 #6 0x0000559aaa2331b8 in object_deinit (obj=0x559aabffe800, type=0x559aabfd9060) at qom/object.c:610 #7 0x0000559aaa233200 in object_finalize (data=0x559aabffe800) at qom/object.c:620 #8 0x0000559aaa234202 in object_unref (obj=0x559aabffe800) at qom/object.c:1074 #9 0x0000559aaa2356b6 in object_finalize_child_property (obj=0x559aac0dac10, name=0x559aac778760 "compare0-0", opaque=0x559aabffe800) at qom/object.c:1584 #10 0x0000559aaa232f70 in object_property_del_all (obj=0x559aac0dac10) at qom/object.c:557 #11 0x0000559aaa2331ed in object_finalize (data=0x559aac0dac10) at qom/object.c:619 #12 0x0000559aaa234202 in object_unref (obj=0x559aac0dac10) at qom/object.c:1074 #13 0x0000559aaa2356b6 in object_finalize_child_property (obj=0x559aac0c75c0, name=0x559aac0dadc0 "chardevs", opaque=0x559aac0dac10) at qom/object.c:1584 #14 0x0000559aaa233071 in object_property_del_child (obj=0x559aac0c75c0, child=0x559aac0dac10, errp=0x0) at qom/object.c:580 #15 0x0000559aaa233155 in object_unparent (obj=0x559aac0dac10) at qom/object.c:599 #16 0x0000559aaa2fb721 in qemu_chr_cleanup () at chardev/char.c:1159 #17 0x0000559aa9f9b110 in main (argc=54, argv=0x7ffeb62fa998, envp=0x7ffeb62fab50) at vl.c:4539 When chardev is cleaned up, chr_write_lock needs to be destroyed. But the colo-compare module is not cleaned up normally before it when the guest poweroff. It is holding chr_write_lock at this time. This will cause qemu crash.So we add the function of colo_compare_cleanup() before qemu_chr_cleanup() to fix the bug. Signed-off-by: Lei Rao Reviewed-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub Signed-off-by: Zhang Chen --- net/colo-compare.c | 10 ++++++++++ net/colo-compare.h | 1 + net/net.c | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/net/colo-compare.c b/net/colo-compare.c index c142c08dc6..5b538f4e0b 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1402,6 +1402,16 @@ static void colo_compare_init(Object *obj) compare_set_vnet_hdr); } +void colo_compare_cleanup(void) +{ + CompareState *tmp = NULL; + CompareState *n = NULL; + + QTAILQ_FOREACH_SAFE(tmp, &net_compares, next, n) { + object_unparent(OBJECT(tmp)); + } +} + static void colo_compare_finalize(Object *obj) { CompareState *s = COLO_COMPARE(obj); diff --git a/net/colo-compare.h b/net/colo-compare.h index 22ddd512e2..b055270da2 100644 --- a/net/colo-compare.h +++ b/net/colo-compare.h @@ -20,5 +20,6 @@ void colo_notify_compares_event(void *opaque, int event, Error **errp); void colo_compare_register_notifier(Notifier *notify); void colo_compare_unregister_notifier(Notifier *notify); +void colo_compare_cleanup(void); #endif /* QEMU_COLO_COMPARE_H */ diff --git a/net/net.c b/net/net.c index 2a472604ec..76bbb7c31b 100644 --- a/net/net.c +++ b/net/net.c @@ -52,6 +52,7 @@ #include "qapi/error.h" #include "qapi/opts-visitor.h" #include "sysemu/runstate.h" +#include "net/colo-compare.h" #include "net/filter.h" #include "qapi/string-output-visitor.h" @@ -1402,6 +1403,9 @@ void net_cleanup(void) { NetClientState *nc; + /*cleanup colo compare module for COLO*/ + colo_compare_cleanup(); + /* We may del multiple entries during qemu_del_net_client(), * so QTAILQ_FOREACH_SAFE() is also not safe here. */ From patchwork Tue Jun 8 08:23:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 12305851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9242C4743D for ; Tue, 8 Jun 2021 08:39:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F0B86124B for ; Tue, 8 Jun 2021 08:39:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F0B86124B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXGJ-0001zr-Ha for qemu-devel@archiver.kernel.org; Tue, 08 Jun 2021 04:39:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8Z-00042W-PC for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:11 -0400 Received: from mga14.intel.com ([192.55.52.115]:24324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8X-0000K7-Ti for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:31:03 -0400 IronPort-SDR: fucIQFc80KW4HIp22M+aQo6Fje3395JDbATyRTBIkxx9/Ho4ixAyTHVM8YHO1e+V1tzKVQTmpu JONyiFDdIv4A== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="204614549" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="204614549" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:55 -0700 IronPort-SDR: 0WY5fKPPMLUwjepzoqv80+oOuwgL7mzho/uUYxnf4I/Kh+yDBZIklg3Shh8s2ne1+sr8KBmuzO OmF+7TvEy5dw== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862959" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:52 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 7/7] Fixed calculation error of pkt->header_size in fill_pkt_tcp_info() Date: Tue, 8 Jun 2021 16:23:31 +0800 Message-Id: <20210608082331.1949117-8-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.115; envelope-from=chen.zhang@intel.com; helo=mga14.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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: Lukas Straub , Li Zhijian , "Rao, Lei" , Li Zhijian , Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" The data pointer has skipped vnet_hdr_len in the function of parse_packet_early().So, we can not subtract vnet_hdr_len again when calculating pkt->header_size in fill_pkt_tcp_info(). Otherwise, it will cause network packet comparsion errors and greatly increase the frequency of checkpoints. Signed-off-by: Lei Rao Signed-off-by: Zhang Chen Reviewed-by: Li Zhijian Reviewed-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub --- net/colo-compare.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 5b538f4e0b..b100e7b51f 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -211,7 +211,7 @@ static void fill_pkt_tcp_info(void *data, uint32_t *max_ack) pkt->tcp_ack = ntohl(tcphd->th_ack); *max_ack = *max_ack > pkt->tcp_ack ? *max_ack : pkt->tcp_ack; pkt->header_size = pkt->transport_header - (uint8_t *)pkt->data - + (tcphd->th_off << 2) - pkt->vnet_hdr_len; + + (tcphd->th_off << 2); pkt->payload_size = pkt->size - pkt->header_size; pkt->seq_end = pkt->tcp_seq + pkt->payload_size; pkt->flags = tcphd->th_flags;