From nobody Sun May 5 09:01:12 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; dkim=fail; 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 1509369661377246.5007209180044; Mon, 30 Oct 2017 06:21:01 -0700 (PDT) Received: from localhost ([::1]:40694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99zk-0004uL-E1 for importer@patchew.org; Mon, 30 Oct 2017 09:20:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99w2-0002GK-6r for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e99vx-000453-7l for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:58 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:51546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e99vw-00042F-RN for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:53 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171030131648euoutp01f852cc4091b04e869f241faeca53ed81~yW3rr4_Vy0384103841euoutp01x; Mon, 30 Oct 2017 13:16:48 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030131647eucas1p1d3afdad3945a52875d3e1f5fa327d06a~yW3rA2FCd0723107231eucas1p1T; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 01.13.12743.F3627F95; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030131647eucas1p2ea569225550a2250ee75f76b482b7498~yW3qWvgP-3254932549eucas1p2G; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 83.C1.18832.F3627F95; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYN00A7O0VNBHD0@eusync3.samsung.com>; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171030131648euoutp01f852cc4091b04e869f241faeca53ed81~yW3rr4_Vy0384103841euoutp01x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509369408; bh=aYvB9v7g8l/r6fhAms2gLh7becp2lydaT8Jka1nrMKM=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=M3gLi0KyhKJGesAe+wrXe6X9VU8OO30VydjhQF9I0noUIRtnIlS8zIs/Ax014/5k1 +0xzzRv7nftXbipQxlcNs6EKQsgRoGn73BmFVZh3/HKnMGP/Zxk/ACEZNbm9fRDQAH Jc9ajEiRBRnj7jRlCnZ2VPsRlP+BzZN39JGrSgo4= X-AuditID: cbfec7f5-f79d06d0000031c7-de-59f7263f8cc7 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 16:16:25 +0300 Message-id: <1509369390-8285-2-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509369390-8285-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djPc7r2at8jDX5uUreYe/c8i0Xvtnvs FtM+32a3uNL+k91iy/5v7BbHe3ewWNzZ0sfkwO7x5NpmJo/3+66yefRtWcUYwBzFZZOSmpNZ llqkb5fAlbH2222Wgm1CFVcf/WJvYJzC38XIySEhYCLRd+gFG4QtJnHh3nogm4tDSGApo8TN ng5WkISQwGdGiRPvfGEaGrbvhCpaxiix599tKKebSWL16h+MXYwcHGwCBhL77tmCNIgISEr8 7jrNDFLDLLCQUWLK/udg64QFvCVOndjNDGKzCKhKtK9dxARi8wq4SXQe38UIsU1O4ua5TrAa TgF3iVsHPjCBDJIQaGSTWHvrETNEkYvEy30zoX4Qlnh1fAs7hC0j0dlxEKqhnVGie2cnK4Qz gVHizPS/UFX2EqduXgVbzSzAJzFp23RmkBckBHglOtqEIEo8JD7fmwy1wFHi9o0ZrBAvzwKa 83YK2wRG6QWMDKsYRVJLi3PTU4tN9YoTc4tL89L1kvNzNzECY/P0v+NfdzAuPWZ1iFGAg1GJ h9dB5HukEGtiWXFl7iFGCQ5mJRHeVYpAId6UxMqq1KL8+KLSnNTiQ4zSHCxK4ry2UW2RQgLp iSWp2ampBalFMFkmDk6pBkYtqccZpcmS//X8LX75HXjqlCl1YrfH1MNyqYk6s/89zWZImmbh 4XK5sZCj6HiASt6R+UtzHaJVtR/m7df1nFWpc4EzUdRl3lOjwgPfPfbfco18fKHttvph0ynr 3s601vD4Y1njerbswK7TDuIzRKqmn7Fl2yQtwW3qxh1r+U2okbvS6liGuBJLcUaioRZzUXEi AOowzA/JAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupiluLIzCtJLcpLzFFi42I5/e/4VV17te+RBjd2clnMvXuexaJ32z12 i2mfb7NbXGn/yW6xZf83dovjvTtYLO5s6WNyYPd4cm0zk8f7fVfZPPq2rGIMYI7isklJzcks Sy3St0vgylj77TZLwTahiquPfrE3ME7h72Lk5JAQMJFo2L6TDcIWk7hwbz2QzcUhJLCEUeLu ye1QTi+TxIs5F1i7GDk42AQMJPbdswVpEBGQlPjddZoZpIZZYCGjxKXu18wgCWEBb4lTJ3aD 2SwCqhLtaxcxgdi8Am4Sncd3MUJsk5O4ea4TrIZTwF3i1oEPYDVCQDWzt19gnMDIu4CRYRWj SGppcW56brGhXnFibnFpXrpecn7uJkZgCG079nPzDsZLG4MPMQpwMCrx8N7I/RYpxJpYVlyZ e4hRgoNZSYR3leL3SCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8vXtWRwoJpCeWpGanphakFsFk mTg4pRoYQ5sXnVJMkXxwM/vaZ7Ok9xa3A5ifnl16bPaa1RMuqe5r/dEkZfw4Ups/KDRxacr8 OSuW7LPbblsaHz85VLpAkuXxpa3s1YZ3MgV7g9/6ydxttPxh7nxg3u75S+SanV4nKi/5+SHQ fteSbHmpi39/q8/4FT3NRWZTxYrO6smTtdV465avjmp5qcRSnJFoqMVcVJwIAGSGNoAdAgAA X-CMS-MailID: 20171030131647eucas1p2ea569225550a2250ee75f76b482b7498 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030131647eucas1p2ea569225550a2250ee75f76b482b7498 X-RootMTR: 20171030131647eucas1p2ea569225550a2250ee75f76b482b7498 References: <1509369390-8285-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 v12 1/6] 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, dgilbert@redhat.com, peterx@redhat.com, Alexey Perevalov , i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (identity @samsung.com: inappropriate hash for a=rsa/sha256) X-ZohoMail: RDKM_2 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 Reviewed-by: Juan Quintela --- migration/migration.c | 9 +++++++++ migration/migration.h | 1 + qapi/migration.json | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 62761d5..c5244ae 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1492,6 +1492,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 8ccdd7a..5f5e527 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -202,6 +202,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 6ae866e..c20caf4 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -352,12 +352,16 @@ # # @x-multifd: Use more than one fd for migration (since 2.11) # +# @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', 'pause-before-switchover', 'x-multifd' = ] } + 'block', 'return-path', 'pause-before-switchover', 'x-multifd', + 'postcopy-blocktime' ] } =20 ## # @MigrationCapabilityStatus: --=20 2.7.4 From nobody Sun May 5 09:01:12 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 1509369778754507.6921007210501; Mon, 30 Oct 2017 06:22:58 -0700 (PDT) Received: from localhost ([::1]:40700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9A1V-0006Gm-Th for importer@patchew.org; Mon, 30 Oct 2017 09:22:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99w3-0002GP-9I for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e99vx-00045I-8y for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:59 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35964) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e99vw-00043W-VJ for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:53 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171030131649euoutp021196a2e3e127b1a27256846b3e0d0b03~yW3sfqmtN2108521085euoutp02j; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030131648eucas1p2a5744c89703c557af8a057ed2ddbf682~yW3rsnvWv1096110961eucas1p2N; Mon, 30 Oct 2017 13:16:48 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 96.4B.12867.04627F95; Mon, 30 Oct 2017 13:16:48 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030131647eucas1p1b5fb0616e683e78fdca767d267400f50~yW3rCHaBs1758017580eucas1p11; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id FE.23.20118.F3627F95; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYN00A7O0VNBHD0@eusync3.samsung.com>; Mon, 30 Oct 2017 13:16:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171030131649euoutp021196a2e3e127b1a27256846b3e0d0b03~yW3sfqmtN2108521085euoutp02j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509369409; bh=IrbbQHw9BvIzYTUXQugsjBpcfl9GpY3OEIM+IoQK/YY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Hc91WaHo6wbZnyICLJfOHXfSYXdBgPzRe3uaxFoHIZqXo9kmjQdxpxHmaczpcH3IX PvClui3OII5bV/EM1D8pbB0VJimSoz947/wInQaAmS1kGTnvlDedFg7kiagAnmG7Zh ffTnZVgHN8pwqrDpzFxDz0qZiFq3HERhyGgxvSN8= X-AuditID: cbfec7f2-f793b6d000003243-de-59f72640bbeb From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 16:16:26 +0300 Message-id: <1509369390-8285-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509369390-8285-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djP87oOat8jDbq/i1nMvXuexaJ32z12 i2mfb7NbXGn/yW6xZf83dovjvTtYLO5s6WNyYPd4cm0zk8f7fVfZPPq2rGIMYI7isklJzcks Sy3St0vgyri+7T5bwTW1il1LtjE3MDbJdzFyckgImEgsmPmOFcIWk7hwbz1bFyMXh5DAUkaJ I8072CGcz4wSj6ceZoTpmLLyLDNEYhmjxK4TK5ggnG4midWrfwBVcXCwCRhI7LtnC9IgIiAp 8bvrNFgDs8BCRokp+5+zgSSEBWIkNkz6AzaVRUBV4vz+HrA4r4CbxPYpO6G2yUncPNfJDGJz CrhL3DrwAWyZhEAHm8S991PYIYpcJL5++gtlC0u8Or4FypaRuDy5mwWioZ1RontnJyuEM4FR 4sx0mA57iVM3rzKB2MwCfBKTtk1nBnlBQoBXoqNNCKLEQ+L/1RnsEGFHiWcX3SE+ngX0/pfJ 7BMYpRcwMqxiFEktLc5NTy021itOzC0uzUvXS87P3cQIjM3T/45/2sH49YTVIUYBDkYlHt4b ud8ihVgTy4orcw8xSnAwK4nwrlL8HinEm5JYWZValB9fVJqTWnyIUZqDRUmc1zaqLVJIID2x JDU7NbUgtQgmy8TBKdXA2PHx3FedaeklUp9EFJ8nG79fw+coeF4+zvfe6nlmcrIGF49aJNx2 lZVn1P3hfa6e2bK9Yzav5Dn/aPnu5Y8aFigI3FS9Zly47N4rsTyOAzlHFarO2za2x4uW/Oz4 WaIsL/yt7fmVjUKPLvY9vjZFznNuzfflhw5Ovrlqzk6mZewx96bfeeZ1W4mlOCPRUIu5qDgR AAGOaTLJAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupiluLIzCtJLcpLzFFi42I5/e/4VV17te+RBvOazS3m3j3PYtG77R67 xbTPt9ktrrT/ZLfYsv8bu8Xx3h0sFne29DE5sHs8ubaZyeP9vqtsHn1bVjEGMEdx2aSk5mSW pRbp2yVwZVzfdp+t4Jpaxa4l25gbGJvkuxg5OSQETCSmrDzLDGGLSVy4t56ti5GLQ0hgCaPE 6QsT2SGcXiaJF3MusHYxcnCwCRhI7LtnC9IgIiAp8bvrNDNIDbPAQkaJS92vwSYJC8RIbJj0 hxHEZhFQlTi/v4cNxOYVcJPYPmUnI8Q2OYmb5zrB6jkF3CVuHfjABGILAdXM3n6BcQIj7wJG hlWMIqmlxbnpucVGesWJucWleel6yfm5mxiBIbTt2M8tOxi73gUfYhTgYFTi4b2R+y1SiDWx rLgy9xCjBAezkgjvKsXvkUK8KYmVValF+fFFpTmpxYcYpTlYlMR5e/esjhQSSE8sSc1OTS1I LYLJMnFwSjUwcmf775qwPU0+NsbT6W78GTXHbxa5D62Pbvykd8SHOfdOLbNMuNCe8r/Ol/+c 29l1qlksLNnSh3OF6rwZcjOVnk2VVl+wau7Ubxd9Prnf+j53msgj8a2q4necTuapXGeJiq1w aKiRstgQ96Zt2ecNz0XFVPXdV72JrW0XDH1/vCn0baPst+NzlFiKMxINtZiLihMBcdur4R0C AAA= X-CMS-MailID: 20171030131647eucas1p1b5fb0616e683e78fdca767d267400f50 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030131647eucas1p1b5fb0616e683e78fdca767d267400f50 X-RootMTR: 20171030131647eucas1p1b5fb0616e683e78fdca767d267400f50 References: <1509369390-8285-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 v12 2/6] 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, dgilbert@redhat.com, peterx@redhat.com, Alexey Perevalov , i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (identity @samsung.com: inappropriate hash for a=rsa/sha256) X-ZohoMail: RDKM_2 RSF_6 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 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov Reviewed-by: Juan Quintela --- migration/migration.h | 8 +++++++ migration/postcopy-ram.c | 59 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 67 insertions(+) diff --git a/migration/migration.h b/migration/migration.h index 5f5e527..fb8d2ef 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -22,6 +22,8 @@ #include "hw/qdev.h" #include "io/channel.h" =20 +struct PostcopyBlocktimeContext; + /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -59,6 +61,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..c18ec5a 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -61,6 +61,52 @@ 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; +} 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); + return ctx; +} =20 /** * receive_ufd_features: check userfault fd features, to request only supp= orted @@ -153,6 +199,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 2.7.4 From nobody Sun May 5 09:01:12 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; dkim=fail; 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 1509369658507409.96226370337695; Mon, 30 Oct 2017 06:20:58 -0700 (PDT) Received: from localhost ([::1]:40696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99zo-0004wP-Mj for importer@patchew.org; Mon, 30 Oct 2017 09:20:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99w3-0002GX-Io for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:17:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e99vx-00045D-8m for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:59 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:51553) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e99vw-00043o-Rf for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:53 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171030131649euoutp01ce9bc06991b5c972738b67aabad1a1fc~yW3sus3VR0337403374euoutp01j; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030131649eucas1p1d336723cd55bfbdcb6e25e8b92b2409d~yW3sWcSA21152411524eucas1p1R; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id A1.13.12743.14627F95; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030131648eucas1p14830b04b73c8eb12d07b752738238b8a~yW3rtpQZi2427724277eucas1p1f; Mon, 30 Oct 2017 13:16:48 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B4.C1.18832.04627F95; Mon, 30 Oct 2017 13:16:48 +0000 (GMT) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYN00A7O0VNBHD0@eusync3.samsung.com>; Mon, 30 Oct 2017 13:16:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171030131649euoutp01ce9bc06991b5c972738b67aabad1a1fc~yW3sus3VR0337403374euoutp01j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509369409; bh=ajjBl+cDJyRgKYxG1m2eDgUkdXTgCYH7Ea/7Wdrz5uc=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=OEFFKnGSzzev5oh2bG9NQvuw+WmObHYTkXiUCZlnz6syz8weKokVrMSdLT3DW0duw bPsZrQ/lwIrpuXCehUYGZCo3dcxKZ55wagAsZ2DDZINfj0YmvkFNrZ744woHgxQN5s xv0+VV/q2iqt0jFXf057SA8Qm/YpebaD17IZfv5g= X-AuditID: cbfec7f5-f79d06d0000031c7-e2-59f72641461c From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 16:16:27 +0300 Message-id: <1509369390-8285-4-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509369390-8285-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djPc7qOat8jDdZ+ZbGYe/c8i0Xvtnvs FtM+32a3uNL+k91iy/5v7BbHe3ewWNzZ0sfkwO7x5NpmJo/3+66yefRtWcUYwBzFZZOSmpNZ llqkb5fAlXFsQQNbwTP3inN9sxkbGCeZdTFyckgImEj0nzrLBGGLSVy4t56ti5GLQ0hgKaPE neVTWSGcz4wSmycuYIfpmH/xBFTVMkaJ533zWSCcbiaJibuuAM3i4GATMJDYd88WpEFEQFLi d9dpZpAaZoGFjBJT9j9nA0kIC3hIdLVMZgWxWQRUJabOnckMYvMKuElceDiXEWKbnMTNc51g cU4Bd4lbBz4wgQySEOhgk1i8poMFoshF4vG8icwQtrDEq+NboE6VkejsOAjV0M4o0b2zkxXC mcAocWb6X6gqe4lTN6+Cg4BZgE9i0rbpzCAvSAjwSnS0CUGUeEh8mzuZDcJ2lFj67Sc0YGYx Suw49ZBpAqP0AkaGVYwiqaXFuempxaZ6xYm5xaV56XrJ+bmbGIHRefrf8a87GJceszrEKMDB qMTD6yDyPVKINbGsuDL3EKMEB7OSCO8qRaAQb0piZVVqUX58UWlOavEhRmkOFiVxXtuotkgh gfTEktTs1NSC1CKYLBMHp1QDI/+tpybGpp+2y9qb+m98KLH4WQ0zV2gSS/Tzan/1l0deK0j8 f/9KNdqdlfP2ifDyfjf/gjyVzoM7P6Tdn9KsPzV5UsUlr7WhOvVHyhKfn/8w8dkUP4cL5aHq NQpu8RYhfEeMt4jVZ0yJuvzu18tb/bwPJhlFTOxuFzTfIvXm2luhy6a3rL/2K7EUZyQaajEX FScCAIIqAJHKAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupiluLIzCtJLcpLzFFi42I5/e/4VV0Hte+RBm/2qVnMvXuexaJ32z12 i2mfb7NbXGn/yW6xZf83dovjvTtYLO5s6WNyYPd4cm0zk8f7fVfZPPq2rGIMYI7isklJzcks Sy3St0vgyji2oIGt4Jl7xbm+2YwNjJPMuhg5OSQETCTmXzzBBmGLSVy4tx7I5uIQEljCKPFn 4WF2CKeXSWLRmrksXYwcHGwCBhL77tmCNIgISEr87jrNDFLDLLCQUeJS92tmkISwgIdEV8tk VhCbRUBVYurcmWBxXgE3iQsP5zJCbJOTuHmuEyzOKeAucevAByYQWwioZvb2C4wTGHkXMDKs YhRJLS3OTc8tNtQrTswtLs1L10vOz93ECAyhbcd+bt7BeGlj8CFGAQ5GJR7eG7nfIoVYE8uK K3MPMUpwMCuJ8K5S/B4pxJuSWFmVWpQfX1Sak1p8iFGag0VJnLd3z+pIIYH0xJLU7NTUgtQi mCwTB6dUA2OTu3HrzoiIkyV8d1j+Ws1dccbsZiKj4mHLc1NXG71RWrzc0P3wecmdruFXONs6 9HefcFKf9Ilxnk7RQUPWFeLmf367vtZYUsbk+uO1mnKe2sUtnesCdpgznCzd9FouP+HV07uF Wzqls2f2Zp3zN6pvnK91L//BQ0ttS/bO21zftm/X1/zplKjEUpyRaKjFXFScCACB0+weHQIA AA== X-CMS-MailID: 20171030131648eucas1p14830b04b73c8eb12d07b752738238b8a X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030131648eucas1p14830b04b73c8eb12d07b752738238b8a X-RootMTR: 20171030131648eucas1p14830b04b73c8eb12d07b752738238b8a References: <1509369390-8285-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 v12 3/6] 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, dgilbert@redhat.com, peterx@redhat.com, Alexey Perevalov , i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (identity @samsung.com: inappropriate hash for a=rsa/sha256) X-ZohoMail: RDKM_2 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 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela --- migration/postcopy-ram.c | 143 +++++++++++++++++++++++++++++++++++++++++++= +++- migration/trace-events | 5 +- 2 files changed, 146 insertions(+), 2 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index c18ec5a..6bf24e9 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -553,6 +553,142 @@ 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->last_begin, now_ms); + atomic_xchg__nocheck(&dc->page_fault_vcpu_time[cpu], now_ms); + atomic_xchg__nocheck(&dc->vcpu_addr[cpu], addr); + + /* check it here, not at the begining of the function, + * due to, check could accur early than bitmap_set in + * qemu_ufd_copy_ioctl */ + 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_dec(&dc->smp_cpus_down); + } + 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; + int64_t read_vcpu_time; + + 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; + + read_vcpu_time =3D atomic_fetch_add(&dc->page_fault_vcpu_time[i], = 0); + if (atomic_fetch_add(&dc->vcpu_addr[i], 0) !=3D addr || + read_vcpu_time =3D=3D 0) { + continue; + } + atomic_xchg__nocheck(&dc->vcpu_addr[i], 0); + vcpu_blocktime =3D now_ms - read_vcpu_time; + 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 */ @@ -630,8 +766,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) @@ -721,6 +860,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 6f29fcc..462d157 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -115,6 +115,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) "" @@ -191,7 +193,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) "" @@ -200,6 +202,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 2.7.4 From nobody Sun May 5 09:01:12 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; dkim=fail; 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 1509369537784457.05130843817744; Mon, 30 Oct 2017 06:18:57 -0700 (PDT) Received: from localhost ([::1]:40680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99xd-0003CZ-GX for importer@patchew.org; Mon, 30 Oct 2017 09:18:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99w2-0002GM-8I for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e99vx-00045S-HF for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:58 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e99vx-00044N-Ak for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:53 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171030131650euoutp0281e1cfae50deccf8d3e3c5537b67c146~yW3tq6P7h2114621146euoutp02L; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030131650eucas1p23df5be3537d3452d123fa6ed146b546d~yW3tBT8xA3245832458eucas1p2S; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 67.4B.12867.14627F95; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030131649eucas1p1f96847d18071ffdc4ea869438edb2e12~yW3saza6k0074700747eucas1p1_; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AF.23.20118.14627F95; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYN00A7O0VNBHD0@eusync3.samsung.com>; Mon, 30 Oct 2017 13:16:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171030131650euoutp0281e1cfae50deccf8d3e3c5537b67c146~yW3tq6P7h2114621146euoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509369410; bh=0H1FZeKGdq3uH4w+UyteJ2dxD2E98CUZQ5bIEQxIkd0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ZmOLKFqbdyRYDVUevTGIj/pHTQCsrJlPnRuBe1nQIOydVO7FqQpvJFSsC7ibD9jJP tQ+ygY1XSKmynauoLc7nvVg3YrkTZ5xo7FThAndZrtzIKARx1fBCqJ+QoBxDjEEtlj zRtozvy2c5iDNzkYYrk8sHDL/vEPvuNCxOfhr59I= X-AuditID: cbfec7f2-f793b6d000003243-e3-59f72641cae6 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 16:16:28 +0300 Message-id: <1509369390-8285-5-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509369390-8285-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djPc7qOat8jDZZNNrSYe/c8i0Xvtnvs FtM+32a3uNL+k91iy/5v7BbHe3ewWNzZ0sfkwO7x5NpmJo/3+66yefRtWcUYwBzFZZOSmpNZ llqkb5fAldF6eBZbwRzuivsNM1gbGDdxdjFyckgImEjcW9PHBmGLSVy4tx7I5uIQEljKKDFt +Tl2COczo0TPknssMB2tMzewQCSWMUo8mL+BGcLpZpJYtmQ6YxcjBwebgIHEvnu2IA0iApIS v7tOg9UwCyxklJiy/znYPmEBF4nt0z+D2SwCqhLfpt9gAenlFXCTWL+oEmKZnMTNc53MIDan gLvErQMfmCDiHWwSr/fbQ9guEl8OTYc6Tlji1fEt7BC2jMTlyd1gh0oItDNKdO/sZIVwJjBK nJn+F6rKXuLUzatgU5kF+CQmbZvODHKEhACvREebEESJh8TzJzuYIWxHiSebFjJBPDyLUWJd 3yO2CYzSCxgZVjGKpJYW56anFhvrFSfmFpfmpesl5+duYgRG5ul/xz/tYPx6wuoQowAHoxIP 743cb5FCrIllxZW5hxglOJiVRHhXKX6PFOJNSaysSi3Kjy8qzUktPsQozcGiJM5rG9UWKSSQ nliSmp2aWpBaBJNl4uCUamBkZ5nTdK89Y8nrR+5LrjaYPkk1yLpbX/Ep8OeihAXMhoeP/HQJ DFvJ6FG69o/b6cxmcz+/pa9sMriDA+tETmZf2fL4Ve/e41N3Hphxv2CR9fcbrS4rfs73y7jA 3RYtkvXjfelhLdbU4nl8iXofL8yIvGrFfOPCH9F2p9sW2R3TZfmDlar+Zr5SYinOSDTUYi4q TgQAtEy6ZcgCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkluLIzCtJLcpLzFFi42I5/e/4VV1Hte+RBns/ilvMvXuexaJ32z12 i2mfb7NbXGn/yW6xZf83dovjvTtYLO5s6WNyYPd4cm0zk8f7fVfZPPq2rGIMYI7isklJzcks Sy3St0vgymg9PIutYA53xf2GGawNjJs4uxg5OSQETCRaZ25ggbDFJC7cW8/WxcjFISSwhFHi xdpzrBBOL5PEollLmLoYOTjYBAwk9t2zBWkQEZCU+N11mhmkhllgIaPEpe7XzCAJYQEXie3T P7OB2CwCqhLfpt9gAenlFXCTWL+oEmKZnMTNc51g5ZwC7hK3DnxgArGFgEpmb7/AOIGRdwEj wypGkdTS4tz03GIjveLE3OLSvHS95PzcTYzAANp27OeWHYxd74IPMQpwMCrx8N7I/RYpxJpY VlyZe4hRgoNZSYR3leL3SCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8vXtWRwoJpCeWpGanphak FsFkmTg4pRoY2097nzNzW68S3HPx47dG+e2dD49ad22p+ZfAlyh17ERewsSKAr7bC9d/lpsu 8Du+jTP0i4SUnkeTvZao5SKTq567DvZ9XFB3WHrFJr/FK2q/PJTjEmhd6cTbyubk/sSOt3/p DK3z8sJqfcsDUrd1c/n0Ls9/n6fvtbPd5H3QvdgvJTFnnOYosRRnJBpqMRcVJwIAyj8GfRwC AAA= X-CMS-MailID: 20171030131649eucas1p1f96847d18071ffdc4ea869438edb2e12 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030131649eucas1p1f96847d18071ffdc4ea869438edb2e12 X-RootMTR: 20171030131649eucas1p1f96847d18071ffdc4ea869438edb2e12 References: <1509369390-8285-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 v12 4/6] 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, dgilbert@redhat.com, peterx@redhat.com, Alexey Perevalov , i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (identity @samsung.com: inappropriate hash for a=rsa/sha256) X-ZohoMail: RDKM_2 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 Reviewed-by: Juan Quintela --- docs/devel/migration.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/devel/migration.txt b/docs/devel/migration.txt index 4030703..cebfe7a 100644 --- a/docs/devel/migration.txt +++ b/docs/devel/migration.txt @@ -402,6 +402,19 @@ 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. +That metric is calculated both for all vCPUs as overlapped value, and +separately for each vCPU. These values are 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. +postcopy-blocktime value of qmp command will show overlapped blocking time= for +all vCPU, postcopy-vcpu-blocktime will show list of blocking time per vCPU. + 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 2.7.4 From nobody Sun May 5 09:01:12 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; dkim=fail; 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 150936953777498.88117815362887; Mon, 30 Oct 2017 06:18:57 -0700 (PDT) Received: from localhost ([::1]:40681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99xe-0003Cz-2G for importer@patchew.org; Mon, 30 Oct 2017 09:18:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99w2-0002GL-7I for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e99vx-00045a-IP for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:58 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35979) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e99vx-00044o-Cd for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:53 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171030131651euoutp0299c9ab2bad06251c762135a63a226301~yW3uyI2ZT2108521085euoutp02k; Mon, 30 Oct 2017 13:16:51 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030131651eucas1p284aaab40bd3b3894a8a17f1339e72411~yW3uBDmAh3254932549eucas1p2J; Mon, 30 Oct 2017 13:16:51 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id A4.03.12576.24627F95; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030131650eucas1p11e65153f114fd66677a37751e4e82b2d~yW3tSKVnU0722607226eucas1p1t; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 56.C1.18832.24627F95; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYN00A7O0VNBHD0@eusync3.samsung.com>; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171030131651euoutp0299c9ab2bad06251c762135a63a226301~yW3uyI2ZT2108521085euoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509369411; bh=ywYP+3087aMW+bRqHjZuaEG21zhvHhw8JQkmWQHrVVA=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=r7r6ISnJKoK+VAcjIhsNIp6GJ/+uYQ5AQF6CQiYnRHDq9nFAFWsdj0OEUi2J+fnDs krWC1guqSPWDVmk0WQdDdIJCYuB9awG3bL4GWanFw2w/gFmO1UNQjMyddNpkbgBHWi fMq83pqp6IXxEcClywia+xYodD1NnAD6m51GY/B8= X-AuditID: cbfec7ef-f79ee6d000003120-63-59f72642d32e From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 16:16:29 +0300 Message-id: <1509369390-8285-6-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509369390-8285-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsWy7djPc7pOat8jDS6fNbGYe/c8i0Xvtnvs FtM+32a3uNL+k91iy/5v7BbHe3ewWNzZ0sfkwO7x5NpmJo/3+66yefRtWcUYwBzFZZOSmpNZ llqkb5fAlfHtdhNjQb9gxZWJm1kbGM/zdjFycEgImEismZfXxcgJZIpJXLi3nq2LkYtDSGAZ o8SEJ91sIAkhgc+MEnt6BGDq29ZZwdUs+NHKCuF0M0n0zT/EClLEJmAgse+eLUiviICkxO+u 08wgNcwCCxklpux/DjZUWCBYYtWrfWwg9SwCqhJ3b4qAhHkF3CS6Xh5ngzhITuLmuU5mEJtT wF3i1oEPTCBzJAQ62CQ+f/7NDnGQi0TH6TiIemGJV8e3sEPYMhKdHQeh6tsZJbp3drJCOBMY Jc5M/wtVZS9x6uZVJhCbWYBPYtK26cwQQ3klOtqEIEo8JNat7WWFsB0lFsxuhobQLEaJ6YvO ME9glF7AyLCKUSS1tDg3PbXYUK84Mbe4NC9dLzk/dxMjMCZP/zv+fgfj0+aQQ4wCHIxKPLw3 cr9FCrEmlhVX5h5ilOBgVhLhXaX4PVKINyWxsiq1KD++qDQntfgQozQHi5I4r21UW6SQQHpi SWp2ampBahFMlomDU6qBUapzp+/vXU5iK484cyR6MO+8+HSH5vwnj++kTpl647XG55eiDrEh Z23a2vbwBMsIX7Xim/3Y6bd0/q38sF+il3+lat/LfK2/Z14h3/Eiy+Ca2i2X9Z60aeUox4r0 xwkE3b2sHaU5Z5aatHpl6vVFbX+uOnwTvnnhrpF6Jx/Xi9uTVL4wekhcUmIpzkg01GIuKk4E AI2P3HfFAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgluLIzCtJLcpLzFFi42I5/e/4VV0nte+RBvvbWS3m3j3PYtG77R67 xbTPt9ktrrT/ZLfYsv8bu8Xx3h0sFne29DE5sHs8ubaZyeP9vqtsHn1bVjEGMEdx2aSk5mSW pRbp2yVwZXy73cRY0C9YcWXiZtYGxvO8XYwcHBICJhJt66y6GDmBTDGJC/fWs3UxcnEICSxh lLjXsYcVwullkrg68wY7SAObgIHEvnu2IA0iApISv7tOM4PUMAssZJS41P2aGSQhLBAsserV PjaQehYBVYm7N0VAwrwCbhJdL4+zQSyTk7h5rhOsnFPAXeLWgQ9MILYQUM3s7RcYJzDyLmBk WMUoklpanJueW2yoV5yYW1yal66XnJ+7iREYPtuO/dy8g/HSxuBDjAIcjEo8vDdyv0UKsSaW FVfmHmKU4GBWEuFdpfg9Uog3JbGyKrUoP76oNCe1+BCjNAeLkjhv757VkUIC6YklqdmpqQWp RTBZJg5OqQZGZcc3jhvOys52UfyisLq8scJN7dqlTPnlWkG8/1O2bu0rPFzTtvHzRP6HXx0j 6yc23mZ2WyzNXP+m+XquMLdodbK/sEhE9cpHVnoTpdUSnJv2PYmNeJpqpyau9GLWzqCeO5/m 5Rf+PRH33J3BKuLfYe4jrq8fVuUz8l7OkZCp/62+as683ZpKLMUZiYZazEXFiQDcGtpUGwIA AA== X-CMS-MailID: 20171030131650eucas1p11e65153f114fd66677a37751e4e82b2d X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030131650eucas1p11e65153f114fd66677a37751e4e82b2d X-RootMTR: 20171030131650eucas1p11e65153f114fd66677a37751e4e82b2d References: <1509369390-8285-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 v12 5/6] migration: add blocktime calculation into migration-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, dgilbert@redhat.com, peterx@redhat.com, Alexey Perevalov , i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (identity @samsung.com: inappropriate hash for a=rsa/sha256) X-ZohoMail: RDKM_2 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, and check it in case when UFFD_FEATURE_THREAD_ID feature is set on the host. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov Reviewed-by: Juan Quintela --- tests/migration-test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index db30b38..3b4d88a 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -25,6 +25,7 @@ const unsigned start_address =3D 1024 * 1024; const unsigned end_address =3D 100 * 1024 * 1024; bool got_stop; +static bool uffd_feature_thread_id; =20 #if defined(__linux__) #include @@ -54,6 +55,7 @@ static bool ufd_version_check(void) g_test_message("Skipping test: UFFDIO_API failed"); return false; } + uffd_feature_thread_id =3D api_struct.features & UFFD_FEATURE_THREAD_I= D; =20 ioctl_mask =3D (__u64)1 << _UFFDIO_REGISTER | (__u64)1 << _UFFDIO_UNREGISTER; @@ -266,6 +268,16 @@ static uint64_t get_migration_pass(QTestState *who) return result; } =20 +static void read_blocktime(QTestState *who) +{ + QDict *rsp, *rsp_return; + + rsp =3D wait_command(who, "{ 'execute': 'query-migrate' }"); + rsp_return =3D qdict_get_qdict(rsp, "return"); + g_assert(qdict_haskey(rsp_return, "postcopy-blocktime")); + QDECREF(rsp); +} + static void wait_for_migration_complete(QTestState *who) { QDict *rsp, *rsp_return; @@ -540,6 +552,7 @@ static void test_postcopy(void) =20 migrate_set_capability(from, "postcopy-ram", "true"); migrate_set_capability(to, "postcopy-ram", "true"); + migrate_set_capability(to, "postcopy-blocktime", "true"); =20 /* We want to pick a speed slow enough that the test completes * quickly, but that it doesn't complete precopy even on a slow @@ -568,6 +581,9 @@ static void test_postcopy(void) wait_for_serial("dest_serial"); wait_for_migration_complete(from); =20 + if (uffd_feature_thread_id) { + read_blocktime(to); + } g_free(uri); =20 test_migrate_end(from, to); --=20 2.7.4 From nobody Sun May 5 09:01:12 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; dkim=fail; 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 1509369768535844.4417048801862; Mon, 30 Oct 2017 06:22:48 -0700 (PDT) Received: from localhost ([::1]:40701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9A1a-0006JE-Ln for importer@patchew.org; Mon, 30 Oct 2017 09:22:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e99w2-0002GN-Gd for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e99vy-00045l-4J for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:58 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:51569) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e99vx-00044u-QW for qemu-devel@nongnu.org; Mon, 30 Oct 2017 09:16:54 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171030131652euoutp01bb3edbbbde850a3cf0f87f04443d7bdd~yW3vHR5U50384103841euoutp013; Mon, 30 Oct 2017 13:16:52 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171030131651eucas1p262b2b1c033977f59a376e61e2ce56b14~yW3uXbSuz3245832458eucas1p2W; Mon, 30 Oct 2017 13:16:51 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id DB.6B.12944.34627F95; Mon, 30 Oct 2017 13:16:51 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171030131650eucas1p183c745b845ded5e02e842582bb44fd7b~yW3tucdOw0074600746eucas1p1I; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 62.33.20118.24627F95; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OYN00A7O0VNBHD0@eusync3.samsung.com>; Mon, 30 Oct 2017 13:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171030131652euoutp01bb3edbbbde850a3cf0f87f04443d7bdd~yW3vHR5U50384103841euoutp013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1509369412; bh=hfNVJr27DLq+kBCL5RLliBliIL6sEL1dqvkZsXI1e9k=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=mRYy3cMtJXWX14TNXAHrIMWwY/0+uqPaECkWCWBo/kMcXjvlt5ppVuT+TSEZT7mgm fmXkuuZJ4LywEaD1oib/POh6UVDycIG7VDtDK1K7UAFikzibhpRTVwqien9mKI4nzJ DqqzxBnhbDqHows37qRh/hKuEXF5QUdUUMHkm0U4= X-AuditID: cbfec7f4-f79ab6d000003290-19-59f72643b330 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Mon, 30 Oct 2017 16:16:30 +0300 Message-id: <1509369390-8285-7-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1509369390-8285-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djPc7rOat8jDb485rOYe/c8i0Xvtnvs FtM+32a3uNL+k91iy/5v7BbHe3ewWNzZ0sfkwO7x5NpmJo/3+66yefRtWcUYwBzFZZOSmpNZ llqkb5fAlfHpwVWmgsMuFZv/vWVrYHxn2sXIySEhYCIx884JZghbTOLCvfVsXYxcHEICSxkl Tty+zwThfGaUeLrxNitMx/VJF1ggEssYJU4eXwTV0s0k0Tf/EFAVBwebgIHEvnu2IA0iApIS v7tOM4PUMAssZJSYsv85G0iNsECoxP2zbCA1LAKqEu39j1lAbF4BN4kbG1qhlslJ3DzXCXYe p4C7xK0DH8AukhDoYJM4fegxE0SRi8T/ifPZIWxhiVfHt0DZMhKXJ3ezQDS0M0p07+xkhXAm MEqcmf4Xqspe4tTNq2CTmAX4JCZtm84Mcp2EAK9ER5sQRImHxP5jE6EucpR4d2AX2EVCArMY JbbtV5rAKL2AkWEVo0hqaXFuemqxiV5xYm5xaV66XnJ+7iZGYGSe/nf8yw7GxcesDjEKcDAq 8fDeyP0WKcSaWFZcmXuIUYKDWUmEd5Xi90gh3pTEyqrUovz4otKc1OJDjNIcLErivLZRbZFC AumJJanZqakFqUUwWSYOTqkGRhGef2WWPurfTs6Tfzbrxm2rxYfNsuPnb/HUXf57pn37T8ev KyexMf6JSqns0mgqnVtnLBBuM//RT+e7H6s+Wdd7aR5pV9iUbejy9CA3z4/fd/9w653+PF9I WvrnrK8vEt50PZqX2vkpn3MLc8riJJ9rOWuqQuV8ZQ/daj/toMHifXfdncnbGZVYijMSDbWY i4oTARI87kfIAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkluLIzCtJLcpLzFFi42I5/e/4VV0nte+RBl8XGVjMvXuexaJ32z12 i2mfb7NbXGn/yW6xZf83dovjvTtYLO5s6WNyYPd4cm0zk8f7fVfZPPq2rGIMYI7isklJzcks Sy3St0vgyvj04CpTwWGXis3/3rI1ML4z7WLk5JAQMJG4PukCC4QtJnHh3nq2LkYuDiGBJYwS bz/cY4dwepkkrs68AeRwcLAJGEjsu2cL0iAiICnxu+s0M0gNs8BCRolL3a+ZQWqEBUIl7p9l A6lhEVCVaO9/DLaAV8BN4saGVlaIZXISN891MoPYnALuErcOfGACsYWAamZvv8A4gZF3ASPD KkaR1NLi3PTcYiO94sTc4tK8dL3k/NxNjMAA2nbs55YdjF3vgg8xCnAwKvHw3sj9FinEmlhW XJl7iFGCg1lJhHeV4vdIId6UxMqq1KL8+KLSnNTiQ4zSHCxK4ry9e1ZHCgmkJ5akZqemFqQW wWSZODilGhgFrlSzSk4rlbrMe3ANP1+CoP2ax0tkDs7o0inSXnKwqlr6zGtbAZ3PBencf4/a Zh/Y75ovsG/ri3Kp1VVrFP9WdEaWMGw+89d0teMzEeF/SSUMAs7rHP6VXbTd/Hy10xpjtYz+ 49Jp+4Im/JaXuSnxrvhIxJQPu0qfq7M1zOLNrfwVUaVUPFeJpTgj0VCLuag4EQAu5L8wHAIA AA== X-CMS-MailID: 20171030131650eucas1p183c745b845ded5e02e842582bb44fd7b X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171030131650eucas1p183c745b845ded5e02e842582bb44fd7b X-RootMTR: 20171030131650eucas1p183c745b845ded5e02e842582bb44fd7b References: <1509369390-8285-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 v12 6/6] 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, dgilbert@redhat.com, peterx@redhat.com, Alexey Perevalov , i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (identity @samsung.com: inappropriate hash for a=rsa/sha256) X-ZohoMail: RDKM_2 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 | 56 ++++++++++++++++++++++++++++++++++++++++++++= ++++ migration/trace-events | 1 + qapi/migration.json | 11 +++++++++- 6 files changed, 124 insertions(+), 5 deletions(-) diff --git a/hmp.c b/hmp.c index 41fcce6..4f42eb8 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 c5244ae..cd09ba4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -589,14 +589,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; @@ -647,8 +648,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) break; } info->status =3D s->state; - - return info; } =20 /** @@ -712,6 +711,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 fb8d2ef..99f294f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -71,6 +71,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 6bf24e9..2823133 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -108,6 +108,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. @@ -482,6 +531,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; } @@ -959,6 +1011,10 @@ 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) +{ +} + 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 462d157..141e773 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -198,6 +198,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 c20caf4..be4a869 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -156,6 +156,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.11) +# + +# # Since: 0.14.0 ## { 'struct': 'MigrationInfo', @@ -167,7 +174,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 2.7.4