From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494589093816113.15462909332712; Fri, 12 May 2017 04:38:13 -0700 (PDT) Received: from localhost ([::1]:53013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98tg-0007hc-Ld for importer@patchew.org; Fri, 12 May 2017 07:38:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oN-0003YW-HM for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98oK-0000ud-EW for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:43 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:37410) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98oK-0000i2-8q for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:40 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00G2381VKD90@mailout2.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:19 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113219eucas1p267e9d8c0fd4da09566a52e5b6746014f~92IodkZtu1053810538eucas1p2S; Fri, 12 May 2017 11:32:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 0B.9A.04459.24D95195; Fri, 12 May 2017 12:32:18 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113218eucas1p2ee870fa027dea5d1533f2841021fb44d~92In3g8FX0445204452eucas1p2x; Fri, 12 May 2017 11:32:18 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 77.8E.17452.5DD95195; Fri, 12 May 2017 12:34:45 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:18 +0100 (BST) X-AuditID: cbfec7f1-f796e6d00000116b-5f-59159d42b3f6 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:35 +0300 Message-id: <1494588703-9076-2-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djP87pOc0UjDf5tNLKYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFgdWjyfXNjN5vN93lc2jb8sqxgDmKC6blNSczLLUIn27BK6MSzNy C5azV5zve8fawPidtYuRk0NCwESifVI7E4QtJnHh3nq2LkYuDiGBpYwSnR87WSCcz4wSlx78 ZofpWH3zKFTVMkaJ2euvM0M43UwSO461AWU4ONgEDCT23bMFaRARkJT43XWaGcRmFoiVeHv9 GhuILSwQJHFo+UEwm0VAVWLnhpdg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KL 8uOLSnNSiw8xmgLdNJFZSjQ5Hxg9eSXxhiaG5paGRsYWFuZGRkrivCUfroQLCaQnlqRmp6YW pBbB9DFxcEo1MOoy1qzfdVim6Ffx/80h/xPYDwZxVkoxzum5vX198OTLOsuTGGw/rWFd0e9x 7UqG4QXe36b8J133se34fa10i7mdzbFWlvn7Fh84cl96Rni9xN/lHrWmngu6fP7pShSXLfPw b97ed/gvm4p8p0tb87RlIvE3XMV5OJ9MypGuNo+aVXHqxaL6XCWW4oxEQy3mouJEAENz3OFm AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170512113218eucas1p2ee870fa027dea5d1533f2841021fb44d 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-HopCount: 7 X-CMS-RootMailID: 20170512113218eucas1p2ee870fa027dea5d1533f2841021fb44d X-RootMTR: 20170512113218eucas1p2ee870fa027dea5d1533f2841021fb44d References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH V4 1/9] userfault: add pid into uffd_msg & update 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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 duplicates header of "userfaultfd: provide pid in userfault msg" into linux kernel. Signed-off-by: Alexey Perevalov --- linux-headers/linux/userfaultfd.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-headers/linux/userfaultfd.h b/linux-headers/linux/userfa= ultfd.h index 2ed5dc3..e7c8898 100644 --- a/linux-headers/linux/userfaultfd.h +++ b/linux-headers/linux/userfaultfd.h @@ -77,6 +77,9 @@ struct uffd_msg { struct { __u64 flags; __u64 address; + union { + __u32 ptid; + } feat; } pagefault; =20 struct { @@ -158,6 +161,8 @@ struct uffdio_api { #define UFFD_FEATURE_EVENT_MADVDONTNEED (1<<3) #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) #define UFFD_FEATURE_MISSING_SHMEM (1<<5) +#define UFFD_FEATURE_EVENT_UNMAP (1<<6) +#define UFFD_FEATURE_THREAD_ID (1<<7) __u64 features; =20 __u64 ioctls; --=20 1.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494589055468728.8714231566992; Fri, 12 May 2017 04:37:35 -0700 (PDT) Received: from localhost ([::1]:53012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98t3-0007B8-5S for importer@patchew.org; Fri, 12 May 2017 07:37:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oN-0003Yj-Or for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98oK-0000uq-Ke for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:43 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:37410) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98oK-0000i2-F7 for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:40 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00LMV81W6280@mailout2.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:20 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113219eucas1p1b6b07064c3bc9332d7a2e3a57939deca~92IpN3Lcr3189431894eucas1p1k; Fri, 12 May 2017 11:32:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 40.38.14140.64D95195; Fri, 12 May 2017 12:32:22 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113219eucas1p1b48d524f95168b4e21e5fa0e81a107f7~92IonTkq13189931899eucas1p1U; Fri, 12 May 2017 11:32:19 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 56.A1.20206.36D95195; Fri, 12 May 2017 12:32:51 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:18 +0100 (BST) X-AuditID: cbfec7ef-f796a6d00000373c-c0-59159d469c84 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:36 +0300 Message-id: <1494588703-9076-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djP87puc0UjDZ41ilvMvXuexaJ32z12 iyvtP9kttuz/xm5xvHcHiwOrx5Nrm5k83u+7yubRt2UVYwBzFJdNSmpOZllqkb5dAlfGw3va Bd9kKu6dWcrYwNgg3sXIySEhYCJxeNd+RghbTOLCvfVsXYxcHEICyxglWh4cZQVJCAl8ZpT4 eawApuHevVfMcEWXn91hgXC6mSR2HGsDaufgYBMwkNh3zxakQURAUuJ312lmEJtZIFbi7fVr YBuEBToZJS5uXw+2gUVAVWLTxB6wXl4BN4n+7ykQy+QkTh6bDFbCKeAu8WHNckaQXgmBy2wS 69qWMoHUSwjISmw6wAxR7yKxZuJXFghbWOLV8S3sELaMxOXJ3SwQve2MEt07O1khnAmMEmem /4Wqspc4dfMqE8SlfBKTtk1nhljAK9HRJgRR4iHR9/cSVLmjxNn/rdCQmMUosbx5PdsERpkF jAyrGEVSS4tz01OLDfWKE3OLS/PS9ZLzczcxAiPz9L/j73cwPm0OOcQowMGoxMMrUSUSKcSa WFZcmXuIUYKDWUmEd0W8aKQQb0piZVVqUX58UWlOavEhRmkOFiVxXt5T1yKEBNITS1KzU1ML UotgskwcnFINjKwv4m4tb7px/rrx472q33hMt9+en2VlNqPqSlR205l/Od3yE4J/F6emH2+Q +p9dc+ZDraPQlompEpaRUk2upSpTE94teWteGm9sbOvw3GzSkpeGR+VktgRzcm3pWnpVhI1z 7laHX2mK//sSrO3XpO5rDeTWOTslSP+X1zLtO9wmfYpCXZ0lSizFGYmGWsxFxYkAKtQEsMgC AAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsVy+t/xK7rJc0UjDX7MYbeYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFgdWjyfXNjN5vN93lc2jb8sqxgDmKDebjNTElNQihdS85PyUzLx0 W6XQEDddCyWFvMTcVFulCF3fkCAlhbLEnFIgz8gADTg4B7gHK+nbJbhlPLynXfBNpuLemaWM DYwN4l2MnBwSAiYS9+69YoawxSQu3FvP1sXIxSEksIRR4ufmK0wQTi+TxJ7LZ4AcDg42AQOJ ffdsQRpEBCQlfnedBmtmFoiVuDThBVizsEAno8TF7etZQRIsAqoSmyb2sIH08gq4SfR/T4FY Jidx8thksBJOAXeJD2uWM4KUCAGVzP0XO4GRdwEjwypGkdTS4tz03GIjveLE3OLSvHS95Pzc TYzAAN127OeWHYxd74IPMQpwMCrx8EpUiUQKsSaWFVfmHmKU4GBWEuFdES8aKcSbklhZlVqU H19UmpNafIjRFOikicxSosn5wOjJK4k3NDE0tzQ0MrawMDcyUhLnnfrhSriQQHpiSWp2ampB ahFMHxMHp1QDI8+GvyYXNjoxLNf88WIt19prvu3qF2187Pf6mJxbeGRuU4og2+Hjb7X/eFhW a+gLCzJ2CRy6WPlv8dTopesLXp5uvD55xgNfs5qFP5U/RtVsf+dzgiVupdvrLxtT/iXqKWXv vOdfrHpvVYVucc8J8f7JUx2q5KQfyT278ztqraZtk83nR7McipVYijMSDbWYi4oTAYZ1Cwtm AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170512113219eucas1p1b48d524f95168b4e21e5fa0e81a107f7 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-HopCount: 7 X-CMS-RootMailID: 20170512113219eucas1p1b48d524f95168b4e21e5fa0e81a107f7 X-RootMTR: 20170512113219eucas1p1b48d524f95168b4e21e5fa0e81a107f7 References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH V4 2/9] migration: pass ptr to MigrationIncomingState into migration ufd_version_check & postcopy_ram_supported_by_host 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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 --- migration/migration.c | 2 +- migration/postcopy-ram.c | 10 +++++----- migration/postcopy-ram.h | 2 +- migration/savevm.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 799952c..1cce2a1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -804,7 +804,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, * special support. */ if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host()) { + !postcopy_ram_supported_by_host(NULL)) { /* 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 cdadaf6..fbccc53 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -59,7 +59,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; @@ -112,7 +112,7 @@ static int test_range_shared(const char *block_name, vo= id *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; @@ -135,7 +135,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 @@ -512,7 +512,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 @@ -650,7 +650,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 4c25f03..848595f 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 352a8f2..28b3499 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1356,7 +1356,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.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494589007134840.4434862001572; Fri, 12 May 2017 04:36:47 -0700 (PDT) Received: from localhost ([::1]:53009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98sG-0006UZ-Pz for importer@patchew.org; Fri, 12 May 2017 07:36:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oN-0003Yr-Ut for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98oK-0000v1-QM for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:43 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:37410) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98oK-0000i2-LG for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:40 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00LMV81W6280@mailout2.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:20 +0100 (BST) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113220eucas1p2462435e1af25ba70e0624bfb629552cf~92IpuLOd61053810538eucas1p2U; Fri, 12 May 2017 11:32:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 4D.47.25577.44D95195; Fri, 12 May 2017 12:32:20 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113219eucas1p277b36f4201c866269886509677e553c3~92IpJtYTE0445604456eucas1p23; Fri, 12 May 2017 11:32:19 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 07.A1.20206.36D95195; Fri, 12 May 2017 12:32:51 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:19 +0100 (BST) X-AuditID: cbfec7f5-f792f6d0000063e9-84-59159d44f19d From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:37 +0300 Message-id: <1494588703-9076-4-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKP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FvP1sXIxSEksIRRYvfPb0wQTi+TxLc9Rxm7GDk42AQM JPbdswVpEBGQlPjddZoZxGYWiJW4NOEFG4gtLOAn8ae/GSzOIqAqse78XCYQm1fATaLt21Wo xXISJ49NZgWxOQXcJT6sWQ42XgioZu6/2AmMvAsYGVYxiqSWFuem5xYb6RUn5haX5qXrJefn bmIEBui2Yz+37GDsehd8iFGAg1GJh1eiSiRSiDWxrLgy9xCjBAezkgjvinjRSCHelMTKqtSi /Pii0pzU4kOMpkA3TWSWEk3OB0ZPXkm8oYmhuaWhkbGFhbmRkZI479QPV8KFBNITS1KzU1ML Uotg+pg4OKUaGLNUBCdMF65w9t1zuprZ2cnuz5vty5dfvfj2ZhXTfc/PLVK+LBLt3uor7h2Y 4bqkVkAz6LVRne+fqyf8mdOY7iqxbl6g/I0tQoR/35yiat7lclayW4yKl4Tsd/ufIB39Nvti 7p70fDabM6WHtBvi5A6/fCQ3Tbh469NUP88MRSX+mn7rX48MlFiKMxINtZiLihMBH74AxmYC AAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170512113219eucas1p277b36f4201c866269886509677e553c3 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-HopCount: 7 X-CMS-RootMailID: 20170512113219eucas1p277b36f4201c866269886509677e553c3 X-RootMTR: 20170512113219eucas1p277b36f4201c866269886509677e553c3 References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH V4 3/9] 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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" 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 fbccc53..b6eccaf 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -67,7 +67,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.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494589439358387.6550179380122; Fri, 12 May 2017 04:43:59 -0700 (PDT) Received: from localhost ([::1]:53028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98zF-0001Ch-UB for importer@patchew.org; Fri, 12 May 2017 07:43:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98y7-0000cO-Cr for qemu-devel@nongnu.org; Fri, 12 May 2017 07:42:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98y2-0000eM-Bn for qemu-devel@nongnu.org; Fri, 12 May 2017 07:42:47 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:14280) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98y2-0000Ye-0k for qemu-devel@nongnu.org; Fri, 12 May 2017 07:42:42 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00JUS81XF380@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:21 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113221eucas1p2312c0a7db5b11eac1dbd1f3192dc56c0~92IqUKDnQ2905629056eucas1p2a; Fri, 12 May 2017 11:32:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id CB.9A.04459.44D95195; Fri, 12 May 2017 12:32:20 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113220eucas1p1eab5d2f9773a132e09393f41e6dfd251~92IptfQTS0876608766eucas1p11; Fri, 12 May 2017 11:32:20 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 87.A1.20206.46D95195; Fri, 12 May 2017 12:32:52 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:20 +0100 (BST) X-AuditID: cbfec7f1-f796e6d00000116b-64-59159d44bfa0 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:38 +0300 Message-id: <1494588703-9076-5-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsWy7djPc7ouc0UjDY68NbSYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFgdWjyfXNjN5vN93lc2jb8sqxgDmKC6blNSczLLUIn27BK6Mn88W sBfMUK242f2AqYHxhnQXIyeHhICJxL7OXhYIW0ziwr31bF2MXBxCAksZJU6/WMQM4XxmlNj9 7yIjTMeqBzdYIRLLGCXufTgCVdXNJNF2eSJ7FyMHB5uAgcS+e7YgDSICkhK/u04zg9jMArES b69fYwOxhQXiJU70f2IGKWcRUJU49FQBJMwr4CbR9+oSO8QuOYmTxyazgticAu4SH9YsZwRZ JSFwnU2iddMUJpBeCQFZiU0HmCHqXSQ29R1ig7CFJV4d3wI1R0bi8uRuFojedkaJ7p2drBDO BEaJM9P/QlXZS5y6eZUJ4lA+iUnbpjNDLOCV6GgTgjA9JH5uKoAwHSXuvsyH+HwWo8SCqa+Z JzDKLGBkWMUoklpanJueWmykV5yYW1yal66XnJ+7iREYl6f/Hf+4g/H9CatDjAIcjEo8vBJV IpFCrIllxZW5hxglOJiVRHhXxItGCvGmJFZWpRblxxeV5qQWH2KU5mBREuflOnUtQkggPbEk NTs1t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p1eab5d2f9773a132e09393f41e6dfd251 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-HopCount: 7 X-CMS-RootMailID: 20170512113220eucas1p1eab5d2f9773a132e09393f41e6dfd251 X-RootMTR: 20170512113220eucas1p1eab5d2f9773a132e09393f41e6dfd251 References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH V4 4/9] 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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 need 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. Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 82 ++++++++++++++++++++++++++++++++++++++++++--= ---- 1 file changed, 73 insertions(+), 9 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index b6eccaf..a16cde8 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -59,32 +59,96 @@ struct PostcopyDiscardState { #include #include =20 -static bool ufd_version_check(int ufd, MigrationIncomingState *mis) + +/* + * Check userfault fd features, to request only supported features in + * future. + * __NR_userfaultfd - should be checked before + * Return obtained features + */ +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) { + 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__ + 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; +} + +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 - ioctl_mask =3D (__u64)1 << _UFFDIO_REGISTER | - (__u64)1 << _UFFDIO_UNREGISTER; + ioctl_mask =3D 1 << _UFFDIO_REGISTER | + 1 << _UFFDIO_UNREGISTER; if ((api_struct.ioctls & ioctl_mask) !=3D ioctl_mask) { error_report("Missing userfault features: %" PRIx64, (uint64_t)(~api_struct.ioctls & ioctl_mask)); return false; } =20 + return true; +} + +static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) +{ + uint64_t asked_features =3D 0; + uint64_t supported_features; + + /* + * it's not possible to + * request UFFD_API twice per one fd + */ + 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"); @@ -135,7 +199,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 @@ -512,7 +576,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.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494588849488791.8267160746605; Fri, 12 May 2017 04:34:09 -0700 (PDT) Received: from localhost ([::1]:52990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98pi-0004Kg-D6 for importer@patchew.org; Fri, 12 May 2017 07:34:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oA-0003HJ-Rq for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98o7-0000mD-Mr for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:30 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:49631) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98o7-0000kM-HK for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:27 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00HFY81YWY80@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:22 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113221eucas1p18e4976818f1256d4416c51c202981930~92Iq2tA7y0877708777eucas1p1v; Fri, 12 May 2017 11:32:21 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 21.38.14140.84D95195; Fri, 12 May 2017 12:32:24 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113220eucas1p14c340af61c08de90fe20a16be9a3d180~92IqPalXa0876608766eucas1p12; Fri, 12 May 2017 11:32:20 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 09.A1.20206.46D95195; Fri, 12 May 2017 12:32:52 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:20 +0100 (BST) X-AuditID: cbfec7ef-f796a6d00000373c-c5-59159d480025 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:39 +0300 Message-id: <1494588703-9076-6-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djP87oec0UjDV7f5LCYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFgdWjyfXNjN5vN93lc2jb8sqxgDmKC6blNSczLLUIn27BK6M7x37 WArahSr2TF3A0sD4ia+LkZNDQsBE4tzKB0wQtpjEhXvr2boYuTiEBJYxSjzc/xDK+cwosera YmaYjrmLV7DAVf3bsxqqqptJou3yRPYuRg4ONgEDiX33bEEaRAQkJX53nQZrZhaIlXh7/Rob SImwgJfEvRvxIGEWAVWJWYcPsoLYvAJuEutXdrFB7JKTOHlsMlicU8Bd4sOa5YwgqyQErrNJ vJnxHmyVhICsxKYDULe5SExpnsEOYQtLvDq+BcqWkbg8uZsForedUaJ7ZycrhDOBUeLM9L9Q VfYSp25eZYI4lE9i0rbpzBALeCU62oQgTA+JzQvtIaodJV58ewUNh1mMEm/nHWacwCizgJFh FaNIamlxbnpqsaFecWJucWleul5yfu4mRmBknv53/P0OxqfNIYcYBTgYlXh4JapEIoVYE8uK K3MPMUpwMCuJ8K6IF40U4k1JrKxKLcqPLyrNSS0+xCjNwaIkzst76lqEkEB6YklqdmpqQWoR TJ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14c340af61c08de90fe20a16be9a3d180 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-HopCount: 7 X-CMS-RootMailID: 20170512113220eucas1p14c340af61c08de90fe20a16be9a3d180 X-RootMTR: 20170512113220eucas1p14c340af61c08de90fe20a16be9a3d180 References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.14 Subject: [Qemu-devel] [PATCH V4 5/9] 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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. Signed-off-by: Alexey Perevalov --- include/migration/migration.h | 1 + migration/migration.c | 9 +++++++++ qapi-schema.json | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index e29cb01..30108d3 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -316,6 +316,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_message(MigrationIncomingState *mis, diff --git a/migration/migration.c b/migration/migration.c index 1cce2a1..b0af75f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1371,6 +1371,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/qapi-schema.json b/qapi-schema.json index 5728b7f..df9f801 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -894,11 +894,14 @@ # @release-ram: if enabled, qemu will free the migrated ram pages on the s= ource # during postcopy-ram migration. (since 2.9) # +# @postcopy-blocktime: Calculate downtime for postcopy live migration (sin= ce 2.10) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', - 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram'] } + 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', + 'postcopy-blocktime'] } =20 ## # @MigrationCapabilityStatus: --=20 1.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494588875303304.3393251133824; Fri, 12 May 2017 04:34:35 -0700 (PDT) Received: from localhost ([::1]:52992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98q9-0004fh-Mr for importer@patchew.org; Fri, 12 May 2017 07:34:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oL-0003XU-Na for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98oI-0000tZ-I9 for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:41 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:19970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98oI-0000ix-89 for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:38 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00JSG81YAD80@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:22 +0100 (BST) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113222eucas1p17f9771c49257bbb2921c2d070bd9a392~92IrM_vkq3190631906eucas1p1W; Fri, 12 May 2017 11:32:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id A2.C8.17464.54D95195; Fri, 12 May 2017 12:32:21 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113221eucas1p2c0908a17f830fe10ce233ab2248ff0e4~92Iqkkekf0890908909eucas1p2Z; Fri, 12 May 2017 11:32:21 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 79.8E.17452.8DD95195; Fri, 12 May 2017 12:34:48 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:21 +0100 (BST) X-AuditID: cbfec7f2-f797e6d000004438-55-59159d4585af From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:40 +0300 Message-id: <1494588703-9076-7-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djPc7quc0UjDR6d17OYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFgdWjyfXNjN5vN93lc2jb8sqxgDmKC6blNSczLLUIn27BK6Mp5se sxa81ao417OJpYGxWamLkZNDQsBEYuu5dkYIW0ziwr31bF2MXBxCAksZJaZcnM8GkhAS+Mwo sXRhOEzDvNP7GCGKljFK7P27kB3C6WaS2HfpNEsXIwcHm4CBxL57tiANIgKSEr+7TjOD2MwC sRJvr18DGyoskCLxavscsM0sAqoS605PBrN5Bdwk1v3tZoZYJidx8thkVhCbU8Bd4sOa5WCL JQQus0m0Hr/KBLJLQkBWYtMBqHoXif6lS9ggbGGJV8e3sEPYMhKdHQeZIHrbGSW6d3ayQjgT GCXOTP8LVWUvceomyFCQS/kkJm2bzgyxgFeio00IosRD4vKvuVALHCV+/P4HDa5ZjBKv931g m8Aos4CRYRWjSGppcW56arGxXnFibnFpXrpecn7uJkZgbJ7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vOp0+0pE6Q0ivzspLiaU4I9FQi7moOBEAYjSaVWcC AAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170512113221eucas1p2c0908a17f830fe10ce233ab2248ff0e4 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-HopCount: 7 X-CMS-RootMailID: 20170512113221eucas1p2c0908a17f830fe10ce233ab2248ff0e4 X-RootMTR: 20170512113221eucas1p2c0908a17f830fe10ce233ab2248ff0e4 References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.13 Subject: [Qemu-devel] [PATCH V4 6/9] migration: add postcopy vcpu blocktime context 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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 at the tail of 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 Signed-off-by: Alexey Perevalov --- include/migration/migration.h | 8 +++++ migration/postcopy-ram.c | 76 +++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 84 insertions(+) diff --git a/include/migration/migration.h b/include/migration/migration.h index 30108d3..3f34920 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -83,6 +83,8 @@ typedef enum { POSTCOPY_INCOMING_END } PostcopyState; =20 +struct PostcopyBlocktimeContext; + /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -123,6 +125,12 @@ struct MigrationIncomingState { =20 /* See savevm.c */ LoadStateEntry_Head loadvm_handlers; + + /* + * 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 a16cde8..fd5aadd 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -59,6 +59,73 @@ 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 postcopy_migration_cb(Notifier *n, void *data) +{ + PostcopyBlocktimeContext *ctx =3D container_of(n, PostcopyBlocktimeCon= text, + postcopy_notifier); + MigrationState *s =3D data; + if (migration_has_finished(s) || migration_has_failed(s)) { + g_free(ctx->page_fault_vcpu_time); + /* g_free is NULL robust */ + ctx->page_fault_vcpu_time =3D NULL; + g_free(ctx->vcpu_addr); + ctx->vcpu_addr =3D NULL; + } +} + +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; + ctx->postcopy_notifier.notify =3D postcopy_migration_cb; + qemu_add_exit_notifier(&ctx->exit_notifier); + add_migration_state_change_notifier(&ctx->postcopy_notifier); + return ctx; +} =20 /* * Check userfault fd features, to request only supported features in @@ -133,6 +200,15 @@ static bool ufd_check_and_apply(int ufd, MigrationInco= mingState *mis) return false; } =20 +#ifdef UFFD_FEATURE_THREAD_ID + if (migrate_postcopy_blocktime() && mis && + UFFD_FEATURE_THREAD_ID & supported_features) { + /* kernel supports that feature */ + 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.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494588989979333.6005602157742; Fri, 12 May 2017 04:36:29 -0700 (PDT) Received: from localhost ([::1]:53006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98s0-0006HY-H6 for importer@patchew.org; Fri, 12 May 2017 07:36:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oM-0003Xe-0a for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98oI-0000tk-QQ for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:42 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:19970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98oI-0000ix-JO for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:38 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00JR881ZQU80@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:23 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113223eucas1p2f575857c6d9a49c25fedc037eb66d673~92IsI4uUI1055610556eucas1p2A; Fri, 12 May 2017 11:32:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id C8.13.04729.64D95195; Fri, 12 May 2017 12:32:22 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113222eucas1p2f0964bb82e343438798c1c341c1cfe8a~92IrV8-lO1054210542eucas1p2d; Fri, 12 May 2017 11:32:22 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 89.A1.20206.66D95195; Fri, 12 May 2017 12:32:54 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:21 +0100 (BST) Date: Fri, 12 May 2017 14:31:41 +0300 From: Alexey Perevalov In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> To: qemu-devel@nongnu.org Message-id: <1494588703-9076-8-git-send-email-a.perevalov@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.9.1 Content-transfer-encoding: quoted-printable X-Sender-IP: 182.198.249.180 CMS-TYPE: 201P X-AuditID: cbfec7f4-f79806d000001279-69-59159d4641ce X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDIsWRmVeSWpSXmKPExsWy7djPc7puc0UjDX5261vMvXuexaJ32z12 iyvtP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v gfGDXhcjJ4eEgIlE28UDLBC2mMSFe+vZuhi5OIQEljBKNMx+xAaS4BUQlPgx+R5QEQcHs4C8 xJFL2SBhZgF1iUnzFjFD1PcySdx6vo8RpIZNwEBi3z1bkBoRAUmJ312nmSHqYyUuTXgBNlJY wF3i99MJYHEWAVWJPy92Q61yk9g4dS4bxD1yEiePTWYFsTmB6j+sWQ42XgioZu6/2AmMArOQ HDcL4bhZSI5bwMi8ilEktbQ4Nz232EivODG3uDQvXS85P3cTIzBath37uWUHY9e74EOMAhyM Sjy8ElUikUKsiWXFlbmHGCU4mJVEeFfEi0YK8aYkVlalFuXHF5XmpBYfYjQFOnsis5Rocj4w kvNK4g1NDM0tDY2MLSzMjYyUxHmnfrgSLiSQnliSmp2aWpBaBNPHxMEp1cC4VnTfhIN+RxYk 7GbI0BF+ZZG5InbHVfVtM75wOm/ZcrPNWGS5EVtCu+l3htnqLn8tHn1NO7M4fn0c15947z2V Mgu27zhmNUXZveWzR+jhslnZO85/PJ5uqb3o8DOzjonWO65fm8H8oDxi8fbwEpfb4R1Lqu7P 0J547Hf/Ta/NC16clltx8pDMOyWW4oxEQy3mouJEAB+1mSesAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170512113222eucas1p2f0964bb82e343438798c1c341c1cfe8a X-Msg-Generator: CA 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==?= X-HopCount: 7 X-CMS-RootMailID: 20170512113222eucas1p2f0964bb82e343438798c1c341c1cfe8a X-RootMTR: 20170512113222eucas1p2f0964bb82e343438798c1c341c1cfe8a References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.13 Subject: [Qemu-devel] [PATCH V4 7/9] 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_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. PostcopyBlocktimeContext is not protected by lock, due to structure itself = is not changing except postcopy end callback, but even in that time will be query-migrate request, query-migrate is not touching page_fault_vcpu_time & vcpu_addr.=20 Also atomic for int64_t is using here, but QEMU's atomic_read/set is not allowing operation on types which bigger than pointer size, although clang/= gcc supports it ("=E2=80=98__atomic=E2=80=99 builtins can be used with any integral scalar = or pointer type that is 1, 2, 4, or 8 bytes in length) also on 32 platforms such as AR= M. Maybe could be a problem with mingw, but postcopy is under linux ifdef. Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 87 ++++++++++++++++++++++++++++++++++++++++++++= +++- migration/trace-events | 5 ++- 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index fd5aadd..db95747 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -23,6 +23,7 @@ #include "postcopy-ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h" +#include #include "qemu/error-report.h" #include "trace.h" =20 @@ -541,6 +542,86 @@ static int ram_block_enable_notify(const char *block_n= ame, 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) { + return cpu_iter->cpu_index; + } + } + trace_get_mem_fault_cpu_index(pid); + return -1; +} + +static void mark_postcopy_blocktime_begin(uint64_t addr, int cpu) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *dc; + int64_t now_ms; + if (!mis->blocktime_ctx || cpu < 0) { + return; + } + now_ms =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + dc =3D mis->blocktime_ctx; + 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); + + trace_mark_postcopy_blocktime_begin(addr, dc, dc->page_fault_vcpu_time= [cpu], + cpu); +} + +static void mark_postcopy_blocktime_end(uint64_t addr) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *dc; + int i, affected_cpu =3D 0; + int64_t now_ms; + bool vcpu_total_blocktime =3D false; + + if (!mis->blocktime_ctx) { + return; + } + dc =3D mis->blocktime_ctx; + 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); +} + /* * Handle faults detected by the USERFAULT markings */ @@ -618,8 +699,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), + get_mem_fault_cpu_index(msg.arg.pagefault.feat.pt= id)); /* * Send the request to the source - we want to request one * of our host page sizes (which is >=3D TPS) @@ -714,6 +798,7 @@ int postcopy_place_page(MigrationIncomingState *mis, vo= id *host, void *from, =20 return -e; } + mark_postcopy_blocktime_end((uint64_t)(uintptr_t)host); =20 trace_postcopy_place_page(host); return 0; diff --git a/migration/trace-events b/migration/trace-events index 5b8ccf3..7bdadbb 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -112,6 +112,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) "addr 0x%" PRIx64 " dd %p time %" PRId64 " cpu %d" +mark_postcopy_blocktime_end(uint64_t addr, void *dd, int64_t time) "addr 0= x%" PRIx64 " dd %p time %" PRId64 =20 # migration/rdma.c qemu_rdma_accept_incoming_migration(void) "" @@ -188,7 +190,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=3D%" PRIx64 " rb=3D%s offset=3D%zx" +postcopy_ram_fault_thread_request(uint64_t hostaddr, const char *ramblock,= size_t offset, uint32_t pid) "Request for HVA=3D%" PRIx64 " rb=3D%s offset= =3D%zx %u" postcopy_ram_incoming_cleanup_closeuf(void) "" postcopy_ram_incoming_cleanup_entry(void) "" postcopy_ram_incoming_cleanup_exit(void) "" @@ -197,6 +199,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(uint32_t pid) "pid %u is not vCPU" =20 # migration/exec.c migration_exec_outgoing(const char *cmd) "cmd=3D%s" --=20 1.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 1494588882314985.9153286598457; Fri, 12 May 2017 04:34:42 -0700 (PDT) Received: from localhost ([::1]:52993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98qH-0004kf-2U for importer@patchew.org; Fri, 12 May 2017 07:34:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oM-0003Xk-8d for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98oJ-0000ty-1q for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:42 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:19970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98oI-0000ix-RU for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:38 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00JR881ZQU80@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:23 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113223eucas1p111558ca3ff6df67eb8eb283e612fe787~92IscqFSC2798327983eucas1p1w; Fri, 12 May 2017 11:32:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 4C.9A.04459.74D95195; Fri, 12 May 2017 12:32:23 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113222eucas1p218e8147a2c7d5c7ce9cbaf3d376b1332~92Ir3ytts0445604456eucas1p29; Fri, 12 May 2017 11:32:22 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E9.A1.20206.66D95195; Fri, 12 May 2017 12:32:54 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:22 +0100 (BST) X-AuditID: cbfec7f1-f796e6d00000116b-68-59159d47f6d3 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:42 +0300 Message-id: <1494588703-9076-9-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djP87ruc0UjDRbsZ7OYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFgdWjyfXNjN5vN93lc2jb8sqxgDmKC6blNSczLLUIn27BK6MbYuN CybZVSy+fYitgfGaQRcjJ4eEgInEh/657BC2mMSFe+vZuhi5OIQEljJK/NnSwwrhfGaUeDHt KytMx5U985ggEssYJa4vPsAC4XQzSUzoWMjcxcjBwSZgILHvni1Ig4iApMTvrtPMIDazQKzE 2+vX2EBsYYEQibVXVoCtZhFQldg64Q5YnFfATeLcw1fMEMvkJE4emwy2mFPAXeLDmuWMILsk BK6zSayfuYcRZJeEgKzEpgNQ9S4S019+ZYGwhSVeHd8C9ZqMxOXJ3SwQve2MEt07O1khnAmM Emem/4Wqspc4dfMqE8SlfBKTtk1nhljAK9HRJgRheki8XBgIUe0ocWXie2hwzWKUWHikh3kC o8wCRoZVjCKppcW56anFRnrFibnFpXnpesn5uZsYgZF5+t/xjzsY35+wOsQowM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zFU3ePNWfi9u+lKoxFKckWioxVxUnAgApIkR JWYCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170512113222eucas1p218e8147a2c7d5c7ce9cbaf3d376b1332 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-HopCount: 7 X-CMS-RootMailID: 20170512113222eucas1p218e8147a2c7d5c7ce9cbaf3d376b1332 X-RootMTR: 20170512113222eucas1p218e8147a2c7d5c7ce9cbaf3d376b1332 References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.13 Subject: [Qemu-devel] [PATCH V4 8/9] 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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 distinguish src/dst, state of the MigrationState is using, query-migrate prepares MigrationInfo for source machine only in case of migration's state is diffe= rent than MIGRATION_STATUS_NONE. 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. Signed-off-by: Alexey Perevalov --- include/migration/migration.h | 4 +++ migration/migration.c | 47 ++++++++++++++++++++++++++++-- migration/postcopy-ram.c | 68 +++++++++++++++++++++++++++++++++++++++= ++++ migration/trace-events | 1 + qapi-schema.json | 6 +++- 5 files changed, 122 insertions(+), 4 deletions(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index 3f34920..3e5aee7 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -135,6 +135,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 struct MigrationState { diff --git a/migration/migration.c b/migration/migration.c index b0af75f..605aab2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -666,9 +666,15 @@ static void populate_ram_info(MigrationInfo *info, Mig= rationState *s) } } =20 -MigrationInfo *qmp_query_migrate(Error **errp) +/* TODO improve this assumption */ +static bool is_source_migration(void) +{ + MigrationState *ms =3D migrate_get_current(); + return ms->state !=3D MIGRATION_STATUS_NONE; +} + +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) { @@ -759,10 +765,45 @@ MigrationInfo *qmp_query_migrate(Error **errp) break; } info->status =3D s->state; +} + +static void fill_destination_migration_info(MigrationInfo *info) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 - return info; + switch (mis->state) { + case MIGRATION_STATUS_NONE: + 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; } =20 +MigrationInfo *qmp_query_migrate(Error **errp) +{ + MigrationInfo *info =3D g_malloc0(sizeof(*info)); + + if (is_source_migration()) { + fill_source_migration_info(info); + } else { + fill_destination_migration_info(info); + } + + return info; + } + void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, Error **errp) { diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index db95747..ced4b5a 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -128,6 +128,71 @@ 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 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) + */ +void fill_destination_postcopy_migration_info(MigrationInfo *info) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + if (!mis->blocktime_ctx) { + return; + } + + info->has_postcopy_blocktime =3D true; + info->postcopy_blocktime =3D mis->blocktime_ctx->total_blocktime; + info->has_postcopy_vcpu_blocktime =3D true; + info->postcopy_vcpu_blocktime =3D get_vcpu_blocktime_list(mis->blockti= me_ctx); +} + +static uint64_t get_postcopy_total_blocktime(void) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + if (!mis->blocktime_ctx) { + return 0; + } + + return mis->blocktime_ctx->total_blocktime; +} + /* * Check userfault fd features, to request only supported features in * future. @@ -461,6 +526,9 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingStat= e *mis) } =20 postcopy_state_set(POSTCOPY_INCOMING_END); + /* here should be blocktime receiving back operation */ + trace_postcopy_ram_incoming_cleanup_blocktime( + get_postcopy_total_blocktime()); migrate_send_rp_shut(mis, qemu_file_get_error(mis->from_src_file) !=3D= 0); =20 if (mis->postcopy_tmp_page) { diff --git a/migration/trace-events b/migration/trace-events index 7bdadbb..55a3b6e 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -195,6 +195,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-schema.json b/qapi-schema.json index df9f801..92df9bb 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -712,6 +712,8 @@ # @status is 'failed'. Clients should not attempt to parse the # error strings. (Since 2.7) # +# @postcopy_vcpu_blocktime: list of the postcopy blocktime per vCPU (Since= 2.9) +# # Since: 0.14.0 ## { 'struct': 'MigrationInfo', @@ -723,7 +725,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.8.3.1 From nobody Sat Feb 7 05:52:27 2026 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.zoho.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 149458887345465.63531137534108; Fri, 12 May 2017 04:34:33 -0700 (PDT) Received: from localhost ([::1]:52991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98q7-0004d1-NF for importer@patchew.org; Fri, 12 May 2017 07:34:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98oL-0003XQ-Hx for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98oI-0000tR-E6 for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:41 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:13817) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d98oI-0000kD-87 for qemu-devel@nongnu.org; Fri, 12 May 2017 07:32:38 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPU00IYO820FZ80@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 12 May 2017 12:32:24 +0100 (BST) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170512113223eucas1p1bf3584c8c045f0c0ece60ab367e84624~92Is9O1PC2799827998eucas1p1i; Fri, 12 May 2017 11:32:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 33.C8.17464.74D95195; Fri, 12 May 2017 12:32:23 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170512113223eucas1p2c2a88ead00f3121fc1bfc8dab4f18c78~92IsSAFSG1066010660eucas1p2e; Fri, 12 May 2017 11:32:23 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AA.8E.17452.ADD95195; Fri, 12 May 2017 12:34:50 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPU0053K81CCS30@eusync2.samsung.com>; Fri, 12 May 2017 12:32:23 +0100 (BST) X-AuditID: cbfec7f2-f797e6d000004438-59-59159d4778f1 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 14:31:43 +0300 Message-id: <1494588703-9076-10-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djPc7ruc0UjDVb8U7eYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFgdWjyfXNjN5vN93lc2jb8sqxgDmKC6blNSczLLUIn27BK6M+29+ sBXs4ah4fPgXYw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Wa//csI sUxO4uSxyawgNidQ/MOa5WDjhQTcJOb+i53AyLuAkWEVo0hqaXFuem6xoV5xYm5xaV66XnJ+ 7iZGYIBuO/Zz8w7GSxuDDzEKcDAq8fBKVIlECrEmlhVX5h5ilOBgVhLhXREvGinEm5JYWZVa lB9fVJqTWnyI0RToponMUqLJ+cDoySuJNzQxNLc0NDK2sDA3MlIS5y35cCVcSCA9sSQ1OzW1 ILUIpo+Jg1OqgdHlHsdv9S1+4geZe785vHpkeylH/uy+XwEu7i5V7tVh7juz2EOy58r3261u nThnuliMgRtX4hcOkdbVXGs//NmbxWDCpHZrctLewyo8r86Ftt/b+Hl/qUXtjEWLFpVdTj+W ysU68b30uUObdN/JpL6YfvpIytbYt/eMciv6ZyZouGW+ebw0mFuJpTgj0VCLuag4EQDnGjVP ZgIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170512113223eucas1p2c2a88ead00f3121fc1bfc8dab4f18c78 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-HopCount: 7 X-CMS-RootMailID: 20170512113223eucas1p2c2a88ead00f3121fc1bfc8dab4f18c78 X-RootMTR: 20170512113223eucas1p2c2a88ead00f3121fc1bfc8dab4f18c78 References: <1494588703-9076-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH V4 9/9] 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@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" Signed-off-by: Alexey Perevalov --- docs/migration.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/migration.txt b/docs/migration.txt index 1b940a8..d0f5a6d 100644 --- a/docs/migration.txt +++ b/docs/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 it's a postcopy live migration metric, intend to show +when source vCPU was in state 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 could 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.8.3.1