From patchwork Sat Aug 11 20:59:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10563539 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 AC6A913B4 for ; Sat, 11 Aug 2018 21:01:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ED2A29CCD for ; Sat, 11 Aug 2018 21:01:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 805F129CD1; Sat, 11 Aug 2018 21:01:19 +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 5377C29CCD for ; Sat, 11 Aug 2018 21:01:18 +0000 (UTC) Received: from localhost ([::1]:33174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fob0d-0005Wt-8w for patchwork-qemu-devel@patchwork.kernel.org; Sat, 11 Aug 2018 17:01:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1foaz4-0003X6-Pv for qemu-devel@nongnu.org; Sat, 11 Aug 2018 16:59:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1foaz1-0000m7-Ny for qemu-devel@nongnu.org; Sat, 11 Aug 2018 16:59:38 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43141) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1foaz1-0000ko-ES for qemu-devel@nongnu.org; Sat, 11 Aug 2018 16:59:35 -0400 Received: by mail-pg1-x542.google.com with SMTP id a14-v6so5848567pgv.10 for ; Sat, 11 Aug 2018 13:59:35 -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; bh=wxkTZ1ipZ6EbFCP0656NrC0i8n9BInMJnRokA6LfHqk=; b=YBV4KIQ7cOPKrIuf9kxeLNOm75N9fCIgugWM1s4uXtAcaXVeUinMmUzVgmrcQ1Ydgu CHvpmzixLJRlE/GEvxSq+MHmOyDC05+ldSPxEWl9fjN6lN/kTvE48J2ahB8fu4diLdVq W49yle89eVTlalIf5F9pue69oc+yL8L9AVfnXDKu/NafhNOfjmAZKNTjY9+T+xSCo9mz uNfyg5grV3SN7PX19OmXEZNN8d2w5MlmVxdOTCYQ48PvdaIXHY8oMLHR35CQ8+tLX5Zd 3WmQFAa8POOz8W6JKXarT/NuEU0nfyZLH+8j6VhJlRw4k+1DXKEJbnz+zHhSJ7vhSd26 mQrw== 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; bh=wxkTZ1ipZ6EbFCP0656NrC0i8n9BInMJnRokA6LfHqk=; b=TDGGUG99N2W3mBx59AzzBnk2KB7N/zgpjDkwXYsnpKQK5e8G1eWsNs8wx4A5lKzVfN EpXtKMc4cAG8TXVwLyq8HuTMWCM2vm60EQDRfdOeh2U++giCDsE3y/blJ5V+dq9vMhoG gclHzK5xcbyxuXRNUH3VdscCGAIVTbRGKEWRvybT9h13Ta0q5n7NfkkVeNHJG8NlEFMR 2Df0TK8JYu/lB876/lXIhwh2pnYy+FLGPXw/JBDAbyi5QE7Fhhv7fQ2LOkkZfh0VJjqP 6FpY2fmxbSYU3FwQNtH4uoXXM6AK1RxjCWZrPjeZAz5WLhlV9n9kTSDENuAwpdd74mBn 6TAg== X-Gm-Message-State: AOUpUlHcW5NG3jk7Snx6AshwNAu9I9JUwVZLTK4GtFQJsiJiXaDHM0/i jyYNMYjMRiADsF5+e6I5lkkmvoWK X-Google-Smtp-Source: AA+uWPwFmp1Iqe1R+HU41NzP+gBRLOPQNr2ws5IARE7MAwLJUinEq66/jmFetKnooNqtySM6bdWyfA== X-Received: by 2002:a63:6fcc:: with SMTP id k195-v6mr11362019pgc.135.1534021174080; Sat, 11 Aug 2018 13:59:34 -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.13.59.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Aug 2018 13:59:33 -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:04 +0800 Message-Id: <20180811205924.4113-1-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH V11 00/20] COLO: integrate colo frame with block replication and COLO proxy 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 Hi~ All~ COLO Frame, block replication and COLO proxy(colo-compare,filter-mirror, filter-redirector,filter-rewriter) have been exist in qemu for long time, it's time to integrate these three parts to make COLO really works. In this series, we have some optimizations for COLO frame, including separating the process of saving ram and device state, using an COLO_EXIT event to notify users that VM exits COLO, for these parts, most of them have been reviewed long time ago in old version, but since this series have just rebased on upstream which had merged a new series of migration, parts of pathes in this series deserve review again. We use notifier/callback method for COLO compare to notify COLO frame about net packets inconsistent event, and add a handle_event method for NetFilterClass to help COLO frame to notify filters and colo-compare about checkpoint/failover event, it is flexible. For the neweset version, please refer to: https://github.com/zhangckid/qemu/tree/qemu-colo-18aug12 Please review, thanks. V11: - Rebased on upstream. - Used "RAMBLOCK_FOREACH_MIGRATABLE()" to replace "QLIST_FOREACH_RCU()" in patch 08/20. - Fixed COLO related qapi command's since version in patch 10/20. V10: - Rebased on upstream. - Removed the "active" in COLOState. - Fixed some comments. V9: - Rebased on upstream codes. - Addressed Jason's comments add TCP state machine track in filter-rewriter. - Fix some bug in colo-compare. - Fix typo. - Add filter-rewriter failover handle. - Add net client type check in colo-compare. - Add COLO state diagram. - Addressed Markus and Daive's comments. V8: - Rebased on upstream codes. - Addressed Markus's comments in patch 10/17. - Addressed Markus's comments in patch 11/17. - Removed some comments in patch 4/17. - Moved the "migration_bitmap_clear_dirty()" to suitable position in patch 9/17. - Rewrote the patch 07/17 to address Davie's comments. - Moved the "qemu_savevm_live_state" out of the qemu_mutex_lock_iothread. - Fixed the bug that in some status COLO vm crash with segmentation fault. V7: - Addressed Markus's comments in 11/17. - Rebased on upstream. V6: - Addressed Eric Blake's comments, use the enum to feedback in patch 11/17. - Fixed QAPI command separator problem in patch 11/17. Zhang Chen (16): filter-rewriter: Add TCP state machine and fix memory leak in connection_track_table colo-compare: implement the process of checkpoint colo-compare: use notifier to notify packets comparing result COLO: integrate colo compare with colo frame COLO: Add block replication into colo process COLO: Remove colo_state migration struct COLO: Load dirty pages into SVM's RAM cache firstly ram/COLO: Record the dirty pages that SVM received COLO: Flush memory data from ram cache qapi/migration.json: Rename COLO unknown mode to none mode. qapi: Add new command to query colo status savevm: split the process of different stages for loadvm/savevm net/net.c: Add net client type check function for COLO filter: Add handle_event method for NetFilterClass filter-rewriter: handle checkpoint and failover event docs: Add COLO status diagram to COLO-FT.txt zhanghailiang (4): qmp event: Add COLO_EXIT event to notify users while exited COLO COLO: flush host dirty ram from cache COLO: notify net filters about checkpoint/failover event COLO: quick failover process by kick COLO thread docs/COLO-FT.txt | 34 ++++++ include/exec/ram_addr.h | 1 + include/migration/colo.h | 11 +- include/net/filter.h | 5 + include/net/net.h | 1 + migration/Makefile.objs | 2 +- migration/colo-comm.c | 76 -------------- migration/colo-failover.c | 2 +- migration/colo.c | 212 ++++++++++++++++++++++++++++++++++++-- migration/migration.c | 44 +++++++- migration/ram.c | 166 ++++++++++++++++++++++++++++- migration/ram.h | 4 + migration/savevm.c | 53 ++++++++-- migration/savevm.h | 5 + migration/trace-events | 3 + net/colo-compare.c | 120 +++++++++++++++++++-- net/colo-compare.h | 24 +++++ net/colo.c | 10 +- net/colo.h | 11 +- net/filter-rewriter.c | 162 +++++++++++++++++++++++++++-- net/filter.c | 17 +++ net/net.c | 42 ++++++++ qapi/migration.json | 80 +++++++++++++- vl.c | 2 - 24 files changed, 948 insertions(+), 139 deletions(-) delete mode 100644 migration/colo-comm.c create mode 100644 net/colo-compare.h