From patchwork Wed Jun 27 20:41:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10492639 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ABF2660375 for ; Wed, 27 Jun 2018 20:50:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFDC52A09D for ; Wed, 27 Jun 2018 20:50:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADA0B2A05A; Wed, 27 Jun 2018 20:50:11 +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 0AD6B2A020 for ; Wed, 27 Jun 2018 20:50:09 +0000 (UTC) Received: from localhost ([::1]:33136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYHOD-0001US-7j for patchwork-qemu-devel@patchwork.kernel.org; Wed, 27 Jun 2018 16:50:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYHHg-0004iy-Cu for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYHHf-00079N-0Y for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:24 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:36366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYHHe-00078i-Py for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:22 -0400 Received: by mail-pg0-x243.google.com with SMTP id m5-v6so1430889pgd.3 for ; Wed, 27 Jun 2018 13:43:22 -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=z+1kNOSm5VHVyAAnQmFmRuVBcI2IKRsDYoqjEPHEH9I=; b=U7VZVAoaLaLy/2qRmi369pAIDbhPeTkfFs3y9MZb7vCvtppTkIWXau5lBf+COXC8g0 DM/syjbaH2wHmiJ5DkQ8EG1U2cPSog1K/TvoqTh834Untt1Z3bNk7BUwuCA0FUKmGvRo MrA6ft+m/MTtqko4GXvKmTNLNnj1iwUr3F5gbVV1xIhTLXe47gZB9vBpZz/j9++EyPhS ykc/MIMPK94JkyBZz/UiZWxeS2nlt7nTEvbTqtvTEwVqJAKQycc1GaSenFb2yde87SAq e7KFcxcl4rcRbUjPPLWtxuOKNoY9IVk4fFZLUJg8SuvskibnbDqxk0RyNeUt8f6YdrN8 d3ww== 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=z+1kNOSm5VHVyAAnQmFmRuVBcI2IKRsDYoqjEPHEH9I=; b=cDxOYwn9u9F5mPTl0AQwA+VFgoIgywWmRmn4+g3WuS3xjxb8m5ZhMwkdY7MzrS569r wG8Z/UdNBPkf0PkjLkp5zNkY7v5Qgr3ZfEzUr08FhNkc/aSjl4axZl8CTdkwSH3WPKzc sgD9V0ZZHBl3h3tzugD4NeLYBpvz8lTm+nKbdoYPBGa3GWFXo5JTgE3aE4942sL4jLvw Uo2VHBEcX80WtIJ34jFejaH2Q/zdtdAEMhqYKY9udgG13P1NJbz+FdZ8oZxjfhPexdMw HeENWwjfrh8Fg5WvcP2WF0StIDdUffQT5wPqfH3pBtgwEo0WNVEz68mgomc2j7tjQrSr MtKw== X-Gm-Message-State: APt69E0l6odn4JoFSabflrj3GMJu0joRCUwBsLrVFV9WXefASWZtdUZC l19DmrstRdcluk3OBUUuFgtPlQ== X-Google-Smtp-Source: ADUXVKJBaum8LJ1c5JDa7OSkPh8n6pGTWWm19IodQejRC/GTiMv+xCNw5JXpYWh1xeWr1amoAJptEQ== X-Received: by 2002:a63:89c7:: with SMTP id v190-v6mr6333637pgd.194.1530132201573; Wed, 27 Jun 2018 13:43:21 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id c67-v6sm9690428pfj.173.2018.06.27.13.43.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 13:43:20 -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: Thu, 28 Jun 2018 04:41:34 +0800 Message-Id: <20180627204136.4177-19-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180627204136.4177-1-zhangckid@gmail.com> References: <20180627204136.4177-1-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH V9 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 a32c8e2244..4d0ee7d8aa 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 */ @@ -799,6 +806,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");