From nobody Wed Apr 24 17:03:41 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.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 1493363017604161.98691939511923; Fri, 28 Apr 2017 00:03:37 -0700 (PDT) Received: from localhost ([::1]:35494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zwG-0005fD-97 for importer@patchew.org; Fri, 28 Apr 2017 03:03:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zqs-0001KD-6d for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3zqp-00036I-2K for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:02 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:49926) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3zqo-00034A-T5 for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:57:59 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OP300B4TY0IQL20@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 28 Apr 2017 07:57:54 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170428065753eucas1p299290fc4644d80be846124b54b293a08~5fXBwCgDR1887918879eucas1p2K; Fri, 28 Apr 2017 06:57:53 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 77.7E.04729.0F7E2095; Fri, 28 Apr 2017 07:57:53 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065752eucas1p190511b1932f61b6321c489f0eb4e816f~5fXBH3m990423504235eucas1p1E; Fri, 28 Apr 2017 06:57:52 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2F.6A.17452.878E2095; Fri, 28 Apr 2017 08:00:08 +0100 (BST) 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 <0OP300L3YY07A050@eusync3.samsung.com>; Fri, 28 Apr 2017 07:57:52 +0100 (BST) X-AuditID: cbfec7f4-f79806d000001279-b9-5902e7f0f271 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 09:57:33 +0300 Message-id: <1493362658-8179-2-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493362658-8179-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7djP87ofnzNFGixZxGQx9+55FovebffY LU5sOshscaX9J7vFlv3f2C2O9+5gcWDzOPBiIbvHk2ubmTze77vK5tG3ZRVjAEsUl01Kak5m WWqRvl0CV8bq5kXMBUvZK66eOcvYwPiVtYuRk0NCwERi572TzBC2mMSFe+vZuhi5OIQEljJK fFo1jRXC+cwosb5pBTNMR8+Hp0wQiWWMEjc/HmKEcLqZJLb19gNVcXCwCRhI7LtnC9IgIiAp 8bvrN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IUYBDkYlHl6GD4yRQqyJZcWVuYcYJTiYlUR4 JROZIoV4UxIrq1KL8uOLSnNSiw8xmgIdNZFZSjQ5HxhVeSXxhiaG5paGRsYWFuZGRkrivCUf roQLCaQnlqRmp6YWpBbB9DFxcEo1MM5ikOVtnlj7Jiw6eI7Ky1sZcfumBOZs2S55f4bWxOhL E+qNru2QNDrKmS4wXcTj9UKXvzmZ4dmz9/O/XLX1rHXpoW+xniwcYRdmvryz5jp3tUl/Awdf g+HbANU33+9Jfzz1/3Zu8+KT5VHPU0OzZRry/ae/7PMq6jPc+cTSfbmEYtAZTk2pcCWW4oxE Qy3mouJEAJUoVfxyAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170428065752eucas1p190511b1932f61b6321c489f0eb4e816f 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: 20170428065752eucas1p190511b1932f61b6321c489f0eb4e816f X-RootMTR: 20170428065752eucas1p190511b1932f61b6321c489f0eb4e816f References: <1493362658-8179-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 RESEND V3 1/6] 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, f4bug@amsat.org, 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.9.1 From nobody Wed Apr 24 17:03:41 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.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 1493362947092726.5427384386035; Fri, 28 Apr 2017 00:02:27 -0700 (PDT) Received: from localhost ([::1]:35481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zv7-0004Ve-9c for importer@patchew.org; Fri, 28 Apr 2017 03:02:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zqr-0001Jj-LS for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3zqo-00035c-JQ for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:01 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63296) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3zqo-00033A-DS for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:57:58 -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 <0OP300BA7Y0I4D20@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 28 Apr 2017 07:57:54 +0100 (BST) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065754eucas1p160dd006ab0fed9d3fa82351b95e738b9~5fXCZH4nq0312903129eucas1p1F; Fri, 28 Apr 2017 06:57:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 90.6B.25577.1F7E2095; Fri, 28 Apr 2017 07:57:53 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c~5fXBvFAeB1555615556eucas1p1E; Fri, 28 Apr 2017 06:57:53 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 70.7A.17452.978E2095; Fri, 28 Apr 2017 08:00:09 +0100 (BST) 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 <0OP300L3YY07A050@eusync3.samsung.com>; Fri, 28 Apr 2017 07:57:53 +0100 (BST) X-AuditID: cbfec7f5-f792f6d0000063e9-db-5902e7f11074 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 09:57:34 +0300 Message-id: <1493362658-8179-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493362658-8179-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djP87ofnzNFGiyepGcx9+55FovebffY LU5sOshscaX9J7vFlv3f2C2O9+5gcWDzOPBiIbvHk2ubmTze77vK5tG3ZRVjAEsUl01Kak5m WWqRvl0CV8b3NaEFW2QrZj3laWBcJt7FyMkhIWAicfn3UzYIW0ziwr31QDYXh5DAUkaJAwem sEA4nxkljl/fwgbT8erufFaIxDJGienrbrCAJIQEupkklp0x6GLk4GATMJDYd88WJCwiICnx u+s0M4jNLJAn8WjyeWaQXmGBCYwSy47MZQapZxFQlfjZYQ5SwyvgJtHe+4cJYpecxMljk1lB bE4Bd4ndj2+BXSch8JxN4vvc1awgvRICshKbDjBDmC4S87YlQbQKS7w6voUdwpaR6Ow4yATR 2s4o0b2zkxXCAbrhzPS/UFX2EqduXmWCOJRPYtK26VBDeSU62oQgTA+JWT+zIUxHia8/fSGh MItRom3ef7YJjDILGBlWMYqklhbnpqcWm+oVJ+YWl+al6yXn525iBEbp6X/Hv+5gXHrM6hCj AAejEg8vwwfGSCHWxLLiytxDjBIczEoivJKJTJFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEe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000000000000@CPGS X-CMS-MailID: 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c 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: 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c X-RootMTR: 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c References: <1493362658-8179-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 RESEND V3 2/6] 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, f4bug@amsat.org, 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 --- include/migration/postcopy-ram.h | 2 +- migration/migration.c | 2 +- migration/postcopy-ram.c | 10 +++++----- migration/savevm.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/migration/postcopy-ram.h b/include/migration/postcopy-= ram.h index 8e036b9..809f6db 100644 --- a/include/migration/postcopy-ram.h +++ b/include/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/migration.c b/migration/migration.c index 353f272..569a7f6 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 85fd8d7..4c859b4 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -60,7 +60,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; @@ -113,7 +113,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; @@ -136,7 +136,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 @@ -513,7 +513,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 @@ -651,7 +651,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/savevm.c b/migration/savevm.c index 03ae1bd..2aff64c 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1360,7 +1360,7 @@ static int loadvm_postcopy_handle_advise(MigrationInc= omingState *mis) return -1; } =20 - if (!postcopy_ram_supported_by_host()) { + if (!postcopy_ram_supported_by_host(mis)) { postcopy_state_set(POSTCOPY_INCOMING_NONE); return -1; } --=20 1.9.1 From nobody Wed Apr 24 17:03:41 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.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 1493362874504780.962066199933; Fri, 28 Apr 2017 00:01:14 -0700 (PDT) Received: from localhost ([::1]:35472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3ztw-0003Xn-08 for importer@patchew.org; Fri, 28 Apr 2017 03:01:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zqr-0001Ju-T0 for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3zqo-00035u-Py for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:01 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63296) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3zqo-00033A-KU for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:57:58 -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 <0OP300BA7Y0I4D20@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 28 Apr 2017 07:57:54 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065754eucas1p1822c0e702c85b5fc54d5862c0b21404c~5fXC09PTz1734817348eucas1p18; Fri, 28 Apr 2017 06:57:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id D4.BA.14140.4F7E2095; Fri, 28 Apr 2017 07:57:57 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065753eucas1p1524aa2bd8e469e6c94a88ee80eb54a6e~5fXCRIg721555515555eucas1p1E; Fri, 28 Apr 2017 06:57:53 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 31.7A.17452.A78E2095; Fri, 28 Apr 2017 08:00:10 +0100 (BST) 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 <0OP300L3YY07A050@eusync3.samsung.com>; Fri, 28 Apr 2017 07:57:53 +0100 (BST) X-AuditID: cbfec7ef-f796a6d00000373c-0d-5902e7f458fa From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 09:57:35 +0300 Message-id: <1493362658-8179-4-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493362658-8179-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHIsWRmVeSWpSXmKPExsWy7djP87pfnzNFGjy7wGgx9+55FovebffY LU5sOshscaX9J7vFlv3f2C2O9+5gcWDzOPBiIbvHk2ubmTze77vK5tG3ZRVjAEsUl01Kak5m WWqRvl0CV8bvIzPZC27LVByd8oilgfG7aBcjJ4eEgInE8jV32SFsMYkL99azdTFycQgJLGOU 2LPuFQtIQkjgM6PEvY1RMA2Hvt5ggSt6/PE5VFE3k8SyMwZdjBwcbAIGEvvu2YKERQQkJX53 nWYGsZkF8iQeTT7PDFIiLJAmcWiBJ0iYRUBV4vX8VWwgNq+Am8SNnj4miFVyEiePTWYFsTkF 3CV2P74FdpuEwHM2iVsrN7GCzJEQkJXYdIAZot5FYtP/TSwQtrDEq+NboP6SkejsOMgE0dvO KNG9s5MVwpnAKHFm+l+oKnuJUzevMkEcyicxadt0ZogFvBIdbUIQJR4Sv2Z1M0LYjhKdC1qh gTWLUaK95xDjBEaZBYwMqxhFUkuLc9NTiw31ihNzi0vz0vWS83M3MQJj9fS/4+93MD5tDjnE KMDBqMTDy/CBMVKINbGsuDL3EKMEB7OSCK9kIlOkEG9KYmVValF+fFFpTmrxIUZpDhYlcV7e U9cihATSE0tSs1NTC1KLYLJMHJxSDYx9HJKBj36FnN6hzcmWJvzAbEeX/uNDUbfeRN5mYntT pivqKZampX16d0z4Kk2b5Dnfj034dFRwRdwued89qmsDVb9u43LbWvmUJ+ZDV8WH5+tWTj5z vO2lg73QnRXMa2bk8W+5UHPmjPNLsxWMaxT4Flb6zCuey3Yt0PpWzIEfSwJ//RWK9AhQYinO SDTUYi4qTgQAqheFgNECAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHLMWRmVeSWpSXmKPExsVy+t/xq7pVL5giDRoPcVjMvXuexaJ32z12 ixObDjJbXGn/yW6xZf83dovjvTtYHNg8DrxYyO7x5NpmJo/3+66yefRtWcUYwBLlZpORmpiS WqSQmpecn5KZl26rFBripmuhpJCXmJtqqxSh6xsSpKRQlphTCuQZGaABB+cA92AlfbsEt4zf R2ayF9yWqTg65RFLA+N30S5GTg4JAROJQ19vsEDYYhIX7q1n62Lk4hASWMIoMW3rTlYIp5dJ YvXGbqAMBwebgIHEvnu2IA0iApISv7tOM4PYzAJ5Eitn/GcEKREWSJM4tMATJMwioCrxev4q NhCbV8BN4kZPHxPELjmJk8cms4LYnALuErsf3wKrEQKqWfJ6GvMERt4FjAyrGEVSS4tz03OL DfWKE3OLS/PS9ZLzczcxAsN227Gfm3cwXtoYfIhRgINRiYeX4QNjpBBrYllxZe4hRgkOZiUR XslEpkgh3pTEyqrUovz4otKc1OJDjKZAR01klhJNzgfGVF5JvKGJobmloZGxhYW5kZGSOG/J hyvhQgLpiSWp2ampBalFMH1MHJxSDYyc/oUKqUcyb/T1Lnis9jLnVfhmv82+EgIRr1fYrp/y TjHWM+ORH/u1pZKLNWRS/s6xm1aQKqN8/k/OjccB9neNjyvXzlwSJc7t/05ta+8J59fily+V zo25legro+1S7rfizifbRfkX3mdJLWP3S1LXjFf8y5G271PEWaWDRjP2sipMdpxtN1+JpTgj 0VCLuag4EQAOUByvcQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170428065753eucas1p1524aa2bd8e469e6c94a88ee80eb54a6e 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: 20170428065753eucas1p1524aa2bd8e469e6c94a88ee80eb54a6e X-RootMTR: 20170428065753eucas1p1524aa2bd8e469e6c94a88ee80eb54a6e References: <1493362658-8179-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 RESEND V3 3/6] 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, f4bug@amsat.org, 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 | 68 ++++++++++++++++++++++++++++++++++++++++++++= ---- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 4c859b4..21e7150 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -60,15 +60,51 @@ 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(__u64 *features) { - struct uffdio_api api_struct; - uint64_t ioctl_mask; + struct uffdio_api api_struct =3D {0}; + int ufd; + bool ret =3D true; =20 + /* if we are here __NR_userfaultfd should exists */ + ufd =3D syscall(__NR_userfaultfd, O_CLOEXEC); + if (ufd =3D=3D -1) { + return false; + } + + /* ask features */ 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("receive_ufd_features: UFFDIO_API failed: %s", + 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, __u64 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("request_ufd_features: UFFDIO_API failed: %s", strerror(errno)); return false; } @@ -81,11 +117,33 @@ static bool ufd_version_check(int ufd, MigrationIncomi= ngState *mis) return false; } =20 + return true; +} + +static bool ufd_version_check(int ufd, MigrationIncomingState *mis) +{ + __u64 new_features =3D 0; + + /* ask features */ + __u64 supported_features; + + if (!receive_ufd_features(&supported_features)) { + error_report("ufd_version_check failed"); + return false; + } + + /* request features */ + if (new_features && !request_ufd_features(ufd, new_features)) { + error_report("ufd_version_check failed: features %" PRIu64, + (uint64_t)new_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"); --=20 1.9.1 From nobody Wed Apr 24 17:03:41 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.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 1493362798330667.9950818394047; Thu, 27 Apr 2017 23:59:58 -0700 (PDT) Received: from localhost ([::1]:35463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zsi-0002Wa-Pk for importer@patchew.org; Fri, 28 Apr 2017 02:59:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zqs-0001Kp-RK for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3zqp-00037I-QP for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:02 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:13557) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3zqp-00035P-IA for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:57:59 -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 <0OP300A8SY0K8X20@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 28 Apr 2017 07:57:56 +0100 (BST) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065755eucas1p10dd64fdb259a718a02540acbadd2c3d0~5fXDpOLFM0423504235eucas1p1M; Fri, 28 Apr 2017 06:57:55 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 01.6B.25577.3F7E2095; Fri, 28 Apr 2017 07:57:55 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065754eucas1p1f51713373ce8c2d19945a4f91c52bd5c~5fXC-07hm1555515555eucas1p1F; Fri, 28 Apr 2017 06:57:54 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id FE.CC.20206.D08E2095; Fri, 28 Apr 2017 07:58:21 +0100 (BST) 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 <0OP300L3YY07A050@eusync3.samsung.com>; Fri, 28 Apr 2017 07:57:54 +0100 (BST) X-AuditID: cbfec7f5-f792f6d0000063e9-de-5902e7f302d8 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 09:57:36 +0300 Message-id: <1493362658-8179-5-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493362658-8179-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRmVeSWpSXmKPExsWy7djP87qfnzNFGrxYz2Yx9+55FovebffY LU5sOshscaX9J7vFlv3f2C2O9+5gcWDzOPBiIbvHk2ubmTze77vK5tG3ZRVjAEsUl01Kak5m WWqRvl0CV8b+lqyC83IV+5ZMYW1gPCHRxcjJISFgIrG88ScLhC0mceHeerYuRi4OIYGljBJb 5u5khXA+AzlPZrDCdMzramOESCxjlLh06jE7hN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zczcxAoN227GfW3Ywdr0LPsQowMGoxMMb8YkxUog1say4MvcQowQHs5IIr2Qi U6QQb0piZVVqUX58UWlOavEhRlOgoyYyS4km5wMjKq8k3tDE0NzS0MjYwsLcyEhJnHfqhyvh QgLpiSWp2ampBalFMH1MHJxSDYze2rNWHdm+6qTjinv7XOxVr11e8I77T+zNN+8qL28o/Vpe vr5w0wN71YvXjcz8ORfOiF37KGZ+Vf+NsAsvbv86FXgs8HnVTv8Hdbua2y5eiqu49uTjuqet XNzPJW/dm/qc4c8vBiPvjds1P5/j26HSbbF0y46tU8OT+Zd6brfqWPXkzfK3lj8EPyqxFGck GmoxFxUnAgCCB7S9cAIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170428065754eucas1p1f51713373ce8c2d19945a4f91c52bd5c 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: 20170428065754eucas1p1f51713373ce8c2d19945a4f91c52bd5c X-RootMTR: 20170428065754eucas1p1f51713373ce8c2d19945a4f91c52bd5c References: <1493362658-8179-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 RESEND V3 4/6] migration: add postcopy downtime into MigrationIncommingState 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, f4bug@amsat.org, 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 add request to kernel space for UFFD_FEATURE_THREAD_ID, in case when this feature is provided by kernel. DowntimeContext is incapsulated inside migration.c. Signed-off-by: Alexey Perevalov --- include/migration/migration.h | 12 ++++++++++++ migration/migration.c | 33 +++++++++++++++++++++++++++++++++ migration/postcopy-ram.c | 8 ++++++++ 3 files changed, 53 insertions(+) diff --git a/include/migration/migration.h b/include/migration/migration.h index ba1a16c..e8fb68f 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -83,6 +83,8 @@ typedef enum { POSTCOPY_INCOMING_END } PostcopyState; =20 +struct DowntimeContext; + /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -123,10 +125,20 @@ struct MigrationIncomingState { =20 /* See savevm.c */ LoadStateEntry_Head loadvm_handlers; + + /* + * DowntimeContext to keep information for postcopy + * live migration, to calculate downtime + * */ + struct DowntimeContext *downtime_ctx; }; =20 MigrationIncomingState *migration_incoming_get_current(void); void migration_incoming_state_destroy(void); +/* + * Functions to work with downtime context + */ +struct DowntimeContext *downtime_context_new(void); =20 struct MigrationState { diff --git a/migration/migration.c b/migration/migration.c index 569a7f6..ec76e5c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -77,6 +77,18 @@ static NotifierList migration_state_notifiers =3D =20 static bool deferred_incoming; =20 +typedef struct DowntimeContext { + /* time when page fault initiated per vCPU */ + int64_t *page_fault_vcpu_time; + /* page address per vCPU */ + uint64_t *vcpu_addr; + int64_t total_downtime; + /* downtime per vCPU */ + int64_t *vcpu_downtime; + /* point in time when last page fault was initiated */ + int64_t last_begin; +} DowntimeContext; + /* * Current state of incoming postcopy; note this is not part of * MigrationIncomingState since it's state is used during cleanup @@ -116,6 +128,23 @@ MigrationState *migrate_get_current(void) return ¤t_migration; } =20 +struct DowntimeContext *downtime_context_new(void) +{ + DowntimeContext *ctx =3D g_new0(DowntimeContext, 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_downtime =3D g_new0(int64_t, smp_cpus); + return ctx; +} + +static void destroy_downtime_context(struct DowntimeContext *ctx) +{ + g_free(ctx->page_fault_vcpu_time); + g_free(ctx->vcpu_addr); + g_free(ctx->vcpu_downtime); + g_free(ctx); +} + MigrationIncomingState *migration_incoming_get_current(void) { static bool once; @@ -138,6 +167,10 @@ void migration_incoming_state_destroy(void) =20 qemu_event_destroy(&mis->main_thread_load_event); loadvm_free_handlers(mis); + if (mis->downtime_ctx) { + destroy_downtime_context(mis->downtime_ctx); + mis->downtime_ctx =3D NULL; + } } =20 =20 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 21e7150..f3688f5 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -132,6 +132,14 @@ static bool ufd_version_check(int ufd, MigrationIncomi= ngState *mis) return false; } =20 +#ifdef UFFD_FEATURE_THREAD_ID + if (mis && UFFD_FEATURE_THREAD_ID & supported_features) { + /* kernel supports that feature */ + mis->downtime_ctx =3D downtime_context_new(); + new_features |=3D UFFD_FEATURE_THREAD_ID; + } +#endif + /* request features */ if (new_features && !request_ufd_features(ufd, new_features)) { error_report("ufd_version_check failed: features %" PRIu64, --=20 1.9.1 From nobody Wed Apr 24 17:03:41 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.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 149336288318829.103771726804325; Fri, 28 Apr 2017 00:01:23 -0700 (PDT) Received: from localhost ([::1]:35475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zu4-0003eU-KZ for importer@patchew.org; Fri, 28 Apr 2017 03:01:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zqr-0001Jm-MG for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3zqp-00036A-0w for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:01 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63296) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3zqo-00033A-Qy for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:57:58 -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 <0OP3008EDY0KZ220@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 28 Apr 2017 07:57:56 +0100 (BST) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065755eucas1p14f64cac3a9a1fc950a178120706937fe~5fXEJBXpr0350003500eucas1p1Q; Fri, 28 Apr 2017 06:57:55 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 71.6B.25577.3F7E2095; Fri, 28 Apr 2017 07:57:55 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170428065755eucas1p2ff9aa17eaa294e741d8c65f8d58a71fb~5fXDjqKhI1887918879eucas1p2R; Fri, 28 Apr 2017 06:57:55 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AF.CC.20206.E08E2095; Fri, 28 Apr 2017 07:58:22 +0100 (BST) 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 <0OP300L3YY07A050@eusync3.samsung.com>; Fri, 28 Apr 2017 07:57:54 +0100 (BST) X-AuditID: cbfec7f5-f792f6d0000063e9-df-5902e7f364c5 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 09:57:37 +0300 Message-id: <1493362658-8179-6-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493362658-8179-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsWy7djP87qfnzNFGvQ9VrOYe/c8i0Xvtnvs Fic2HWS2uNL+k91iy/5v7BbHe3ewOLB5HHixkN3jybXNTB7v911l8+jbsooxgCWKyyYlNSez LLVI3y6BK2Pl34KCTy4Ve5YdYmlgnGPaxcjJISFgItGzfh87hC0mceHeerYuRi4OIYGljBIr vuyFcj4zSnw/+p4FpuP/krvsEIlljBLr9r1kgnC6mSQ2L7sFlOHgYBMwkNh3zxakQURAUuJ3 12lmEJtZIE/i0eTzYLawgIfEzY3nmEBsFgFViUs3/7CC2LwCbhLTd31hglgmJ3Hy2GSwOKeA u8Tux7fYIOL32YCGhoKskhCQldh0gBki7CIx+043lC0s8er4FqjPZCQuT+5mATlTQqCdUaJ7 ZycrhDOBUeL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m1++PtVd3eKP6461nd2+tvc +XwHl1amr7s/g0UzI9/khe/e+fFvGAUiG05GdEYpdh9iu2Vtu/671deWJvGPZ9Y32XEERF1Q aFgazcVw7qJM003lH0vZd4gaLbmrW3DEYc6eO6Fpr/admvVIe8VzVQGmjYUlSizFGYmGWsxF xYkAdCDYiW8CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170428065755eucas1p2ff9aa17eaa294e741d8c65f8d58a71fb 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: 20170428065755eucas1p2ff9aa17eaa294e741d8c65f8d58a71fb X-RootMTR: 20170428065755eucas1p2ff9aa17eaa294e741d8c65f8d58a71fb References: <1493362658-8179-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 RESEND V3 5/6] migration: calculate downtime 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, f4bug@amsat.org, 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 provides downtime 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 downtime per vCPU (could be traced with page_fault_addr) For more details see comments for get_postcopy_total_downtime implementation. Downtime will not calculated if postcopy_downtime field of MigrationIncomingState wasn't initialized. Signed-off-by: Alexey Perevalov --- include/migration/migration.h | 3 ++ migration/migration.c | 103 ++++++++++++++++++++++++++++++++++++++= ++++ migration/postcopy-ram.c | 20 +++++++- migration/trace-events | 6 ++- 4 files changed, 130 insertions(+), 2 deletions(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index e8fb68f..a22f9ce 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -139,6 +139,9 @@ void migration_incoming_state_destroy(void); * Functions to work with downtime context */ struct DowntimeContext *downtime_context_new(void); +void mark_postcopy_downtime_begin(uint64_t addr, int cpu); +void mark_postcopy_downtime_end(uint64_t addr); +uint64_t get_postcopy_total_downtime(void); =20 struct MigrationState { diff --git a/migration/migration.c b/migration/migration.c index ec76e5c..2c6f150 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2150,3 +2150,106 @@ PostcopyState postcopy_state_set(PostcopyState new_= state) return atomic_xchg(&incoming_postcopy_state, new_state); } =20 +void mark_postcopy_downtime_begin(uint64_t addr, int cpu) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + DowntimeContext *dc; + if (!mis->downtime_ctx || cpu < 0) { + return; + } + dc =3D mis->downtime_ctx; + dc->vcpu_addr[cpu] =3D addr; + dc->last_begin =3D dc->page_fault_vcpu_time[cpu] =3D + qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + + trace_mark_postcopy_downtime_begin(addr, dc, dc->page_fault_vcpu_time[= cpu], + cpu); +} + +void mark_postcopy_downtime_end(uint64_t addr) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + DowntimeContext *dc; + int i; + bool all_vcpu_down =3D true; + int64_t now; + + if (!mis->downtime_ctx) { + return; + } + dc =3D mis->downtime_ctx; + now =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + + /* check all vCPU down, + * QEMU has bitmap.h, but even with bitmap_and + * will be a cycle */ + for (i =3D 0; i < smp_cpus; i++) { + if (dc->vcpu_addr[i]) { + continue; + } + all_vcpu_down =3D false; + break; + } + + if (all_vcpu_down) { + dc->total_downtime +=3D now - dc->last_begin; + } + + /* lookup cpu, to clear it */ + for (i =3D 0; i < smp_cpus; i++) { + uint64_t vcpu_downtime; + + if (dc->vcpu_addr[i] !=3D addr) { + continue; + } + + vcpu_downtime =3D now - dc->page_fault_vcpu_time[i]; + + dc->vcpu_addr[i] =3D 0; + dc->vcpu_downtime[i] +=3D vcpu_downtime; + } + + trace_mark_postcopy_downtime_end(addr, dc, dc->total_downtime); +} + +/* + * This function just provide calculated before downtime per cpu and trace= it. + * Total downtime is calculated in mark_postcopy_downtime_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 downtime. + * S1 - here is last_begin + * Legend of the picture is following: + * * - means downtime per vCPU + * x - means overlapped downtime (total downtime) + */ +uint64_t get_postcopy_total_downtime(void) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + if (!mis->downtime_ctx) { + return 0; + } + + if (trace_event_get_state(TRACE_DOWNTIME_PER_CPU)) { + int i; + for (i =3D 0; i < smp_cpus; i++) { + trace_downtime_per_cpu(i, mis->downtime_ctx->vcpu_downtime[i]); + } + } + return mis->downtime_ctx->total_downtime; +} diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index f3688f5..cf2b935 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -23,6 +23,7 @@ #include "migration/postcopy-ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h" +#include #include "qemu/error-report.h" #include "trace.h" =20 @@ -468,6 +469,19 @@ 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; +} + /* * Handle faults detected by the USERFAULT markings */ @@ -545,8 +559,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_downtime_begin((uintptr_t)(msg.arg.pagefault.address= ), + 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) @@ -641,6 +658,7 @@ int postcopy_place_page(MigrationIncomingState *mis, vo= id *host, void *from, =20 return -e; } + mark_postcopy_downtime_end((uint64_t)host); =20 trace_postcopy_place_page(host); return 0; diff --git a/migration/trace-events b/migration/trace-events index b8f01a2..d338810 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -110,6 +110,9 @@ 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_downtime_begin(uint64_t addr, void *dd, int64_t time, int cp= u) "addr 0x%" PRIx64 " dd %p time %" PRId64 " cpu %d" +mark_postcopy_downtime_end(uint64_t addr, void *dd, int64_t time) "addr 0x= %" PRIx64 " dd %p time %" PRId64 +downtime_per_cpu(int cpu_index, int64_t downtime) "downtime cpu[%d]=3D%" P= RId64 =20 # migration/rdma.c qemu_rdma_accept_incoming_migration(void) "" @@ -186,7 +189,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) "" @@ -195,6 +198,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.9.1 From nobody Wed Apr 24 17:03:41 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.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 1493363063829865.5811075190787; Fri, 28 Apr 2017 00:04:23 -0700 (PDT) Received: from localhost ([::1]:35495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zx0-00067o-Cv for importer@patchew.org; Fri, 28 Apr 2017 03:04:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zqs-0001Kq-RT for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3zqq-00037g-1F for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:02 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:13557) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3zqp-00035P-RQ for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:57:59 -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 <0OP300D23Y0LN620@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 28 Apr 2017 07:57:57 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170428065756eucas1p257dde3e3ead77cab1cb1af7931c1f7a6~5fXE4ACLz2075420754eucas1p2x; Fri, 28 Apr 2017 06:57:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id A0.CA.14140.7F7E2095; Fri, 28 Apr 2017 07:57:59 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065755eucas1p1cdd0f278a235f176e9f63c40bc64a7a9~5fXEEjGAh2285222852eucas1p1j; Fri, 28 Apr 2017 06:57:55 +0000 (GMT) Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 40.DC.20206.E08E2095; Fri, 28 Apr 2017 07:58:22 +0100 (BST) 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 <0OP300L3YY07A050@eusync3.samsung.com>; Fri, 28 Apr 2017 07:57:55 +0100 (BST) X-AuditID: cbfec7ef-f796a6d00000373c-12-5902e7f7c649 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 09:57:38 +0300 Message-id: <1493362658-8179-7-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493362658-8179-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7djPc7rfnzNFGqzp57OYe/c8i0Xvtnvs Fic2HWS2uNL+k91iy/5v7BbHe3ewOLB5HHixkN3jybXNTB7v911l8+jbsooxgCWKyyYlNSez LLVI3y6BK+P0iaXMBce5K2a8nc7YwPiHs4uRk0NCwETi1ZpLTBC2mMSFe+vZuhi5OIQEljFK 7Py/kAXC+cwoce/SS3aYjkcn1jPCVa3/OhnK6WaSOPZlG1AVBwebgIHEvnu2IA0iApISv7tO M4PYzAJ5Eo8mnwezhQXcJWYcfAw2lEVAVeJLwycwm1fATeLmi+UsEMvkJE4em8wKYnMC1e9+ fAvsPAmB52wSm15MYwTZJSEgK7HpADNEvYvE90VnoN4Rlnh1fAvU0TISlyd3s0D0tjNKdO/s ZIVwJjBKnJn+F6rKXuLUzatMEJfySUzaNp0ZYgGvREebEESJh8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Jk41+cvgsfTdzzOZybu66zN0r6qfrLN926HcEPFE bcXVV1cunU57/UFkkhr/2oB19Yd5L1ZOm5hiK3bw/X4trmk8Tjc4P+n93DPv/e3LEyX3KLEU ZyQaajEXFScCABuBFGJyAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170428065755eucas1p1cdd0f278a235f176e9f63c40bc64a7a9 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: 20170428065755eucas1p1cdd0f278a235f176e9f63c40bc64a7a9 X-RootMTR: 20170428065755eucas1p1cdd0f278a235f176e9f63c40bc64a7a9 References: <1493362658-8179-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 RESEND V3 6/6] migration: trace postcopy total downtime 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, f4bug@amsat.org, 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" It's not possible to transmit it back to source host, due to RP protocol is not expandable. Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 2 ++ migration/trace-events | 1 + 2 files changed, 3 insertions(+) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index cf2b935..35e77ba 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -388,6 +388,8 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingStat= e *mis) } =20 postcopy_state_set(POSTCOPY_INCOMING_END); + /* here should be downtime receiving back operation */ + trace_postcopy_ram_incoming_cleanup_downtime(get_postcopy_total_downti= me()); 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 d338810..faa1b22 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -194,6 +194,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_downtime(uint64_t total) "total downtime %" = 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" --=20 1.9.1