From patchwork Sun Jul 22 19:33:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10539405 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 C06211805 for ; Sun, 22 Jul 2018 19:52:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3D2C28420 for ; Sun, 22 Jul 2018 19:52:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96D4E28434; Sun, 22 Jul 2018 19:52:38 +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 09E7428420 for ; Sun, 22 Jul 2018 19:52:37 +0000 (UTC) Received: from localhost ([::1]:57304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhKPF-000830-0o for patchwork-qemu-devel@patchwork.kernel.org; Sun, 22 Jul 2018 15:52:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhK91-0003Qa-QM for qemu-devel@nongnu.org; Sun, 22 Jul 2018 15:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhK91-00015W-10 for qemu-devel@nongnu.org; Sun, 22 Jul 2018 15:35:51 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:38590) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhK90-00015O-Qi for qemu-devel@nongnu.org; Sun, 22 Jul 2018 15:35:50 -0400 Received: by mail-pl0-x242.google.com with SMTP id b1-v6so7294661pls.5 for ; Sun, 22 Jul 2018 12:35:50 -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=O4LGoTN/7dnIo6QygGS9w7gOTri42IzEVdwEggBKL+4=; b=SrOKp5bhsY5mxN50Th7BdVV7ScHrtrfAcorb60sUWxT+fBQR1RfHILvHfwDACA8r/D 4WP/DLtRouyb8Hj5D9FWGr4KDF+mesCImlv5+WJGndXnPXVmv2SeIW8B/Jdq9Zc/DPy6 AcNQ2F6czLPJibpMsilmXRbQlcvJWapsMrdgpYFVCLhEG0JD1ia6mome5Od3L/GRuhuw FEfVILsQwl0NZPPmZPknR0N6JFET2MlqJZ+Utr2TsqCqfB4smaaDEOemQC9lzdPAbP0D q4J6fkKqSP8I06SFsUCtRAWpXEgkrw/nGIl52VOrtnRtjxTiBKssnahhy1FdCxPCtce/ uV4w== 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=O4LGoTN/7dnIo6QygGS9w7gOTri42IzEVdwEggBKL+4=; b=ED2cwQfRv/Pd2v7TpRShB7twHWss5nhm3hAJob8A5zA4yQBDvtxr32NJcys2EL1jAa 3bg5KvMHA4649F6+2UUqFjrPdEDEcBVvwin11m5cYrBAGBDdg7t0LogWi8rGYfqBmIvx lVDupv17pSakaz5v7Da1J9byDXQt7DwiQfJPOqmpzd5MVCd8JwCrweB+ZwFCEca8GLC3 V7RCQdLdTgoc5tAENOr5DxKQkhyAQnbe3rI+i3jSiligw4HZNupATht2UBR8Kr/a/xa5 nUNK/bBWQGocKzbQhNpDmL8Uy5xjllzxG1Kcu4CPBx2V08YLfBTfHYGAQjGn7jY7+gAg qviA== X-Gm-Message-State: AOUpUlEHUfSoZtZ1xmcSQKgoNelrO1GL4b1rW8Em4rR651eZlgOYsC0O L4lYYieUgc00K9trRRSRWtc0KjTR X-Google-Smtp-Source: AAOMgpeLhQke4dWcEwqLtqtKFUY9DzfbmBI7HJdObvmVGEXetqIBO34dujbQxjQd+p4SVH0L/i0r+g== X-Received: by 2002:a17:902:3f81:: with SMTP id a1-v6mr10163842pld.29.1532288149561; Sun, 22 Jul 2018 12:35:49 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id 87-v6sm14215353pfn.103.2018.07.22.12.35.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 12:35:48 -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, 23 Jul 2018 03:33:48 +0800 Message-Id: <20180722193350.6028-19-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180722193350.6028-1-zhangckid@gmail.com> References: <20180722193350.6028-1-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH V10 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");