From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150584175622119.459482413291084; Tue, 19 Sep 2017 10:22:36 -0700 (PDT) Received: from localhost ([::1]:44252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duMEF-0005lS-B0 for importer@patchew.org; Tue, 19 Sep 2017 13:22:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhF-0001Cr-4m for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhB-0006NB-6w for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33235) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhB-0006LP-0h for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:25 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164822euoutp0163fb4a5190ee5f20e78667ac97088d04~l0Tso17Tl2610726107euoutp01k; Tue, 19 Sep 2017 16:48:22 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164821eucas1p2a8d6b22b32977bda0cf74a6dd68eddb7~l0Tr5zqHI0045800458eucas1p2a; Tue, 19 Sep 2017 16:48:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 38.6F.12907.55A41C95; Tue, 19 Sep 2017 17:48:21 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164820eucas1p25f16f91aa65933fa18cdff7cb7b7444c~l0Tq-Nvb10045800458eucas1p2Z; Tue, 19 Sep 2017 16:48:20 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C2.6C.18832.45A41C95; Tue, 19 Sep 2017 17:48:20 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:20 +0100 (BST) X-AuditID: cbfec7f1-f793a6d00000326b-33-59c14a55be31 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:47:55 +0300 Message-id: <1505839684-10046-2-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7qhXgcjDaY+FbeYe/c8i0Xvtnvs FhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu m5TUnMyy1CJ9uwSujA2bVrEXzOavuHb3OVsDYxdPFyMnh4SAicSEF6tZIWwxiQv31rN1MXJx CAksZZToeH2WHcL5zCjx4/kxoAwHWEfP1gSI+DJGiZPbZ0J1dDNJHOk8zwpSxCZgILHvni3I VBEBSYnfXaeZQWqYBbYwSty59xpsnbCAv8TM5uPsIPUsAqoSRx6rgYR5Bdwl9vyYzQZxkZzE yWOTwco5BTwkbh1fC3aQhMAENonFtydAFblInL55hBnCFpZ4dXwLO4QtI9HZcZAJoqGdUaJ7 ZycrVDejxJnpf6Gq7CVO3bzKBGIzC/BJTNo2nRniTV6JjjYhiBIPiSUz5zNC2I4Sa3+eZIT4 eDajxM4LZxknMEovYGRYxSiSWlqcm55abKRXnJhbXJqXrpecn7uJERijp/8d/7iD8f0Jq0OM AhyMSjy8K2wORgqxJpYVV+YeYpTgYFYS4X3tBBTiTUmsrEotyo8vKs1JLT7EKM3BoiTOaxvV FikkkJ5YkpqdmlqQWgSTZeLglGpgXCoax7buCq8Ry+7G2RkxVUY/bO13hedd8z296eDULUa5 r2zbMjo1DtY0TTMOC5CcNktzSbDMZnUbwz9SK7eFGsWv712bnZC/J2vDPu+kWQGzvsXwZO16 YfOxMz54sbrzFI3jbF/ncX293nvz13JTrozzcpUH1iZsO33n92K+Ff+kDzfp7p+eo8RSnJFo qMVcVJwIAEcn1jLNAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4Zd0Qr4ORBp131Szm3j3PYtG77R67 xcS361ktpn2+zW5xpf0nu8WW/d/YLY737mCxuLOlj8mBw+PJtc1MHu/3XWXz6NuyijGAOYrL JiU1J7MstUjfLoErY8OmVewFs/krrt19ztbA2MXTxcjBISFgItGzNaGLkRPIFJO4cG89Wxcj F4eQwBJGiScr/rODJIQEepkkWhZmg9SzCRhI7LtnCxIWEZCU+N11mhmknllgC6PExuMrGUES wgK+EoenvGcBqWcRUJU48lgNJMwr4C6x58dsNohdchInj01mBbE5BTwkbh1fC7XKXeLG2utM Exh5FzAyrGIUSS0tzk3PLTbUK07MLS7NS9dLzs/dxAgMo23Hfm7ewXhpY/AhRgEORiUe3hU2 ByOFWBPLiitzDzFKcDArifC+dgIK8aYkVlalFuXHF5XmpBYfYpTmYFES5+3dszpSSCA9sSQ1 OzW1ILUIJsvEwSnVwMhwatn1DOHzfBcfO2bu1r7xOdC98lnZWa69R9d9kX1W+vRvTz2b+2z5 U9oHZ520f92WG5Ie+UrJ1v0R26t97BOrZskw1c7ubNWZFmP76cLZZcXHE3K233mYvGlN1u3t TlutT/4TYz1/R/TqrU05U/1+ONy/3L1Idc1vW76fJa/fK+xLZzl55QWvEktxRqKhFnNRcSIA 2K2mjB8CAAA= X-CMS-MailID: 20170919164820eucas1p25f16f91aa65933fa18cdff7cb7b7444c X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164820eucas1p25f16f91aa65933fa18cdff7cb7b7444c X-RootMTR: 20170919164820eucas1p25f16f91aa65933fa18cdff7cb7b7444c References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH v10 01/10] userfault: update kernel header for UFFD_FEATURE_* X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This commit adds modification for UFFD_FEATURE_SIGBUS and UFFD_FEATURE_THREAD_ID. Signed-off-by: Alexey Perevalov --- linux-headers/linux/userfaultfd.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/linux-headers/linux/userfaultfd.h b/linux-headers/linux/userfa= ultfd.h index 9701772..b43cf0d 100644 --- a/linux-headers/linux/userfaultfd.h +++ b/linux-headers/linux/userfaultfd.h @@ -23,7 +23,9 @@ UFFD_FEATURE_EVENT_REMOVE | \ UFFD_FEATURE_EVENT_UNMAP | \ UFFD_FEATURE_MISSING_HUGETLBFS | \ - UFFD_FEATURE_MISSING_SHMEM) + UFFD_FEATURE_MISSING_SHMEM | \ + UFFD_FEATURE_SIGBUS | \ + UFFD_FEATURE_THREAD_ID) #define UFFD_API_IOCTLS \ ((__u64)1 << _UFFDIO_REGISTER | \ (__u64)1 << _UFFDIO_UNREGISTER | \ @@ -78,6 +80,9 @@ struct uffd_msg { struct { __u64 flags; __u64 address; + union { + __u32 ptid; + } feat; } pagefault; =20 struct { @@ -153,6 +158,13 @@ struct uffdio_api { * UFFD_FEATURE_MISSING_SHMEM works the same as * UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem * (i.e. tmpfs and other shmem based APIs). + * + * UFFD_FEATURE_SIGBUS feature means no page-fault + * (UFFD_EVENT_PAGEFAULT) event will be delivered, instead + * a SIGBUS signal will be sent to the faulting process. + * + * UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will + * be returned, if feature is not requested 0 will be returned. */ #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0) #define UFFD_FEATURE_EVENT_FORK (1<<1) @@ -161,6 +173,8 @@ struct uffdio_api { #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) #define UFFD_FEATURE_MISSING_SHMEM (1<<5) #define UFFD_FEATURE_EVENT_UNMAP (1<<6) +#define UFFD_FEATURE_SIGBUS (1<<7) +#define UFFD_FEATURE_THREAD_ID (1<<8) __u64 features; =20 __u64 ioctls; --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505841931573105.99670278288067; Tue, 19 Sep 2017 10:25:31 -0700 (PDT) Received: from localhost ([::1]:44265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duMH4-0008Fz-D0 for importer@patchew.org; Tue, 19 Sep 2017 13:25:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhF-0001Cm-25 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhB-0006OF-VH for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33237) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhB-0006MD-LH for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:25 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164823euoutp0147d9ea48105c9e60861d707272282543~l0TtRZlHv2660026600euoutp01M; Tue, 19 Sep 2017 16:48:23 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170919164822eucas1p1b56ea80125ae6452b068b0088db125aa~l0TsZThuB3070230702eucas1p14; Tue, 19 Sep 2017 16:48:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id BF.1F.12867.55A41C95; Tue, 19 Sep 2017 17:48:21 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453~l0Trv-qjn0223102231eucas1p2a; Tue, 19 Sep 2017 16:48:21 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 73.6C.18832.55A41C95; Tue, 19 Sep 2017 17:48:21 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:21 +0100 (BST) X-AuditID: cbfec7f2-f793b6d000003243-f6-59c14a5544a0 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:47:56 +0300 Message-id: <1505839684-10046-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7qhXgcjDVb/MLeYe/c8i0Xvtnvs FhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu m5TUnMyy1CJ9uwSujEktM9kLWuQrns7+z97AeFOii5GTQ0LARGLrtJlsELaYxIV764FsLg4h gaWMEj0f77FCOJ8ZJSZO62HqYuQA61hzwB0ivoxR4tSc/YwQTjeTRPPSX2BFbAIGEvvu2YJM FRGQlPjddZoZpIZZYAujxJ17r1lBEsICyRKv2jezgtSzCKhKzN7kCxLmFXCXePl4KzPERXIS J49NBivnFPCQuHV8LTvIHAmBCWwSx64tYYIocpE4uvYp1AvCEq+Ob2GHsGUkOjsOMkE0tDNK dO/sZIXqZpQ4M/0vVJW9xKmbV8EmMQvwSUzaNp0Z4k1eiY42IYgSD4lXq4+wQtiOErvXzoP6 eDajxOWNT1kmMEovYGRYxSiSWlqcm55abKxXnJhbXJqXrpecn7uJERijp/8d/7SD8esJq0OM AhyMSjy8K2wORgqxJpYVV+YeYpTgYFYS4X3tBBTiTUmsrEotyo8vKs1JLT7EKM3BoiTOaxvV FikkkJ5YkpqdmlqQWgSTZeLglGpgLKrI27/zyoNYjZJPPvPKtc5nr8jabF7cfC1y78/YLcdu 35KYyRHxMCnXXG9NLxN3os8eDq0dT1tcHGbMY5v/kHdpxzu1/cfkG0UltzMrZEzjmDP5R+iU pg7G6oU7tCzmfVnJn/fYu0YxJbpSujLLYYfq+gk3FvcuE27SKT5hI2l/ds+3Y3mSSizFGYmG WsxFxYkAJEFgOM0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Zd1Qr4ORBnPuSFvMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXxqSWmewFLfIVT2f/Z29gvCnRxcjBISFgIrHmgHsXIyeQKSZx4d56ti5G Lg4hgSWMElu3P2CHcHqZJI4dPsMO0sAmYCCx754tSIOIgKTE767TzCA1zAJbGCU2Hl/JCJIQ FkiWeNW+mRWknkVAVWL2Jl+QMK+Au8TLx1uZIZbJSZw8NpkVxOYU8JC4dXwtO4gtBFRzY+11 pgmMvAsYGVYxiqSWFuem5xYb6hUn5haX5qXrJefnbmIEBtK2Yz8372C8tDH4EKMAB6MSD+8K m4ORQqyJZcWVuYcYJTiYlUR4XzsBhXhTEiurUovy44tKc1KLDzFKc7AoifP27lkdKSSQnliS mp2aWpBaBJNl4uCUamCs2PzmW/f7/1+02p+8e3DvZMtU8ZbFLCHyjAteHfz45Ki9eliVCbvb XK/5l03sg38aLBZy+sIsf69s76+Od7+sNp6qvZoT3871NCA3VaJJW2D92XXMm/WObO5wzJX9 kzBVq3a3yc2r5qvOH/Cd+OVFcHj3jpMyr1Z9m+BybbrFn+zOX+eNo2SvK7EUZyQaajEXFScC AH2TKRwgAgAA X-CMS-MailID: 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453 X-RootMTR: 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453 References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH v10 02/10] migration: pass MigrationIncomingState* into migration check functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" That tiny refactoring is necessary to be able to set UFFD_FEATURE_THREAD_ID while requesting features, and then to create downtime context in case when kernel supports it. Signed-off-by: Alexey Perevalov Reviewed-by: Juan Quintela --- migration/migration.c | 3 ++- migration/postcopy-ram.c | 10 +++++----- migration/postcopy-ram.h | 2 +- migration/savevm.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 959e8ec..e820d47 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -603,6 +603,7 @@ static bool migrate_caps_check(bool *cap_list, { MigrationCapabilityStatusList *cap; bool old_postcopy_cap; + MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 old_postcopy_cap =3D cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]; =20 @@ -636,7 +637,7 @@ static bool migrate_caps_check(bool *cap_list, * special support. */ if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host()) { + !postcopy_ram_supported_by_host(mis)) { /* postcopy_ram_supported_by_host will have emitted a more * detailed message */ diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 7a414eb..4350dd0 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -61,7 +61,7 @@ struct PostcopyDiscardState { #include #include =20 -static bool ufd_version_check(int ufd) +static bool ufd_version_check(int ufd, MigrationIncomingState *mis) { struct uffdio_api api_struct; uint64_t ioctl_mask; @@ -124,7 +124,7 @@ static int test_ramblock_postcopiable(const char *block= _name, void *host_addr, * normally fine since if the postcopy succeeds it gets turned back on at = the * end. */ -bool postcopy_ram_supported_by_host(void) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { long pagesize =3D getpagesize(); int ufd =3D -1; @@ -147,7 +147,7 @@ bool postcopy_ram_supported_by_host(void) } =20 /* Version and features check */ - if (!ufd_version_check(ufd)) { + if (!ufd_version_check(ufd, mis)) { goto out; } =20 @@ -523,7 +523,7 @@ int postcopy_ram_enable_notify(MigrationIncomingState *= mis) * Although the host check already tested the API, we need to * do the check again as an ABI handshake on the new fd. */ - if (!ufd_version_check(mis->userfault_fd)) { + if (!ufd_version_check(mis->userfault_fd, mis)) { return -1; } =20 @@ -677,7 +677,7 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis) =20 #else /* No target OS support, stubs just fail */ -bool postcopy_ram_supported_by_host(void) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { error_report("%s: No OS support", __func__); return false; diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 78a3591..77ea0fd 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -14,7 +14,7 @@ #define QEMU_POSTCOPY_RAM_H =20 /* Return true if the host supports everything we need to do postcopy-ram = */ -bool postcopy_ram_supported_by_host(void); +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis); =20 /* * Make all of RAM sensitive to accesses to areas that haven't yet been wr= itten diff --git a/migration/savevm.c b/migration/savevm.c index 7a55023..6ed6d57 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1352,7 +1352,7 @@ static int loadvm_postcopy_handle_advise(MigrationInc= omingState *mis) return -1; } =20 - if (!postcopy_ram_supported_by_host()) { + if (!postcopy_ram_supported_by_host(mis)) { postcopy_state_set(POSTCOPY_INCOMING_NONE); return -1; } --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505841565743320.0676118970898; Tue, 19 Sep 2017 10:19:25 -0700 (PDT) Received: from localhost ([::1]:44237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duMBA-0003MR-U6 for importer@patchew.org; Tue, 19 Sep 2017 13:19:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhE-0001CY-RB for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhB-0006OK-Vt for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:28 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:46472) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhB-0006Ma-PY for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:25 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164823euoutp02801a3dc47eabd0fae71851e5dfbc190a~l0TtyBt1M2806628066euoutp021; Tue, 19 Sep 2017 16:48:23 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170919164822eucas1p14708956579ec0674f7f4eb201386239e~l0TtHpjLc3069830698eucas1p1A; Tue, 19 Sep 2017 16:48:22 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id C8.6F.12907.65A41C95; Tue, 19 Sep 2017 17:48:22 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164822eucas1p2e2b1f9bbf32fdb171a8db1e6d75941ef~l0TsZa9892073720737eucas1p2g; Tue, 19 Sep 2017 16:48:22 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 34.6C.20118.65A41C95; Tue, 19 Sep 2017 17:48:22 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:22 +0100 (BST) X-AuditID: cbfec7f1-f793a6d00000326b-35-59c14a56f855 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:47:57 +0300 Message-id: <1505839684-10046-4-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRmVeSWpSXmKPExsWy7djP87phXgcjDVa2alvMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXRnNfJ3PBebaK5+cvszYwLmftYuTkkBAwkZi8fxI7hC0mceHeerYuRi4O IYGljBKnFm5nA0kICXxmlNj3zgem4enJ+1BFyxglLk1fxQzhdDNJTD27namLkYODTcBAYt89 W5AGEQFJid9dp8FqmAW2MErcufeaFaRGWCBYYtJMBZAaFgFVidbD31hAwrwC7hKdE6shdslJ nDw2GexQTgEPiVvH17KDjJEQ6GGT+HVhE9QHLhJ9nzuZIGxhiVfHt0B9IyNxeXI3C0RDO6NE 985OVghnAqPEmel/oarsJU7dvArWzSzAJzFp23RmkCskBHglOtqEIEo8JF7/v8IGYTtKbDsy iQni4dmMEp/mrGKcwCi9gJFhFaNIamlxbnpqsZFecWJucWleul5yfu4mRmCEnv53/OMOxvcn rA4xCnAwKvHwrrA5GCnEmlhWXJl7iFGCg1lJhPe1E1CINyWxsiq1KD++qDQntfgQozQHi5I4 r21UW6SQQHpiSWp2ampBahFMlomDU6qBUWzqk1MNkUc268gXTm1dXXNN/KNgl++pb+dPhdaq bdNPWTzHmfH6db6ga29cptevXJOXpjdlQcKplNyaDYE1sy7l/zkab2jromV2zaWI8dNLw79M uf7enUuiJ8zyS/v/Jj7/Lv+2V9Z/kytlFzNc+7lZ6+aV+GmzDMsNTuZ9b36aV+zGezMzToml OCPRUIu5qDgRAI6fE2LMAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Zd0wr4ORBpdOclrMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXRnNfJ3PBebaK5+cvszYwLmftYuTkkBAwkXh68j4bhC0mceHeeiCbi0NI YAmjxN4Fj9ghnF4miYtbXjF2MXJwsAkYSOy7ZwvSICIgKfG76zQzSA2zwBZGiY3HV4LVCAsE S0yaqQBSwyKgKtF6+BsLSJhXwF2ic2I1xC45iZPHJoPdwCngIXHr+Fp2EFsIqOTG2utMExh5 FzAyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/dxAgMpG3Hfm7Zwdj1LvgQowAHoxIP7wqbg5FC rIllxZW5hxglOJiVRHhfOwGFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8/buWR0pJJCeWJKanZpa kFoEk2Xi4JRqYEx3S3V6usjOcMG7PY2fJx81bry0+dHiRb/2tCVueH5uq71p15Ejp7tKGBNV st80brrj6bqASUCbJXV+s7aDmNvFz89nSrjff8qoaWNxO2xh3CGJ96dLH/F6fitY6i/ouuxD e/XVb/N3bVN027jd7VHKw/3RH2Vi6u6dmX4vvIvFSeDFlox1lXuUWIozEg21mIuKEwGMr2hE IAIAAA== X-CMS-MailID: 20170919164822eucas1p2e2b1f9bbf32fdb171a8db1e6d75941ef X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164822eucas1p2e2b1f9bbf32fdb171a8db1e6d75941ef X-RootMTR: 20170919164822eucas1p2e2b1f9bbf32fdb171a8db1e6d75941ef References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH v10 03/10] migration: fix hardcoded function name in error report X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 4350dd0..a0e74db 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -69,7 +69,7 @@ static bool ufd_version_check(int ufd, MigrationIncomingS= tate *mis) api_struct.api =3D UFFD_API; api_struct.features =3D 0; if (ioctl(ufd, UFFDIO_API, &api_struct)) { - error_report("postcopy_ram_supported_by_host: UFFDIO_API failed: %= s", + error_report("%s: UFFDIO_API failed: %s", __func__, strerror(errno)); return false; } --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505841380075671.8130818276145; Tue, 19 Sep 2017 10:16:20 -0700 (PDT) Received: from localhost ([::1]:44224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duM8B-0000aR-5H for importer@patchew.org; Tue, 19 Sep 2017 13:16:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhE-0001CZ-R8 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhC-0006OX-3j for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:28 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:46474) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhB-0006NA-QG for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:26 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164824euoutp02e559e21c19e8b6f0a95a8702a463959a~l0Tua0SdX2834328343euoutp02U; Tue, 19 Sep 2017 16:48:24 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164823eucas1p2690fe1cf6ec5099f7a79750731b33b7d~l0TtxLeXi0226002260eucas1p2b; Tue, 19 Sep 2017 16:48:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 59.6F.12907.75A41C95; Tue, 19 Sep 2017 17:48:23 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164822eucas1p27957a05191b242b4982f62fab15a4539~l0TtD-o1w2115421154eucas1p2i; Tue, 19 Sep 2017 16:48:22 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 44.6C.18832.65A41C95; Tue, 19 Sep 2017 17:48:22 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:22 +0100 (BST) X-AuditID: cbfec7f1-f793a6d00000326b-37-59c14a5720c5 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:47:58 +0300 Message-id: <1505839684-10046-5-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djP87rhXgcjDQ7NlLCYe/c8i0Xvtnvs FhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu m5TUnMyy1CJ9uwSujDXtZ1gLJmpUbJn9h62BsUmui5GTQ0LARGJB81NmCFtM4sK99WxdjFwc QgJLGSV2H/zGCuF8ZpR48P8jC0zHm+/TmCESyxgl+hfMZYFwupkkpp7dztTFyMHBJmAgse+e LUiDiICkxO+u02ANzAJbGCXu3HvNCpIQFkiSmNXVDmazCKhK3PowHewOXgF3iXMdN6FukpM4 eWwyWA2ngIfEreNr2UEGSQj0sEmc7/sNdZKLxOTLR9ghbGGJV8e3QNkyEp0dB5kgGtoZJbp3 drJCOBMYJc5M/wtVZS9x6uZVJhCbWYBPYtI2kDM4gOK8Eh1tQhAlHhJPTtxlgQg7Svz96w/x 8WxGiQ1zjjBPYJRewMiwilEktbQ4Nz212EivODG3uDQvXS85P3cTIzBKT/87/nEH4/sTVocY BTgYlXh4V9gcjBRiTSwrrsw9xCjBwawkwvvaCSjEm5JYWZValB9fVJqTWnyIUZqDRUmc1zaq LVJIID2xJDU7NbUgtQgmy8TBKdXAeIhFuyhr095Yw59dT0UXLzn7o37NLg5FkRuSF+WcKs7u up0hr9ISIvW9U3Erd+pP9q3Pn9zsX7o28SzvurCdgT1Gq32qj/Lq2ZW2zD6S57CsIXozm/5P 9zkdm9+ImTyJEe7+17bhfMSLWk8eCZatNovN3jmFetpO+74kqWzyM45Ks7Pv/zOfUWIpzkg0 1GIuKk4EANV2NdrOAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Zd0wr4ORBisfmljMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXxpr2M6wFEzUqtsz+w9bA2CTXxcjJISFgIvHm+zRmCFtM4sK99WxdjFwc QgJLGCUufv/JAuH0Mklc3PKKsYuRg4NNwEBi3z1bkAYRAUmJ312nmUFqmAW2MEpsPL6SESQh LJAkMaurnRXEZhFQlbj1YTrYBl4Bd4lzHTehtslJnDw2GayGU8BD4tbxtewgthBQzY2115km MPIuYGRYxSiSWlqcm55bbKhXnJhbXJqXrpecn7uJERhM24793LyD8dLG4EOMAhyMSjy8K2wO RgqxJpYVV+YeYpTgYFYS4X3tBBTiTUmsrEotyo8vKs1JLT7EKM3BoiTO27tndaSQQHpiSWp2 ampBahFMlomDU6qBkXfmU3Xvp/mnv8kXMetOdQ5OyahznnbhpGJAUdb8Nwnp5jM/5LxZyLZd xzSa5923a3mmcis9hKya1x07et1X3MWa+5jjyisHnGd4LOKvf3xr8t21h9fnC0ZM9kpUdLj9 MKbKzj9wos05rykHjosc8t65LPj80e/pVz1WT2GY12o6o3FtE9PhnUosxRmJhlrMRcWJABRy wHkiAgAA X-CMS-MailID: 20170919164822eucas1p27957a05191b242b4982f62fab15a4539 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164822eucas1p27957a05191b242b4982f62fab15a4539 X-RootMTR: 20170919164822eucas1p27957a05191b242b4982f62fab15a4539 References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH v10 04/10] migration: split ufd_version_check onto receive/request features part X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This modification is necessary for userfault fd features which are required to be requested from userspace. UFFD_FEATURE_THREAD_ID is a one of such "on demand" feature, which will be introduced in the next patch. QEMU have to use separate userfault file descriptor, due to userfault context has internal state, and after first call of ioctl UFFD_API it changes its state to UFFD_STATE_RUNNING (in case of success), but kernel while handling ioctl UFFD_API expects UFFD_STATE_WAIT_= API. So only one ioctl with UFFD_API is possible per ufd. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 94 ++++++++++++++++++++++++++++++++++++++++++++= ---- 1 file changed, 88 insertions(+), 6 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index a0e74db..bec6c2c 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -61,16 +61,67 @@ struct PostcopyDiscardState { #include #include =20 -static bool ufd_version_check(int ufd, MigrationIncomingState *mis) + +/** + * receive_ufd_features: check userfault fd features, to request only supp= orted + * features in the future. + * + * Returns: true on success + * + * __NR_userfaultfd - should be checked before + * @features: out parameter will contain uffdio_api.features provided by = kernel + * in case of success + */ +static bool receive_ufd_features(uint64_t *features) { - struct uffdio_api api_struct; - uint64_t ioctl_mask; + struct uffdio_api api_struct =3D {0}; + int ufd; + bool ret =3D true; + + /* if we are here __NR_userfaultfd should exists */ + ufd =3D syscall(__NR_userfaultfd, O_CLOEXEC); + if (ufd =3D=3D -1) { + error_report("%s: syscall __NR_userfaultfd failed: %s", __func__, + strerror(errno)); + return false; + } =20 + /* ask features */ api_struct.api =3D UFFD_API; api_struct.features =3D 0; if (ioctl(ufd, UFFDIO_API, &api_struct)) { error_report("%s: UFFDIO_API failed: %s", __func__, strerror(errno)); + ret =3D false; + goto release_ufd; + } + + *features =3D api_struct.features; + +release_ufd: + close(ufd); + return ret; +} + +/** + * request_ufd_features: this function should be called only once on a new= ly + * opened ufd, subsequent calls will lead to error. + * + * Returns: true on succes + * + * @ufd: fd obtained from userfaultfd syscall + * @features: bit mask see UFFD_API_FEATURES + */ +static bool request_ufd_features(int ufd, uint64_t features) +{ + struct uffdio_api api_struct =3D {0}; + uint64_t ioctl_mask; + + api_struct.api =3D UFFD_API; + api_struct.features =3D features; + if (ioctl(ufd, UFFDIO_API, &api_struct)) { + error_report("%s failed: UFFDIO_API failed: %s", __func__, + strerror(errno)); return false; } =20 @@ -82,11 +133,42 @@ static bool ufd_version_check(int ufd, MigrationIncomi= ngState *mis) return false; } =20 + return true; +} + +static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) +{ + uint64_t asked_features =3D 0; + static uint64_t supported_features; + + /* + * it's not possible to + * request UFFD_API twice per one fd + * userfault fd features is persistent + */ + if (!supported_features) { + if (!receive_ufd_features(&supported_features)) { + error_report("%s failed", __func__); + return false; + } + } + + /* + * request features, even if asked_features is 0, due to + * kernel expects UFFD_API before UFFDIO_REGISTER, per + * userfault file descriptor + */ + if (!request_ufd_features(ufd, asked_features)) { + error_report("%s failed: features %" PRIu64, __func__, + asked_features); + return false; + } + if (getpagesize() !=3D ram_pagesize_summary()) { bool have_hp =3D false; /* We've got a huge page */ #ifdef UFFD_FEATURE_MISSING_HUGETLBFS - have_hp =3D api_struct.features & UFFD_FEATURE_MISSING_HUGETLBFS; + have_hp =3D supported_features & UFFD_FEATURE_MISSING_HUGETLBFS; #endif if (!have_hp) { error_report("Userfault on this host does not support huge pag= es"); @@ -147,7 +229,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingSt= ate *mis) } =20 /* Version and features check */ - if (!ufd_version_check(ufd, mis)) { + if (!ufd_check_and_apply(ufd, mis)) { goto out; } =20 @@ -523,7 +605,7 @@ int postcopy_ram_enable_notify(MigrationIncomingState *= mis) * Although the host check already tested the API, we need to * do the check again as an ABI handshake on the new fd. */ - if (!ufd_version_check(mis->userfault_fd, mis)) { + if (!ufd_check_and_apply(mis->userfault_fd, mis)) { return -1; } =20 --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505842096730614.4964571832182; Tue, 19 Sep 2017 10:28:16 -0700 (PDT) Received: from localhost ([::1]:44277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duMJj-0002Nz-QL for importer@patchew.org; Tue, 19 Sep 2017 13:28:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhF-0001Cn-2o for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhC-0006PK-OE for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33240) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhC-0006OB-Ib for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:26 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164825euoutp01cb2cf7ff64dd10f39ef79cec48618176~l0TvIQkjG2660026600euoutp01N; Tue, 19 Sep 2017 16:48:25 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164824eucas1p2881fe8443e29433df8a40ba940630cf0~l0TuYl52X0223102231eucas1p2g; Tue, 19 Sep 2017 16:48:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 60.2F.12867.75A41C95; Tue, 19 Sep 2017 17:48:23 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164823eucas1p25540d608fc48a5e0ebd2f170416aec45~l0TttndmK2115421154eucas1p2j; Tue, 19 Sep 2017 16:48:23 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F4.6C.18832.75A41C95; Tue, 19 Sep 2017 17:48:23 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:23 +0100 (BST) X-AuditID: cbfec7f2-f793b6d000003243-fa-59c14a5738cf From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:47:59 +0300 Message-id: <1505839684-10046-6-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djP87rhXgcjDa622VjMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXxu3Ju1gK2oQq5uxoZmpgfMTXxcjJISFgInFz8i1mCFtM4sK99WwgtpDA UkaJKVc0uxi5gOzPjBIPPi9ihGm4ePMjG0RiGaPEp1MPmSGcbiaJDZc6mboYOTjYBAwk9t2z BWkQEZCU+N11GqyGWWALo8Sde69ZQRLCAv4Sy5r3sYPUswioSsxfxApi8gq4S7TsFIfYJSdx 8thksGpOAQ+JW8fXskPEe9gk/h8xASmXEHCR+NdrDxEWlnh1fAtUiYxEZ8dBJpCtEgLtjBLd OztZIZwJjBJnpv+FqrKXOHXzKhOIzSzAJzFp23RmiKG8Eh1tQhAlHhLn75xggbAdJXbtW8AE 8e5sRonvF9YxT2CUXsDIsIpRJLW0ODc9tdhYrzgxt7g0L10vOT93EyMwOk//O/5pB+PXE1aH GAU4GJV4eFfYHIwUYk0sK67MPcQowcGsJML72gkoxJuSWFmVWpQfX1Sak1p8iFGag0VJnNc2 qi1SSCA9sSQ1OzW1ILUIJsvEwSnVwDjHaU6G2MXp3PFnpku27zxX2rK18k2rplKbdXmt2smk X/4uq7jFru+SnLTm+q9A1+w9oTYM/N++rN/7ym1//o+2ipUFSRNFxF8YLTLMMtQ9xe572NR5 lh23iCH/j90P6pT+FHPO0zme+jLMvHrhSp7IA5urlJYoBfV9DnMWueFw7NSLLRJV7UosxRmJ hlrMRcWJABjqDAvKAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Zd1wr4ORBpe3KVnMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXxu3Ju1gK2oQq5uxoZmpgfMTXxcjJISFgInHx5kc2CFtM4sK99UA2F4eQ wBJGic5npxkhnF4miZNPjrN2MXJwsAkYSOy7ZwvSICIgKfG76zQzSA2zwBZGiY3HVzKCJIQF fCWuTbrDAlLPIqAqMX8RWCuvgLtEy05xiF1yEiePTWYFsTkFPCRuHV/LDmILAZXcWHudaQIj 7wJGhlWMIqmlxbnpucWGesWJucWleel6yfm5mxiBgbTt2M/NOxgvbQw+xCjAwajEw7vC5mCk EGtiWXFl7iFGCQ5mJRHe105AId6UxMqq1KL8+KLSnNTiQ4zSHCxK4ry9e1ZHCgmkJ5akZqem FqQWwWSZODilGhhj2fxdxK9IlXd+fif68+j7zONT9c7Mjo9dLhfX38Sxw/O7fGryS6Wz3Upc E02XvPadauEZx7x5fdCl50cEvP7x751bpuO22ZGhY93LRZMlZPLuvzfSVulYmeS8as0UjpW1 Sx2/Zf5pP7Hk8Ik3ps/TeKTLOO5/V9hbd0XmVOK3MNM/zROZrLOVWIozEg21mIuKEwG7R5uR IAIAAA== X-CMS-MailID: 20170919164823eucas1p25540d608fc48a5e0ebd2f170416aec45 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164823eucas1p25540d608fc48a5e0ebd2f170416aec45 X-RootMTR: 20170919164823eucas1p25540d608fc48a5e0ebd2f170416aec45 References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH v10 05/10] migration: introduce postcopy-blocktime capability X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Right now it could be used on destination side to enable vCPU blocktime calculation for postcopy live migration. vCPU blocktime - it's time since vCPU thread was put into interruptible sleep, till memory page was copied and thread awake. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- migration/migration.c | 9 +++++++++ migration/migration.h | 1 + qapi/migration.json | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index e820d47..4f029e8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1380,6 +1380,15 @@ bool migrate_zero_blocks(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } =20 +bool migrate_postcopy_blocktime(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME= ]; +} + bool migrate_use_compression(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 148c9fa..56bf33c 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -184,6 +184,7 @@ int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_decompress_threads(void); bool migrate_use_events(void); +bool migrate_postcopy_blocktime(void); =20 /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, diff --git a/qapi/migration.json b/qapi/migration.json index ee2b3b8..2e4a15d 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -341,12 +341,15 @@ # @return-path: If enabled, migration will use the return path even # for precopy. (since 2.10) # +# @postcopy-blocktime: Calculate downtime for postcopy live migration +# (since 2.11) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', - 'block', 'return-path' ] } + 'block', 'return-path', 'postcopy-blocktime' ] } =20 ## # @MigrationCapabilityStatus: --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505841352681845.9684320098122; Tue, 19 Sep 2017 10:15:52 -0700 (PDT) Received: from localhost ([::1]:44222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duM7j-0000B1-Hm for importer@patchew.org; Tue, 19 Sep 2017 13:15:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhG-0001Ds-FC for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhD-0006QB-L8 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:30 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:46476) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhD-0006PF-BT for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:27 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164825euoutp0227ebde261a43cdc8881214fbb3da047e~l0Tv1Q-p82806628066euoutp022; Tue, 19 Sep 2017 16:48:25 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170919164825eucas1p17b36f8a15970098cab98a7d030e63f9f~l0TvFfD1I2430324303eucas1p1A; Tue, 19 Sep 2017 16:48:25 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id FE.9B.12743.85A41C95; Tue, 19 Sep 2017 17:48:24 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f~l0TuXb3Pc2115421154eucas1p2l; Tue, 19 Sep 2017 16:48:24 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A5.6C.18832.85A41C95; Tue, 19 Sep 2017 17:48:24 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:24 +0100 (BST) X-AuditID: cbfec7f5-f79d06d0000031c7-bf-59c14a582a73 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:48:00 +0300 Message-id: <1505839684-10046-7-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djP87oRXgcjDZ5PNrSYe/c8i0Xvtnvs FhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu m5TUnMyy1CJ9uwSujDXX+1kLmjUqvs2Ra2BsVuhi5OSQEDCROPnrGyuELSZx4d56ti5GLg4h gaWMEpun/WCEcD4zSuzo384G03F21wpmiMQyRom9018xgiSEBLqZJFa9jeli5OBgEzCQ2HfP FiQsIiAp8bvrNFg9s8AWRok7916zgtQIC8RJ9OxlB6lhEVCVeLL5A9gVvALuEnvf72SE2CUn cfLYZLA4p4CHxK3ja9kh4j1sEms22IKMkRBwkWh/YggRFpZ4dXwLVImMRGfHQSaQtRIC7YwS 3Ts7WSGcCYwSZ6b/haqylzh18yoTiM0swCcxadt0ZoihvBIdbUIQJR4S1zo/QN3jKLH+zAdo oMxmlOh7tZd9AqP0AkaGVYwiqaXFuempxaZ6xYm5xaV56XrJ+bmbGIHRefrf8a87GJceszrE KMDBqMTDu8LmYKQQa2JZcWXuIUYJDmYlEd7XTkAh3pTEyqrUovz4otKc1OJDjNIcLErivLZR bZFCAumJJanZqakFqUUwWSYOTqkGRsk/3T0/FIsYdRvLdtpvKTX8NmXR/bcnFfzFg2Wm8mjf 4S/oldXadt7//5rpDmGJrzduPHHp7NrwNXttdRoPZi8V2Jr6zO3Q26eNjLMaV7xmOHsrrCBq q/0a7oSaTfN0z5irMCz2+17HNmnx7SNPS85sjJme5DrjPYt1kN+hvYIf7vH7/5miZKnEUpyR aKjFXFScCAC4M6lWygIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Zd0Ir4ORBn8nCFjMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXxprr/awFzRoV3+bINTA2K3QxcnJICJhInN21ghnCFpO4cG89WxcjF4eQ wBJGifkPnzNCOL1MEo+OrmfvYuTgYBMwkNh3zxakQURAUuJ312lmkBpmgS2MEhuPr2QEqREW iJPo2csOUsMioCrxZPMHVhCbV8BdYu/7nYwQy+QkTh6bDBbnFPCQuHV8LVi9EFDNjbXXmSYw 8i5gZFjFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGEjbjv3cvIPx0sbgQ4wCHIxKPLwrbA5G CrEmlhVX5h5ilOBgVhLhfe0EFOJNSaysSi3Kjy8qzUktPsQozcGiJM7bu2d1pJBAemJJanZq akFqEUyWiYNTqoFRWdvBIDj5maKNB8O9D9PUqy0iMk7eeW3Y/z79Yv0mq4gtv7w6zxpNeMe2 VeOwQWrajFfeCyucXV+5HA7c+zvfZRNLodXt75JSK6RWnRfd/32jgNt8SS7ne26/VnvsO/ds 7mtRt69mwsIcapcnhzI9V30cdUrJ9bTmFH8P76Uv9bz+KK08dDRZiaU4I9FQi7moOBEAnSV6 WiACAAA= X-CMS-MailID: 20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f X-RootMTR: 20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH v10 06/10] migration: add postcopy blocktime ctx into MigrationIncomingState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch adds request to kernel space for UFFD_FEATURE_THREAD_ID, in case when this feature is provided by kernel. PostcopyBlocktimeContext is incapsulated inside postcopy-ram.c, due to it's postcopy only feature. Also it defines PostcopyBlocktimeContext's instance live time. Information from PostcopyBlocktimeContext instance will be provided much after postcopy migration end, instance of PostcopyBlocktimeContext will live till QEMU exit, but part of it (vcpu_addr, page_fault_vcpu_time) used only during calculation, will be released when postcopy ended or failed. To enable postcopy blocktime calculation on destination, need to request proper capabiltiy (Patch for documentation will be at the tail of the patch set). As an example following command enable that capability, assume QEMU was started with -chardev socket,id=3Dcharmonitor,path=3D/var/lib/migrate-vm-monitor.sock option to control it [root@host]#printf "{\"execute\" : \"qmp_capabilities\"}\r\n \ {\"execute\": \"migrate-set-capabilities\" , \"arguments\": { \"capabilities\": [ { \"capability\": \"postcopy-blocktime\", \"state\": true } ] } }" | nc -U /var/lib/migrate-vm-monitor.sock Or just with HMP (qemu) migrate_set_capability postcopy-blocktime on Signed-off-by: Alexey Perevalov --- migration/migration.h | 8 ++++++ migration/postcopy-ram.c | 65 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 73 insertions(+) diff --git a/migration/migration.h b/migration/migration.h index 56bf33c..770466b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -21,6 +21,8 @@ #include "qemu/coroutine_int.h" #include "hw/qdev.h" =20 +struct PostcopyBlocktimeContext; + /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -58,6 +60,12 @@ struct MigrationIncomingState { /* The coroutine we should enter (back) after failover */ Coroutine *migration_incoming_co; QemuSemaphore colo_incoming_sem; + + /* + * PostcopyBlocktimeContext to keep information for postcopy + * live migration, to calculate vCPU block time + * */ + struct PostcopyBlocktimeContext *blocktime_ctx; }; =20 MigrationIncomingState *migration_incoming_get_current(void); diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index bec6c2c..cc78981 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -61,6 +61,58 @@ struct PostcopyDiscardState { #include #include =20 +typedef struct PostcopyBlocktimeContext { + /* time when page fault initiated per vCPU */ + int64_t *page_fault_vcpu_time; + /* page address per vCPU */ + uint64_t *vcpu_addr; + int64_t total_blocktime; + /* blocktime per vCPU */ + int64_t *vcpu_blocktime; + /* point in time when last page fault was initiated */ + int64_t last_begin; + /* number of vCPU are suspended */ + int smp_cpus_down; + + /* + * Handler for exit event, necessary for + * releasing whole blocktime_ctx + */ + Notifier exit_notifier; + /* + * Handler for postcopy event, necessary for + * releasing unnecessary part of blocktime_ctx + */ + Notifier postcopy_notifier; +} PostcopyBlocktimeContext; + +static void destroy_blocktime_context(struct PostcopyBlocktimeContext *ctx) +{ + g_free(ctx->page_fault_vcpu_time); + g_free(ctx->vcpu_addr); + g_free(ctx->vcpu_blocktime); + g_free(ctx); +} + +static void migration_exit_cb(Notifier *n, void *data) +{ + PostcopyBlocktimeContext *ctx =3D container_of(n, PostcopyBlocktimeCon= text, + exit_notifier); + destroy_blocktime_context(ctx); +} + +static struct PostcopyBlocktimeContext *blocktime_context_new(void) +{ + PostcopyBlocktimeContext *ctx =3D g_new0(PostcopyBlocktimeContext, 1); + ctx->page_fault_vcpu_time =3D g_new0(int64_t, smp_cpus); + ctx->vcpu_addr =3D g_new0(uint64_t, smp_cpus); + ctx->vcpu_blocktime =3D g_new0(int64_t, smp_cpus); + + ctx->exit_notifier.notify =3D migration_exit_cb; + qemu_add_exit_notifier(&ctx->exit_notifier); + add_migration_state_change_notifier(&ctx->postcopy_notifier); + return ctx; +} =20 /** * receive_ufd_features: check userfault fd features, to request only supp= orted @@ -153,6 +205,19 @@ static bool ufd_check_and_apply(int ufd, MigrationInco= mingState *mis) } } =20 +#ifdef UFFD_FEATURE_THREAD_ID + if (migrate_postcopy_blocktime() && mis && + UFFD_FEATURE_THREAD_ID & supported_features) { + /* kernel supports that feature */ + /* don't create blocktime_context if it exists */ + if (!mis->blocktime_ctx) { + mis->blocktime_ctx =3D blocktime_context_new(); + } + + asked_features |=3D UFFD_FEATURE_THREAD_ID; + } +#endif + /* * request features, even if asked_features is 0, due to * kernel expects UFFD_API before UFFDIO_REGISTER, per --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150584152203724.504642533726383; Tue, 19 Sep 2017 10:18:42 -0700 (PDT) Received: from localhost ([::1]:44233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duMAS-0002bD-Rb for importer@patchew.org; Tue, 19 Sep 2017 13:18:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhG-0001Dw-OD for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhE-0006RH-CO for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:30 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33242) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhE-0006Q2-2I for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:28 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164826euoutp0177221a800d493d6dd02044aa38dc7ec1~l0TwfJrBI2610726107euoutp01m; Tue, 19 Sep 2017 16:48:26 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170919164825eucas1p14708b99c17b8f90a186e2368492d27b1~l0Tvxk4Re3069830698eucas1p1G; Tue, 19 Sep 2017 16:48:25 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 2A.6F.12907.95A41C95; Tue, 19 Sep 2017 17:48:25 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164825eucas1p213639e95387bf054270d020f1d7dbfe9~l0TvFbKZ-2073720737eucas1p2k; Tue, 19 Sep 2017 16:48:25 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 36.6C.18832.95A41C95; Tue, 19 Sep 2017 17:48:25 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:25 +0100 (BST) X-AuditID: cbfec7f1-f793a6d00000326b-3c-59c14a59746a From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:48:01 +0300 Message-id: <1505839684-10046-8-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djP87qRXgcjDbZcUrSYe/c8i0Xvtnvs FhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu m5TUnMyy1CJ9uwSujJU3LzAV9HlUHDm1lKmB8bRZFyMnh4SAicTDPyfYIGwxiQv31gPZXBxC AksZJU4euM0O4XxmlFh6Zh87TMf1U78YIRLLGCUOzOxihXC6mSTu9e9n6WLk4GATMJDYd88W pEFEQFLid9dpZpAaZoEtjBJ37r1mBUkIC3hJ7Jq2nhHEZhFQleh43A4W5xVwl7i5dikLxDY5 iZPHJoPFOQU8JG4dXwt2koRAB5vEl7anrBBFLhKTd/UyQdjCEq+Ob4E6VUais+MgE0RDO6NE 985OVghnAqPEmel/oarsJU7dvArWzSzAJzFp23RmkBckBHglOtqEIEwPietP9CCqHSUWv78G DjAhgdmMEjf3809glF7AyLCKUSS1tDg3PbXYSK84Mbe4NC9dLzk/dxMjMEZP/zv+cQfj+xNW hxgFOBiVeHhX2ByMFGJNLCuuzD3EKMHBrCTC+9oJKMSbklhZlVqUH19UmpNafIhRmoNFSZzX NqotUkggPbEkNTs1tSC1CCbLxMEp1cC43GLdNZbO679ZqusPc83/9HWt4P60yhj7LbzS9h4n pv7e8dNMJ/exortrgO11qz+uCyptLXaIrP482TTs9qKYGV79D7PVHi3olz1xePPjONllPTlR 3+2ORy5pM+W7P0f5Zl6c6hEfFZXEBINd/5oOccWJqLgKd09bPvnP34Nic+MW/UtX+2KpxFKc kWioxVxUnAgAOlSejM0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Zd1Ir4ORBq96mSzm3j3PYtG77R67 xcS361ktpn2+zW5xpf0nu8WW/d/YLY737mCxuLOlj8mBw+PJtc1MHu/3XWXz6NuyijGAOYrL JiU1J7MstUjfLoErY+XNC0wFfR4VR04tZWpgPG3WxcjJISFgInH91C9GCFtM4sK99WxdjFwc QgJLGCUmvjsB5fQySay//BOoioODTcBAYt89W5AGEQFJid9dp5lBapgFtjBKbDy+EmySsICX xK5p68FsFgFViY7H7awgNq+Au8TNtUtZILbJSZw8NhkszingIXHr+Fp2EFsIqObG2utMExh5 FzAyrGIUSS0tzk3PLTbUK07MLS7NS9dLzs/dxAgMpm3Hfm7ewXhpY/AhRgEORiUe3hU2ByOF WBPLiitzDzFKcDArifC+dgIK8aYkVlalFuXHF5XmpBYfYpTmYFES5+3dszpSSCA9sSQ1OzW1 ILUIJsvEwSnVwNg8P1ifvY/tl3W84dHNrQGHuqQ6MzOVRAsfTHqXnfgiz+IY7/OaFIUnZtuX lrC+ZP9+4BoX7yIzVmOxZV8L7k3dNO2+8d/TepymTAuCr0Ut3nVQz19SsfzzHhWN/8tm3f+v mXRSr7yYfY74tskeYjMVD5TVCR9kuHXjnluYWlUvO9fBWvvqeCWW4oxEQy3mouJEAGQ7DbMi AgAA X-CMS-MailID: 20170919164825eucas1p213639e95387bf054270d020f1d7dbfe9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164825eucas1p213639e95387bf054270d020f1d7dbfe9 X-RootMTR: 20170919164825eucas1p213639e95387bf054270d020f1d7dbfe9 References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH v10 07/10] migration: calculate vCPU blocktime on dst side X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch provides blocktime calculation per vCPU, as a summary and as a overlapped value for all vCPUs. This approach was suggested by Peter Xu, as an improvements of previous approch where QEMU kept tree with faulted page address and cpus bi= tmask in it. Now QEMU is keeping array with faulted page address as value and vCPU as index. It helps to find proper vCPU at UFFD_COPY time. Also it keeps list for blocktime per vCPU (could be traced with page_fault_addr) Blocktime will not calculated if postcopy_blocktime field of MigrationIncomingState wasn't initialized. Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 138 +++++++++++++++++++++++++++++++++++++++++++= +++- migration/trace-events | 5 +- 2 files changed, 140 insertions(+), 3 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index cc78981..9a5133f 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -110,7 +110,6 @@ static struct PostcopyBlocktimeContext *blocktime_conte= xt_new(void) =20 ctx->exit_notifier.notify =3D migration_exit_cb; qemu_add_exit_notifier(&ctx->exit_notifier); - add_migration_state_change_notifier(&ctx->postcopy_notifier); return ctx; } =20 @@ -559,6 +558,136 @@ static int ram_block_enable_notify(const char *block_= name, void *host_addr, return 0; } =20 +static int get_mem_fault_cpu_index(uint32_t pid) +{ + CPUState *cpu_iter; + + CPU_FOREACH(cpu_iter) { + if (cpu_iter->thread_id =3D=3D pid) { + trace_get_mem_fault_cpu_index(cpu_iter->cpu_index, pid); + return cpu_iter->cpu_index; + } + } + trace_get_mem_fault_cpu_index(-1, pid); + return -1; +} + +/* + * This function is being called when pagefault occurs. It + * tracks down vCPU blocking time. + * + * @addr: faulted host virtual address + * @ptid: faulted process thread id + * @rb: ramblock appropriate to addr + */ +static void mark_postcopy_blocktime_begin(uint64_t addr, uint32_t ptid, + RAMBlock *rb) +{ + int cpu, already_received; + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *dc =3D mis->blocktime_ctx; + int64_t now_ms; + + if (!dc || ptid =3D=3D 0) { + return; + } + cpu =3D get_mem_fault_cpu_index(ptid); + if (cpu < 0) { + return; + } + + now_ms =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + if (dc->vcpu_addr[cpu] =3D=3D 0) { + atomic_inc(&dc->smp_cpus_down); + } + + atomic_xchg__nocheck(&dc->vcpu_addr[cpu], addr); + atomic_xchg__nocheck(&dc->last_begin, now_ms); + atomic_xchg__nocheck(&dc->page_fault_vcpu_time[cpu], now_ms); + + already_received =3D ramblock_recv_bitmap_test(rb, (void *)addr); + if (already_received) { + atomic_xchg__nocheck(&dc->vcpu_addr[cpu], 0); + atomic_xchg__nocheck(&dc->page_fault_vcpu_time[cpu], 0); + atomic_sub(&dc->smp_cpus_down, 1); + } + trace_mark_postcopy_blocktime_begin(addr, dc, dc->page_fault_vcpu_time= [cpu], + cpu, already_received); +} + +/* + * This function just provide calculated blocktime per cpu and trace it. + * Total blocktime is calculated in mark_postcopy_blocktime_end. + * + * + * Assume we have 3 CPU + * + * S1 E1 S1 E1 + * -----***********------------xxx***************------------------------>= CPU1 + * + * S2 E2 + * ------------****************xxx--------------------------------------->= CPU2 + * + * S3 E3 + * ------------------------****xxx********------------------------------->= CPU3 + * + * We have sequence S1,S2,E1,S3,S1,E2,E3,E1 + * S2,E1 - doesn't match condition due to sequence S1,S2,E1 doesn't includ= e CPU3 + * S3,S1,E2 - sequence includes all CPUs, in this case overlap will be S1,= E2 - + * it's a part of total blocktime. + * S1 - here is last_begin + * Legend of the picture is following: + * * - means blocktime per vCPU + * x - means overlapped blocktime (total blocktime) + * + * @addr: host virtual address + */ +static void mark_postcopy_blocktime_end(uint64_t addr) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *dc =3D mis->blocktime_ctx; + int i, affected_cpu =3D 0; + int64_t now_ms; + bool vcpu_total_blocktime =3D false; + + if (!dc) { + return; + } + + now_ms =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + + /* lookup cpu, to clear it, + * that algorithm looks straighforward, but it's not + * optimal, more optimal algorithm is keeping tree or hash + * where key is address value is a list of */ + for (i =3D 0; i < smp_cpus; i++) { + uint64_t vcpu_blocktime =3D 0; + if (atomic_fetch_add(&dc->vcpu_addr[i], 0) !=3D addr) { + continue; + } + atomic_xchg__nocheck(&dc->vcpu_addr[i], 0); + vcpu_blocktime =3D now_ms - + atomic_fetch_add(&dc->page_fault_vcpu_time[i], 0); + affected_cpu +=3D 1; + /* we need to know is that mark_postcopy_end was due to + * faulted page, another possible case it's prefetched + * page and in that case we shouldn't be here */ + if (!vcpu_total_blocktime && + atomic_fetch_add(&dc->smp_cpus_down, 0) =3D=3D smp_cpus) { + vcpu_total_blocktime =3D true; + } + /* continue cycle, due to one page could affect several vCPUs */ + dc->vcpu_blocktime[i] +=3D vcpu_blocktime; + } + + atomic_sub(&dc->smp_cpus_down, affected_cpu); + if (vcpu_total_blocktime) { + dc->total_blocktime +=3D now_ms - atomic_fetch_add(&dc->last_begin= , 0); + } + trace_mark_postcopy_blocktime_end(addr, dc, dc->total_blocktime, + affected_cpu); +} + /* * Handle faults detected by the USERFAULT markings */ @@ -636,8 +765,11 @@ static void *postcopy_ram_fault_thread(void *opaque) rb_offset &=3D ~(qemu_ram_pagesize(rb) - 1); trace_postcopy_ram_fault_thread_request(msg.arg.pagefault.address, qemu_ram_get_idstr(rb), - rb_offset); + rb_offset, + msg.arg.pagefault.feat.pti= d); =20 + mark_postcopy_blocktime_begin((uintptr_t)(msg.arg.pagefault.addres= s), + msg.arg.pagefault.feat.ptid, rb); /* * Send the request to the source - we want to request one * of our host page sizes (which is >=3D TPS) @@ -727,6 +859,8 @@ static int qemu_ufd_copy_ioctl(int userfault_fd, void *= host_addr, if (!ret) { ramblock_recv_bitmap_set_range(rb, host_addr, pagesize / qemu_target_page_size()); + mark_postcopy_blocktime_end((uint64_t)(uintptr_t)host_addr); + } return ret; } diff --git a/migration/trace-events b/migration/trace-events index d2910a6..01f30fe 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -114,6 +114,8 @@ process_incoming_migration_co_end(int ret, int ps) "ret= =3D%d postcopy-state=3D%d" process_incoming_migration_co_postcopy_end_main(void) "" migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" migration_set_outgoing_channel(void *ioc, const char *ioctype, const char = *hostname) "ioc=3D%p ioctype=3D%s hostname=3D%s" +mark_postcopy_blocktime_begin(uint64_t addr, void *dd, int64_t time, int c= pu, int received) "addr: 0x%" PRIx64 ", dd: %p, time: %" PRId64 ", cpu: %d,= already_received: %d" +mark_postcopy_blocktime_end(uint64_t addr, void *dd, int64_t time, int aff= ected_cpu) "addr: 0x%" PRIx64 ", dd: %p, time: %" PRId64 ", affected_cpu: %= d" =20 # migration/rdma.c qemu_rdma_accept_incoming_migration(void) "" @@ -190,7 +192,7 @@ postcopy_ram_enable_notify(void) "" postcopy_ram_fault_thread_entry(void) "" postcopy_ram_fault_thread_exit(void) "" postcopy_ram_fault_thread_quit(void) "" -postcopy_ram_fault_thread_request(uint64_t hostaddr, const char *ramblock,= size_t offset) "Request for HVA=3D0x%" PRIx64 " rb=3D%s offset=3D0x%zx" +postcopy_ram_fault_thread_request(uint64_t hostaddr, const char *ramblock,= size_t offset, uint32_t pid) "Request for HVA=3D0x%" PRIx64 " rb=3D%s offs= et=3D0x%zx pid=3D%u" postcopy_ram_incoming_cleanup_closeuf(void) "" postcopy_ram_incoming_cleanup_entry(void) "" postcopy_ram_incoming_cleanup_exit(void) "" @@ -199,6 +201,7 @@ save_xbzrle_page_skipping(void) "" save_xbzrle_page_overflow(void) "" ram_save_iterate_big_wait(uint64_t milliconds, int iterations) "big wait: = %" PRIu64 " milliseconds, %d iterations" ram_load_complete(int ret, uint64_t seq_iter) "exit_code %d seq iteration = %" PRIu64 +get_mem_fault_cpu_index(int cpu, uint32_t pid) "cpu: %d, pid: %u" =20 # migration/exec.c migration_exec_outgoing(const char *cmd) "cmd=3D%s" --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150584127866861.02176261418424; Tue, 19 Sep 2017 10:14:38 -0700 (PDT) Received: from localhost ([::1]:44213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duM6X-0007P3-NF for importer@patchew.org; Tue, 19 Sep 2017 13:14:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhG-0001Du-HQ for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhF-0006Se-CP for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:30 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:46478) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhF-0006RS-4t for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:29 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164827euoutp02f6a9518f0a9680cc9f0e05ec55b67c91~l0TxdyDIj2834328343euoutp02V; Tue, 19 Sep 2017 16:48:27 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164826eucas1p2a0ab83bb1f3bda27749a8c7d86055558~l0Twe2Vkq2208322083eucas1p2C; Tue, 19 Sep 2017 16:48:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id DA.6F.12907.A5A41C95; Tue, 19 Sep 2017 17:48:26 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164825eucas1p21fd133a55091e4a09fdeee05d130260d~l0TvvfT1y2073720737eucas1p2n; Tue, 19 Sep 2017 16:48:25 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F6.6C.18832.95A41C95; Tue, 19 Sep 2017 17:48:25 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:25 +0100 (BST) X-AuditID: cbfec7f1-f793a6d00000326b-3f-59c14a5a8303 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:48:02 +0300 Message-id: <1505839684-10046-9-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRmVeSWpSXmKPExsWy7djP87pRXgcjDd70ClvMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXxuXNuQVTOStWfrnF0sB4hb2LkYNDQsBEYsl+0S5GTiBTTOLCvfVsXYxc HEICSxkleue0skI4nxklLjf8Z4aoMpGY+3keE0RiGaPEzbbNUC3dTBL3+vezgIxlEzCQ2HfP FqRBREBS4nfXaWaQGmaBLYwSd+69ZgVJCAu4SXx8N50NxGYRUJXonbUXLM4r4C7RcLsdapuc xMljk8HinAIeEreOr2UHGSQh0MMmsfrkXnaIIheJPct6WSFsYYlXx7dAxWUkOjsOMkE0tDNK dO/sZIVwJjBKnJn+F6rKXuLUzatMIDazAJ/EpG3TmSEhwyvR0SYEYXpITHxqAVHtKDFt4312 iI9nM0osnfmTeQKj9AJGhlWMIqmlxbnpqcVGesWJucWleel6yfm5mxiBEXr63/GPOxjfn7A6 xCjAwajEw7vC5mCkEGtiWXFl7iFGCQ5mJRHe105AId6UxMqq1KL8+KLSnNTiQ4zSHCxK4ry2 UW2RQgLpiSWp2ampBalFMFkmDk6pBsaal+8n6e7rTf9fk9QbHjxP1PKRk++MhNSGpJke2n5v 929Rjth5wWSC2S/vVLGsT8fVJtdU50jtnF7LeSh0xiMrrzebSm5t+u6Y4TtZsMBl1eXyqhkZ fnYGd//f7WBa8L7U+cD7G3uMK//skHpg3MDkPO207aorLeJXbKbfnCp2fvKHK9tu8AUqsRRn JBpqMRcVJwIAxYBTt8wCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjluLIzCtJLcpLzFFi42I5/e/4Zd1Ir4ORBq1bdC3m3j3PYtG77R67 xcS361ktpn2+zW5xpf0nu8WW/d/YLY737mCxuLOlj8mBw+PJtc1MHu/3XWXz6NuyijGAOYrL JiU1J7MstUjfLoEr4/Lm3IKpnBUrv9xiaWC8wt7FyMkhIWAiMffzPCYIW0ziwr31bF2MXBxC AksYJR79m8QK4fQySay//JOxi5GDg03AQGLfPVuQBhEBSYnfXaeZQWqYBbYwSmw8vpIRJCEs 4Cbx8d10NhCbRUBVonfWXlYQm1fAXaLhdjszxDY5iZPHJoPFOQU8JG4dXwt2kRBQzY2115km MPIuYGRYxSiSWlqcm55bbKhXnJhbXJqXrpecn7uJERhK24793LyD8dLG4EOMAhyMSjy8K2wO RgqxJpYVV+YeYpTgYFYS4X3tBBTiTUmsrEotyo8vKs1JLT7EKM3BoiTO27tndaSQQHpiSWp2 ampBahFMlomDU6qBMeH2lt0Wv46oZlUv57rJF/El1y96jWmz7epT3EsOxhavWPXUTzd1W4NL qsn7OUwPz6fNcsoJF9k3zVPCbv5Gtz99LPcXdQlfz98dUDzlbZXFlQvLapTUmMTW2Oe0bEyc w/p86qpDb9Zpcm95zLRh9+OCbYv+yBpH3eZ+eGWr4rspL3UlDHLqJJVYijMSDbWYi4oTAYE2 JNchAgAA X-CMS-MailID: 20170919164825eucas1p21fd133a55091e4a09fdeee05d130260d X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164825eucas1p21fd133a55091e4a09fdeee05d130260d X-RootMTR: 20170919164825eucas1p21fd133a55091e4a09fdeee05d130260d References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH v10 08/10] migration: postcopy_blocktime documentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- docs/devel/migration.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/devel/migration.txt b/docs/devel/migration.txt index 1b940a8..4b625ca 100644 --- a/docs/devel/migration.txt +++ b/docs/devel/migration.txt @@ -402,6 +402,16 @@ will now cause the transition from precopy to postcopy. It can be issued immediately after migration is started or any time later on. Issuing it after the end of a migration is harmless. =20 +Blocktime is a postcopy live migration metric, intended to show +how long the vCPU was in state of interruptable sleep due to pagefault. +This value is calculated on destination side. +To enable postcopy blocktime calculation, enter following command on desti= nation +monitor: + +migrate_set_capability postcopy-blocktime on + +Postcopy blocktime can be retrieved by query-migrate qmp command. + Note: During the postcopy phase, the bandwidth limits set using migrate_set_speed is ignored (to avoid delaying requested pages that the destination is waiting for). --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505841195192417.8852594285869; Tue, 19 Sep 2017 10:13:15 -0700 (PDT) Received: from localhost ([::1]:44206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duM5C-00065J-Ad for importer@patchew.org; Tue, 19 Sep 2017 13:13:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhG-0001Dt-GC for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhF-0006T1-IK for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:30 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhF-0006RW-AK for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:29 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164827euoutp01a1fb9913961cc28159bd90cd2da13ba8~l0TxqRCJi2660026600euoutp01O; Tue, 19 Sep 2017 16:48:27 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164827eucas1p23e0c567e2eab066978083b1aea5bb209~l0TxDD6-W2115821158eucas1p2q; Tue, 19 Sep 2017 16:48:27 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 81.2F.12867.A5A41C95; Tue, 19 Sep 2017 17:48:26 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164826eucas1p249e6e9759612d74cd5c69bd375a01cd9~l0TwaAmA12073720737eucas1p2o; Tue, 19 Sep 2017 16:48:26 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 87.6C.18832.A5A41C95; Tue, 19 Sep 2017 17:48:26 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:26 +0100 (BST) X-AuditID: cbfec7f2-f793b6d000003243-00-59c14a5aa345 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:48:03 +0300 Message-id: <1505839684-10046-10-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djP87pRXgcjDbp7LSzm3j3PYtG77R67 xcS361ktpn2+zW5xpf0nu8WW/d/YLY737mCxuLOlj8mBw+PJtc1MHu/3XWXz6NuyijGAOYrL JiU1J7MstUjfLoEr48rsWSwFR7gqpq94wNbA+JK9i5GTQ0LARGLRgp+sELaYxIV769m6GLk4 hASWMkr8+HueHcL5zCjRteAnG0zH162zWCESyxglVqy6zQLhdDNJTFmyh7mLkYODTcBAYt89 W5AGEQFJid9dp5lBapgFtjBK3Ln3GmyfsECIxMM9u8CmsgioSsyY94IJxOYV8JD4eG8VM8Q2 OYmTxyaD1XMCxW8dXwt1dwebxLm//BC2i8Tr3W1QPwhLvDq+BapGRqKz4yATyGIJgXZGie6d nawQzgRGiTPT/0JV2UucunkVbDOzAJ/EpG3TwT6QEOCV6GgTgijxkPjyfS47RNhRYkqjHMTD sxklPrcdZJzAKL2AkWEVo0hqaXFuemqxsV5xYm5xaV66XnJ+7iZGYIye/nf80w7GryesDjEK cDAq8fCusDkYKcSaWFZcmXuIUYKDWUmE97UTUIg3JbGyKrUoP76oNCe1+BCjNAeLkjivbVRb pJBAemJJanZqakFqEUyWiYNTqoEx5uW611xrE/pdszI091ozupt/ftVeZTP9zoTCf9l2+9+9 OtlW13u3tc9DQnD/5HLNZOZoXuN7HZ0HF3FrhomXGR5NM7b4oGW78pDyUjfNAAdtiT/LGPTl GwIWb1m06Kkdh0Z/7t2bmtPmzamXeNPwrHOSckTok8m38qbs9jBsPvxWJONum5cSS3FGoqEW c1FxIgArWV4VzQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Zd0or4ORBhvuSFvMvXuexaJ32z12 i4lv17NaTPt8m93iSvtPdost+7+xWxzv3cFicWdLH5MDh8eTa5uZPN7vu8rm0bdlFWMAcxSX TUpqTmZZapG+XQJXxpXZs1gKjnBVTF/xgK2B8SV7FyMnh4SAicTXrbNYIWwxiQv31rOB2EIC SxglDm91g7B7mSRmLCvqYuTgYBMwkNh3zxYkLCIgKfG76zRzFyMXB7PAFkaJjcdXMoIkhAVC JB7u2QU2h0VAVWLGvBdMIDavgIfEx3urmCF2yUmcPDYZbC8nUPzW8bXsELvcJW6svc40gZF3 ASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxNjMBA2nbs5+YdjJc2Bh9iFOBgVOLhXWFzMFKI NbGsuDL3EKMEB7OSCO9rJ6AQb0piZVVqUX58UWlOavEhRmkOFiVx3t49qyOFBNITS1KzU1ML UotgskwcnFINjIIz3TZx86f8zuw3ltp5ZHa2hr5T6oTrYc+tF3/cE7FC+MxLm+fG0So7szaZ zXx4+8La9MK6M6JS9+yVJ9qFfn3Xsv9l9PLeTet+q65U13N13RdrpZdy357hb9Iflu8LLy5e IZnr+91wuohjXXbbHX6tz/s5/koqqnvxhoctfx1gwpAe+kObXYmlOCPRUIu5qDgRAOdJ38Eg AgAA X-CMS-MailID: 20170919164826eucas1p249e6e9759612d74cd5c69bd375a01cd9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164826eucas1p249e6e9759612d74cd5c69bd375a01cd9 X-RootMTR: 20170919164826eucas1p249e6e9759612d74cd5c69bd375a01cd9 References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH v10 09/10] migration: add blocktime calculation into postcopy-test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch just requests blocktime calculation, but doesn't add any facility to check or show it. Signed-off-by: Alexey Perevalov --- tests/postcopy-test.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c index 8142f2a..1db5359 100644 --- a/tests/postcopy-test.c +++ b/tests/postcopy-test.c @@ -425,6 +425,17 @@ static void test_migrate(void) g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); =20 +#ifdef UFFD_FEATURE_THREAD_ID + global_qtest =3D to; + rsp =3D qmp("{ 'execute': 'migrate-set-capabilities'," + "'arguments': { " + "'capabilities': [ {" + "'capability': 'postcopy-blocktime'," + "'state': true } ] } }"); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); +#endif + /* We want to pick a speed slow enough that the test completes * quickly, but that it doesn't complete precopy even on a slow * machine, so also set the downtime. @@ -441,7 +452,6 @@ static void test_migrate(void) g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); =20 - /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 --=20 1.9.1 From nobody Sun May 5 13:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505842258718337.08158135075826; Tue, 19 Sep 2017 10:30:58 -0700 (PDT) Received: from localhost ([::1]:44293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duMMH-0004lE-76 for importer@patchew.org; Tue, 19 Sep 2017 13:30:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhI-0001E1-JN for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhG-0006UM-TJ for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33246) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhG-0006TL-Kb for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:30 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164829euoutp015e73ca10499428113e88733a5d2fe597~l0Ty4bOVz2610726107euoutp01n; Tue, 19 Sep 2017 16:48:29 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170919164828eucas1p1e8c50103e8a669aa5f5c9a5559f20ad4~l0Tx6AYtX3070230702eucas1p1C; Tue, 19 Sep 2017 16:48:28 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 6B.6F.12907.B5A41C95; Tue, 19 Sep 2017 17:48:27 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164827eucas1p231a5b9afd8e81427db114e57a0b6fbbe~l0TxJHFrl2073720737eucas1p2r; Tue, 19 Sep 2017 16:48:27 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 16.6C.20118.B5A41C95; Tue, 19 Sep 2017 17:48:27 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:27 +0100 (BST) X-AuditID: cbfec7f1-f793a6d00000326b-42-59c14a5b3332 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:48:04 +0300 Message-id: <1505839684-10046-11-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djP87rRXgcjDVZNNraYe/c8i0Xvtnvs FhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu m5TUnMyy1CJ9uwSujM2LrrEXfHWpWHbwIGMD4zSzLkZODgkBE4kHy2ayQNhiEhfurWfrYuTi EBJYyigx79oLVgjnM6PE3PnzWWA6tly4wwKRWMYocWLqX3aQhJBAN5NE+2uFLkYODjYBA4l9 92xBwiICkhK/u04zg9QzC2xhlLhz7zUrSEJYIFxi78XbYENZBFQlOrauZgKxeQU8JDYsOMcK sUxO4uSxyWA2J1D81vG17CCDJAR62CT2vfnLCFHkIvHp9mVmCFtY4tXxLewQtozE5cndLBAN 7YwS3Ts7WSGcCYwSZ6b/haqylzh18yrYamYBPolJ26Yzg7wgIcAr0dEmBFHiIfF10lYmCNtR 4tnsddBAms0ocePDbeYJjNILGBlWMYqklhbnpqcWG+kVJ+YWl+al6yXn525iBEbp6X/HP+5g fH/C6hCjAAejEg/vCpuDkUKsiWXFlbmHGCU4mJVEeF87AYV4UxIrq1KL8uOLSnNSiw8xSnOw KInz2ka1RQoJpCeWpGanphakFsFkmTg4pRoYK/IVbLX/FZRPiPwgputoW13AvLgga+aPevNi w/KXkR0yd2qfBt5d8OpCXCiT2qKdIS6bM62LIn1bL0q5Nl/ZenjSpTMlnBsFLaa/O37vS0rL wfZX7eGlCk6Cdxg5180prv9yaKfSfGe3jWkaclv5Nt2UVM3QzDAxffDkmltTI5f0vP4/fKpK LMUZiYZazEXFiQABWyt/zgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Zd1or4ORBu97+S3m3j3PYtG77R67 xcS361ktpn2+zW5xpf0nu8WW/d/YLY737mCxuLOlj8mBw+PJtc1MHu/3XWXz6NuyijGAOYrL JiU1J7MstUjfLoErY/Oia+wFX10qlh08yNjAOM2si5GTQ0LARGLLhTssELaYxIV769m6GLk4 hASWMEocXtDADOH0MklsO70AqIqDg03AQGLfPVuQBhEBSYnfXafBapgFtjBKbDy+khEkISwQ LrH34m2wqSwCqhIdW1czgdi8Ah4SGxacY4XYJidx8thkMJsTKH7r+Fp2EFtIwF3ixtrrTBMY eRcwMqxiFEktLc5Nzy020itOzC0uzUvXS87P3cQIDKZtx35u2cHY9S74EKMAB6MSD+8Km4OR QqyJZcWVuYcYJTiYlUR4XzsBhXhTEiurUovy44tKc1KLDzFKc7AoifP27lkdKSSQnliSmp2a WpBaBJNl4uCUamDMee5ZIqaYL9lhtTP35wxT74+NL76sebsx+Ef6ypd2rwr0irZ1HZXP8xF8 4KRUVDp3m+eVd8l+S3a0eIo373ATvZlyVMEg21Tt2gcXPfdJ9oliudKOcz7Nu/ZI3apCLX7J a4bHV7VfNsf7n53VkndW/KHRlbnpHEErXt9nCPd4UrpTdOppI2klluKMREMt5qLiRAA83rJt IgIAAA== X-CMS-MailID: 20170919164827eucas1p231a5b9afd8e81427db114e57a0b6fbbe X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170919164827eucas1p231a5b9afd8e81427db114e57a0b6fbbe X-RootMTR: 20170919164827eucas1p231a5b9afd8e81427db114e57a0b6fbbe References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH v10 10/10] migration: add postcopy total blocktime into query-migrate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Postcopy total blocktime is available on destination side only. But query-migrate was possible only for source. This patch adds ability to call query-migrate on destination. To be able to see postcopy blocktime, need to request postcopy-blocktime capability. The query-migrate command will show following sample result: {"return": "postcopy-vcpu-blocktime": [115, 100], "status": "completed", "postcopy-blocktime": 100 }} postcopy_vcpu_blocktime contains list, where the first item is the first vCPU in QEMU. This patch has a drawback, it combines states of incoming and outgoing migration. Ongoing migration state will overwrite incoming state. Looks like better to separate query-migrate for incoming and outgoing migration or add parameter to indicate type of migration. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- hmp.c | 15 +++++++++++++ migration/migration.c | 42 +++++++++++++++++++++++++++++++---- migration/migration.h | 4 ++++ migration/postcopy-ram.c | 57 ++++++++++++++++++++++++++++++++++++++++++++= ++++ migration/trace-events | 1 + qapi/migration.json | 11 +++++++++- 6 files changed, 125 insertions(+), 5 deletions(-) diff --git a/hmp.c b/hmp.c index 0fb2bc7..142f76e 100644 --- a/hmp.c +++ b/hmp.c @@ -264,6 +264,21 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) info->cpu_throttle_percentage); } =20 + if (info->has_postcopy_blocktime) { + monitor_printf(mon, "postcopy blocktime: %" PRId64 "\n", + info->postcopy_blocktime); + } + + if (info->has_postcopy_vcpu_blocktime) { + Visitor *v; + char *str; + v =3D string_output_visitor_new(false, &str); + visit_type_int64List(v, NULL, &info->postcopy_vcpu_blocktime, NULL= ); + visit_complete(v, &str); + monitor_printf(mon, "postcopy vcpu blocktime: %s\n", str); + g_free(str); + visit_free(v); + } qapi_free_MigrationInfo(info); qapi_free_MigrationCapabilityStatusList(caps); } diff --git a/migration/migration.c b/migration/migration.c index 4f029e8..e1d3248 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -528,14 +528,15 @@ static void populate_disk_info(MigrationInfo *info) } } =20 -MigrationInfo *qmp_query_migrate(Error **errp) +static void fill_source_migration_info(MigrationInfo *info) { - MigrationInfo *info =3D g_malloc0(sizeof(*info)); MigrationState *s =3D migrate_get_current(); =20 switch (s->state) { case MIGRATION_STATUS_NONE: /* no migration has happened ever */ + /* do not overwrite destination migration status */ + return; break; case MIGRATION_STATUS_SETUP: info->has_status =3D true; @@ -584,8 +585,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) break; } info->status =3D s->state; - - return info; } =20 /** @@ -649,6 +648,41 @@ static bool migrate_caps_check(bool *cap_list, return true; } =20 +static void fill_destination_migration_info(MigrationInfo *info) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + switch (mis->state) { + case MIGRATION_STATUS_NONE: + return; + break; + case MIGRATION_STATUS_SETUP: + case MIGRATION_STATUS_CANCELLING: + case MIGRATION_STATUS_CANCELLED: + case MIGRATION_STATUS_ACTIVE: + case MIGRATION_STATUS_POSTCOPY_ACTIVE: + case MIGRATION_STATUS_FAILED: + case MIGRATION_STATUS_COLO: + info->has_status =3D true; + break; + case MIGRATION_STATUS_COMPLETED: + info->has_status =3D true; + fill_destination_postcopy_migration_info(info); + break; + } + info->status =3D mis->state; +} + +MigrationInfo *qmp_query_migrate(Error **errp) +{ + MigrationInfo *info =3D g_malloc0(sizeof(*info)); + + fill_destination_migration_info(info); + fill_source_migration_info(info); + + return info; +} + void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, Error **errp) { diff --git a/migration/migration.h b/migration/migration.h index 770466b..882a59b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -70,6 +70,10 @@ struct MigrationIncomingState { =20 MigrationIncomingState *migration_incoming_get_current(void); void migration_incoming_state_destroy(void); +/* + * Functions to work with blocktime context + */ +void fill_destination_postcopy_migration_info(MigrationInfo *info); =20 #define TYPE_MIGRATION "migration" =20 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 9a5133f..5fdbf1e 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -113,6 +113,55 @@ static struct PostcopyBlocktimeContext *blocktime_cont= ext_new(void) return ctx; } =20 +static int64List *get_vcpu_blocktime_list(PostcopyBlocktimeContext *ctx) +{ + int64List *list =3D NULL, *entry =3D NULL; + int i; + + for (i =3D smp_cpus - 1; i >=3D 0; i--) { + entry =3D g_new0(int64List, 1); + entry->value =3D ctx->vcpu_blocktime[i]; + entry->next =3D list; + list =3D entry; + } + + return list; +} + +/* + * This function just populates MigrationInfo from postcopy's + * blocktime context. It will not populate MigrationInfo, + * unless postcopy-blocktime capability was set. + * + * @info: pointer to MigrationInfo to populate + */ +void fill_destination_postcopy_migration_info(MigrationInfo *info) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *bc =3D mis->blocktime_ctx; + + if (!bc) { + return; + } + + info->has_postcopy_blocktime =3D true; + info->postcopy_blocktime =3D bc->total_blocktime; + info->has_postcopy_vcpu_blocktime =3D true; + info->postcopy_vcpu_blocktime =3D get_vcpu_blocktime_list(bc); +} + +static uint64_t get_postcopy_total_blocktime(void) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *bc =3D mis->blocktime_ctx; + + if (!bc) { + return 0; + } + + return bc->total_blocktime; +} + /** * receive_ufd_features: check userfault fd features, to request only supp= orted * features in the future. @@ -487,6 +536,9 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingStat= e *mis) munmap(mis->postcopy_tmp_zero_page, mis->largest_page_size); mis->postcopy_tmp_zero_page =3D NULL; } + trace_postcopy_ram_incoming_cleanup_blocktime( + get_postcopy_total_blocktime()); + trace_postcopy_ram_incoming_cleanup_exit(); return 0; } @@ -958,6 +1010,11 @@ void *postcopy_get_tmp_page(MigrationIncomingState *m= is) =20 #else /* No target OS support, stubs just fail */ +void fill_destination_postcopy_migration_info(MigrationInfo *info) +{ + error_report("%s: No OS support", __func__); +} + bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { error_report("%s: No OS support", __func__); diff --git a/migration/trace-events b/migration/trace-events index 01f30fe..741f2ae 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -197,6 +197,7 @@ postcopy_ram_incoming_cleanup_closeuf(void) "" postcopy_ram_incoming_cleanup_entry(void) "" postcopy_ram_incoming_cleanup_exit(void) "" postcopy_ram_incoming_cleanup_join(void) "" +postcopy_ram_incoming_cleanup_blocktime(uint64_t total) "total blocktime %= " PRIu64 save_xbzrle_page_skipping(void) "" save_xbzrle_page_overflow(void) "" ram_save_iterate_big_wait(uint64_t milliconds, int iterations) "big wait: = %" PRIu64 " milliseconds, %d iterations" diff --git a/qapi/migration.json b/qapi/migration.json index 2e4a15d..55b055e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -150,6 +150,13 @@ # @status is 'failed'. Clients should not attempt to parse the # error strings. (Since 2.7) # +# @postcopy-blocktime: total time when all vCPU were blocked during postco= py +# live migration (Since 2.11) +# +# @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU (Since= 2.10) +# + +# # Since: 0.14.0 ## { 'struct': 'MigrationInfo', @@ -161,7 +168,9 @@ '*downtime': 'int', '*setup-time': 'int', '*cpu-throttle-percentage': 'int', - '*error-desc': 'str'} } + '*error-desc': 'str', + '*postcopy-blocktime' : 'int64', + '*postcopy-vcpu-blocktime': ['int64']} } =20 ## # @query-migrate: --=20 1.9.1