From patchwork Mon Sep 3 04:38:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10585439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53E3913AC for ; Mon, 3 Sep 2018 04:54:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41ADC29515 for ; Mon, 3 Sep 2018 04:54:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 350E329532; Mon, 3 Sep 2018 04:54:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DC8FA29515 for ; Mon, 3 Sep 2018 04:54:54 +0000 (UTC) Received: from localhost ([::1]:43434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwgt4-0005O0-4d for patchwork-qemu-devel@patchwork.kernel.org; Mon, 03 Sep 2018 00:54:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwgh6-0002Lg-GY for qemu-devel@nongnu.org; Mon, 03 Sep 2018 00:42:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwgh2-0006Bo-Jl for qemu-devel@nongnu.org; Mon, 03 Sep 2018 00:42:32 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46322) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fwgh2-0006Bc-DE for qemu-devel@nongnu.org; Mon, 03 Sep 2018 00:42:28 -0400 Received: by mail-pg1-x543.google.com with SMTP id b129-v6so8003135pga.13 for ; Sun, 02 Sep 2018 21:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SPbpnEYkE02fEANS6dtUBnvhJ9fE2CIuRiZeuzr7BqY=; b=nBFziBr4qu6D+JR8PP1nexuyyGlZOxewiMenOORpB1Hmn8KWPC2iLTVIhzPYE2ushq dCizHKZ1ktaH+7BI9trBf8ELuHuBUl775hyjcJ4YfmWbA9yL6PBnpkWeUF8gmCsNFhkq wzOpspHVCTYbm13dexQMAmJKDqviExO65CRWdtvNHciqrhipnzQPG3ZxiOVZeog+o4Um xH3tQOgrRK/N7EtSDBJdlIyjL+2Vw1dB5g4TRlTQvRFtP01Dpm+OWwOXmS+0e5xrXKBI KoHU7uijQMJGxGXtp100fcpOp0ntZuNt+EogEJrM0hCDxsthYVz4Tv8GaQD/MRtKGPXv TsOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SPbpnEYkE02fEANS6dtUBnvhJ9fE2CIuRiZeuzr7BqY=; b=MkWiv+1PuPirkLEFqvM6VfGQSEr5hQaPVsScvudMGXtYNFgjeVugQOveQzkaKbeBwy FzuLRvAw8TW6rwLY/21pyNzBqq1D10enf2uaDBemuUEo0cJ17ZShxYQZ0XaVb3S/0YmF DfB5WzmHVMag7BFgas1hEAfnbqoPjfPuWkVtzOON7YRWCKxPiNda2BISsHFAbwP77mmb yLuQXEaUIygObxbokofEIaul8Fo65hlDX799492x7Dxe+1bFFNXG5X4cgZN+EA1vI56u /EFRaySLMYJ2m42HdlkpPtqzg+aF/flKPUX3ulWStcDjYwUo4vBpRfNNcsiMpQZTPVYb 7gUw== X-Gm-Message-State: APzg51D+WXxgAtWloa5PXOT9jpTgtaVvgAD3Czj5pQI/+v88b6Iz2K2p 7mqYy6rBUU7U9+o+P5Y31TKqc883 X-Google-Smtp-Source: ANB0VdbmwB8jNPXrcxuRJsQBp3vAizBUY/HNlCm4jqNwJc5a5XL09zfNgzeJatjV2cA/cUNK62UzJw== X-Received: by 2002:a63:fc07:: with SMTP id j7-v6mr22387214pgi.1.1535949747346; Sun, 02 Sep 2018 21:42:27 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id g6-v6sm32738308pfb.11.2018.09.02.21.42.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Sep 2018 21:42:26 -0700 (PDT) From: Zhang Chen To: qemu-devel@nongnu.org, Paolo Bonzini , Juan Quintela , "Dr . David Alan Gilbert" , Jason Wang , Eric Blake , Markus Armbruster Date: Mon, 3 Sep 2018 12:38:58 +0800 Message-Id: <20180903043900.28592-18-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180903043900.28592-1-zhangckid@gmail.com> References: <20180903043900.28592-1-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH V12 17/19] COLO: notify net filters about checkpoint/failover event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhanghailiang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: zhanghailiang Notify all net filters about the checkpoint and failover event. Signed-off-by: zhanghailiang Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/migration/colo.c b/migration/colo.c index 25d279decf..365e913e51 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -31,6 +31,7 @@ #include "qapi/qapi-events-migration.h" #include "qapi/qmp/qerror.h" #include "sysemu/cpus.h" +#include "net/filter.h" static bool vmstate_loading; static Notifier packets_compare_notifier; @@ -83,6 +84,12 @@ static void secondary_vm_do_failover(void) error_report_err(local_err); } + /* Notify all filters of all NIC to do checkpoint */ + colo_notify_filters_event(COLO_EVENT_FAILOVER, &local_err); + if (local_err) { + error_report_err(local_err); + } + if (!autostart) { error_report("\"-S\" qemu option will be ignored in secondary side"); /* recover runstate to normal migration finish state */ @@ -782,6 +789,14 @@ void *colo_process_incoming_thread(void *opaque) goto out; } + /* Notify all filters of all NIC to do checkpoint */ + colo_notify_filters_event(COLO_EVENT_CHECKPOINT, &local_err); + + if (local_err) { + qemu_mutex_unlock_iothread(); + goto out; + } + vmstate_loading = false; vm_start(); trace_colo_vm_state_change("stop", "run");