From patchwork Thu Mar 25 02:24: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: 12162725 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 637A7C433C1 for ; Thu, 25 Mar 2021 02:50:09 +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 D95F461A16 for ; Thu, 25 Mar 2021 02:50:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D95F461A16 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]:51222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG4V-0002NP-R2 for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:50:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2a-0000us-IB for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:08 -0400 Received: from mga07.intel.com ([134.134.136.100]:40251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2Y-0001ZZ-1u for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:07 -0400 IronPort-SDR: sHAmnmyfz812RXC28GEpFAhlp5sFA+UUG0SQbu3CsDnlritU3GB611Lpn03GAB/Yv2zdQhOh1a WyL2Yf+4Lh2A== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823094" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823094" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:00 -0700 IronPort-SDR: OfqKCzRdM0oKg5jX2HDfo6gFhUVERaSPtBX5S/Sn4Hnz+JHacmksQYCM6CQaV+Gb+2t5ElnGIS JScrHmgr0eAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881350" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:47:57 -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 v4 01/10] Remove some duplicate trace code. Date: Thu, 25 Mar 2021 10:24:42 +0800 Message-Id: <1616639091-28279-2-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 9d1ad99..c142c08 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 Thu Mar 25 02:24: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: 12162733 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 EDFF0C433C1 for ; Thu, 25 Mar 2021 02:52:18 +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 8F1C1619C2 for ; Thu, 25 Mar 2021 02:52:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F1C1619C2 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]:59164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG6b-0005qn-Jy for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:52:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2b-0000v5-89 for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:09 -0400 Received: from mga07.intel.com ([134.134.136.100]:40258) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2Y-0001bh-Hg for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:09 -0400 IronPort-SDR: jmY1iVz3wVHjEIVj1B0XMZZuK+LZlzpEgJq6VVdQgp4p1O+hAPPT+bgfp6THf68ScGBnFDeSZZ gp1YuDjDBLsQ== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823098" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823098" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:03 -0700 IronPort-SDR: AWcXGcy3CcpSHMTWKLYk9+afOzTOUz8U+8fFqzlK+jJGeT4lL7bWO9p0fsST1qmPXe1QsYq/WV WeW3vFXLehxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881370" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48:01 -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 v4 02/10] Fix the qemu crash when guest shutdown during checkpoint Date: Thu, 25 Mar 2021 10:24:43 +0800 Message-Id: <1616639091-28279-3-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 ce8977c..1564057 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 Thu Mar 25 02:24: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: 12162735 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 BC117C433DB for ; Thu, 25 Mar 2021 02:52:19 +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 18C87619C2 for ; Thu, 25 Mar 2021 02:52:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18C87619C2 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]:59160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG6c-0005qg-1j for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:52:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2c-0000vC-9a for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:10 -0400 Received: from mga07.intel.com ([134.134.136.100]:40251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2a-0001ZZ-M8 for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:10 -0400 IronPort-SDR: Ob5mqqqiSyT7dcwNQ5jxNA8gKSBzCQs+SMjFIkP56wmqJB5FW/eEhjMNG/rtdomSB0xSQDfc8M 5lGGwD2pDefA== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823115" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823115" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:08 -0700 IronPort-SDR: LRnveuCF/DRKROTss2JA4wGmseMd3r10U63XTzYHGX4wli4VJQq+GyKo++wF0Wh8iVv6tGgTFz Dc8KN3pUhWdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881391" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48: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 v4 03/10] Optimize the function of filter_send Date: Thu, 25 Mar 2021 10:24:44 +0800 Message-Id: <1616639091-28279-4-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 Thu Mar 25 02:24: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: 12162739 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 8B35DC433DB for ; Thu, 25 Mar 2021 02:54: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 2F38161A18 for ; Thu, 25 Mar 2021 02:54:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F38161A18 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]:38442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG91-0000Tu-9n for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:54:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2k-00010z-Lw for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:18 -0400 Received: from mga07.intel.com ([134.134.136.100]:40251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2e-0001ZZ-Fu for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:18 -0400 IronPort-SDR: Gs2YxKAfmM5f5S41skjiRrG2hvLxSXJiCvql890Qy8UDBFRfhqbKCyxlGrjbpDxPOFlw0O/hps 2uZXC6BCTATA== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823119" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823119" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:11 -0700 IronPort-SDR: T+ZZUJ6bXG8PEOVDdVM2k8w2rA2gnVlawzgJ6KufPcCvUGTiroeftagCbThPclCjY6XLQKltkS NNeMcwZD9WoA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881402" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48: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 v4 04/10] Remove migrate_set_block_enabled in checkpoint Date: Thu, 25 Mar 2021 10:24:45 +0800 Message-Id: <1616639091-28279-5-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 ca8b97b..4578f22 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2219,6 +2219,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 Thu Mar 25 02:24: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: 12162789 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 C8DCEC433DB for ; Thu, 25 Mar 2021 02:57:55 +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 4871861A02 for ; Thu, 25 Mar 2021 02:57:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4871861A02 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]:46306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPGC2-0003lQ-9u for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2n-00012p-4i for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:21 -0400 Received: from mga07.intel.com ([134.134.136.100]:40268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2k-0001he-Ug for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:20 -0400 IronPort-SDR: yDerLEvN5WeBD6hGNl4MwSxc6pKKc2/0VPhaffNX/jRhYW43dlMq5lKFSxt8z6fqot8q1fU197 v0zpS0syzvUg== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823123" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823123" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:15 -0700 IronPort-SDR: RGq+PfsjuBjSpGBHJe7duvxRHYkX9AIgI7Z13LAMj0swm/VpNw6/J6TWlC17Rop3MxctEA+KwB QSOkE16roQjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881411" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48: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 v4 05/10] Add a function named packet_new_nocopy for COLO. Date: Thu, 25 Mar 2021 10:24:46 +0800 Message-Id: <1616639091-28279-6-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 Thu Mar 25 02:24: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: 12162741 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 67D95C433C1 for ; Thu, 25 Mar 2021 02:54: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 040EA61A02 for ; Thu, 25 Mar 2021 02:54:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 040EA61A02 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]:38452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG91-0000U9-0f for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:54:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2o-00013w-UC for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:22 -0400 Received: from mga07.intel.com ([134.134.136.100]:40251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2m-0001ZZ-5Q for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:22 -0400 IronPort-SDR: Ro6Zvt0BDMkXtw5/hsGosXaEO/yT6gxo/DzIZV6X/Wr2tbCfk4ojl72/SKx6ajisOUS8lPtI+W vFqyRYDGrpRA== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823131" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823131" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:19 -0700 IronPort-SDR: Ip4WSMHwRmKaIaXa9AGq0QzSntBDZpQWV58+AcuyKJFmciBCGs9/EWs/TRJ+oHW3/YAjFVkkuT sMFIadQIBe/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881423" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48:16 -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 v4 06/10] Add the function of colo_compare_cleanup Date: Thu, 25 Mar 2021 10:24:47 +0800 Message-Id: <1616639091-28279-7-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 c142c08..5b538f4 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 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 725a4e1..8fcb2e7 100644 --- a/net/net.c +++ b/net/net.c @@ -53,6 +53,7 @@ #include "sysemu/sysemu.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" +#include "net/colo-compare.h" #include "net/filter.h" #include "qapi/string-output-visitor.h" #include "qapi/hmp-output-visitor.h" @@ -1463,6 +1464,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 Thu Mar 25 02:24: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: 12162729 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 60E01C433DB for ; Thu, 25 Mar 2021 02:50:41 +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 D84D9619C2 for ; Thu, 25 Mar 2021 02:50:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D84D9619C2 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]:52266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG51-0002oH-LL for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:50:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2w-00016W-6O for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:30 -0400 Received: from mga07.intel.com ([134.134.136.100]:40272) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2r-0001k6-9h for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:29 -0400 IronPort-SDR: PIevxM0swKIqz7MPQtMsylgGnsHcjVAV/QAfJanYTsOEkEobkx3C/d2rpYq3SK+HaO6XqCc0bw +ZEjEiGejx/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823136" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823136" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:23 -0700 IronPort-SDR: K2ahEwBUZnAselN9/zhy6pp34kbpm4/Is0ypqOxvBVsAnjtRe+yR6mIZTsihtPTjoLYsiAMqi6 LtBc2G5TF4DA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881432" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48:20 -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 v4 07/10] Reset the auto-converge counter at every checkpoint. Date: Thu, 25 Mar 2021 10:24:48 +0800 Message-Id: <1616639091-28279-8-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 --- migration/colo.c | 4 ++++ migration/ram.c | 9 +++++++++ migration/ram.h | 1 + 3 files changed, 14 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 40e7895..c69a8e0 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -652,6 +652,15 @@ 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; +} + /** * 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 Thu Mar 25 02:24:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12162737 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 4B08DC433C1 for ; Thu, 25 Mar 2021 02:52:27 +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 0268461A16 for ; Thu, 25 Mar 2021 02:52:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0268461A16 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]:59936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG6k-0006BC-50 for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:52:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2x-00019F-JR for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:31 -0400 Received: from mga07.intel.com ([134.134.136.100]:40276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2v-0001lm-0y for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:31 -0400 IronPort-SDR: tbfzBUEaLChCmNHIfjtzSMPOgJ/eLUHZFHM1vcIIac7ngMDrD10YWvhvqhKeM8HdszLs+QJwZq yZOjF8ClDybw== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823143" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823143" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:26 -0700 IronPort-SDR: iuutVtCAhbmN4YBIdVpOCPpdjfXYczGR9OSclcQ8N/jErlRC7e6eTyRRyfLlBXTXDLuFzCo58G KtLHI7tKkcrA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881441" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48:24 -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 v4 08/10] Reduce the PVM stop time during Checkpoint Date: Thu, 25 Mar 2021 10:24:49 +0800 Message-Id: <1616639091-28279-9-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 Reviewed-by: Dr. David Alan Gilbert --- migration/ram.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index c69a8e0..a258466 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -822,6 +822,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) @@ -3666,6 +3699,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() { @@ -3679,19 +3714,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 Thu Mar 25 02:24:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12162791 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 987FFC433C1 for ; Thu, 25 Mar 2021 02:57:56 +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 0CC7661A02 for ; Thu, 25 Mar 2021 02:57:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CC7661A02 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]:46400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPGC2-0003nl-V3 for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG33-0001Bb-3F for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:37 -0400 Received: from mga07.intel.com ([134.134.136.100]:40272) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG2x-0001k6-0i for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:34 -0400 IronPort-SDR: xcEfYaul7xobVVyi7rx1+rCiOatV0PT7/9AHBA/pIG/jGzIy5ZEFX0l+xESQu1k3bHXt/tH0ar Oc21GRk/3srg== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823147" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823147" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:30 -0700 IronPort-SDR: lS9PtaVqspX7CuAJOCnYi5yuZICnUAvnmiN+qvpMyZo8OMNlyw3smvHUoEN2EaGz5BEd34K9sO mNlaBc45Oisw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881453" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48:28 -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 v4 09/10] Add the function of colo_bitmap_clear_diry. Date: Thu, 25 Mar 2021 10:24:50 +0800 Message-Id: <1616639091-28279-10-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 a258466..ae1e659 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -855,6 +855,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) @@ -3700,7 +3724,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() { @@ -3722,9 +3745,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 Thu Mar 25 02:24:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Lei" X-Patchwork-Id: 12162731 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 B40CEC433C1 for ; Thu, 25 Mar 2021 02:50:42 +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 2E672619C2 for ; Thu, 25 Mar 2021 02:50:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E672619C2 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]:52410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPG53-0002ro-6C for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 22:50:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG3A-0001CD-5n for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:45 -0400 Received: from mga07.intel.com ([134.134.136.100]:40276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPG31-0001lm-QU for qemu-devel@nongnu.org; Wed, 24 Mar 2021 22:48:42 -0400 IronPort-SDR: 8pQ6GQyVu3YmVPmlJEtisGe7seAoEtp6BbFW0LgIM9uANNtmwHLo4GZEgeORyBQauwXbFdMXVp IqgbH2oqaSxg== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="254823154" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="254823154" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 19:48:34 -0700 IronPort-SDR: aB/vLZeWCcbeYcQOUBJdyIwWII6oQDhUB7IV8cZodIYTLWemwjJreAgu/Zfq6dBMXEQ8Fh7EXZ be5TLrnRw0ZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374881468" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 19:48:31 -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 v4 10/10] Fixed calculation error of pkt->header_size in fill_pkt_tcp_info() Date: Thu, 25 Mar 2021 10:24:51 +0800 Message-Id: <1616639091-28279-11-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616639091-28279-1-git-send-email-lei.rao@intel.com> References: <1616639091-28279-1-git-send-email-lei.rao@intel.com> Received-SPF: pass client-ip=134.134.136.100; envelope-from=lei.rao@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: "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 5b538f4..b100e7b 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;