From patchwork Sat Aug 11 20:59:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10563579 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 F355C13BB for ; Sat, 11 Aug 2018 21:16:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E69A52990B for ; Sat, 11 Aug 2018 21:16:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8F1529982; Sat, 11 Aug 2018 21:16:51 +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 859382990B for ; Sat, 11 Aug 2018 21:16:51 +0000 (UTC) Received: from localhost ([::1]:33260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fobFi-0003GS-O2 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 11 Aug 2018 17:16:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fob0g-0005ai-JQ for qemu-devel@nongnu.org; Sat, 11 Aug 2018 17:01:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fob0d-0001fV-Im for qemu-devel@nongnu.org; Sat, 11 Aug 2018 17:01:18 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:35076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fob0d-0001f8-CS for qemu-devel@nongnu.org; Sat, 11 Aug 2018 17:01:15 -0400 Received: by mail-pf1-x444.google.com with SMTP id p12-v6so6017204pfh.2 for ; Sat, 11 Aug 2018 14:01:15 -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=icdrUsJnfbDed6Ff8GShXGHEA9pGkgHwJ593EjVc+iw=; b=ciVrvTeg3v4mRHWU7WVYlitqmT0FAPVz1KJ1lntVJ7B9+HQYa3et+tMbFjvte8bJ3M ybWXGDyBIdTi4IWOZDzOHCduZxDvi3dSIMlp73VISpvhJXchRnYlEOcJhnqOf6mMqx5G xCPWVAdVX4nM2+nVUH0eY7zED5cNxUqh5MuTcFmgBC/3X5x3unCQ9+Yw/3JJ6QtFL3cY Fp/0vSWKKkNeMeqVBw+hq/dsxt6Lkd1rkR23Cspr2zqAXLTUlwJ11uIFXywe2IaYIKpm /o19PJ2CIa5NgJ1Xy9fyB04HX4OKNxOLMJiR5liBfTMCIvCjOP/8vnygcUwyQinwnudv eUqg== 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=icdrUsJnfbDed6Ff8GShXGHEA9pGkgHwJ593EjVc+iw=; b=kJH0+6gEl63g7G0Rb0Icz8udhbAH1hn7QEKjynHNdWQWgtg6FYQcAVv54H/kFOm9g9 bCixzjc+uOQVqXG6nfdbnBxsocDC2gUZv3ehwtXES/4CfXZ7ZFeN3SrzCFZbfteqpMy5 Zxik94s8/FAtdnjfsiiZH/2x4AQI59t58Y8Uia/HZIofiKQSCZO2xGNElTCXFuYrONK/ f3yJ4DLXSeJSn4MM6hg06ISAm9yxSVJ6TzdJDY/PEbrRuYOqZm5wJ+l/qK7rpTd88h35 xIzYxVu3B80vRVlMXVzwtnHcf+Szdv12ep8OMbBd1O2y7kGPFLSEtcIqXWb/1koeUr6b r6oA== X-Gm-Message-State: AOUpUlHDO7aHhcG6S2liKteyFkc+KQdDXkj1upM0Qd2aItGWfJy2VLb+ +inQ46IAHu0x5NJ1MHEUTjeig0rz X-Google-Smtp-Source: AA+uWPzHBqLS+m+M99wPa78Ut9YKSPjPZ2v+IVP6j/AuUAZNxvcFnclzNYRePJcrvyAPqYSQNE/YUA== X-Received: by 2002:a62:d544:: with SMTP id d65-v6mr12442596pfg.107.1534021273991; Sat, 11 Aug 2018 14:01:13 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id h24-v6sm23502641pfk.113.2018.08.11.14.01.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Aug 2018 14:01:13 -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: Sun, 12 Aug 2018 04:59:22 +0800 Message-Id: <20180811205924.4113-19-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180811205924.4113-1-zhangckid@gmail.com> References: <20180811205924.4113-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::444 Subject: [Qemu-devel] [PATCH V11 18/20] 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 688d6f40b2..8221a18add 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 */ @@ -781,6 +788,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");