From patchwork Fri Mar 19 03:07:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149889 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,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 0018AC433DB for ; Fri, 19 Mar 2021 03:32:20 +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 771F764DE1 for ; Fri, 19 Mar 2021 03:32:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 771F764DE1 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]:51792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5s3-00029u-Ir for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:32:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qf-0000Xc-Ds for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:30:53 -0400 Received: from mga06.intel.com ([134.134.136.31]:59919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qc-0002u1-EG for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:30:53 -0400 IronPort-SDR: APXyEQe7Sf4K0B17M2mXuU+5hePtWiuWwnkd22dUj6K1396T3UsndeAXd98Iw/KmZ+6ygJ/qqJ 6I+ew+JqLEwA== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="251169520" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="251169520" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:30:47 -0700 IronPort-SDR: JobrD6xVpSIYwaCcBPXxX3bsg62bLM2PRGl7uKktvy9xnwrCEoTY9k1W8sbOhcnP6u88z76FhS UdHG+5iL2VXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448841" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:30:45 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 01/10] Remove some duplicate trace code. Date: Fri, 19 Mar 2021 11:07:39 +0800 Message-Id: <1616123268-89517-2-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.31; envelope-from=lei.rao@intel.com; helo=mga06.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_H4=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: "Rao, Lei" , qemu-devel@nongnu.org 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 --- net/colo-compare.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 84db497..9e18baa 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 Fri Mar 19 03:07:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149891 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,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 700CDC433E0 for ; Fri, 19 Mar 2021 03:32: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 18F4364F1B for ; Fri, 19 Mar 2021 03:32:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18F4364F1B 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]:51814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5s4-0002AQ-68 for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:32:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qi-0000Yt-OK for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:30:56 -0400 Received: from mga12.intel.com ([192.55.52.136]:34574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qf-0002um-8Y for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:30:56 -0400 IronPort-SDR: fGCwR80GbUh+iwNB0X7pxpfA6XqMkd7FWwbXcJmDCq4Qk0LkMK/eTZjcr6TmD6v/tniuZF445i DVLMvAPkxnmA== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117055" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117055" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:30:50 -0700 IronPort-SDR: fkjDAWZkJ56KDL8m11oCpG6pJ6rPrt/P7ypdIf2Q2OYuNp/zdIAfal2pU0dWkzIyjW63ZTUgbQ SQUZHC5Q2Afw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448856" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:30:48 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 02/10] Fix the qemu crash when guest shutdown during checkpoint Date: Fri, 19 Mar 2021 11:07:40 +0800 Message-Id: <1616123268-89517-3-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org 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 --- softmmu/runstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/softmmu/runstate.c b/softmmu/runstate.c index 2874417..884f8fa 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 Fri Mar 19 03:07:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149895 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 636FAC433E0 for ; Fri, 19 Mar 2021 03:34:11 +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 10E4764F1B for ; Fri, 19 Mar 2021 03:34:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10E4764F1B 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]:59168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5to-00057q-Sg for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:34:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qm-0000bn-CM for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:00 -0400 Received: from mga12.intel.com ([192.55.52.136]:34574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qj-0002um-9n for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:00 -0400 IronPort-SDR: PIEj+AGEKGCms8PZmc1F5F2pGaG0KtFl1DCEiYCsFnlU4vY7uHX2QSN+sXV2Xs7rBJ2ySjyFzx UIsT7lxZxmrA== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117080" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117080" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:30:55 -0700 IronPort-SDR: r99VZ1SnJYzDKg1GlZMbVHhnoJAMN59L1nbv3Eo/0muV36UqsSNBgpC/VsRy2VCkO9jOchpfyO dTzbvgpSyE6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448879" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:30:51 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 03/10] Optimize the function of filter_send Date: Fri, 19 Mar 2021 11:07:41 +0800 Message-Id: <1616123268-89517-4-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org 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 --- 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 f8e6500..f20240c 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 Fri Mar 19 03:07:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149901 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,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 B60DEC433E0 for ; Fri, 19 Mar 2021 03:35:53 +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 5D0F364DEF for ; Fri, 19 Mar 2021 03:35:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D0F364DEF 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]:37126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5vU-0007cq-Gd for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:35:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qn-0000dD-7E for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:01 -0400 Received: from mga12.intel.com ([192.55.52.136]:34583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5ql-0002vy-Hq for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:00 -0400 IronPort-SDR: ZqA1TfruOTww5CxWugqwa0j+eL5Sv8oq9UnyTJ2V9QYqNE9Dw+qS1C5lvJ9qdwvfGhNF8MFss2 Q/eqMepvcYPw== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117091" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117091" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:30:58 -0700 IronPort-SDR: 3c076Vd0qzgDzsyHMIpJ6SGGWMhkqYrbBi/ApPm1oS3Lp2u1kveKB66DuLX2TrxkXkLuqx3SHk g6H44xDkraYw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448904" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:30:56 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 04/10] Remove migrate_set_block_enabled in checkpoint Date: Fri, 19 Mar 2021 11:07:42 +0800 Message-Id: <1616123268-89517-5-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org 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 --- 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 de27662..1aaf316 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 a5ddf43..785a331 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2221,6 +2221,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 Fri Mar 19 03:07:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149905 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 78638C433DB for ; Fri, 19 Mar 2021 03:37:44 +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 C4DA064DEF for ; Fri, 19 Mar 2021 03:37:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4DA064DEF 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]:40748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5xG-0000l5-TQ for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:37:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qq-0000la-Kj for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:04 -0400 Received: from mga12.intel.com ([192.55.52.136]:34596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qo-00030p-Uf for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:04 -0400 IronPort-SDR: 2u5iYMfEp8xAbxKaG8wwLIVAHPUF5hPTQ/GYUKz9NWGq2du4HXj9u/0FQXQo5DXYpf6GlSS37U I2oY4fsq7l5A== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117099" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117099" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:31:01 -0700 IronPort-SDR: M/VwxG7+dsIlOI0AhKm9VmXqYlD5hhm01IX2bo+RpAbj+57FhpTTf1TibeYq/GcT+XpQ8hJkfm euPNE8cY3YMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448922" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:30:59 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 05/10] Add a function named packet_new_nocopy for COLO. Date: Fri, 19 Mar 2021 11:07:43 +0800 Message-Id: <1616123268-89517-6-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org 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 --- net/colo.c | 23 +++++++++++++++++++++++ net/colo.h | 1 + net/filter-rewriter.c | 3 +-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/net/colo.c b/net/colo.c index ef00609..58106a8 100644 --- a/net/colo.c +++ b/net/colo.c @@ -174,6 +174,29 @@ Packet *packet_new(const void *data, int size, int vnet_hdr_len) 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_new(Packet); + + pkt->data = data; + 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; +} + void packet_destroy(void *opaque, void *user_data) { Packet *pkt = opaque; diff --git a/net/colo.h b/net/colo.h index 573ab91..d91cd24 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 10fe393..cb3a96c 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 Fri Mar 19 03:07:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149897 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,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 66632C433E0 for ; Fri, 19 Mar 2021 03:34:14 +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 19D6864F1B for ; Fri, 19 Mar 2021 03:34:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19D6864F1B 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]:59430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5tt-0005EC-7r for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:34:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qu-0000r4-OT for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:08 -0400 Received: from mga12.intel.com ([192.55.52.136]:34596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qr-00030p-PR for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:08 -0400 IronPort-SDR: 2HfnaCWL+ZQ1ELr6kq3Ta9oa9I3smANuiFUS4abCXN96lD4pryH8f212GpiYLFuKFIBsfzbARj MaSd4gnMhARA== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117119" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117119" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:31:05 -0700 IronPort-SDR: 2gJLZAUJPu61S9gaB4hBQmya6mbYUizSjM+JYvPhTLHsIxkb9HOaLOhMrhcsgsQRbpFGDXlT7v X3EX+EJyWbXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448956" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:31:02 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 06/10] Add the function of colo_compare_cleanup Date: Fri, 19 Mar 2021 11:07:44 +0800 Message-Id: <1616123268-89517-7-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org 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 --- 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 9e18baa..26464a2 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1401,6 +1401,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 22ddd51..b055270 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 fb7b7dc..3a94a27 100644 --- a/net/net.c +++ b/net/net.c @@ -53,6 +53,7 @@ #include "sysemu/qtest.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" +#include "net/colo-compare.h" #include "net/filter.h" #include "qapi/string-output-visitor.h" @@ -1375,6 +1376,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 Fri Mar 19 03:07:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149893 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,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 8AD16C433E0 for ; Fri, 19 Mar 2021 03:32:52 +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 3BFAC64DE1 for ; Fri, 19 Mar 2021 03:32:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BFAC64DE1 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]:52918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5sZ-0002cq-9k for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:32:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qy-0000uo-97 for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:12 -0400 Received: from mga12.intel.com ([192.55.52.136]:34596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qv-00030p-58 for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:11 -0400 IronPort-SDR: WO4D9gFL+XiXyOGWLg2z3Ts3P7eM12Vy2MqLD+9fqD5LiXbJ52vPovS4MpiHWPihZPzO5gDe56 dtTCj2UvsAzg== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117133" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117133" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:31:08 -0700 IronPort-SDR: RLYiOFYiWWAg/OUwMylHbUBB9V3ha0v8CQw0ANhvfHbNMFTXingT071b0/2WHyY4/j1UVm3HfH K6ZNthChi6EQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448973" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:31:05 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 07/10] Reset the auto-converge counter at every checkpoint. Date: Fri, 19 Mar 2021 11:07:45 +0800 Message-Id: <1616123268-89517-8-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" if we don't reset the auto-converge counter, it will continue to run with COLO running, and eventually the system will hang due to the CPU throttle reaching DEFAULT_MIGRATE_MAX_CPU_THROTTLE. Signed-off-by: Lei Rao Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 4 ++++ migration/ram.c | 10 ++++++++++ migration/ram.h | 1 + 3 files changed, 15 insertions(+) diff --git a/migration/colo.c b/migration/colo.c index 1aaf316..723ffb8 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -459,6 +459,10 @@ static int colo_do_checkpoint_transaction(MigrationState *s, if (ret < 0) { goto out; } + + if (migrate_auto_converge()) { + mig_throttle_counter_reset(); + } /* * Only save VM's live state, which not including device state. * TODO: We may need a timeout mechanism to prevent COLO process diff --git a/migration/ram.c b/migration/ram.c index 72143da..e795a8d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -652,6 +652,16 @@ static void mig_throttle_guest_down(uint64_t bytes_dirty_period, } } +void mig_throttle_counter_reset(void) +{ + RAMState *rs = ram_state; + + rs->time_last_bitmap_sync = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + rs->num_dirty_pages_period = 0; + rs->bytes_xfer_prev = ram_counters.transferred; + cpu_throttle_stop(); +} + /** * xbzrle_cache_zero_page: insert a zero page in the XBZRLE cache * diff --git a/migration/ram.h b/migration/ram.h index 6378bb3..3f78175 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -50,6 +50,7 @@ bool ramblock_is_ignored(RAMBlock *block); int xbzrle_cache_resize(uint64_t new_size, Error **errp); uint64_t ram_bytes_remaining(void); uint64_t ram_bytes_total(void); +void mig_throttle_counter_reset(void); uint64_t ram_pagesize_summary(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len); From patchwork Fri Mar 19 03:07:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149899 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,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 333A4C433DB for ; Fri, 19 Mar 2021 03:34:39 +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 DC9A264F1B for ; Fri, 19 Mar 2021 03:34:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC9A264F1B 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]:60250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5uI-0005ZU-2e for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:34:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5r5-00011k-3l for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:19 -0400 Received: from mga12.intel.com ([192.55.52.136]:34596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5r1-00030p-6c for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:18 -0400 IronPort-SDR: bTRti6lPSjqUkg9HSQE975zoYwjFoHXytbVmOPHtqfqdTYU3lJVYY90W2onWayMgY4Lq1zDm2v oPgYwx1G+S7g== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117149" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117149" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:31:11 -0700 IronPort-SDR: cPBUgrMs2GnMF1xUpYjIuSM7+kojd4lfBqLC8ZyhLx32+98yuZku0mHuXBd4iFrN6RpBeLyyil /gWz0UEKBfHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448984" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:31:09 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 08/10] Reduce the PVM stop time during Checkpoint Date: Fri, 19 Mar 2021 11:07:46 +0800 Message-Id: <1616123268-89517-9-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" When flushing memory from ram cache to ram during every checkpoint on secondary VM, we can copy continuous chunks of memory instead of 4096 bytes per time to reduce the time of VM stop during checkpoint. Signed-off-by: Lei Rao --- migration/ram.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index e795a8d..2a8ee96 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -823,6 +823,39 @@ unsigned long migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb, return next; } +/* + * colo_bitmap_find_diry:find contiguous dirty pages from start + * + * Returns the page offset within memory region of the start of the contiguout + * dirty page + * + * @rs: current RAM state + * @rb: RAMBlock where to search for dirty pages + * @start: page where we start the search + * @num: the number of contiguous dirty pages + */ +static inline +unsigned long colo_bitmap_find_dirty(RAMState *rs, RAMBlock *rb, + unsigned long start, unsigned long *num) +{ + unsigned long size = rb->used_length >> TARGET_PAGE_BITS; + unsigned long *bitmap = rb->bmap; + unsigned long first, next; + + if (ramblock_is_ignored(rb)) { + return size; + } + + first = find_next_bit(bitmap, size, start); + if (first >= size) { + return first; + } + next = find_next_zero_bit(bitmap, size, first + 1); + assert(next >= first); + *num = next - first; + return first; +} + static inline bool migration_bitmap_clear_dirty(RAMState *rs, RAMBlock *rb, unsigned long page) @@ -3669,6 +3702,8 @@ void colo_flush_ram_cache(void) void *dst_host; void *src_host; unsigned long offset = 0; + unsigned long num = 0; + unsigned long i = 0; memory_global_dirty_log_sync(); WITH_RCU_READ_LOCK_GUARD() { @@ -3682,19 +3717,23 @@ void colo_flush_ram_cache(void) block = QLIST_FIRST_RCU(&ram_list.blocks); while (block) { - offset = migration_bitmap_find_dirty(ram_state, block, offset); + offset = colo_bitmap_find_dirty(ram_state, block, offset, &num); if (((ram_addr_t)offset) << TARGET_PAGE_BITS >= block->used_length) { offset = 0; + num = 0; block = QLIST_NEXT_RCU(block, next); } else { - migration_bitmap_clear_dirty(ram_state, block, offset); + for (i = 0; i < num; i++) { + migration_bitmap_clear_dirty(ram_state, block, offset + i); + } dst_host = block->host + (((ram_addr_t)offset) << TARGET_PAGE_BITS); src_host = block->colo_cache + (((ram_addr_t)offset) << TARGET_PAGE_BITS); - memcpy(dst_host, src_host, TARGET_PAGE_SIZE); + memcpy(dst_host, src_host, TARGET_PAGE_SIZE * num); + offset += num; } } } From patchwork Fri Mar 19 03:07:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149903 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,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 EB5BDC433DB for ; Fri, 19 Mar 2021 03:36:03 +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 98FE364DEF for ; Fri, 19 Mar 2021 03:36:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98FE364DEF 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]:37832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5ve-0007wc-OB for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:36:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5r5-00012B-A4 for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:19 -0400 Received: from mga12.intel.com ([192.55.52.136]:34610) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5r3-00038f-0t for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:19 -0400 IronPort-SDR: MYXlynPNGVVpJicm93NQ8BkUr22YtcgafVVKdy4R6hW9/gQXKENgdUSdo727nFhQbaTKcHy6sI P/Nbm6Tp106A== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117181" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117181" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:31:15 -0700 IronPort-SDR: CNl4WPp0E2XtH7FB4Bn1iV/FbPqH11FBhJfViyCwNr3RFbEmxHdpkrDM+d12GXwz5sRRwS5uXq Z3YAhszgpMpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606449006" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:31:12 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 09/10] Add the function of colo_bitmap_clear_diry. Date: Fri, 19 Mar 2021 11:07:47 +0800 Message-Id: <1616123268-89517-10-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" When we use continuous dirty memory copy for flushing ram cache on secondary VM, we can also clean up the bitmap of contiguous dirty page memory. This also can reduce the VM stop time during checkpoint. Signed-off-by: Lei Rao --- migration/ram.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 2a8ee96..9b23df6 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -856,6 +856,30 @@ unsigned long colo_bitmap_find_dirty(RAMState *rs, RAMBlock *rb, return first; } +/** + * colo_bitmap_clear_dirty:when we flush ram cache to ram, we will use + * continuous memory copy, so we can also clean up the bitmap of contiguous + * dirty memory. + */ +static inline bool colo_bitmap_clear_dirty(RAMState *rs, + RAMBlock *rb, + unsigned long start, + unsigned long num) +{ + bool ret; + unsigned long i = 0; + + qemu_mutex_lock(&rs->bitmap_mutex); + for (i = 0; i < num; i++) { + ret = test_and_clear_bit(start + i, rb->bmap); + if (ret) { + rs->migration_dirty_pages--; + } + } + qemu_mutex_unlock(&rs->bitmap_mutex); + return ret; +} + static inline bool migration_bitmap_clear_dirty(RAMState *rs, RAMBlock *rb, unsigned long page) @@ -3703,7 +3727,6 @@ void colo_flush_ram_cache(void) void *src_host; unsigned long offset = 0; unsigned long num = 0; - unsigned long i = 0; memory_global_dirty_log_sync(); WITH_RCU_READ_LOCK_GUARD() { @@ -3725,9 +3748,7 @@ void colo_flush_ram_cache(void) num = 0; block = QLIST_NEXT_RCU(block, next); } else { - for (i = 0; i < num; i++) { - migration_bitmap_clear_dirty(ram_state, block, offset + i); - } + colo_bitmap_clear_dirty(ram_state, block, offset, num); dst_host = block->host + (((ram_addr_t)offset) << TARGET_PAGE_BITS); src_host = block->colo_cache From patchwork Fri Mar 19 03:07:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12149907 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 A407EC433DB for ; Fri, 19 Mar 2021 03:39:12 +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 1E65064DE2 for ; Fri, 19 Mar 2021 03:39:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E65064DE2 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]:43370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5yh-0001qg-9B for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 23:39:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5r7-00013j-Ef for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:21 -0400 Received: from mga12.intel.com ([192.55.52.136]:34615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5r5-00039O-PC for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:21 -0400 IronPort-SDR: m5s5VciSFmEHf7FcRh44RSw+MQt8voeFEtENfruEGeqPTNsbZQjCT4xtr9CbkLDxOL4yr+BYs1 N6lJAiWTl5tw== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117206" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117206" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:31:18 -0700 IronPort-SDR: P+PLdb0JuYbBthGKarAo4E2c1hsNFdKgyXhOB/G3T4GMp4/YtsQ5gOW8ndrEcOVIkxHUQsgqrO sUM5R607uLjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606449021" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:31:15 -0700 From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 10/10] Fixed calculation error of pkt->header_size in fill_pkt_tcp_info() Date: Fri, 19 Mar 2021 11:07:48 +0800 Message-Id: <1616123268-89517-11-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=192.55.52.136; envelope-from=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org 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 --- 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 26464a2..32b7775 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;