From patchwork Fri Jul 24 08:43:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D93AC433E0 for ; Fri, 24 Jul 2020 08:47:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FE9620674 for ; Fri, 24 Jul 2020 08:47:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="VQ28zukb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FE9620674 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytMA-0007H8-H9 for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJ1-0001HI-Jq; Fri, 24 Jul 2020 04:43:51 -0400 Received: from mail-eopbgr60095.outbound.protection.outlook.com ([40.107.6.95]:40593 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytIz-0008Mg-IS; Fri, 24 Jul 2020 04:43:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oTCwF31iU2JfWJ8EIIdKB3/YTyB6oFkQUQ1Xexl1mC7IyXhFhy0mKjRIRVb0SC/5WpVlK1NpWXyz/OCqFaDzKECMzMrUl6DDTiEKTBhYp8MYiXLcz83tPHl0zPx+T8RBvo2a3SpFfnEYTxmVPZXdAEetRIBOtEu50LCFSAItOXGW0Fl26Ypmt2J04McUczeymDRzaLQcGRJJ6Fd1xCNdbR0IqrsYqc7I+jRbrAj8M7fVXz84OGWF1V3Pjk5Win96ZXRr5uawTGAxZQ/BvPX3Xz6g41FyUoGr7OjX/1tBLhtDQeCy6t/EfNYUnOJ8P0YTSTFja1Ob0KsQS4yaQsq5ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6stCfgXPoC2/AaFxjtKjcah3q0/msd1RvhXsnx7wrMY=; b=E+GrEOIZb/8+aN9ay121TPUsGrb+zRza0GAHxTFGwHKaUGnbLy4GAgmZ68KDYy4M6amiF2Rkwn1eaw6cFIalrONg8m5mfh8RI9MG3CNfDSmZxLZDYTyavNArKdLboKWQaL6SlS8M0LMVC+ecV6YbmSdMMfakAtc/cj0j9IgNENx9IKbtfWjFjeYKzGf6mB27p55effEL9zEVc9AvKtc+0f6Ha663ILWai1XGvJeuib5n97fO7hhxKGyu644cStvYZI+pVv7tSwFqLWEAqgsLt3SzG3ekSsNgxl3XNrF1IPPbC9AJq8X08ULj5IZir4zv5pJirAQys5WKO68flEOGGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6stCfgXPoC2/AaFxjtKjcah3q0/msd1RvhXsnx7wrMY=; b=VQ28zukb3s/juyRTcnU6URCrC/SOW2k7/yaBqEWx78v1wLkIuUuGL7WwL/iBSToX5vn26uVunpvLK1ObBEvxZOwVqnIBFnmgeCAWykXS0xLo2ZQ4JKiP+yTNjEUMrBW9zApygPh9Y/6ZJrY2S89fuDluQt9SAOsKFA59Ba7YIGo= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4849.eurprd08.prod.outlook.com (2603:10a6:20b:c3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Fri, 24 Jul 2020 08:43:43 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:43 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 01/21] qemu-iotests/199: fix style Date: Fri, 24 Jul 2020 11:43:07 +0300 Message-Id: <20200724084327.15665-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:42 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4bc61dc3-eb5f-4085-1517-08d82fadac05 X-MS-TrafficTypeDiagnostic: AM6PR08MB4849: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l5iDhJoHadUiXGhI0QCr/CUmJ9JaSX4G9XLWNoZPutceWJJtClUBOuSokBPep0JvtW8R1ZHBhLb5PItWnvuI7fHKwotHBjfum70esqmYPz2nfwEzLeGOgd73iBSri2jQ9UNbnzn7v0hQumo2cuRcdnyIjdvsLHLkJyccaIhW4r96xajTF9t3K9BMZquwqOlam2yw0/JTc/7Zm6zujTSxBxVtLDXa2JhYvNspRyogz/3JU62vuG9osZB01ZgoN8bAfQr2bBloMtoogtx9AYT9OybsSjbfUhczVjDr06VfkgP7j60+pG1lXA1rMQFGHUr0vTyjikCW6TpNI1Jy+tyghj9gT2C0GqZo4tDFLfruPaAJKtkPWKEbg8XAJ08F/ONh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39840400004)(136003)(346002)(396003)(366004)(376002)(26005)(6916009)(6512007)(478600001)(2616005)(6666004)(316002)(4326008)(186003)(6506007)(956004)(16526019)(86362001)(83380400001)(1076003)(6486002)(66946007)(36756003)(69590400007)(8936002)(107886003)(2906002)(52116002)(5660300002)(7416002)(8676002)(66556008)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: kE9HY3KiX8R8z1WMV1+hem0SPJbL3a/WJwRNgsFtjl1dP55rTrPELD2Zqr3Dyv9IIujAGL/b/Hf/iaw2fQoqmkWSR5a4U/U2n2mYC9DcNLL9YFILk8ImH43HTjJuvpRbuwYnfdcOy0lb2tx1dQUwsR2a01MtIMJy/QUnULyxQjDiBOl0dCW2kYl2vTUnhDcpG8hrZT6JI4tGghRMwIn6YAOC5Zwk5W9pwz9Au/ID1RKrNr6H8P+Ng7YOHFbO4iLS2DcgtsiRG8jEEgM9KOYikyFuLorlpU+wJxuKPOFOV7ld9OqoqwE+0NwE2065RhIrRkoEzLpZP/1EFfZCp48NVUs98Z0ouoOBojmnLLBeVpY2Y+o/I2ll8JCw2e+MxHpebVrU7nKJ/jW84j+uRlwPKYk3k5Dp0FFij+wB2tWLaGcAbl2X2B+7DKIPqZLIK+8whqX0oAfGGXm0vhSix+HZCFoOOQaaAEPLgMuubRgfqng= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bc61dc3-eb5f-4085-1517-08d82fadac05 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:43.6668 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NGFV+rTv62V4MyzeNpCgNPal+wDWtVT+OdoKlwbzsUx0EJQkPW3Vf5jKB0f8eU4s+ryHSSE6rbrLBSOeinPIfzrL2Lz0UxujsvIh+kniyvc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4849 Received-SPF: pass client-ip=40.107.6.95; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:44 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Mostly, satisfy pep8 complains. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Tested-by: Eric Blake --- tests/qemu-iotests/199 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199 index 40774eed74..de9ba8d94c 100755 --- a/tests/qemu-iotests/199 +++ b/tests/qemu-iotests/199 @@ -28,8 +28,8 @@ disk_b = os.path.join(iotests.test_dir, 'disk_b') size = '256G' fifo = os.path.join(iotests.test_dir, 'mig_fifo') -class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): +class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): def tearDown(self): self.vm_a.shutdown() self.vm_b.shutdown() @@ -54,7 +54,7 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): result = self.vm_a.qmp('block-dirty-bitmap-add', node='drive0', name='bitmap', granularity=granularity) - self.assert_qmp(result, 'return', {}); + self.assert_qmp(result, 'return', {}) s = 0 while s < write_size: @@ -71,7 +71,7 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): result = self.vm_a.qmp('block-dirty-bitmap-clear', node='drive0', name='bitmap') - self.assert_qmp(result, 'return', {}); + self.assert_qmp(result, 'return', {}) s = 0 while s < write_size: self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) @@ -104,15 +104,16 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): self.vm_b.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) s += 0x10000 - result = self.vm_b.qmp('query-block'); + result = self.vm_b.qmp('query-block') while len(result['return'][0]['dirty-bitmaps']) > 1: time.sleep(2) - result = self.vm_b.qmp('query-block'); + result = self.vm_b.qmp('query-block') result = self.vm_b.qmp('x-debug-block-dirty-bitmap-sha256', node='drive0', name='bitmap') - self.assert_qmp(result, 'return/sha256', sha256); + self.assert_qmp(result, 'return/sha256', sha256) + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'], supported_cache_modes=['none'], From patchwork Fri Jul 24 08:43:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC79EC433E0 for ; Fri, 24 Jul 2020 08:45:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAF3D20674 for ; Fri, 24 Jul 2020 08:45:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="BLs810KQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAF3D20674 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytKk-0004us-Vt for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:45:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJ3-0001NB-UA; Fri, 24 Jul 2020 04:43:53 -0400 Received: from mail-eopbgr60095.outbound.protection.outlook.com ([40.107.6.95]:40593 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJ2-0008Mg-4B; Fri, 24 Jul 2020 04:43:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YK4yTh1dn/Aol0ttF3/7FKK6DwE+m1hsGJdgFbbuqUjKkpuCMIrWxCPywjIzJKEu25Iaitf/Minq2yG4RsLk0zPv/3Afpf0HATI/WADYjjpmPA3ikHll36c7h3oz4ASAqnWsG9ixyNraYaRZrdEMVRBMI+A+59cv3ggrTgGzjq78HamDxuZFMJYhYAwwN4M7thS7uBafeWYzcu9fALRcQ/3KYgBMub9rpIqE+7GrQNYHBZYfS/IoMq34g4CEJ+1XDN2xKBvXgqqlfeQ1f603IyNtAvtGSvaeEY98qdJ7LV9ZdZFrsL0/Dn+PzeShjfz6OROHUgpk4POtDv14DJIJ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WRjEsKXCNKOMH92X12n2N4X/wygLaagQIufb/RiMPAg=; b=GrQwxXc0Se4c4y9JEQdQo2pBLQVW1e6yroh+/mjVqZ84/meA/cBMLEin/Rtm/7r2GUKZUxgjHDynT0OFtDG6rttXONRBs7720pfn7Aos9BtD9IDrmWbZUDkp3BfCHjhsS0Nq28dW+V344bYfwIyu+Ka+Bg9M2YkJfqbuYb5vb2+kvp1ThJc2oSEe5tCdqVOK4/HNmGR0fIrjN9TNPpaTAgUFUDQVfxJsKe0D9Z8elmLX8ZJkv3tlcyb86QSJPchmg5tAC9eU3TQKfHoI9UxcG72jLysp5CrZB3SgyXUcAyfdg0nrKLbiOKDyZQjK+WRtj3WidnU1wp5JYkOJR+3GLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WRjEsKXCNKOMH92X12n2N4X/wygLaagQIufb/RiMPAg=; b=BLs810KQeCbbcxmarV2hP2q33sz3AnM1MBndQyrSoBvgqoSFvVhKMSfx4QQewOpKxSo2+8+0551jE8f5xbkGWl/R9Nu3gISet/nVhjhwqTRUTrmhzXzz1S+uEvHosn1J9ZIxjgYazTSDL3KRtKgznekOdT9yblJrSjsoy4jVbOk= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4849.eurprd08.prod.outlook.com (2603:10a6:20b:c3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Fri, 24 Jul 2020 08:43:44 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:44 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 02/21] qemu-iotests/199: drop extra constraints Date: Fri, 24 Jul 2020 11:43:08 +0300 Message-Id: <20200724084327.15665-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:43 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b7e5a0f-7bd7-4e35-fa42-08d82fadac9e X-MS-TrafficTypeDiagnostic: AM6PR08MB4849: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wk4+kePn8MpJxXpxgwgteyi5IlY6Ay7E7yMkpa5RlQIo8r3heFE3PvxX/s3KcXLKtjGrQ5Jfuw+KGeSDhKfrOqTXnMPLnCgCHcF4pwiGwTHvKOv5itnIR1GkEvraD0KSHGOvja+nxhrl+6HjIXWq3sFtS+KCpjjBgpifNAmaDOGe7EEkI1EJ00Q7gy8vppwsN5pFOQ7QK0TEem3mLAWxFFKqapohZTin7P+s0kqvf3SciF4K4hrCP0MV0vuqOzZ2HUGkuXeMU+EK1qYyvBv6Kcy95U/qnUA2RHWMCwy2NhzS9/Ke7IKgSzIs2INHlkB2fSsCgLihhufbLWC+ioVEnLsto4ArELiXv1Oemyw/VaTX9qGQxPifvo93obdgc9LT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39840400004)(136003)(346002)(396003)(366004)(376002)(26005)(6916009)(6512007)(478600001)(2616005)(6666004)(316002)(4326008)(186003)(6506007)(956004)(16526019)(86362001)(83380400001)(1076003)(6486002)(66946007)(36756003)(69590400007)(4744005)(8936002)(107886003)(2906002)(52116002)(5660300002)(7416002)(8676002)(66556008)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: KtU2/eAIseMn+7J5skIu87OVQQXSCHqp0jgqcv+F01H/KaTIUYcYvIZKtGePRM9PJa5m9l8aXGcn/8L3wab8bURocuUAfY/AIT4nETS2Qjchlc052L3daV/wsNbXN4TnAFxSslg0O93huUy9n4KcZn9fOtEY/BOJTmdnpgS6GRswKfjvpRBrx4HEwoPmYossUStOc/dbQSxmoGvmgzaqcDyaMUCeT1HBxU+zRXfMzbDMuiKpI7uzmFz4AClkk9KXsHXj9vlNvonzwX5oOCX01pKeW7qv4WQBVdlw2dTd4w69kgHazBgO3pDE11r/ivL0o2cAl0kAO6/14/2d7mnJBlrCRgPj+OcTMV1jlPkDLZr4c2f8Qg4JmK3dOAHIPEfKPbEEnQIXU2PPm/CS5RCTMJM73OTnF2HWUpLN11q6jXe+LVTP7UyvsOLraYo1Cmi0CLb/DHvexq8/9SHSaaLFe2mJM2qNpaqPl7qVrR/7557tGxqtOY/sXKEKJjLVx/Kv X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b7e5a0f-7bd7-4e35-fa42-08d82fadac9e X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:44.6226 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Jhhlve2B5Ak9p0r9rQjCb/q0OmXVweq3XvRrRgVqGUDeh66f1aOupLLDJGm9iNqSzBxFdbIa2BM4lkAc+k5XqolMRry1we+qNxNgpsnQzmU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4849 Received-SPF: pass client-ip=40.107.6.95; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:44 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We don't need any specific format constraints here. Still keep qcow2 for two reasons: 1. No extra calls of format-unrelated test 2. Add some check around persistent bitmap in future (require qcow2) Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Tested-by: Eric Blake --- tests/qemu-iotests/199 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199 index de9ba8d94c..dda918450a 100755 --- a/tests/qemu-iotests/199 +++ b/tests/qemu-iotests/199 @@ -116,5 +116,4 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], supported_cache_modes=['none'], - supported_protocols=['file']) + iotests.main(supported_fmts=['qcow2']) From patchwork Fri Jul 24 08:43:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 100ADC433E1 for ; Fri, 24 Jul 2020 08:47:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BCED12068F for ; Fri, 24 Jul 2020 08:47:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="t5rdfjHJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCED12068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytMY-0008Dw-Vu for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:47:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJ7-0001Vv-50; Fri, 24 Jul 2020 04:43:57 -0400 Received: from mail-eopbgr60095.outbound.protection.outlook.com ([40.107.6.95]:40593 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJ4-0008Mg-Cw; Fri, 24 Jul 2020 04:43:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lAR7qXLRXHLT1fhBHlF6tx0G3AQCrZByk03koEQVZXN9FnZlOISPovlREVwzcUvzE/J23Ns6nyjEZNwZpGKcYEjd7A1v02q8nvvrIGGm0lDNTQgwNZYqhzcFiXIK2W0wIkq409FM4wj2g20oiKESEMZCrZ0/QEjghroNmhxvoXKDjiCJV92hDEFEY2GFKHe/pZPcUVmXps5e/qo5oSXSnV2zkvdfv7WePwDt/+l0pAQpmep4YUG1okzFukNy6ih4F0GJXPys6ppx3LUKVCi03NgXVM6zlgE0CjvQY6xZ3d6uOZH4/nRxG+3VM/W2OeWIOrHN9FZBXJ5BEfxYmWtG9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KIUczuyo7ZVpEctMGRMGsSWl8WOF68jEM2Gk2nPLJCU=; b=GEwWWf7apq1k1meUb5DvvNeEkW++RIVXu9pk5w9E0064NpwqXfgvfQnNNSlWQHJtFrgZ0BijtwMnsq955+SPzQFsweOUqXX6P3jPNm+mDzh3FM9TGI3KpnV1e2fJ9nT+PUbCZU+ca6awnfk2bKKwdruEj+cfKGTgvDr4gdG3wrS/Mso65FILT9fPvfoOo6psh5Mo7o306X7z5Jf3jTYREm2SMf2q6o2n/g+cWmsFo/Nckw1qQpeZaR+qLWE+bfZluLFZ4009PiV+bfH/sK8Pkm5QoA26A537jjduqxSvS9OpkIxOoFICkwCrfPgxkn65NOAjq+l+4knTxPj+9GXMGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KIUczuyo7ZVpEctMGRMGsSWl8WOF68jEM2Gk2nPLJCU=; b=t5rdfjHJNxgUm5BpYyvwnn62HfeZ9qjl6pXNqsDPd3gDiOi+vn2iu/CWFoPdUvHEfpmHBID01o/R8AEZ9qzQLrKIixrCI14m8oA/MPjYMXEuUOo3zfUmtYjhvuUK1HjHFju/kORhJPcjpoaO7qAAEz2KQTxeVR8KYDN+uA0wJkM= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4849.eurprd08.prod.outlook.com (2603:10a6:20b:c3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Fri, 24 Jul 2020 08:43:45 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:45 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 03/21] qemu-iotests/199: better catch postcopy time Date: Fri, 24 Jul 2020 11:43:09 +0300 Message-Id: <20200724084327.15665-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:44 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d91cfacd-c768-4a43-5d8b-08d82fadad30 X-MS-TrafficTypeDiagnostic: AM6PR08MB4849: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:175; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RhaQCukjG5OSpL5azgx1zMTxASzOjgD8w9vWRSHG0w+9v6sg3dayQFUToOIH3Hvd2JCsm4SQASL8ptv/20rPQpwdOqYB/Ao/QKN+1MQKFbNPLaImdpzqzaryRYG8cb574bEnOfwVOkzAx9eL0tg8bucoPx7qu//JCIJenmXzd6a7VeOxpnEI1SUBczGRAOTX+FZPte8iTAuwT89Cq5DagBGizcHvjkWz9zCSV+7jp57ps4WupTqVbt3D2dSe6v5GMyIIgvaWx2+9Y3TtmJ225EVzEfKDcryHEv2ec8DQO5lkbaXkq47dsfK4R2RwrjHFU02yPNqsxyh3mtfA5O1n9rwzHN9Gn8cAOuaUURNoweGLgFZ2kOcYJw6zqXSv+wmC X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39840400004)(136003)(346002)(396003)(366004)(376002)(26005)(6916009)(6512007)(478600001)(2616005)(6666004)(316002)(4326008)(186003)(6506007)(956004)(16526019)(86362001)(83380400001)(1076003)(6486002)(66946007)(36756003)(69590400007)(8936002)(107886003)(2906002)(52116002)(5660300002)(7416002)(8676002)(66556008)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: NZCsCfx5tKguTirQkPcbgcv5JTo1Tyr1eARDuSKiEwynzkNIc0GVRYpVGS4eAxM2YNfcH3zCADnv1bqfRijbN4BuqkZbE7eyN7xhrnXgIiBZp1e2O+lDTLqi0h9Unlw//hJatDKgio4HUAPNMIbBXDtZT7emmy4QNIDBAUsNaCmJPuwfmikL9NTwRYhaI2ZdWpFwSudiYTNaH04yurle3P5GZo/txtOfwwbo0abUnmaE10HH5Abz8Y2vz7uW2CefK+M7Hig5/LG6eurJnlYP8+x6DGenYG4mkCgYGR5RDep3YfISf3W5ycbcgEq6At7ltQy68ZNAWwh8swa7lfar5WQURfc6l0u8sh82MXEJUgAvLjdfZnE6AI4sCaSjoYc5eYPq00NBSb+NcHCzHyRy23X6SlBMGj6srAxlc24mbUEdBBQTT/iuWQH7GAYdw76wX1hPP1JuLAf/qCF6w/fBh5EDed44UkrH+e1XJkGPYdY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d91cfacd-c768-4a43-5d8b-08d82fadad30 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:45.5605 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QebCed8D5WSO5Kmd8WA+WLWAjXPXH7qSXhu/bmEDDKmM3/8Cj1unBsSiWPzC6dlJpsAHqoph0+zWk902b0lANt5eTwllj2v6oRzYN9u0Bes= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4849 Received-SPF: pass client-ip=40.107.6.95; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:44 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The test aims to test _postcopy_ migration, and wants to do some write operations during postcopy time. Test considers migrate status=complete event on source as start of postcopy. This is completely wrong, completion is completion of the whole migration process. Let's instead consider destination start as start of postcopy, and use RESUME event for it. Next, as migration finish, let's use migration status=complete event on target, as such method is closer to what libvirt or another user will do, than tracking number of dirty-bitmaps. Finally, add a possibility to dump events for debug. And if set debug to True, we see, that actual postcopy period is very small relatively to the whole test duration time (~0.2 seconds to >40 seconds for me). This means, that test is very inefficient in what it supposed to do. Let's improve it in following commits. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Tested-by: Eric Blake --- tests/qemu-iotests/199 | 72 +++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199 index dda918450a..dd6044768c 100755 --- a/tests/qemu-iotests/199 +++ b/tests/qemu-iotests/199 @@ -20,17 +20,43 @@ import os import iotests -import time from iotests import qemu_img +debug = False + disk_a = os.path.join(iotests.test_dir, 'disk_a') disk_b = os.path.join(iotests.test_dir, 'disk_b') size = '256G' fifo = os.path.join(iotests.test_dir, 'mig_fifo') +def event_seconds(event): + return event['timestamp']['seconds'] + \ + event['timestamp']['microseconds'] / 1000000.0 + + +def event_dist(e1, e2): + return event_seconds(e2) - event_seconds(e1) + + class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): def tearDown(self): + if debug: + self.vm_a_events += self.vm_a.get_qmp_events() + self.vm_b_events += self.vm_b.get_qmp_events() + for e in self.vm_a_events: + e['vm'] = 'SRC' + for e in self.vm_b_events: + e['vm'] = 'DST' + events = (self.vm_a_events + self.vm_b_events) + events = [(e['timestamp']['seconds'], + e['timestamp']['microseconds'], + e['vm'], + e['event'], + e.get('data', '')) for e in events] + for e in sorted(events): + print('{}.{:06} {} {} {}'.format(*e)) + self.vm_a.shutdown() self.vm_b.shutdown() os.remove(disk_a) @@ -47,6 +73,10 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): self.vm_a.launch() self.vm_b.launch() + # collect received events for debug + self.vm_a_events = [] + self.vm_b_events = [] + def test_postcopy(self): write_size = 0x40000000 granularity = 512 @@ -77,15 +107,13 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) s += 0x10000 - bitmaps_cap = {'capability': 'dirty-bitmaps', 'state': True} - events_cap = {'capability': 'events', 'state': True} + caps = [{'capability': 'dirty-bitmaps', 'state': True}, + {'capability': 'events', 'state': True}] - result = self.vm_a.qmp('migrate-set-capabilities', - capabilities=[bitmaps_cap, events_cap]) + result = self.vm_a.qmp('migrate-set-capabilities', capabilities=caps) self.assert_qmp(result, 'return', {}) - result = self.vm_b.qmp('migrate-set-capabilities', - capabilities=[bitmaps_cap]) + result = self.vm_b.qmp('migrate-set-capabilities', capabilities=caps) self.assert_qmp(result, 'return', {}) result = self.vm_a.qmp('migrate', uri='exec:cat>' + fifo) @@ -94,24 +122,38 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): result = self.vm_a.qmp('migrate-start-postcopy') self.assert_qmp(result, 'return', {}) - while True: - event = self.vm_a.event_wait('MIGRATION') - if event['data']['status'] == 'completed': - break + event_resume = self.vm_b.event_wait('RESUME') + self.vm_b_events.append(event_resume) s = 0x8000 while s < write_size: self.vm_b.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) s += 0x10000 + match = {'data': {'status': 'completed'}} + event_complete = self.vm_b.event_wait('MIGRATION', match=match) + self.vm_b_events.append(event_complete) + + # take queued event, should already been happened + event_stop = self.vm_a.event_wait('STOP') + self.vm_a_events.append(event_stop) + + downtime = event_dist(event_stop, event_resume) + postcopy_time = event_dist(event_resume, event_complete) + + # TODO: assert downtime * 10 < postcopy_time + if debug: + print('downtime:', downtime) + print('postcopy_time:', postcopy_time) + + # Assert that bitmap migration is finished (check that successor bitmap + # is removed) result = self.vm_b.qmp('query-block') - while len(result['return'][0]['dirty-bitmaps']) > 1: - time.sleep(2) - result = self.vm_b.qmp('query-block') + assert len(result['return'][0]['dirty-bitmaps']) == 1 + # Check content of migrated (and updated by new writes) bitmap result = self.vm_b.qmp('x-debug-block-dirty-bitmap-sha256', node='drive0', name='bitmap') - self.assert_qmp(result, 'return/sha256', sha256) From patchwork Fri Jul 24 08:43:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51C73C433E3 for ; Fri, 24 Jul 2020 08:44:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C0D82068F for ; Fri, 24 Jul 2020 08:44:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="U3iusLtt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C0D82068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytK6-0003Wn-Bw for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:44:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJ1-0001GD-5j; Fri, 24 Jul 2020 04:43:51 -0400 Received: from mail-am6eur05on2134.outbound.protection.outlook.com ([40.107.22.134]:63329 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytIz-0008OD-4L; Fri, 24 Jul 2020 04:43:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B4Fm4isbLKmz5K4B1JOEyWPlLc/3E6YmGhIwJ/esuLWtTUQOhUTBBB73/vyOs7J3tRKo8cfu26IXKsY8sdocqjAnU9dMHF3i8al45VpOKkiKJ3buSJmBGKryQ6lKvjPdulptIZ6vCANZAukUBOv5F1m9uTkwlk91uuRPf/Yg1y+GKZ0doDN0keaENz+JAMQVxiViX0RFjvhOcxEo+0UxNiNAfas3lp4PGujoKvVD+uRwKp/4n9ViRHn/I1D9UCcX3kMWH1ZLHaWb50dETz0eilBG/808ZpX2CPEvgWh/IT1Wt5oUYNPcOioo6NGyDQGU+MkcS9M3p3DT0C2tcoiHQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tl486APdJgMxQD8NFBHBW3Xh3Bwx2Gw0wiffDVVWwT8=; b=RrTC5+XBdwUxlVD6DyGn9n6XttYkhySMv+1mYdhUWKLa/OJ4uoi252thWEKeLsiB06n6RqmAzAGuBhjMOqVq1tTz1WgRbSeg30Y+CwF6VIsKOqyNKtB6o/pYNpB/TI6cd4/FHi8h5Tt20BM9UV1Anlh0Dy5ODAVFvBz2iHplg/dVMgeKov7GemTfIvTU2dTIpO+/ZPQtzuvnzUGZJ2rX5RANxo9yXgH0JkowirfoEBkaVpfenvpoLH1BCz8xXAQZCOT+N91QN5o7Cjr+BlJoxYDymYC0x/Rs/lHT1V7ZMHz4ES6HgxlBsA1b1nuB2NIQMT8W52Ixr7ALQqzBZJ3s0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tl486APdJgMxQD8NFBHBW3Xh3Bwx2Gw0wiffDVVWwT8=; b=U3iusLttr6UhEn4Rr8EiqQDhcvSrabZs4i8upwQLXTdTMB030WXU8cmZK5VPLr1zGkkF+ar4kEhI/0Nb2m2wqXDKXGcg6lr4ja4l5Aog0M6bFc3/RxkQNOoc+HgMUetE9mpmEY/Rl6mhRUXw3sRuBGimRvpfrTBwdQRj7xRS5EE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4534.eurprd08.prod.outlook.com (2603:10a6:20b:ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 08:43:46 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:46 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 04/21] qemu-iotests/199: improve performance: set bitmap by discard Date: Fri, 24 Jul 2020 11:43:10 +0300 Message-Id: <20200724084327.15665-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:45 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8df52518-8c7c-42c6-c737-08d82fadadbf X-MS-TrafficTypeDiagnostic: AM6PR08MB4534: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pOeFSn3NHSVwl1PNmycoblTgUopYA7BTEm9G7kZNnXSvVHjxks4tNnMqN/Mz0SGmNFXPQOZY3J4cDQ09Njc03jtwzLDnfKynyR/7WvLq2LTVKR0b+akqrA7oL1UYGeeblwmK9coBpfy248zTay7DR9ZDYlOX6vT5xr5y+e7zYTNkRZ5YZa8EWRLsU5zsE6f91+Q0T55ewTO8kyBELr6o3W6BiszgYJQWxgTNPSFr3vju/5XrLezhQBV6QkyT5heViJmvNhJrcTVdcfSMma7gNOTXvmSC3w8Og4JmNstHJr17bl7vKCSMXe2HN2p+5lLp33Fn50hGPdB80n5DnW6ENIiTxFC0fHVIcHX3ru+AKsJjT9v5aN13unes+q5LmI/M X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(396003)(136003)(39840400004)(376002)(6512007)(6916009)(66476007)(8676002)(66556008)(52116002)(66946007)(4326008)(83380400001)(6506007)(36756003)(6486002)(956004)(26005)(6666004)(2616005)(69590400007)(7416002)(186003)(5660300002)(478600001)(8936002)(2906002)(107886003)(16526019)(86362001)(316002)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 4wYz5Juu4hF7Ay0BoWDO/zcqXje+Pwf4I+uDx2spUdCLr/paRubgdBAWSd3oxiYbhISaegVg6YH5Bw6e+RifwYpYOPU2nIvZLSaFcn+of9UUWu9t4JofweeMS6+w9iLuvu6ZCJbD+PvNM+BvK1PS3Vgf/cQ5mE4zygrYyepjUHon12n9uHvqmHjdY7GZ01k/kZxo1gQia+WBH+3p8/J9PsCBM+NvcpgxcDZ1T+XnJcADWl7znqP0mVIgsvv9dyJNyxOHrBPBxXzi7lBtluVVB0H+y7WZ3qEK3dbMlaPhmWHuTpmsiKEmshvOCuiJUFkqr+Q0/h00qrvz3c0AzPKYkk2csmmcHhlhqW47hn4CBLusfEG+jAKf6aXQE0RNVxXUhwn64E+1N5fSdgjL/sTDPvjalde+vb3k32AjS993K0HvZDLuACRDCFBGf6Xzc39BLjo+NwNbfeK2pmypvHFfz7LJ/UpsvKfqvMH0d9RZx8c= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8df52518-8c7c-42c6-c737-08d82fadadbf X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:46.5093 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MGoYPI5qPfjuhv83a9l7SNQ7MRAe0gQxrssWFk1sZXIMyGLIfiP/nZCLkQ71Qf58iLMcQkmWma22fEGuy8wZ3lWDikJnBdbUdY55FbPYmyA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4534 Received-SPF: pass client-ip=40.107.22.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:47 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Discard dirties dirty-bitmap as well as write, but works faster. Let's use it instead. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Tested-by: Eric Blake --- tests/qemu-iotests/199 | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199 index dd6044768c..190e820b84 100755 --- a/tests/qemu-iotests/199 +++ b/tests/qemu-iotests/199 @@ -67,8 +67,10 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): os.mkfifo(fifo) qemu_img('create', '-f', iotests.imgfmt, disk_a, size) qemu_img('create', '-f', iotests.imgfmt, disk_b, size) - self.vm_a = iotests.VM(path_suffix='a').add_drive(disk_a) - self.vm_b = iotests.VM(path_suffix='b').add_drive(disk_b) + self.vm_a = iotests.VM(path_suffix='a').add_drive(disk_a, + 'discard=unmap') + self.vm_b = iotests.VM(path_suffix='b').add_drive(disk_b, + 'discard=unmap') self.vm_b.add_incoming("exec: cat '" + fifo + "'") self.vm_a.launch() self.vm_b.launch() @@ -78,7 +80,7 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): self.vm_b_events = [] def test_postcopy(self): - write_size = 0x40000000 + discard_size = 0x40000000 granularity = 512 chunk = 4096 @@ -86,25 +88,32 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): name='bitmap', granularity=granularity) self.assert_qmp(result, 'return', {}) + result = self.vm_a.qmp('x-debug-block-dirty-bitmap-sha256', + node='drive0', name='bitmap') + empty_sha256 = result['return']['sha256'] + s = 0 - while s < write_size: - self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) + while s < discard_size: + self.vm_a.hmp_qemu_io('drive0', 'discard %d %d' % (s, chunk)) s += 0x10000 s = 0x8000 - while s < write_size: - self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) + while s < discard_size: + self.vm_a.hmp_qemu_io('drive0', 'discard %d %d' % (s, chunk)) s += 0x10000 result = self.vm_a.qmp('x-debug-block-dirty-bitmap-sha256', node='drive0', name='bitmap') sha256 = result['return']['sha256'] + # Check, that updating the bitmap by discards works + assert sha256 != empty_sha256 + result = self.vm_a.qmp('block-dirty-bitmap-clear', node='drive0', name='bitmap') self.assert_qmp(result, 'return', {}) s = 0 - while s < write_size: - self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) + while s < discard_size: + self.vm_a.hmp_qemu_io('drive0', 'discard %d %d' % (s, chunk)) s += 0x10000 caps = [{'capability': 'dirty-bitmaps', 'state': True}, @@ -126,8 +135,8 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): self.vm_b_events.append(event_resume) s = 0x8000 - while s < write_size: - self.vm_b.hmp_qemu_io('drive0', 'write %d %d' % (s, chunk)) + while s < discard_size: + self.vm_b.hmp_qemu_io('drive0', 'discard %d %d' % (s, chunk)) s += 0x10000 match = {'data': {'status': 'completed'}} From patchwork Fri Jul 24 08:43:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74901C433E1 for ; Fri, 24 Jul 2020 08:49:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F83A2068F for ; Fri, 24 Jul 2020 08:49:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="O1Rd4Qwu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F83A2068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytO3-0002b7-Dm for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:49:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJC-0001jO-4o; Fri, 24 Jul 2020 04:44:02 -0400 Received: from mail-am6eur05on2134.outbound.protection.outlook.com ([40.107.22.134]:63329 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJ9-0008OD-PM; Fri, 24 Jul 2020 04:44:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i+yKiA8Tj1NNzBpVDAb9cgg5413fbLotP1ctt0YaRViZzg7Re1b8ZemG4XH9zV1P4VDQuwRpS4GEaWGJ9n9Jqv82Qt/YBBCyazJpfkBmiPGDv7S5dzVxZBHiH6z/cX8xhb2uXQK11cE2O6DuBN7SYaZJMCSEsYYmrR7VMivd2Ifgrzkp1zkERYG3d15zvXR9cYzZ5r+X8l162JI7y03qAz+8FpjvUzShYFabN0Vlp//wwmEQEEwIyez+s/l54TaYrgYbEhsPdUfkmXX9pp7xg6GNG3askcj00Oq3pbUgo6iXyp32jHaej50Y9yBrFDIsblwcHhaALReo7tNeri8i4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mw910HX6zmutdFxO1V4xG8fDRTG0jT6yD7Nn0Tzd7yk=; b=IEx6t+OaKSoyDJFmbpDEMCA+IbGtDanZB6Wra57flWKMqsT5lxzrQMLnau0IOo8nvJ1b9glyr5sQBNrcVh4qTubNmmN5KiMAv8KiHCOyaCzRyMGysAwIocaT0B7Ml/r1qUgm7IxMV36brhzHrQSeaFllbPAqTaDaAGsqOGbvKjDZ4mZypt4AMty0o3ALqU4Urc54jECauSEW3tDXtqaFXKeCYXh80qVLO5yxeye6CVDlezPwytYGzO/l8KFsbk/h58Dn3IR8b6Q1SB3XIB2mNnjqmPLkDEPuPHAd/IzRprcLo6ZqJ9HpPIJrhQvfveeH2TEzib4bAlnjfo5bq4heEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mw910HX6zmutdFxO1V4xG8fDRTG0jT6yD7Nn0Tzd7yk=; b=O1Rd4QwuWaY7lu86TUWdymP6H7BBaI2n/HtnLtMfnpV6C3GHf2p8vXkDL5VWXm925QTqzryRfnlTHaRRgu4KLTluiP6KVu6FkqfKRZUycdIYiW1jPU5me+OZo0uzWpqnOclSNRUYGW8wwKS2dzK40PBsN31GGryqYhsQGj7bKSU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4534.eurprd08.prod.outlook.com (2603:10a6:20b:ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 08:43:50 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:50 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 08/21] migration/block-dirty-bitmap: rename state structure types Date: Fri, 24 Jul 2020 11:43:14 +0300 Message-Id: <20200724084327.15665-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:49 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48c459e8-641f-4f8e-ecd9-08d82fadb00c X-MS-TrafficTypeDiagnostic: AM6PR08MB4534: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:213; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wuwdp8u+mEXHEgiKQr30LNMm8GOyY+8Fuxs/TWlHFxVXUy1/aka4yK4G27+7HqAvsOdHRy35u73yT7ArScm9JKMKUSKT1R8nvqP6/fETwiag0LDkpZxKCcnYoyXLNrjDgHs+899ew0cmu3YlSLOHZiP3gVnJDCEKFHL6ULXlRl+fuN5OTBRZPasVB8xJi3YPD8TP1lqP/z97bT/NSDTEKvTQBq4YjjiM9yQmZQON++TiTYC9eMyqk3/U4mvtZ9GkagQQYEPamZn4LVBSYBCOeiO3219qeaF9fVZY3TbXT1TRLCwq+5G6Y1wGg4tFTOtv3d11XOarB3Lzyy4wcWibsfXzw5b4S//GgZfP9x1LDXbxGaiwklTpbonxqer/l4b3ZcrbwyR/pQ/HLAaawaJszjFRlNNM8d/XNBD6+DPKyx4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(396003)(136003)(39840400004)(376002)(6512007)(6916009)(66476007)(8676002)(66556008)(52116002)(66946007)(4326008)(83380400001)(6506007)(36756003)(6486002)(956004)(26005)(6666004)(2616005)(69590400007)(7416002)(186003)(5660300002)(478600001)(8936002)(2906002)(107886003)(16526019)(86362001)(316002)(1076003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: CrtCbb5nXWXE0CDasnzMCHyzDctR1o9kVXL0rmlPphjszgfx5qsjU0Dw05jx6IO9HqU5z7yr4o1DbD5VpLbkKTYFkEWGll7qtq/lP/dmU3/6Vr+IZbX1KlgXF7f821xNDbkqegaylaRsag/WdtYRIagatbqa4agRs8xYjEvoonzsZQBVpan1UzbGhUrvYoy7KsdCLzF2i70PrbIZf6lzZTjSBhinMhRaTYeS6D1VP1slwVWRBRohSkIVYxE+ztEles0Km/wIwTdf4NpVX99h6BV9dAmuXFv8Ju8NccExJIn59G0kXOwgmYp0YtOY7aeKjrx0G8FC87hI5cMCa8jAN1rKgSC1EzS4XfX2EuF8bE5lxWAw6H3q9WpXGLiKHSkoyFy1FNrylRJ7MoZeXpByewEgjqIe0SqPGRm+l15ANnmF0UrtA6Dp/SqSjjB9lT3dQnMgQOlc9roz5CTnEWf7Vc8bpRn/nis6WTwc/AnXSKc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48c459e8-641f-4f8e-ecd9-08d82fadb00c X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:50.4072 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 86NCuygYdtp3WSTntIzFd49OJ88LqhZKdVhRQXp7YZDG5kkKiyBGKAHPxORjvUxoe5Vlzf5TaRq3Cwzy2LcaYGWxDKyUEKOaqvNJuU2LtZM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4534 Received-SPF: pass client-ip=40.107.22.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:47 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Rename types to be symmetrical for load/save part and shorter. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Reviewed-by: Eric Blake --- migration/block-dirty-bitmap.c | 70 ++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 0739f1259e..1d57bff4f6 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -100,23 +100,25 @@ /* 0x04 was "AUTOLOAD" flags on elder versions, no it is ignored */ #define DIRTY_BITMAP_MIG_START_FLAG_RESERVED_MASK 0xf8 -typedef struct DirtyBitmapMigBitmapState { +/* State of one bitmap during save process */ +typedef struct SaveBitmapState { /* Written during setup phase. */ BlockDriverState *bs; const char *node_name; BdrvDirtyBitmap *bitmap; uint64_t total_sectors; uint64_t sectors_per_chunk; - QSIMPLEQ_ENTRY(DirtyBitmapMigBitmapState) entry; + QSIMPLEQ_ENTRY(SaveBitmapState) entry; uint8_t flags; /* For bulk phase. */ bool bulk_completed; uint64_t cur_sector; -} DirtyBitmapMigBitmapState; +} SaveBitmapState; -typedef struct DirtyBitmapMigState { - QSIMPLEQ_HEAD(, DirtyBitmapMigBitmapState) dbms_list; +/* State of the dirty bitmap migration (DBM) during save process */ +typedef struct DBMSaveState { + QSIMPLEQ_HEAD(, SaveBitmapState) dbms_list; bool bulk_completed; bool no_bitmaps; @@ -124,23 +126,25 @@ typedef struct DirtyBitmapMigState { /* for send_bitmap_bits() */ BlockDriverState *prev_bs; BdrvDirtyBitmap *prev_bitmap; -} DirtyBitmapMigState; +} DBMSaveState; -typedef struct DirtyBitmapLoadState { +/* State of the dirty bitmap migration (DBM) during load process */ +typedef struct DBMLoadState { uint32_t flags; char node_name[256]; char bitmap_name[256]; BlockDriverState *bs; BdrvDirtyBitmap *bitmap; -} DirtyBitmapLoadState; +} DBMLoadState; -static DirtyBitmapMigState dirty_bitmap_mig_state; +static DBMSaveState dirty_bitmap_mig_state; -typedef struct DirtyBitmapLoadBitmapState { +/* State of one bitmap during load process */ +typedef struct LoadBitmapState { BlockDriverState *bs; BdrvDirtyBitmap *bitmap; bool migrated; -} DirtyBitmapLoadBitmapState; +} LoadBitmapState; static GSList *enabled_bitmaps; QemuMutex finish_lock; @@ -170,7 +174,7 @@ static void qemu_put_bitmap_flags(QEMUFile *f, uint32_t flags) qemu_put_byte(f, flags); } -static void send_bitmap_header(QEMUFile *f, DirtyBitmapMigBitmapState *dbms, +static void send_bitmap_header(QEMUFile *f, SaveBitmapState *dbms, uint32_t additional_flags) { BlockDriverState *bs = dbms->bs; @@ -199,19 +203,19 @@ static void send_bitmap_header(QEMUFile *f, DirtyBitmapMigBitmapState *dbms, } } -static void send_bitmap_start(QEMUFile *f, DirtyBitmapMigBitmapState *dbms) +static void send_bitmap_start(QEMUFile *f, SaveBitmapState *dbms) { send_bitmap_header(f, dbms, DIRTY_BITMAP_MIG_FLAG_START); qemu_put_be32(f, bdrv_dirty_bitmap_granularity(dbms->bitmap)); qemu_put_byte(f, dbms->flags); } -static void send_bitmap_complete(QEMUFile *f, DirtyBitmapMigBitmapState *dbms) +static void send_bitmap_complete(QEMUFile *f, SaveBitmapState *dbms) { send_bitmap_header(f, dbms, DIRTY_BITMAP_MIG_FLAG_COMPLETE); } -static void send_bitmap_bits(QEMUFile *f, DirtyBitmapMigBitmapState *dbms, +static void send_bitmap_bits(QEMUFile *f, SaveBitmapState *dbms, uint64_t start_sector, uint32_t nr_sectors) { /* align for buffer_is_zero() */ @@ -257,7 +261,7 @@ static void send_bitmap_bits(QEMUFile *f, DirtyBitmapMigBitmapState *dbms, /* Called with iothread lock taken. */ static void dirty_bitmap_mig_cleanup(void) { - DirtyBitmapMigBitmapState *dbms; + SaveBitmapState *dbms; while ((dbms = QSIMPLEQ_FIRST(&dirty_bitmap_mig_state.dbms_list)) != NULL) { QSIMPLEQ_REMOVE_HEAD(&dirty_bitmap_mig_state.dbms_list, entry); @@ -271,7 +275,7 @@ static void dirty_bitmap_mig_cleanup(void) static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) { BdrvDirtyBitmap *bitmap; - DirtyBitmapMigBitmapState *dbms; + SaveBitmapState *dbms; Error *local_err = NULL; FOR_EACH_DIRTY_BITMAP(bs, bitmap) { @@ -309,7 +313,7 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) bdrv_ref(bs); bdrv_dirty_bitmap_set_busy(bitmap, true); - dbms = g_new0(DirtyBitmapMigBitmapState, 1); + dbms = g_new0(SaveBitmapState, 1); dbms->bs = bs; dbms->node_name = bs_name; dbms->bitmap = bitmap; @@ -334,7 +338,7 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) static int init_dirty_bitmap_migration(void) { BlockDriverState *bs; - DirtyBitmapMigBitmapState *dbms; + SaveBitmapState *dbms; GHashTable *handled_by_blk = g_hash_table_new(NULL, NULL); BlockBackend *blk; @@ -408,7 +412,7 @@ fail: } /* Called with no lock taken. */ -static void bulk_phase_send_chunk(QEMUFile *f, DirtyBitmapMigBitmapState *dbms) +static void bulk_phase_send_chunk(QEMUFile *f, SaveBitmapState *dbms) { uint32_t nr_sectors = MIN(dbms->total_sectors - dbms->cur_sector, dbms->sectors_per_chunk); @@ -424,7 +428,7 @@ static void bulk_phase_send_chunk(QEMUFile *f, DirtyBitmapMigBitmapState *dbms) /* Called with no lock taken. */ static void bulk_phase(QEMUFile *f, bool limit) { - DirtyBitmapMigBitmapState *dbms; + SaveBitmapState *dbms; QSIMPLEQ_FOREACH(dbms, &dirty_bitmap_mig_state.dbms_list, entry) { while (!dbms->bulk_completed) { @@ -461,7 +465,7 @@ static int dirty_bitmap_save_iterate(QEMUFile *f, void *opaque) static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque) { - DirtyBitmapMigBitmapState *dbms; + SaveBitmapState *dbms; trace_dirty_bitmap_save_complete_enter(); if (!dirty_bitmap_mig_state.bulk_completed) { @@ -486,7 +490,7 @@ static void dirty_bitmap_save_pending(QEMUFile *f, void *opaque, uint64_t *res_compatible, uint64_t *res_postcopy_only) { - DirtyBitmapMigBitmapState *dbms; + SaveBitmapState *dbms; uint64_t pending = 0; qemu_mutex_lock_iothread(); @@ -507,7 +511,7 @@ static void dirty_bitmap_save_pending(QEMUFile *f, void *opaque, } /* First occurrence of this bitmap. It should be created if doesn't exist */ -static int dirty_bitmap_load_start(QEMUFile *f, DirtyBitmapLoadState *s) +static int dirty_bitmap_load_start(QEMUFile *f, DBMLoadState *s) { Error *local_err = NULL; uint32_t granularity = qemu_get_be32(f); @@ -538,7 +542,7 @@ static int dirty_bitmap_load_start(QEMUFile *f, DirtyBitmapLoadState *s) bdrv_disable_dirty_bitmap(s->bitmap); if (flags & DIRTY_BITMAP_MIG_START_FLAG_ENABLED) { - DirtyBitmapLoadBitmapState *b; + LoadBitmapState *b; bdrv_dirty_bitmap_create_successor(s->bitmap, &local_err); if (local_err) { @@ -546,7 +550,7 @@ static int dirty_bitmap_load_start(QEMUFile *f, DirtyBitmapLoadState *s) return -EINVAL; } - b = g_new(DirtyBitmapLoadBitmapState, 1); + b = g_new(LoadBitmapState, 1); b->bs = s->bs; b->bitmap = s->bitmap; b->migrated = false; @@ -563,7 +567,7 @@ void dirty_bitmap_mig_before_vm_start(void) qemu_mutex_lock(&finish_lock); for (item = enabled_bitmaps; item; item = g_slist_next(item)) { - DirtyBitmapLoadBitmapState *b = item->data; + LoadBitmapState *b = item->data; if (b->migrated) { bdrv_enable_dirty_bitmap(b->bitmap); @@ -580,7 +584,7 @@ void dirty_bitmap_mig_before_vm_start(void) qemu_mutex_unlock(&finish_lock); } -static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s) +static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) { GSList *item; trace_dirty_bitmap_load_complete(); @@ -589,7 +593,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s) qemu_mutex_lock(&finish_lock); for (item = enabled_bitmaps; item; item = g_slist_next(item)) { - DirtyBitmapLoadBitmapState *b = item->data; + LoadBitmapState *b = item->data; if (b->bitmap == s->bitmap) { b->migrated = true; @@ -621,7 +625,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s) qemu_mutex_unlock(&finish_lock); } -static int dirty_bitmap_load_bits(QEMUFile *f, DirtyBitmapLoadState *s) +static int dirty_bitmap_load_bits(QEMUFile *f, DBMLoadState *s) { uint64_t first_byte = qemu_get_be64(f) << BDRV_SECTOR_BITS; uint64_t nr_bytes = (uint64_t)qemu_get_be32(f) << BDRV_SECTOR_BITS; @@ -666,7 +670,7 @@ static int dirty_bitmap_load_bits(QEMUFile *f, DirtyBitmapLoadState *s) return 0; } -static int dirty_bitmap_load_header(QEMUFile *f, DirtyBitmapLoadState *s) +static int dirty_bitmap_load_header(QEMUFile *f, DBMLoadState *s) { Error *local_err = NULL; bool nothing; @@ -715,7 +719,7 @@ static int dirty_bitmap_load_header(QEMUFile *f, DirtyBitmapLoadState *s) static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) { - static DirtyBitmapLoadState s; + static DBMLoadState s; int ret = 0; trace_dirty_bitmap_load_enter(); @@ -753,7 +757,7 @@ static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque) { - DirtyBitmapMigBitmapState *dbms = NULL; + SaveBitmapState *dbms = NULL; if (init_dirty_bitmap_migration() < 0) { return -1; } From patchwork Fri Jul 24 08:43:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59D03C433E4 for ; Fri, 24 Jul 2020 08:49:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 230A1206EB for ; Fri, 24 Jul 2020 08:49:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="uWL8/c3L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 230A1206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytOf-0003c3-BX for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:49:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJF-0001r7-0t; Fri, 24 Jul 2020 04:44:05 -0400 Received: from mail-am6eur05on2134.outbound.protection.outlook.com ([40.107.22.134]:63329 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJC-0008OD-Iw; Fri, 24 Jul 2020 04:44:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UvDBF3bTRIXOTwDR5ka+FcJLUORW04/lsu+SpLawSPsnKMbSUlfeJHLwAH2LE8NNqVV04epWL7Sw6iSHMgRe4wUTfTpPM8IayG3bLJ9Hajq1ed5MdVdvoemRB7wLbR9qHLWXR3SZPrmSAzP0aG/H1N4UNqCPK1VqdQUnuLVf4305tWzmkPZ0heQLcLuBshx/QHAp4dAJV4YDmFVdfsy9Af3Dz5gpkZ+Pa+QIiAjeCGJ3YTQeZzHzyoM5QgYEjWe8eGhPt4wMq+EaX/9D3j4uvGgDeUdZ2i/mtcbR1RH7GUYDlLg8ThsDEH+NM304/ksBDg1k4SzQvHFf0/AJel00Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=io3tFOkKpzTbPb3JQ7N3yjrDorjhgOPeMsrQHBAWBrU=; b=V0x7uSRyoMgvlpIn6+xtkRDliyN7ziFLkPFD4LyxM4cgFmsor8zjG0oXHFtM1G4ywUcA8LBvkgzWwJjdjGeON+Jc8QpRMlAWMwRzqYDyPORHnpnlK6SdC/BbfoQ/XRViQ3W8jyQMBKmCfmtJgJ6J3MO2FV4Xv0HZdQHy++5sDho9FQB/7z1LKPoJ8yxri4SGsWNtulmFqSMnaghtLB8YimHMT8Uy8eoVcYtxj+mmlyBWAGWoUn2tEN43J05qM6DL1tv0qSeRdL3VG14ezkj65fgyVRH2rTPYEfM3ALrbAQdJ7xre+90VLSgq2clqYjhnc9YuNvIL1c/6O4hCcX9yiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=io3tFOkKpzTbPb3JQ7N3yjrDorjhgOPeMsrQHBAWBrU=; b=uWL8/c3L3FxKEcLabDVM3HO3JInBavygceu74sOKVIPWk5wjchjmzX9MGozt3NZ6PVahz4nlFYwpTbXPv2ISejb82JgoYaX8QVJ9pcUCOywiq47OonoCLlAxf6ayGe/+p5nw6M+EWyUIMMkuZKJLVGJuGBNI13Pk+DiQqq7vmCI= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4534.eurprd08.prod.outlook.com (2603:10a6:20b:ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 08:43:52 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:52 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 10/21] migration/block-dirty-bitmap: move mutex init to dirty_bitmap_mig_init Date: Fri, 24 Jul 2020 11:43:16 +0300 Message-Id: <20200724084327.15665-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:51 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23554cd1-b5ad-4c32-012a-08d82fadb130 X-MS-TrafficTypeDiagnostic: AM6PR08MB4534: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:93; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tltSaCF5SszFoMU4BazddftDTIpGqyuOJU5YaOPwIV3M28zAX4SQUYKkflaOSvezCA5gEgWohRBZaHz7y285dTo6w9LOsfXNvH2QU3VI+wDKA4yOwrHiIyxR0TfNrP7KCA5VP9cTwFpXP2MKr05Iq3iKTGc0epd+JCHuNeZsoTIZWqWNV4MgeySo6F3+3keq4aQvi5Lj8MlAYDQQhQ/3q5AlfXTAb1pA9OqpPCTuTFt7KVkNtpcqTzrMRk6UpATPgreq83REQXEKLn/q8iM0aLkKuVTElu6YwNuSS0FF0bteI2xGNbG4JBPP1PfwKibV4ZxvEJPA41sZrWCUHW9llZ7yKipgaKGM7zhR+n5HEFD7KcJZJ/pYDv7KQBPV6rvmbHDyFDMCkytd6eoSdl2qsw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(396003)(136003)(39840400004)(376002)(6512007)(6916009)(66476007)(8676002)(66556008)(52116002)(66946007)(4326008)(83380400001)(6506007)(36756003)(6486002)(956004)(26005)(6666004)(2616005)(69590400007)(7416002)(186003)(5660300002)(478600001)(8936002)(2906002)(107886003)(16526019)(86362001)(316002)(1076003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: JULAZBZ6Z2Jipjyd5Hwq4E/W2s6Iq5Omk2VvpO3XZTUmHoAXUk0iTToc39SRtOwUu1sJH3vVxHy+SBGk1EWZ2mrOy2zZsA+OvjbYNpgdYzYbIgN/COQWl8bFKQicfIl4BrAWRpGhiuM/weUQOiI7QCtjioQqWzBiVr+M3dta9yNYqvr5k9NWrRfTIeAwK4DfIrmIYaEhTmMHgSb4mIzccYOCvFW0VP+CJvXG0pYbxZCyx97WE89OJ7ICRRzJqZq4TqiKsdFBL8k5RpGKFbYr2noQaKegnn0Jh+j1KP4EwKWNvJguY1S88tw2Cyzh1jpQohN4FdoNVA4uVA6MCfAuFOzuQU/My30o0k5oApLz6zNbW8W2QMsnLPuotrGMUY6fyMoXLmbU/ikgxCbRbcHLjRYqYNlC1gOy3CZgGB5YYmI/XXfQ51uSQ7ydGYMcvQD0wGU4AhE6OR9OYCVtydZccM6i1AXh9Xr2fpaq0m3ETJk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23554cd1-b5ad-4c32-012a-08d82fadb130 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:52.2720 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p/Ob5T1FT4BIE8cAJC7jiokfiTOkGwcZ2dBzA3NUsNmFeLSy81rI60rtL+qx4DVt5FOUOi1wp4d4yniIhtea7Z4SrPdVAb6TLouj4MaPZ10= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4534 Received-SPF: pass client-ip=40.107.22.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:47 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" No reasons to keep two public init functions. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich --- migration/migration.h | 1 - migration/block-dirty-bitmap.c | 6 +----- migration/migration.c | 2 -- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index f617960522..ab20c756f5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -335,7 +335,6 @@ void migrate_send_rp_recv_bitmap(MigrationIncomingState *mis, void migrate_send_rp_resume_ack(MigrationIncomingState *mis, uint32_t value); void dirty_bitmap_mig_before_vm_start(void); -void init_dirty_bitmap_incoming_migration(void); void migrate_add_address(SocketAddress *address); int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque); diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 01a536d7d3..4b67e4f4fb 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -148,11 +148,6 @@ typedef struct LoadBitmapState { static GSList *enabled_bitmaps; QemuMutex finish_lock; -void init_dirty_bitmap_incoming_migration(void) -{ - qemu_mutex_init(&finish_lock); -} - static uint32_t qemu_get_bitmap_flags(QEMUFile *f) { uint8_t flags = qemu_get_byte(f); @@ -801,6 +796,7 @@ static SaveVMHandlers savevm_dirty_bitmap_handlers = { void dirty_bitmap_mig_init(void) { QSIMPLEQ_INIT(&dirty_bitmap_mig_state.dbms_list); + qemu_mutex_init(&finish_lock); register_savevm_live("dirty-bitmap", 0, 1, &savevm_dirty_bitmap_handlers, diff --git a/migration/migration.c b/migration/migration.c index 2ed9923227..1c61428988 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -165,8 +165,6 @@ void migration_object_init(void) qemu_sem_init(¤t_incoming->postcopy_pause_sem_dst, 0); qemu_sem_init(¤t_incoming->postcopy_pause_sem_fault, 0); - init_dirty_bitmap_incoming_migration(); - if (!migration_object_check(current_migration, &err)) { error_report_err(err); exit(1); From patchwork Fri Jul 24 08:43:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DBC1C433ED for ; Fri, 24 Jul 2020 08:52:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF8AF2074F for ; Fri, 24 Jul 2020 08:52:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Hn8Y78nq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF8AF2074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytRj-00018D-1P for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:52:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJH-0001z9-U0; Fri, 24 Jul 2020 04:44:07 -0400 Received: from mail-eopbgr80095.outbound.protection.outlook.com ([40.107.8.95]:31299 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJE-0008Pz-6m; Fri, 24 Jul 2020 04:44:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q781WiXzpJJ6VfQT7Dt3syNS1RfQWLqhZdtPWkzAmeZRv4cbCPWFnF+gyPhtYgN+8wgApwPy2T7qWQ7LTyXBx02dUeRseJpFSanjFA3Mj0gru8uOjBn+zp5yl448uzah1oD9yKFFIeFNWOasiYuex1BwzSMsz3+vNTJvDMcoNNfvXM5Z5QGub9MZXo5P6lbfukhdbE7cMFabWDWgkPMt5M9pVqtbcBMsZ4k2kFVJ8vNNugGLrABws1vPBgV0tmIbl1y7kugOZUlp/eSOFE/NHYEIoiAXPtgoHhpHdDFnWiCmfcUVp0wTZvXQwlVTOGGO5wKGoUgMtg54lPw1+KF9Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OE5BgvfVeBJvGsHaNHx3jfSfSKrbjLEvLUzGlrVt5Rc=; b=KkRkF5fh9ChLSB+ez5WS8u0030Ht9Tr/UTksmTm1KoZ8XAq+KeHRrobNvrB22tHI8CnHOpccmeWAhdNl4FYc1VncqVFdcJBAbiW3Eyv1synQTfZnLqrF9CgpmdgzickmKdiJ6eHvV6PVg3MupJlAhKa9KBBKPEsbWY1hg8OX+/PVnqc46HM7b1zko/uKjl5hXKV4/SudrcSaBSnR4xe0+XaVDpeF8clHJ5wNGKr5UOpDvXxs6B4dBlJe0LobFiirRdE4gV6zw3C569zSw1I1qbWat6FhpXW2hdLsIcthfT3L4kbTdzDEcIsKwMgpIZ2jOMhASG03QG9QJzRo34q0Qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OE5BgvfVeBJvGsHaNHx3jfSfSKrbjLEvLUzGlrVt5Rc=; b=Hn8Y78nqIT8YDU9j2fgCtaluMTVI668Zdi7x4u0wtEx3Tg3VD90DXCIt5WiJ4fhErSD1eaP8hxXZfPC6+kqZaZ1HvEWmXmdWszlKKpMFLAxdXgh3Ssf1cnMWE2EgFCrmHhjlpxJ7Py2kE/00hxPyE7TSUntGZiVnDvn8krSyrMo= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4534.eurprd08.prod.outlook.com (2603:10a6:20b:ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 08:43:53 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:53 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 11/21] migration/block-dirty-bitmap: refactor state global variables Date: Fri, 24 Jul 2020 11:43:17 +0300 Message-Id: <20200724084327.15665-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:52 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 47465cbd-b2dc-4cd2-3d91-08d82fadb1c1 X-MS-TrafficTypeDiagnostic: AM6PR08MB4534: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:24; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0ffyZF+pgF/A1IGkCv/HnWxJtOJYlUqFwhA5XGWZ6wD4HTJLkKAPA1pzHmKe1MtZ6UXtDp/lC+JfcP6vRl42pizKdXMHqDsIZKXrKOpePnwlca9Q9Z1E8q830QiDE0bA480roJg26J/oBtH41Z7Fwr4zRc1ExeCNwvVI0kVn4bSAp9M5JrMGyMrcA0q45aQyhavdMOdMeYwsQJ/XWjOvirHanWvoQGOg4fEKLKrnTs2gNsU2EzUhEdRm2DsdhbKtCPt7qk0R5xlD0ch3M9h6O9mZArnmEZ8tXNPIUeIfvu+jhZqyR+B0msK6jSqtrbD5n0E0EkmXIHvV9KwzGXTYO9FjC/fBr/AaPxoMHh3zF2cbJVW2i1XVCdVlCmEvJsh9B10u+A4O4P1OtDfxnCm0Bw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(396003)(136003)(39840400004)(376002)(6512007)(6916009)(66476007)(8676002)(66556008)(52116002)(30864003)(66946007)(4326008)(83380400001)(6506007)(36756003)(6486002)(956004)(26005)(6666004)(2616005)(69590400007)(7416002)(186003)(5660300002)(478600001)(8936002)(2906002)(107886003)(16526019)(86362001)(316002)(1076003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: GpW+s48jcba8Y9ffjYXj8pxvYcnjZu4JRsKb6OHAvFLquw62FnYswq1qZh9bq4jg4JFc+I+NsjrJ72D7nHwEpNxOlTpUHbg1bllMrwYgRD+Wv+oY3cBEl/xQtVoBjKxblfBeO2I7e4PLEyd8mvNyQIf8ypX9+bqLJqkHRy8GGnlfvwMi0KYUJNSFwGqpfK+fuEnYz7XWFtkDHEB5wDZAGWexyYlnHevwqyUZnvOyeJOr6Cg56jz7a5nOgvCDfTMKxUif2L8cisn1zW3X7Ps2vBFI8GAYBcXVeT4o5Uc2gyqYLrwhTaO7FnHAvNb6rJ8DmMrcTqd8/JylUSg9vpWrBngtpa8oaDwRge1/0Olki5h+7mLX3JJqZLQHi5o8VdLR6/euFVT1jzUEGpUFnh2/vHLmXbFEqQZfudmO7BK1KAAjVu78xJ8w7/2dwN+DWjAkz2Ul/nJi/eHRXwuaxJ4zleQhfySHwdy11hdLcUFaxSA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47465cbd-b2dc-4cd2-3d91-08d82fadb1c1 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:53.3383 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LM6wYBgr15IemQLEuajqqktGz3Zu0TeOYZ9aImRs+j8QF9DZ9OMdQ5aVnWBNyVMRh0fYrcJOHdg8ON4Fr6+uH1a02JkONI6YvbHG8778cv4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4534 Received-SPF: pass client-ip=40.107.8.95; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:59 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move all state variables into one global struct. Reduce global variable usage, utilizing opaque pointer where possible. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich --- migration/block-dirty-bitmap.c | 179 ++++++++++++++++++--------------- 1 file changed, 99 insertions(+), 80 deletions(-) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 4b67e4f4fb..9b39e7aa2b 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -128,6 +128,12 @@ typedef struct DBMSaveState { BdrvDirtyBitmap *prev_bitmap; } DBMSaveState; +typedef struct LoadBitmapState { + BlockDriverState *bs; + BdrvDirtyBitmap *bitmap; + bool migrated; +} LoadBitmapState; + /* State of the dirty bitmap migration (DBM) during load process */ typedef struct DBMLoadState { uint32_t flags; @@ -135,18 +141,17 @@ typedef struct DBMLoadState { char bitmap_name[256]; BlockDriverState *bs; BdrvDirtyBitmap *bitmap; + + GSList *enabled_bitmaps; + QemuMutex finish_lock; } DBMLoadState; -static DBMSaveState dirty_bitmap_mig_state; +typedef struct DBMState { + DBMSaveState save; + DBMLoadState load; +} DBMState; -/* State of one bitmap during load process */ -typedef struct LoadBitmapState { - BlockDriverState *bs; - BdrvDirtyBitmap *bitmap; - bool migrated; -} LoadBitmapState; -static GSList *enabled_bitmaps; -QemuMutex finish_lock; +static DBMState dbm_state; static uint32_t qemu_get_bitmap_flags(QEMUFile *f) { @@ -169,21 +174,21 @@ static void qemu_put_bitmap_flags(QEMUFile *f, uint32_t flags) qemu_put_byte(f, flags); } -static void send_bitmap_header(QEMUFile *f, SaveBitmapState *dbms, - uint32_t additional_flags) +static void send_bitmap_header(QEMUFile *f, DBMSaveState *s, + SaveBitmapState *dbms, uint32_t additional_flags) { BlockDriverState *bs = dbms->bs; BdrvDirtyBitmap *bitmap = dbms->bitmap; uint32_t flags = additional_flags; trace_send_bitmap_header_enter(); - if (bs != dirty_bitmap_mig_state.prev_bs) { - dirty_bitmap_mig_state.prev_bs = bs; + if (bs != s->prev_bs) { + s->prev_bs = bs; flags |= DIRTY_BITMAP_MIG_FLAG_DEVICE_NAME; } - if (bitmap != dirty_bitmap_mig_state.prev_bitmap) { - dirty_bitmap_mig_state.prev_bitmap = bitmap; + if (bitmap != s->prev_bitmap) { + s->prev_bitmap = bitmap; flags |= DIRTY_BITMAP_MIG_FLAG_BITMAP_NAME; } @@ -198,19 +203,22 @@ static void send_bitmap_header(QEMUFile *f, SaveBitmapState *dbms, } } -static void send_bitmap_start(QEMUFile *f, SaveBitmapState *dbms) +static void send_bitmap_start(QEMUFile *f, DBMSaveState *s, + SaveBitmapState *dbms) { - send_bitmap_header(f, dbms, DIRTY_BITMAP_MIG_FLAG_START); + send_bitmap_header(f, s, dbms, DIRTY_BITMAP_MIG_FLAG_START); qemu_put_be32(f, bdrv_dirty_bitmap_granularity(dbms->bitmap)); qemu_put_byte(f, dbms->flags); } -static void send_bitmap_complete(QEMUFile *f, SaveBitmapState *dbms) +static void send_bitmap_complete(QEMUFile *f, DBMSaveState *s, + SaveBitmapState *dbms) { - send_bitmap_header(f, dbms, DIRTY_BITMAP_MIG_FLAG_COMPLETE); + send_bitmap_header(f, s, dbms, DIRTY_BITMAP_MIG_FLAG_COMPLETE); } -static void send_bitmap_bits(QEMUFile *f, SaveBitmapState *dbms, +static void send_bitmap_bits(QEMUFile *f, DBMSaveState *s, + SaveBitmapState *dbms, uint64_t start_sector, uint32_t nr_sectors) { /* align for buffer_is_zero() */ @@ -235,7 +243,7 @@ static void send_bitmap_bits(QEMUFile *f, SaveBitmapState *dbms, trace_send_bitmap_bits(flags, start_sector, nr_sectors, buf_size); - send_bitmap_header(f, dbms, flags); + send_bitmap_header(f, s, dbms, flags); qemu_put_be64(f, start_sector); qemu_put_be32(f, nr_sectors); @@ -254,12 +262,12 @@ static void send_bitmap_bits(QEMUFile *f, SaveBitmapState *dbms, } /* Called with iothread lock taken. */ -static void dirty_bitmap_do_save_cleanup(void) +static void dirty_bitmap_do_save_cleanup(DBMSaveState *s) { SaveBitmapState *dbms; - while ((dbms = QSIMPLEQ_FIRST(&dirty_bitmap_mig_state.dbms_list)) != NULL) { - QSIMPLEQ_REMOVE_HEAD(&dirty_bitmap_mig_state.dbms_list, entry); + while ((dbms = QSIMPLEQ_FIRST(&s->dbms_list)) != NULL) { + QSIMPLEQ_REMOVE_HEAD(&s->dbms_list, entry); bdrv_dirty_bitmap_set_busy(dbms->bitmap, false); bdrv_unref(dbms->bs); g_free(dbms); @@ -267,7 +275,8 @@ static void dirty_bitmap_do_save_cleanup(void) } /* Called with iothread lock taken. */ -static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) +static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs, + const char *bs_name) { BdrvDirtyBitmap *bitmap; SaveBitmapState *dbms; @@ -322,25 +331,24 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) dbms->flags |= DIRTY_BITMAP_MIG_START_FLAG_PERSISTENT; } - QSIMPLEQ_INSERT_TAIL(&dirty_bitmap_mig_state.dbms_list, - dbms, entry); + QSIMPLEQ_INSERT_TAIL(&s->dbms_list, dbms, entry); } return 0; } /* Called with iothread lock taken. */ -static int init_dirty_bitmap_migration(void) +static int init_dirty_bitmap_migration(DBMSaveState *s) { BlockDriverState *bs; SaveBitmapState *dbms; GHashTable *handled_by_blk = g_hash_table_new(NULL, NULL); BlockBackend *blk; - dirty_bitmap_mig_state.bulk_completed = false; - dirty_bitmap_mig_state.prev_bs = NULL; - dirty_bitmap_mig_state.prev_bitmap = NULL; - dirty_bitmap_mig_state.no_bitmaps = false; + s->bulk_completed = false; + s->prev_bs = NULL; + s->prev_bitmap = NULL; + s->no_bitmaps = false; /* * Use blockdevice name for direct (or filtered) children of named block @@ -369,7 +377,7 @@ static int init_dirty_bitmap_migration(void) } if (bs && bs->drv && !bs->drv->is_filter) { - if (add_bitmaps_to_list(bs, name)) { + if (add_bitmaps_to_list(s, bs, name)) { goto fail; } g_hash_table_add(handled_by_blk, bs); @@ -381,18 +389,18 @@ static int init_dirty_bitmap_migration(void) continue; } - if (add_bitmaps_to_list(bs, bdrv_get_node_name(bs))) { + if (add_bitmaps_to_list(s, bs, bdrv_get_node_name(bs))) { goto fail; } } /* unset migration flags here, to not roll back it */ - QSIMPLEQ_FOREACH(dbms, &dirty_bitmap_mig_state.dbms_list, entry) { + QSIMPLEQ_FOREACH(dbms, &s->dbms_list, entry) { bdrv_dirty_bitmap_skip_store(dbms->bitmap, true); } - if (QSIMPLEQ_EMPTY(&dirty_bitmap_mig_state.dbms_list)) { - dirty_bitmap_mig_state.no_bitmaps = true; + if (QSIMPLEQ_EMPTY(&s->dbms_list)) { + s->no_bitmaps = true; } g_hash_table_destroy(handled_by_blk); @@ -401,18 +409,19 @@ static int init_dirty_bitmap_migration(void) fail: g_hash_table_destroy(handled_by_blk); - dirty_bitmap_do_save_cleanup(); + dirty_bitmap_do_save_cleanup(s); return -1; } /* Called with no lock taken. */ -static void bulk_phase_send_chunk(QEMUFile *f, SaveBitmapState *dbms) +static void bulk_phase_send_chunk(QEMUFile *f, DBMSaveState *s, + SaveBitmapState *dbms) { uint32_t nr_sectors = MIN(dbms->total_sectors - dbms->cur_sector, dbms->sectors_per_chunk); - send_bitmap_bits(f, dbms, dbms->cur_sector, nr_sectors); + send_bitmap_bits(f, s, dbms, dbms->cur_sector, nr_sectors); dbms->cur_sector += nr_sectors; if (dbms->cur_sector >= dbms->total_sectors) { @@ -421,61 +430,66 @@ static void bulk_phase_send_chunk(QEMUFile *f, SaveBitmapState *dbms) } /* Called with no lock taken. */ -static void bulk_phase(QEMUFile *f, bool limit) +static void bulk_phase(QEMUFile *f, DBMSaveState *s, bool limit) { SaveBitmapState *dbms; - QSIMPLEQ_FOREACH(dbms, &dirty_bitmap_mig_state.dbms_list, entry) { + QSIMPLEQ_FOREACH(dbms, &s->dbms_list, entry) { while (!dbms->bulk_completed) { - bulk_phase_send_chunk(f, dbms); + bulk_phase_send_chunk(f, s, dbms); if (limit && qemu_file_rate_limit(f)) { return; } } } - dirty_bitmap_mig_state.bulk_completed = true; + s->bulk_completed = true; } /* for SaveVMHandlers */ static void dirty_bitmap_save_cleanup(void *opaque) { - dirty_bitmap_do_save_cleanup(); + DBMSaveState *s = &((DBMState *)opaque)->save; + + dirty_bitmap_do_save_cleanup(s); } static int dirty_bitmap_save_iterate(QEMUFile *f, void *opaque) { + DBMSaveState *s = &((DBMState *)opaque)->save; + trace_dirty_bitmap_save_iterate(migration_in_postcopy()); - if (migration_in_postcopy() && !dirty_bitmap_mig_state.bulk_completed) { - bulk_phase(f, true); + if (migration_in_postcopy() && !s->bulk_completed) { + bulk_phase(f, s, true); } qemu_put_bitmap_flags(f, DIRTY_BITMAP_MIG_FLAG_EOS); - return dirty_bitmap_mig_state.bulk_completed; + return s->bulk_completed; } /* Called with iothread lock taken. */ static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque) { + DBMSaveState *s = &((DBMState *)opaque)->save; SaveBitmapState *dbms; trace_dirty_bitmap_save_complete_enter(); - if (!dirty_bitmap_mig_state.bulk_completed) { - bulk_phase(f, false); + if (!s->bulk_completed) { + bulk_phase(f, s, false); } - QSIMPLEQ_FOREACH(dbms, &dirty_bitmap_mig_state.dbms_list, entry) { - send_bitmap_complete(f, dbms); + QSIMPLEQ_FOREACH(dbms, &s->dbms_list, entry) { + send_bitmap_complete(f, s, dbms); } qemu_put_bitmap_flags(f, DIRTY_BITMAP_MIG_FLAG_EOS); trace_dirty_bitmap_save_complete_finish(); - dirty_bitmap_do_save_cleanup(); + dirty_bitmap_save_cleanup(opaque); return 0; } @@ -485,12 +499,13 @@ static void dirty_bitmap_save_pending(QEMUFile *f, void *opaque, uint64_t *res_compatible, uint64_t *res_postcopy_only) { + DBMSaveState *s = &((DBMState *)opaque)->save; SaveBitmapState *dbms; uint64_t pending = 0; qemu_mutex_lock_iothread(); - QSIMPLEQ_FOREACH(dbms, &dirty_bitmap_mig_state.dbms_list, entry) { + QSIMPLEQ_FOREACH(dbms, &s->dbms_list, entry) { uint64_t gran = bdrv_dirty_bitmap_granularity(dbms->bitmap); uint64_t sectors = dbms->bulk_completed ? 0 : dbms->total_sectors - dbms->cur_sector; @@ -549,7 +564,7 @@ static int dirty_bitmap_load_start(QEMUFile *f, DBMLoadState *s) b->bs = s->bs; b->bitmap = s->bitmap; b->migrated = false; - enabled_bitmaps = g_slist_prepend(enabled_bitmaps, b); + s->enabled_bitmaps = g_slist_prepend(s->enabled_bitmaps, b); } return 0; @@ -557,11 +572,12 @@ static int dirty_bitmap_load_start(QEMUFile *f, DBMLoadState *s) void dirty_bitmap_mig_before_vm_start(void) { + DBMLoadState *s = &dbm_state.load; GSList *item; - qemu_mutex_lock(&finish_lock); + qemu_mutex_lock(&s->finish_lock); - for (item = enabled_bitmaps; item; item = g_slist_next(item)) { + for (item = s->enabled_bitmaps; item; item = g_slist_next(item)) { LoadBitmapState *b = item->data; if (b->migrated) { @@ -573,10 +589,10 @@ void dirty_bitmap_mig_before_vm_start(void) g_free(b); } - g_slist_free(enabled_bitmaps); - enabled_bitmaps = NULL; + g_slist_free(s->enabled_bitmaps); + s->enabled_bitmaps = NULL; - qemu_mutex_unlock(&finish_lock); + qemu_mutex_unlock(&s->finish_lock); } static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) @@ -585,9 +601,9 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) trace_dirty_bitmap_load_complete(); bdrv_dirty_bitmap_deserialize_finish(s->bitmap); - qemu_mutex_lock(&finish_lock); + qemu_mutex_lock(&s->finish_lock); - for (item = enabled_bitmaps; item; item = g_slist_next(item)) { + for (item = s->enabled_bitmaps; item; item = g_slist_next(item)) { LoadBitmapState *b = item->data; if (b->bitmap == s->bitmap) { @@ -598,7 +614,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) if (bdrv_dirty_bitmap_has_successor(s->bitmap)) { bdrv_dirty_bitmap_lock(s->bitmap); - if (enabled_bitmaps == NULL) { + if (s->enabled_bitmaps == NULL) { /* in postcopy */ bdrv_reclaim_dirty_bitmap_locked(s->bitmap, &error_abort); bdrv_enable_dirty_bitmap_locked(s->bitmap); @@ -617,7 +633,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) bdrv_dirty_bitmap_unlock(s->bitmap); } - qemu_mutex_unlock(&finish_lock); + qemu_mutex_unlock(&s->finish_lock); } static int dirty_bitmap_load_bits(QEMUFile *f, DBMLoadState *s) @@ -714,7 +730,7 @@ static int dirty_bitmap_load_header(QEMUFile *f, DBMLoadState *s) static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) { - static DBMLoadState s; + DBMLoadState *s = &((DBMState *)opaque)->load; int ret = 0; trace_dirty_bitmap_load_enter(); @@ -724,17 +740,17 @@ static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) } do { - ret = dirty_bitmap_load_header(f, &s); + ret = dirty_bitmap_load_header(f, s); if (ret < 0) { return ret; } - if (s.flags & DIRTY_BITMAP_MIG_FLAG_START) { - ret = dirty_bitmap_load_start(f, &s); - } else if (s.flags & DIRTY_BITMAP_MIG_FLAG_COMPLETE) { - dirty_bitmap_load_complete(f, &s); - } else if (s.flags & DIRTY_BITMAP_MIG_FLAG_BITS) { - ret = dirty_bitmap_load_bits(f, &s); + if (s->flags & DIRTY_BITMAP_MIG_FLAG_START) { + ret = dirty_bitmap_load_start(f, s); + } else if (s->flags & DIRTY_BITMAP_MIG_FLAG_COMPLETE) { + dirty_bitmap_load_complete(f, s); + } else if (s->flags & DIRTY_BITMAP_MIG_FLAG_BITS) { + ret = dirty_bitmap_load_bits(f, s); } if (!ret) { @@ -744,7 +760,7 @@ static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) if (ret) { return ret; } - } while (!(s.flags & DIRTY_BITMAP_MIG_FLAG_EOS)); + } while (!(s->flags & DIRTY_BITMAP_MIG_FLAG_EOS)); trace_dirty_bitmap_load_success(); return 0; @@ -752,13 +768,14 @@ static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque) { + DBMSaveState *s = &((DBMState *)opaque)->save; SaveBitmapState *dbms = NULL; - if (init_dirty_bitmap_migration() < 0) { + if (init_dirty_bitmap_migration(s) < 0) { return -1; } - QSIMPLEQ_FOREACH(dbms, &dirty_bitmap_mig_state.dbms_list, entry) { - send_bitmap_start(f, dbms); + QSIMPLEQ_FOREACH(dbms, &s->dbms_list, entry) { + send_bitmap_start(f, s, dbms); } qemu_put_bitmap_flags(f, DIRTY_BITMAP_MIG_FLAG_EOS); @@ -767,7 +784,9 @@ static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque) static bool dirty_bitmap_is_active(void *opaque) { - return migrate_dirty_bitmaps() && !dirty_bitmap_mig_state.no_bitmaps; + DBMSaveState *s = &((DBMState *)opaque)->save; + + return migrate_dirty_bitmaps() && !s->no_bitmaps; } static bool dirty_bitmap_is_active_iterate(void *opaque) @@ -795,10 +814,10 @@ static SaveVMHandlers savevm_dirty_bitmap_handlers = { void dirty_bitmap_mig_init(void) { - QSIMPLEQ_INIT(&dirty_bitmap_mig_state.dbms_list); - qemu_mutex_init(&finish_lock); + QSIMPLEQ_INIT(&dbm_state.save.dbms_list); + qemu_mutex_init(&dbm_state.load.finish_lock); register_savevm_live("dirty-bitmap", 0, 1, &savevm_dirty_bitmap_handlers, - &dirty_bitmap_mig_state); + &dbm_state); } From patchwork Fri Jul 24 08:43:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94D2CC433EC for ; Fri, 24 Jul 2020 08:55:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D8B72070B for ; Fri, 24 Jul 2020 08:55:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="QrXC3rif" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D8B72070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytUg-0005NS-N3 for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:55:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJJ-00024F-R9; Fri, 24 Jul 2020 04:44:09 -0400 Received: from mail-am6eur05on2134.outbound.protection.outlook.com ([40.107.22.134]:63329 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJI-0008OD-15; Fri, 24 Jul 2020 04:44:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UPx8fCmSFj+FUTrjDC0gmjnzFlqV3hYU0xI/j3Kn/mJAsN7ck5xFCYO+Yts8OFM9arMiyiZ/JZ9+yyTh/i0dyEvjHGcV2m5Xc/Pcm4cZo/r63TwwOBUk/GtxI+CTt+cLPd4G4j0rDQ/GhKX8OzCNpn+Egb42R4gVrVVYPck33EgXkCwcqTLkxzkYJ5lT5Zz4EJmO8IT4ErvgibDu1tPnNDnv9P3gmsNqyKhvp7d/l59x4+Fmms//pLCj2oTlG02qKpsWa+BILWnMFvE2Est9S39bPd+P1RcUdE/1Ocq+nlDVG53xe83Mab8C2LPAbsVlhNnZTdOPNOSr43H7KbAd1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Phxw50qpVKCNupFSp+SUZm4+sy/Cji3YickqluvKk0o=; b=Zcl0HxwAYFPgIT1Tea18tGXVfHu9e5lqeFgPEM//RrJDr5exxG25gsMYxSP3HrAfKezxgazcLCY9w3a6+xpbqhosFc2Xrdt+x24+T0/xUcPIXpF7HjV+xcY4cfvIYqn1M691FFfZf7tf8esXyjxAIsOefS/GakyYAkLuM1XzKLQ8Zst1S36O96A+t2Rdtfk5jjy9Lc2SIqlZI6ElNnug+I7ODkI6FDmR/JEjc0zLMFmazc5eyx+meLKsSGf/tpBfgfV07w4FuuO60ckVIyZnncTW2lI2kpZyMatfnCFXvFVhqfOfMi5KSYwP0+cya9UHlWxNXLKHEYuFNU1oMq3fYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Phxw50qpVKCNupFSp+SUZm4+sy/Cji3YickqluvKk0o=; b=QrXC3rifWsQmTXruGldy8WXMOJXwzglkEiP/am76EvKAsmHvHqrgQ5AJ8ibyjVelbvwfkoufhCXJYlm1UhUGv+yguvGjGR4oDJ+4wu9v4KMcuSURUudt/3bbKER7uHlQYeR81GwNHXE13FUDXvKMU2KNTNozEyM0QRRRSKOtuFU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4534.eurprd08.prod.outlook.com (2603:10a6:20b:ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 08:43:56 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:55 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 13/21] migration/block-dirty-bitmap: simplify dirty_bitmap_load_complete Date: Fri, 24 Jul 2020 11:43:19 +0300 Message-Id: <20200724084327.15665-14-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:54 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8c024bd-2ff7-40cb-ea6d-08d82fadb2eb X-MS-TrafficTypeDiagnostic: AM6PR08MB4534: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:651; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VAEECXfsaudFW8RXiQLbORuBGpg2GZCGfAV1+TIzwdMejboc9cTYVyN7dJhhz77rAqa5DlIRMqwwsuf8uWpiEqkxczR1Kn5AvwDZRgBJV9AI+qMMMNxIBymALsSIo5J8KRq5YXQ5NdNtFlGGjPcrvQhlvN3PKvSjIqaZA7aXsjkPS+uCWy/DRYRcb5GGBvuo3j8F3TxdgwCZr5dkNErAyzRSfn5g0crNRMPr7WjDDoodlVfLI9ckVVqoe1mA2YADmJba4rL/Aao788PykBRODbZhoDxOufXohY+RPo6MbZkym03ydURK+eANmi6sq1DKM5MjnGG0ggh309iBnJAThATb2elGZQkZQtIag0jsUMzs8VnxYX55lH7cCQ38b5jSpIYU3c00oTXc1bNh2wmMLVnVGVKfFsx/G81CAkiQwps= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(396003)(136003)(39840400004)(376002)(6512007)(6916009)(66476007)(8676002)(66556008)(52116002)(66946007)(4326008)(83380400001)(6506007)(36756003)(6486002)(956004)(26005)(6666004)(2616005)(69590400007)(7416002)(186003)(5660300002)(478600001)(8936002)(2906002)(107886003)(16526019)(86362001)(316002)(1076003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: cw0OnldJ+lhhOjBxKWuuXG0uDW6DS5e21on90TyKI/nln8znqvlLnOgrfW+ohHUdpET9IczzJL0QDCn2Fp7DhBIMUO30KkSVNE7oW7w+lQctmhCZ6Tugt0rT6QpXTf6adpgRZMo92XRb1PsZh5urhURRvek5n+bQTwx7r5nIgvFuFyBPo/emXMnN2FuEvvD4JG4BxVbHYApLeKh/btS2ZELiOvt7RMUr967oGZLVH/QxBdsaeTxT5lvqZ1CN1RRt8w7vXtxmF8GJ0gjFNtLuWSmAnpjTEqS0WYs881pTWjHv0/Wi4isuZ2DQAPLO7bKVWl5cts3WcT4kS66BMD06geVCoU3uzh41riPITzT49HzYi6TrycjnbTxPB9kicgef3/C9TJ9gNc93zataAW9r8l1f5YYLfYPPTbyyqhbtmc/OvjVpyZ7jUkPz36/cjBIVHi6/WAeNrNksHaTUuuWP8P1viXZii7MLrbTBnR8zdoI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8c024bd-2ff7-40cb-ea6d-08d82fadb2eb X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:55.1753 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PH+ezineAACdw4QIpiBehXSQbSAzCcTgfeeT+q1uCPn1bceA1nPhhwiAhz9lOyfFUGE5HLJ1o6/2R7ffvIISHJmnsid0OKuXE1JcEYjqScM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4534 Received-SPF: pass client-ip=40.107.22.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:47 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" bdrv_enable_dirty_bitmap_locked() call does nothing, as if we are in postcopy, bitmap successor must be enabled, and reclaim operation will enable the bitmap. So, actually we need just call _reclaim_ in both if branches, and making differences only to add an assertion seems not really good. The logic becomes simple: on load complete we do reclaim and that's all. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich --- migration/block-dirty-bitmap.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 9194807b54..405a259296 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -603,6 +603,10 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) qemu_mutex_lock(&s->lock); + if (bdrv_dirty_bitmap_has_successor(s->bitmap)) { + bdrv_reclaim_dirty_bitmap(s->bitmap, &error_abort); + } + for (item = s->enabled_bitmaps; item; item = g_slist_next(item)) { LoadBitmapState *b = item->data; @@ -612,27 +616,6 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) } } - if (bdrv_dirty_bitmap_has_successor(s->bitmap)) { - bdrv_dirty_bitmap_lock(s->bitmap); - if (s->enabled_bitmaps == NULL) { - /* in postcopy */ - bdrv_reclaim_dirty_bitmap_locked(s->bitmap, &error_abort); - bdrv_enable_dirty_bitmap_locked(s->bitmap); - } else { - /* target not started, successor must be empty */ - int64_t count = bdrv_get_dirty_count(s->bitmap); - BdrvDirtyBitmap *ret = bdrv_reclaim_dirty_bitmap_locked(s->bitmap, - NULL); - /* bdrv_reclaim_dirty_bitmap can fail only on no successor (it - * must be) or on merge fail, but merge can't fail when second - * bitmap is empty - */ - assert(ret == s->bitmap && - count == bdrv_get_dirty_count(s->bitmap)); - } - bdrv_dirty_bitmap_unlock(s->bitmap); - } - qemu_mutex_unlock(&s->lock); } From patchwork Fri Jul 24 08:43:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77330C433DF for ; Fri, 24 Jul 2020 08:51:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40AE2206EB for ; Fri, 24 Jul 2020 08:51:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="BspSyHKP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40AE2206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytQS-0007d7-Ew for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:51:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJP-0002Hw-Kk; Fri, 24 Jul 2020 04:44:15 -0400 Received: from mail-eopbgr80095.outbound.protection.outlook.com ([40.107.8.95]:31299 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJN-0008Pz-Nw; Fri, 24 Jul 2020 04:44:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=icvG1tmNUvujPACCgSk+y4sk/PIiy8xnp+K8Y+FCPCKuipve5i50sNaiqG+eiVkEuv7Ix5rUSiwy8/8urWAfOB7oZ9OOSvtmDK8N7vl08yfMHInUwOJSKcvw2xI9QbsWH2cgBuKPjWX/QotHfU0Tc93s6E1lHv7bL39CN90gdnu1sBcRyn1TvGNmGCasq9ZnE/mGX5TZlJEsC35dgRWc8LGwoaWjUhdt6iltb1Jr5+j2TUIGjhqSel+rQF8568U7XbJPuN+DXVeeNbMPRGB5s3ls7NeL52yQVJztBrqhH95g+cktxoaUWTYWEz7I0mjQBzxnf5dhxKQLej5bpnzc6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ynjU9Knm6e8nCCTu2gLbW8zmWyoAo4WpTYKHgfHY5oY=; b=MI4GPgDhYCyajlzzYDbca1RjWpqS+UTiZzEZAwbNJLKyL0+q7uu0PPi5MHjUT+Et733kCNR4XP/xdJ8NCWCuWwUR15j7h5DCqQfDUrR7OQ0wpQy86XTTPX8WBi9wMqK8kC/Pg11xZ167Y4FYOZJNBJ2Q4+ZKO1w8YhZiK/T5CTpnCJooJt50TZeEA3KNDWpZsGow14waslZXaoqbeVXoGdCIT17B48DE39/sSD3JsBn9+sdL6m67AjBuaJQlVq/HBYO7uGfG+Zod7TuEcUIfw37FTnAAFsl1DCP5NlTHq0v6hwc2Qu/J/Y+rQ0kfcgx5QIvLiV5efcT9lxQmRWlCEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ynjU9Knm6e8nCCTu2gLbW8zmWyoAo4WpTYKHgfHY5oY=; b=BspSyHKPcUduPQFTi/ArCLLrnB6X9SEqnCdxmDiUrnbC90jIhW8jr2eP8s4TNOelN8jkW9Q5v9ldYstf/dyqMo/dUNtWfw0cLjyqqEKByzcje3AP79CWCPP0jPGiO64pPnhezauKGPJv+7kDorN3M/WD6r5YlekOQWKioGadNaA= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4534.eurprd08.prod.outlook.com (2603:10a6:20b:ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 08:43:58 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:58 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 16/21] migration/block-dirty-bitmap: cancel migration on shutdown Date: Fri, 24 Jul 2020 11:43:22 +0300 Message-Id: <20200724084327.15665-17-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:57 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1499da8b-ea96-4b2d-e9ec-08d82fadb49a X-MS-TrafficTypeDiagnostic: AM6PR08MB4534: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:227; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r0muT/Ue4toBs8z0yILfNHjbvJTBdeH1oE8T/vED4nZtSLi//siJHFNEkLQkEqtYACeYGDqGAFj3N+RKvBPgWRsc5dpmfdo4ZWEQ/y3Corb5CDn+M2i9hDNGck/WA4RNpw/BE4xtfrpm1qpTTdn7LSCsEFpCMcZztdlH9uuF/hfGrbswueLIIhBnsnko+mT1qLukDetpS/PmCnP/TmLNJw7HcjN5hhiF3Pv5DdsEvj0lLrUfVV5bWibkprPLoH3p4LLtGjiQgWKfgtxy2F+1bf8Ol0XBakz2Wh4TwdwjWyRfhLtvoqnE6ghAIFKbF/cg8z9r7AU31lTNoF+nmNj5XunXc5mxjJEJTsL+276lTe8puyWuq3OwIcLv7Tv2AqvxtKIfgxJy7zgNA+5dEzvwu26M7zxKcfSQacQLv9W+o1U= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(396003)(136003)(39840400004)(376002)(6512007)(6916009)(66476007)(8676002)(66556008)(52116002)(66946007)(4326008)(83380400001)(6506007)(36756003)(6486002)(956004)(26005)(6666004)(2616005)(69590400007)(7416002)(186003)(5660300002)(478600001)(8936002)(2906002)(107886003)(16526019)(86362001)(316002)(1076003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: JjZ4Ogr+j8rPDPJgP7Fg4EGXXL9HS7gzPPP949XNmcw5VaSBpdTvxPYN/EE6XwntiK0nqhc7IZeUpF+YuSDPNGosFEUtjODaXeLYI4jDsKDwj++2/4CSHhpvP/5UlYronx/eAws2QzEOC223eCMlRQlME9EtAXKCcNKJV7QV/iqNHnrw5D+f0/tq+wPKRzV/pWZfcA8Pko9cPZLdNabm0gZcdEmvxj6VinPoshn9u2Ll5NVeDe3UbQsXAQyvDBbD0GE3b3GAK+juS8WaUky6MAlajCkW7MLqs4m7nZQGp/OO0Y9vOeAPmKPHvHFY89moTjCm7Rx0H9lFXpF/AwhCcamMp9QbMI3vPn6HjI+L5GlMO2buqpm8w1Za30owwicfVY+qPvEtrTxAMDsKJJeHwmEy8ATaIiYrhCSq5J+bmSgFtTjaYnCGiHejT9+I/nUSLWJp8VgZUcCpCyB6MgG1INN0TmpbgsK0c2HMt318IHw= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1499da8b-ea96-4b2d-e9ec-08d82fadb49a X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:58.0048 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: thIm5lKWMs2mpUH45vfiIqCW/WjWhguJFVAQaP3dip20j2xgG97ClYvjMy3h219/ZCUhl055bXNTOQ62QCsSwV24BQPn9tyUFhulkJxpYvc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4534 Received-SPF: pass client-ip=40.107.8.95; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:59 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" If target is turned off prior to postcopy finished, target crashes because busy bitmaps are found at shutdown. Canceling incoming migration helps, as it removes all unfinished (and therefore busy) bitmaps. Similarly on source we crash in bdrv_close_all which asserts that all bdrv states are removed, because bdrv states involved into dirty bitmap migration are referenced by it. So, we need to cancel outgoing migration as well. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich --- migration/migration.h | 2 ++ migration/block-dirty-bitmap.c | 16 ++++++++++++++++ migration/migration.c | 13 +++++++++++++ 3 files changed, 31 insertions(+) diff --git a/migration/migration.h b/migration/migration.h index ab20c756f5..6c6a931d0d 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -335,6 +335,8 @@ void migrate_send_rp_recv_bitmap(MigrationIncomingState *mis, void migrate_send_rp_resume_ack(MigrationIncomingState *mis, uint32_t value); void dirty_bitmap_mig_before_vm_start(void); +void dirty_bitmap_mig_cancel_outgoing(void); +void dirty_bitmap_mig_cancel_incoming(void); void migrate_add_address(SocketAddress *address); int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque); diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index c24d4614bf..a198ec7278 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -657,6 +657,22 @@ static void cancel_incoming_locked(DBMLoadState *s) s->bitmaps = NULL; } +void dirty_bitmap_mig_cancel_outgoing(void) +{ + dirty_bitmap_do_save_cleanup(&dbm_state.save); +} + +void dirty_bitmap_mig_cancel_incoming(void) +{ + DBMLoadState *s = &dbm_state.load; + + qemu_mutex_lock(&s->lock); + + cancel_incoming_locked(s); + + qemu_mutex_unlock(&s->lock); +} + static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s) { GSList *item; diff --git a/migration/migration.c b/migration/migration.c index 1c61428988..8fe36339db 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -188,6 +188,19 @@ void migration_shutdown(void) */ migrate_fd_cancel(current_migration); object_unref(OBJECT(current_migration)); + + /* + * Cancel outgoing migration of dirty bitmaps. It should + * at least unref used block nodes. + */ + dirty_bitmap_mig_cancel_outgoing(); + + /* + * Cancel incoming migration of dirty bitmaps. Dirty bitmaps + * are non-critical data, and their loss never considered as + * something serious. + */ + dirty_bitmap_mig_cancel_incoming(); } /* For outgoing */ From patchwork Fri Jul 24 08:43:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46850C433E8 for ; Fri, 24 Jul 2020 08:51:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0EB49206EB for ; Fri, 24 Jul 2020 08:51:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="jCuUxHgU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EB49206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytQ5-0006aO-82 for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:51:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJS-0002RE-Uy; Fri, 24 Jul 2020 04:44:18 -0400 Received: from mail-eopbgr80095.outbound.protection.outlook.com ([40.107.8.95]:31299 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJQ-0008Pz-7M; Fri, 24 Jul 2020 04:44:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ESr9hIF2VZcDS46P11lyb25PlwMcOwx1CBtgBzESH+a0C+9GdvLVe5ieWynkFtUMdTppWvggTLywjhifxLiwsdgVWOl+qydFmaa8frLKg7twmySHX2w+xUq5NyAPatuxioSuZX4BXYGXzhFUjnKKQqkuw4+Yqrt9MO1zMH4I35ESdkvrnA2MYqxqB/13962AZ4XQKE61d/ygEx3RHZG4te8rheAqVcJwYlFaHa6SugLQBzYqp+I7luMXzGtGR10bstxZVXLADfdNIbyNJ7c6DOPYOF9XeTH0ifL+lha84nYg5knIVF789WsyQqk9DVv36EwGqGdZWuDCIAnoVLUnvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IQd6AHYILgWJYpyBfH8/S8KgLnM4bkE4gk3+hji5yyo=; b=lr/ijIFUJMRToH7DVZaBil+bwxzjcLO+SxBCx474su4NjuYlB4jaBgReZVItEy0vJjCM44u9IfqRCngUuyH6HiaBeZxq1V7njZy4xhxUvfIL/5ventrwG54nHci1IjBhc9t6no9VlK3GwlX2Q/bxYbR+Wx0JHaee3u0a0LNCZwGZ3Qa3kuQUhXPGkjV9r6AFs0trgzKAPOlqTKYDwaDt0klhBaR0DnpvweImNXelIjRq/NJlwZORaXATM0ZlUsmuW9GFFy3TubYDBcY7/452i2xSqW64xN6wCcZwJQOPFWm6FVEX97P4Qi3dBmaD4XqxVQ+5YtWXjDcN6nbrSC8MaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IQd6AHYILgWJYpyBfH8/S8KgLnM4bkE4gk3+hji5yyo=; b=jCuUxHgU8BCauP0uk/zCQ+ECXMb0oal8gFaxwIBuqxqeUoakRuxTZJ2TRgGP7qe2cqlucEgkNun5TfU1EukpvSqem51Pb2TJi2DLMdv+hLSqOBh1EEfRXAWEY1TdFeDyzlW0ZQ8TQBjWL9BC2c3Q+73FsjW+AZag9tWum0H6CR0= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4534.eurprd08.prod.outlook.com (2603:10a6:20b:ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 08:43:59 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:43:58 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 17/21] migration/savevm: don't worry if bitmap migration postcopy failed Date: Fri, 24 Jul 2020 11:43:23 +0300 Message-Id: <20200724084327.15665-18-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:43:58 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a70d11ea-e5eb-4bba-cea9-08d82fadb528 X-MS-TrafficTypeDiagnostic: AM6PR08MB4534: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KQl4UxVGkFB0NuPvFDx0Glk4PWSNoDsJgZQhuYBok+CyW7aVilRRUhPJaSKG8J4NKerKksHBworuWgTQ5mVzHPLJvcY+9HAkuC6RPXeJ3jEmzn2R3FOSQmc9ybir3FbrZyyJT7lDIxRAQkbATQYUEiOU6jN1YxSWqF8VMDKzcQP/tGBfUWrHmjaMh2qfUPUyx7oYLuBT5jNaKCsep2vKrxyAnToNGgTFkHoAIxyTyJ8CjLkSrpr7V5qRiMRjr7humw3eX7tVGrRWR/Qc+CLmxDNBEfqlKjWYcmilS6+czLUij3h8GSgd2uRMw0lnvhZ1aBt589X6h8yUpujzUcSyyFbcVDxaddZyH8OEgn3iETYIMkV9QQ5KvI+uS/1Hy6Xj X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(396003)(136003)(39840400004)(376002)(6512007)(6916009)(66476007)(8676002)(66556008)(52116002)(66946007)(4326008)(83380400001)(6506007)(36756003)(6486002)(956004)(26005)(6666004)(2616005)(69590400007)(7416002)(186003)(5660300002)(478600001)(8936002)(2906002)(107886003)(16526019)(86362001)(316002)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: sdCtQYY4QvabDEFmVvJMfc7WxaAFHFbxwPHn+qQAo/yPSVjpkDDA7x4AB2w8n98nbntDKrmGLJ4Yu71RDrHgAvNARMYjkulZrFDGisN3rmWx1d/ZZzvn5LowmsEucb5eLfeayz/YdrIewYzoPOcBSgGIyw0xWaSl2Z8qMYTEEw2w/g9FetdeDs4tbVNZ6tg2PvhhfJEaWgyuAYR9r5q91HBtBaW6+3SmFDqO1AxraVqtLSV+JlTue6RFM21HQSeI+V14yBVQhAHCVfMGh83PIuryWWljv42uNEoeVELwVtkcwRU6QUaMzKYcwahpX9BPKxa/McdXpCq7j53g9eEAZ5RbZfgkMGTXeGzgJQzG5wn5t9v5iENOlh8pI1Yjvw10BbHkSCZQgYNb4LxNTBDp04UeqDpk1A9uamodkZTklaTJfU57NOXAMU+tY2uI+HVDwC8SHm0MsHnT9gSeqe8SHFVSogd7k4wV2wm+i7tvSC4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a70d11ea-e5eb-4bba-cea9-08d82fadb528 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:43:58.9377 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7tcHpJtUiTsHSuHl1qo4tRMYxJcd+ieGq7yCTjI8HD9Tq6h8IuyCPl4evXM6ZcrPvy4G1cnBZNhVtJyE0pvg+Uz53ov+AjMuVji9NMYzQdc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4534 Received-SPF: pass client-ip=40.107.8.95; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:43:59 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" First, if only bitmaps postcopy enabled (not ram postcopy) postcopy_pause_incoming crashes on assertion assert(mis->to_src_file). And anyway, bitmaps postcopy is not prepared to be somehow recovered. The original idea instead is that if bitmaps postcopy failed, we just loss some bitmaps, which is not critical. So, on failure we just need to remove unfinished bitmaps and guest should continue execution on destination. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Andrey Shinkevich --- migration/savevm.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 45c9dd9d8a..a843d202b5 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1813,6 +1813,9 @@ static void *postcopy_ram_listen_thread(void *opaque) MigrationIncomingState *mis = migration_incoming_get_current(); QEMUFile *f = mis->from_src_file; int load_res; + MigrationState *migr = migrate_get_current(); + + object_ref(OBJECT(migr)); migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_POSTCOPY_ACTIVE); @@ -1839,11 +1842,24 @@ static void *postcopy_ram_listen_thread(void *opaque) trace_postcopy_ram_listen_thread_exit(); if (load_res < 0) { - error_report("%s: loadvm failed: %d", __func__, load_res); qemu_file_set_error(f, load_res); - migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_FAILED); - } else { + dirty_bitmap_mig_cancel_incoming(); + if (postcopy_state_get() == POSTCOPY_INCOMING_RUNNING && + !migrate_postcopy_ram() && migrate_dirty_bitmaps()) + { + error_report("%s: loadvm failed during postcopy: %d. All states " + "are migrated except dirty bitmaps. Some dirty " + "bitmaps may be lost, and present migrated dirty " + "bitmaps are correctly migrated and valid.", + __func__, load_res); + load_res = 0; /* prevent further exit() */ + } else { + error_report("%s: loadvm failed: %d", __func__, load_res); + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, + MIGRATION_STATUS_FAILED); + } + } + if (load_res >= 0) { /* * This looks good, but it's possible that the device loading in the * main thread hasn't finished yet, and so we might not be in 'RUN' @@ -1879,6 +1895,8 @@ static void *postcopy_ram_listen_thread(void *opaque) mis->have_listen_thread = false; postcopy_state_set(POSTCOPY_INCOMING_END); + object_unref(OBJECT(migr)); + return NULL; } @@ -2437,6 +2455,8 @@ static bool postcopy_pause_incoming(MigrationIncomingState *mis) { trace_postcopy_pause_incoming(); + assert(migrate_postcopy_ram()); + /* Clear the triggered bit to allow one recovery */ mis->postcopy_recover_triggered = false; @@ -2521,15 +2541,22 @@ out: if (ret < 0) { qemu_file_set_error(f, ret); + /* Cancel bitmaps incoming regardless of recovery */ + dirty_bitmap_mig_cancel_incoming(); + /* * If we are during an active postcopy, then we pause instead * of bail out to at least keep the VM's dirty data. Note * that POSTCOPY_INCOMING_LISTENING stage is still not enough, * during which we're still receiving device states and we * still haven't yet started the VM on destination. + * + * Only RAM postcopy supports recovery. Still, if RAM postcopy is + * enabled, canceled bitmaps postcopy will not affect RAM postcopy + * recovering. */ if (postcopy_state_get() == POSTCOPY_INCOMING_RUNNING && - postcopy_pause_incoming(mis)) { + migrate_postcopy_ram() && postcopy_pause_incoming(mis)) { /* Reset f to point to the newly created channel */ f = mis->from_src_file; goto retry; From patchwork Fri Jul 24 08:43:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 277481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2C0AC433E8 for ; Fri, 24 Jul 2020 08:54:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BDB3C206EB for ; Fri, 24 Jul 2020 08:54:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="uC/qqEBU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDB3C206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jytTV-0003nt-Vu for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 04:54:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJI-000221-Uk; Fri, 24 Jul 2020 04:44:08 -0400 Received: from mail-eopbgr60129.outbound.protection.outlook.com ([40.107.6.129]:11111 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jytJH-0008Q9-0x; Fri, 24 Jul 2020 04:44:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Za8i8gjz34G5ytIH//Rth6WwNi1ATShBerbrBsN/KYk9TDC8wPtX7TkEy64OPhzMU0MRRPQ8fyErfyctYxeZUz+JAPAnwayD7LZE9n1gpelZQhJxdldEsD5n7gA9yOdCJZ0pqmYBZWrYxh4Q9Cgr5xERr8SXILVBO1gpNRTi24iSKkRuxyjAtyYaNRIaDyFBDtzrAsc/BLaJ2owsVRg4I+hJ+209ZSEHAlgzL3YWX2LjzOZacl+C/DpCIdzrVxXtHa+zQ/mXiAxwLV492JiKsp4IkK6LZJw6Wfy5/RyZuSoVIJ8lRD9CP2+x3jMS2fAMYWmm3WfI7oGlIPIzNfTB8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y0l1ys7V+++oo7VoKW7UFu9i3c+fk3aaaz0LaHhrKRQ=; b=Hj/9BULz1nSqbZOt2dqXUDD7BTtnopYA3/tvkkZmTiG8pZD/G4VCsvUUtBN/XW1ziMz/n3mKhihgXRO0g0C4gVP67mi6+/AmrYc/3vm5nZPGxE7i8S2QySyRG967k1fVjy0Vx8hnN3F1FhHAJZKrxtH6mPIUhmwNt4SKqEvcgVIyUmyQP7Wvr3Q7Yde3veUR4lJYWT9KqR2Ilot5Ro557Imoidh8xPGRDtP7Gv5nA5Iue1MZ6vfTSXfBO5nE+qtWG7HOduulrW2RbEgKd1dYWbUWEytvd5i+Y986to325q3xkNkHz5rcW4i/o8DGJV/4LhMaMl9FDsoMTgrM7UcmOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y0l1ys7V+++oo7VoKW7UFu9i3c+fk3aaaz0LaHhrKRQ=; b=uC/qqEBU8xVN2oCXQcZdknQzUAT8suPDTUZdqrl1f2R5zm1BBCfE0OFrGzKyBqbx4F17lrv4coElCKM7I1T8ovHF5tfiP9FYZZWB69cfrhiuDDQDO+5f856KylKbhCiq5IvCDmpeiRGd4Yje6YvWSCdKSFC4LO1N7JHtEsucfIw= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4849.eurprd08.prod.outlook.com (2603:10a6:20b:c3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Fri, 24 Jul 2020 08:44:01 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%4]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 08:44:01 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 20/21] qemu-iotests/199: add early shutdown case to bitmaps postcopy Date: Fri, 24 Jul 2020 11:43:26 +0300 Message-Id: <20200724084327.15665-21-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200724084327.15665-1-vsementsov@virtuozzo.com> References: <20200724084327.15665-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.156) by AM0PR01CA0160.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 08:44:00 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.156] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d106514a-8a82-431d-b77e-08d82fadb6d8 X-MS-TrafficTypeDiagnostic: AM6PR08MB4849: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZeWzlvsZA51O5ZPnWivCsKBocbKKCZbs4vO8Ewiu/4Eqiuq5HkUq0PvXuoOLub/3RIrdnwIzE7cuUApMlhGysmNPUxn/x97B+FetGNvg6COgft6oQYgPxyALzsWsiU1M5eGYtGG0jYy9CUbozVJoRVnwIsBuyfHTB2Mek8dITCT5zdM+598r7NBJBpk2QzMwjO73mqysMGiTwei8T+mqiwMmWTzKyj++zh0FJWo1k9cto9WBDy08EQ5bqQazBdsWxJC9AJPWiykezNBI3bq7jOpNupSPyelCYgz4fZ5k8RrhvOqwKhzVyiy7m0N0a8Q0kiAFLtGyP35ONoTQ20lbfTUuHCzTD9z5MTSu9swXiyoH7hGkKRTsTHUzBgaQLWXI X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39840400004)(136003)(346002)(396003)(366004)(376002)(26005)(6916009)(6512007)(478600001)(2616005)(6666004)(316002)(4326008)(186003)(6506007)(956004)(16526019)(86362001)(83380400001)(1076003)(6486002)(66946007)(36756003)(69590400007)(8936002)(107886003)(2906002)(52116002)(5660300002)(7416002)(8676002)(66556008)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 7tqoMhfmaVvNUu/PELWq8pfkTAhMD+QuvyK/Bhme7JhKExa+GBsqDawFLtLnVE8LuriGI5HPEEuFMQ7pw8fTsH9nZIC9iuTXNqe714+shC9ss1BFXJqL4loT+Wvx+t6oczfAX3Jq2W98XW4PzzjFupxJK/jbAyqPNOdYd3bT2xATuzyB1mMk026DtsUqiLDj27gueT3ZYKYYmNbNmgE0RwHP0jTqwa2jaxiI4trSA+vvtm6BbvE1ahvIzBHgpi95Z9w9ILttf1daPGlFNMKeelH5V4KmE5f7aeVAj2OIfS16V6MJLE1t5uC0Uy9UPWNojTIpuVHSYSfiweE3h8lkF5Yqy5961WNBHTxZu/dzsOqhNnZLLGlOBiKDzOq6b4mGpGd+YLpFDx75cdughKgazLQ6ln6GG1jgJCtATUGniG1DVMWDJ63lDhG6B539bwif3NSOcSV5EezQocRF420li9+D2GVuzEQ2poGITP4WrP4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d106514a-8a82-431d-b77e-08d82fadb6d8 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 08:44:01.7683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q6KRlU01fLidi2pxnU+rx3ITsMxDWICkiAvAY0OC/47qor9SP7Cc4S2r5Oe5LuDfbKIpk7CB0VRCMYSz5gGKZDDOFmPEVK0Hgoou0Rxags0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4849 Received-SPF: pass client-ip=40.107.6.129; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/24 04:44:00 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Previous patches fixed two crashes which may occur on shutdown prior to bitmaps postcopy finished. Check that it works now. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich --- tests/qemu-iotests/199 | 24 ++++++++++++++++++++++++ tests/qemu-iotests/199.out | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199 index 5fd34f0fcd..140930b2b1 100755 --- a/tests/qemu-iotests/199 +++ b/tests/qemu-iotests/199 @@ -217,6 +217,30 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): sha = self.discards1_sha256 if i % 2 else self.all_discards_sha256 self.assert_qmp(result, 'return/sha256', sha) + def test_early_shutdown_destination(self): + self.start_postcopy() + + self.vm_b_events += self.vm_b.get_qmp_events() + self.vm_b.shutdown() + # recreate vm_b, so there is no incoming option, which prevents + # loading bitmaps from disk + self.vm_b = iotests.VM(path_suffix='b').add_drive(disk_b) + self.vm_b.launch() + check_bitmaps(self.vm_b, 0) + + # Bitmaps will be lost if we just shutdown the vm, as they are marked + # to skip storing to disk when prepared for migration. And that's + # correct, as actual data may be modified in target vm, so we play + # safe. + # Still, this mark would be taken away if we do 'cont', and bitmaps + # become persistent again. (see iotest 169 for such behavior case) + result = self.vm_a.qmp('query-status') + assert not result['return']['running'] + self.vm_a_events += self.vm_a.get_qmp_events() + self.vm_a.shutdown() + self.vm_a.launch() + check_bitmaps(self.vm_a, 0) + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2']) diff --git a/tests/qemu-iotests/199.out b/tests/qemu-iotests/199.out index ae1213e6f8..fbc63e62f8 100644 --- a/tests/qemu-iotests/199.out +++ b/tests/qemu-iotests/199.out @@ -1,5 +1,5 @@ -. +.. ---------------------------------------------------------------------- -Ran 1 tests +Ran 2 tests OK