From nobody Sat May 4 07:43:44 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 1497640603195483.91865902333177; Fri, 16 Jun 2017 12:16:43 -0700 (PDT) Received: from localhost ([::1]:60471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwjZ-0002Sz-Tm for importer@patchew.org; Fri, 16 Jun 2017 15:16:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfU-000793-Nr for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfP-0007Pd-QN for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:28 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:20722) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfP-0007PL-KB for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:23 -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 <0ORN00H8BMOLOA20@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:21 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191220eucas1p1df28ec4fbfabf0cc5a9842e33fb1289f~Ir-R-W7IY0327603276eucas1p1S; Fri, 16 Jun 2017 19:12:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 3A.B8.14140.79D24495; Fri, 16 Jun 2017 20:12:23 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191219eucas1p197a274ce1b480821ac4813cde42aeb74~Ir-RRXlHd0328903289eucas1p1J; Fri, 16 Jun 2017 19:12:19 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 42.9C.17452.39D24495; Fri, 16 Jun 2017 20:12:19 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:19 +0100 (BST) X-AuditID: cbfec7ef-f796a6d00000373c-9c-59442d979644 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:11:58 +0300 Message-id: <1497640325-10960-2-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7rTdV0iDdZ/YbWYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ijuGxSUnMyy1KL9O0S uDK+fvzJXvCFrWLm8X9MDYwnWbsYOTgkBEwkuhYodTFyApliEhfurWfrYuTiEBJYxiix5eBl VgjnM6PE5CetTBBVJhKXmj4xw1U96fkNlhAS6GaS+LSDHWQqm4CBxL57tiBhEQFJid9dp8Hq mQVaGSXa+x4xgySEBYIk7p2YyAJiswioSnRtXwlm8wq4Sxxb84EFYpmcxMljk8Eu5RTwkDi+ yQ9kjoTAfTaJuz+XsUF8ICux6QAzRLmLxPSmmVCtwhKvjm9hh7BlJDo7DjJB9LYzSnTv7GSF cCYwSpyZ/heqyl7i1M2rYM8wC/BJTNo2nRliAa9ER5sQRImHxJzvW6AWOEocmX4CGhCzGSVO di5hm8Aos4CRYRWjSGppcW56arGhXnFibnFpXrpecn7uJkZgjJ7+d/z9DsanzSGHGAU4GJV4 eBluO0cKsSaWFVfmHmKU4GBWEuG113GJFOJNSaysSi3Kjy8qzUktPsQozcGiJM7Le+pahJBA emJJanZqakFqEUyWiYNTqoExKXSr7YmPHs0/tjsW7Ti5SOTgn80feVzmF75v+ypYsrfN+/ip HN26hazTJvA2Lq58/kU5SznN9Wnp5/Zu2amzOY/Itp1RecsmuOGG0n4dH7HW0BmzXW37W2+o Fe2NKlvsKXw4ZGNfkjgb73Xd7vmfmXPMbH4cb9Pjnap6VPTLPF355T4Prt9XYinOSDTUYi4q TgQAtbuQPM0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xy7qTdV0iDVbPsrKYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ij3GwyUhNTUosUUvOS 81My89JtlUJD3HQtlBTyEnNTbZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4Jbx9eNP9oIv bBUzj/9jamA8ydrFyMkhIWAicanpEzOELSZx4d56ti5GLg4hgSWMEt9P3mGEcHqZJLavXwBU xcHBJmAgse+eLUiDiICkxO+u08wgNcwCrYwSTxpnsYMkhAUCJPY9mQK2gUVAVaJr+0oWEJtX wF3i2JoPLBDb5CROHpvMCjKTU8BD4vgmP5CwEFDJli07WCYw8i5gZFjFKJJaWpybnltsqFec mFtcmpeul5yfu4kRGK7bjv3cvIPx0sbgQ4wCHIxKPLwMt50jhVgTy4orcw8xSnAwK4nw2uu4 RArxpiRWVqUW5ccXleakFh9iNAW6aSKzlGhyPjCW8kriDU0MzS0NjYwtLMyNjJTEeUs+XAkX EkhPLEnNTk0tSC2C6WPi4JRqYIwweiujqfq1IGXWpWk2+Z6uPuukpxyRXBbJpeF4PMzrbunO VQck6w2yr/i/fZviqzQ1eh/Ppyepb5dO149bkrpoW5yZUK+yz+85e07dWqn0Z4Psn6UHz2Qt XP7xhKddVs/7XVYdipfWGcY7dE14xR3PXCcR6Z3/U0um3of31uFAkwV+7WYS7EosxRmJhlrM RcWJAMf7HZhtAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191219eucas1p197a274ce1b480821ac4813cde42aeb74 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: 20170616191219eucas1p197a274ce1b480821ac4813cde42aeb74 X-RootMTR: 20170616191219eucas1p197a274ce1b480821ac4813cde42aeb74 References: <1497640325-10960-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 v9 1/8] 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, Alexey Perevalov , peterx@redhat.com, quintela@redhat.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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-headers/linux/userfaultfd.h b/linux-headers/linux/userfa= ultfd.h index 9701772..eda028c 100644 --- a/linux-headers/linux/userfaultfd.h +++ b/linux-headers/linux/userfaultfd.h @@ -78,6 +78,9 @@ struct uffd_msg { struct { __u64 flags; __u64 address; + union { + __u32 ptid; + } feat; } pagefault; =20 struct { @@ -161,6 +164,7 @@ struct uffdio_api { #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) #define UFFD_FEATURE_MISSING_SHMEM (1<<5) #define UFFD_FEATURE_EVENT_UNMAP (1<<6) +#define UFFD_FEATURE_THREAD_ID (1<<7) __u64 features; =20 __u64 ioctls; --=20 1.8.3.1 From nobody Sat May 4 07:43:44 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 1497640710925390.80827606089815; Fri, 16 Jun 2017 12:18:30 -0700 (PDT) Received: from localhost ([::1]:60480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwlJ-0004Qa-Hp for importer@patchew.org; Fri, 16 Jun 2017 15:18:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfW-0007BH-Su for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfS-0007R8-2e for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:30 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:56702) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfR-0007Pu-Ph for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:26 -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 <0ORN00H2IMOMKE50@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:22 +0100 (BST) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170616191221eucas1p237be2f7347bd684fc52ab4f288251801~Ir-SoU-yw3191631916eucas1p2U; Fri, 16 Jun 2017 19:12:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 1D.68.17464.59D24495; Fri, 16 Jun 2017 20:12:21 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170616191220eucas1p2ac6347288c68b20113882eaa38f34d5f~Ir-SDd2Xh3070630706eucas1p2J; Fri, 16 Jun 2017 19:12:20 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D7.D5.20206.49D24495; Fri, 16 Jun 2017 20:12:20 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:20 +0100 (BST) X-AuditID: cbfec7f2-f797e6d000004438-f8-59442d951151 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:11:59 +0300 Message-id: <1497640325-10960-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRmVeSWpSXmKPExsWy7djPc7pTdV0iDa72cVvMvXuexaJ32z12 iyvtP9kttuz/xm5xvHcHi8WdLX1MDmweT65tZvJ4v+8qm0ffllWMAcxRXDYpqTmZZalF+nYJ XBlbjzsXvJWvaJ+zibWBcZ5kFyMnh4SAicSnG/tZIGwxiQv31rOB2EICSxkltq2S6GLkArI/ M0o8fb2FCabh5bxDjBBFyxglnh10gijqZpL4+vsHUBEHB5uAgcS+e7YgNSICkhK/u04zg9Qw C7QySrT3PWIGSQgLJEicaH0KNpRFQFXi3oV37CA2r4C7xKUnzewQy+QkTh6bzAoyk1PAQ+L4 Jj+QORIC99kkftydxAgSlxCQldh0gBmi3EXi8YbJjBC2sMSr41ugxshIXJ7czQLR284o0b2z kxXCmcAocWb6X6gqe4lTN6+CHcQswCcxadt0ZogFvBIdbUIQJR4SvefvQJU7SrRM/8wG8fxs RomlMzewT2CUWcDIsIpRJLW0ODc9tdhYrzgxt7g0L10vOT93EyMwQk//O/5pB+PXE1aHGAU4 GJV4eBluO0cKsSaWFVfmHmKU4GBWEuG113GJFOJNSaysSi3Kjy8qzUktPsQozcGiJM7Ldepa hJBAemJJanZqakFqEUyWiYNTqoHRSFn5wc7vWXpT1ltIf7nF72+hmCARZpJ1/tx1c4+Q9et/ xsus2LXvSIFpgn/GUYkL216vl5y7VFpGWu/getmgowd62L3TvQ/J2/+tlzlTuUnR/YDAn3cp 3998mW51bd6S8OCSE5bMEZEbpx2rjA504pzvIKzjzWi899Kb4w+uZt7mmrx0fe8XJZbijERD Leai4kQA8Y+WGswCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsVy+t/xy7pTdF0iDTY3K1vMvXuexaJ32z12 iyvtP9kttuz/xm5xvHcHi8WdLX1MDmweT65tZvJ4v+8qm0ffllWMAcxRbjYZqYkpqUUKqXnJ +SmZeem2SqEhbroWSgp5ibmptkoRur4hQUoKZYk5pUCekQEacHAOcA9W0rdLcMvYety54K18 RfucTawNjPMkuxg5OSQETCRezjvECGGLSVy4t56ti5GLQ0hgCaPE4QOrWEASQgK9TBKdb527 GDk42AQMJPbdswUJiwhISvzuOs0MUs8s0Moo8aRxFjtIjbBAgsTz7hqQGhYBVYl7F96xg9i8 Au4Sl540s0PskpM4eWwyK0g5p4CHxPFNfhCb3CW2bNnBMoGRdwEjwypGkdTS4tz03GIjveLE 3OLSvHS95PzcTYzAQN127OeWHYxd74IPMQpwMCrx8EbedY4UYk0sK67MPcQowcGsJMJrr+MS KcSbklhZlVqUH19UmpNafIjRFOimicxSosn5wCjKK4k3NDE0tzQ0MrawMDcyUhLnnfrhSriQ QHpiSWp2ampBahFMHxMHp1QDo/PnjyotViHixsc22l9dvvv+Ov7cUyssr1xwm7fXLFP1r3Ku 6f/TdzY8/eJwr0Zz4r7lR/1S9i3lOMgfIHyZ/f4+xSzb0qb40A7TuYWHmO5O0nBUujpV/7qm xRZJo0ib4gDL1RWsX7d1dH1f09yXF/Xg+Ja3GVMiwri7/4twB9Z0Jfec8pbKUWIpzkg01GIu Kk4EAIYECM1qAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191220eucas1p2ac6347288c68b20113882eaa38f34d5f 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: 20170616191220eucas1p2ac6347288c68b20113882eaa38f34d5f X-RootMTR: 20170616191220eucas1p2ac6347288c68b20113882eaa38f34d5f References: <1497640325-10960-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 v9 2/8] migration: pass MigrationIncomingState* into migration check functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: i.maximets@samsung.com, dgilbert@redhat.com, Alexey Perevalov , peterx@redhat.com, quintela@redhat.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 | 3 ++- migration/postcopy-ram.c | 10 +++++----- migration/postcopy-ram.h | 2 +- migration/savevm.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 53fbd41..56929dc 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -591,6 +591,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, Error **errp) { MigrationState *s =3D migrate_get_current(); + MigrationIncomingState *mis =3D migration_incoming_get_current(); MigrationCapabilityStatusList *cap; bool old_postcopy_cap =3D migrate_postcopy_ram(); =20 @@ -637,7 +638,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(mis)) { /* postcopy_ram_supported_by_host will have emitted a more * detailed message */ diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 5d2b92d..35f3ffd 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -63,7 +63,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; @@ -126,7 +126,7 @@ static int test_ramblock_postcopiable(const char *block= _name, void *host_addr, * normally fine since if the postcopy succeeds it gets turned back on at = the * end. */ -bool postcopy_ram_supported_by_host(void) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { long pagesize =3D getpagesize(); int ufd =3D -1; @@ -149,7 +149,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 @@ -525,7 +525,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 @@ -678,7 +678,7 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis) =20 #else /* No target OS support, stubs just fail */ -bool postcopy_ram_supported_by_host(void) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { error_report("%s: No OS support", __func__); return false; diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 78a3591..77ea0fd 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -14,7 +14,7 @@ #define QEMU_POSTCOPY_RAM_H =20 /* Return true if the host supports everything we need to do postcopy-ram = */ -bool postcopy_ram_supported_by_host(void); +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis); =20 /* * Make all of RAM sensitive to accesses to areas that haven't yet been wr= itten diff --git a/migration/savevm.c b/migration/savevm.c index 31158da..4c3b75e 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1367,7 +1367,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 May 4 07:43:44 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 1497640560708991.9857340375366; Fri, 16 Jun 2017 12:16:00 -0700 (PDT) Received: from localhost ([::1]:60469 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwit-0001pq-6B for importer@patchew.org; Fri, 16 Jun 2017 15:15:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfV-00079d-Dr for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfQ-0007QE-Lx for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:51960) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfQ-0007Pk-GA for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:24 -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 <0ORN00H9MMOMDU50@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:22 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191221eucas1p12059f17d1544995d0960cfe3d84f020c~Ir-TIeyEA0328903289eucas1p1N; Fri, 16 Jun 2017 19:12:21 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 13.95.04459.59D24495; Fri, 16 Jun 2017 20:12:21 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191221eucas1p18f1b21abee06f0a34c2a8eb5fb0c6004~Ir-Sb3yQ50328903289eucas1p1M; Fri, 16 Jun 2017 19:12:21 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B2.9C.17452.59D24495; Fri, 16 Jun 2017 20:12:21 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:21 +0100 (BST) X-AuditID: cbfec7f1-f796e6d00000116b-a9-59442d95bb8b From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:12:00 +0300 Message-id: <1497640325-10960-4-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djP87pTdV0iDf4d1rGYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ijuGxSUnMyy1KL9O0S uDImfbzBUnCRreLqlVbGBsaVrF2MnBwSAiYSy/7MYYSwxSQu3FvP1sXIxSEksJRRYvabVhYI 5zOjRO+dLWwwHRfezYZKLGOU+PTxLDuE080ksezdZqYuRg4ONgEDiX33bEEaRAQkJX53nWYG qWEWaGWUaO97xAySEBYIkHh7dR8LiM0ioCpx7dAssA28Au4STx/cYYbYJidx8thkVpCZnAIe Esc3+YHMkRC4zyaxoXcOWFxCQFZi0wGocheJ62vuQtnCEq+Ob2GHsGUkOjsOMkH0tjNKdO/s ZIVwJjBKnJn+F6rKXuLUzatMIDazAJ/EpG3TmSEW8Ep0tAlBlHhIzL66gwUi7Cgx/34wxO+z GSUabi1hm8Aos4CRYRWjSGppcW56arGRXnFibnFpXrpecn7uJkZglJ7+d/zjDsb3J6wOMQpw MCrx8DLcdo4UYk0sK67MPcQowcGsJMJrr+MSKcSbklhZlVqUH19UmpNafIhRmoNFSZyX69S1 CCGB9MSS1OzU1ILUIpgsEwenVAOjw3PTeRGvJKTD9533nbp3w/OtJdKdZ1euaTE5eSDSyFCv 97Po9rVHvGce1lZwuJ0wR/ZsgBZDbOH1uUKmji/t7XZ+3HX89qor6c373WOOZCoErzrTvjCN //TEj7PrzqbW3ZL646+29eGhw/lBG/zaDDdpHD96o0TlcGHkzkMBZ5r4HhSy3m4xVGIpzkg0 1GIuKk4EAKtsLIXOAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsVy+t/xy7pTdV0iDe5u5bGYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ij3GwyUhNTUosUUvOS 81My89JtlUJD3HQtlBTyEnNTbZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4JYx6eMNloKL bBVXr7QyNjCuZO1i5OSQEDCRuPBuNguELSZx4d56NhBbSGAJo0TfeaEuRi4gu5dJYvnR60AJ Dg42AQOJffdsQWpEBCQlfnedZgapYRZoZZR40jiLHSQhLOAn8XfmCWYQm0VAVeLaoVlgQ3kF 3CWePrjDDLFMTuLkscmsIDM5BTwkjm/yg9jrLrFlyw6WCYy8CxgZVjGKpJYW56bnFhvqFSfm Fpfmpesl5+duYgQG67ZjPzfvYLy0MfgQowAHoxIPL8Nt50gh1sSy4srcQ4wSHMxKIrz2Oi6R QrwpiZVVqUX58UWlOanFhxhNgW6ayCwlmpwPjKS8knhDE0NzS0MjYwsLcyMjJXHekg9XwoUE 0hNLUrNTUwtSi2D6mDg4pRoYGd/XyZ7Z+LdrUnPjwsT2IwU6v5beW+e2U8jaqch45uS7Ksbt E97afHimxnTf2iBIdEbeMs6Ln7NL3xgrWOoFrt+wOCpp58L3uiGnVCI7PQq27mtytu+vNF/C c26N5dKWL0ZfHEwLf0qzPHikfmaOfpbGnesTHe5MPdZ76tAxPQfeiJTvAmvuKrEUZyQaajEX FScCAGcOBOlsAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191221eucas1p18f1b21abee06f0a34c2a8eb5fb0c6004 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: 20170616191221eucas1p18f1b21abee06f0a34c2a8eb5fb0c6004 X-RootMTR: 20170616191221eucas1p18f1b21abee06f0a34c2a8eb5fb0c6004 References: <1497640325-10960-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 v9 3/8] 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, Alexey Perevalov , peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 35f3ffd..b35baf3 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -71,7 +71,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 May 4 07:43:44 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 1497640745018354.32039540222195; Fri, 16 Jun 2017 12:19:05 -0700 (PDT) Received: from localhost ([::1]:60482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwlr-000594-IM for importer@patchew.org; Fri, 16 Jun 2017 15:19:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfU-000795-OH for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfR-0007Qg-D1 for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:28 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:20723) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfR-0007Px-3w for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:25 -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 <0ORN00H8DMONOA20@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:23 +0100 (BST) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191223eucas1p187cfc7ad81f8a3a6e4489736d4516d0d~Ir-UKdwAc0328903289eucas1p1P; Fri, 16 Jun 2017 19:12:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id C2.E8.25577.69D24495; Fri, 16 Jun 2017 20:12:22 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170616191222eucas1p2fc88d38fb9f84f7da04d853811dd07db~Ir-TPN37K3191631916eucas1p2W; Fri, 16 Jun 2017 19:12:22 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 48.D5.20206.59D24495; Fri, 16 Jun 2017 20:12:21 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:21 +0100 (BST) X-AuditID: cbfec7f5-f792f6d0000063e9-60-59442d962aa9 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:12:01 +0300 Message-id: <1497640325-10960-5-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djPc7rTdF0iDR7cMrKYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ijuGxSUnMyy1KL9O0S uDKaFr9mLpisUbGm/QlTA2OLXBcjJ4eEgInE0ublzBC2mMSFe+vZuhi5OIQEljJK3Dpyhx0k ISTwmVHi/y47mIYDXxawQBQtY5SYOnsmM4TTzSSx7N1mpi5GDg42AQOJffdsQRpEBCQlfned BqthFmhllGjvewS2TlggXuLO2dtgNouAqsT5h0/BtvEKuEtc/TmJEWKbnMTJY5NZQWZyCnhI HN/kBzJHQuA+m8T55acZQeISArISmw5AfeAicWbeVqhWYYlXx7ewQ9gyEpcnd7NA9LYzSnTv 7GSFcCYwSpyZ/heqyl7i1M2rTCA2swCfxKRt05khFvBKdLQJQZR4SOw7eYMVwnaUeHzkKzS4 ZjNK3Jh+hXUCo8wCRoZVjCKppcW56anFpnrFibnFpXnpesn5uZsYgVF6+t/xrzsYlx6zOsQo wMGoxMPLcNs5Uog1say4MvcQowQHs5IIr72OS6QQb0piZVVqUX58UWlOavEhRmkOFiVxXq5T 1yKEBNITS1KzU1MLUotgskwcnFINjAVacpW2d6V28rT5nz/zyMlA8OqnqKKpaxI51A1j/xh8 +BZYafH/W9/c1f9X3xE+u+/HT6cIq/4IdlaJqYu7P+3/K9ow51CNaXKA3ONFd/PM9zHu+JAv eblwHcuTfc1nmTXeMQru0bO+wv9TIEK66tHMOL7o/sp5U771ZsnsC81YdEHkDQerlRJLcUai oRZzUXEiALKR+VPOAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xy7pTdV0iDe4eMLaYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ij3GwyUhNTUosUUvOS 81My89JtlUJD3HQtlBTyEnNTbZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4JbRtPg1c8Fk jYo17U+YGhhb5LoYOTkkBEwkDnxZwAJhi0lcuLeerYuRi0NIYAmjxOlPV5ggnF4mieVHrwNl ODjYBAwk9t2zBWkQEZCU+N11mhmkhlmglVHiSeMsdpCEsEC8xI9Dd8CmsgioSpx/+BQszivg LnH15yRGiG1yEiePTWYFmckp4CFxfJMfSFgIqGTLlh0sExh5FzAyrGIUSS0tzk3PLTbSK07M LS7NS9dLzs/dxAgM123Hfm7Zwdj1LvgQowAHoxIPb+Rd50gh1sSy4srcQ4wSHMxKIrz2Oi6R QrwpiZVVqUX58UWlOanFhxhNgW6ayCwlmpwPjKW8knhDE0NzS0MjYwsLcyMjJXHeqR+uhAsJ pCeWpGanphakFsH0MXFwSjUw8ipeu8V8/vG21K376ySmnTsg/p5vgk1TwX3uYMFAu4+a92bv EjJ/JlLBt6h6cWDTShWlT3b5bI+4xIobggs3GwUe9n1XumvFh7KVe+X0BKo37/j9dWcJu7jr +XPndk7bnDIpIOYg92555jnHGHKWbQy4W7jUSXRWw8SA/l6+sGWJH7k/unndVGIpzkg01GIu Kk4EAGL7vC1tAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191222eucas1p2fc88d38fb9f84f7da04d853811dd07db 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: 20170616191222eucas1p2fc88d38fb9f84f7da04d853811dd07db X-RootMTR: 20170616191222eucas1p2fc88d38fb9f84f7da04d853811dd07db References: <1497640325-10960-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 v9 4/8] 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, Alexey Perevalov , peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This modification is necessary for userfault fd features which are required to be requested from userspace. UFFD_FEATURE_THREAD_ID is a one of such "on demand" feature, which will be introduced in the next patch. QEMU have to use separate userfault file descriptor, due to userfault context has internal state, and after first call of ioctl UFFD_API it changes its state to UFFD_STATE_RUNNING (in case of success), but kernel while handling ioctl UFFD_API expects UFFD_STATE_WAIT_= API. So only one ioctl with UFFD_API is possible per ufd. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 94 ++++++++++++++++++++++++++++++++++++++++++++= ---- 1 file changed, 88 insertions(+), 6 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index b35baf3..d152f1a 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -63,16 +63,67 @@ struct PostcopyDiscardState { #include #include =20 -static bool ufd_version_check(int ufd, MigrationIncomingState *mis) + +/** + * receive_ufd_features: check userfault fd features, to request only supp= orted + * features in the future. + * + * Returns: true on success + * + * __NR_userfaultfd - should be checked before + * @features: out parameter will contain uffdio_api.features provided by = kernel + * in case of success + */ +static bool receive_ufd_features(uint64_t *features) { - struct uffdio_api api_struct; - uint64_t ioctl_mask; + struct uffdio_api api_struct =3D {0}; + int ufd; + bool ret =3D true; + + /* if we are here __NR_userfaultfd should exists */ + ufd =3D syscall(__NR_userfaultfd, O_CLOEXEC); + if (ufd =3D=3D -1) { + error_report("%s: syscall __NR_userfaultfd failed: %s", __func__, + strerror(errno)); + return false; + } =20 + /* ask features */ api_struct.api =3D UFFD_API; api_struct.features =3D 0; if (ioctl(ufd, UFFDIO_API, &api_struct)) { error_report("%s: UFFDIO_API failed: %s", __func__, strerror(errno)); + ret =3D false; + goto release_ufd; + } + + *features =3D api_struct.features; + +release_ufd: + close(ufd); + return ret; +} + +/** + * request_ufd_features: this function should be called only once on a new= ly + * opened ufd, subsequent calls will lead to error. + * + * Returns: true on succes + * + * @ufd: fd obtained from userfaultfd syscall + * @features: bit mask see UFFD_API_FEATURES + */ +static bool request_ufd_features(int ufd, uint64_t features) +{ + struct uffdio_api api_struct =3D {0}; + uint64_t ioctl_mask; + + api_struct.api =3D UFFD_API; + api_struct.features =3D features; + if (ioctl(ufd, UFFDIO_API, &api_struct)) { + error_report("%s failed: UFFDIO_API failed: %s", __func__, + strerror(errno)); return false; } =20 @@ -84,11 +135,42 @@ static bool ufd_version_check(int ufd, MigrationIncomi= ngState *mis) return false; } =20 + return true; +} + +static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) +{ + uint64_t asked_features =3D 0; + static uint64_t supported_features; + + /* + * it's not possible to + * request UFFD_API twice per one fd + * userfault fd features is persistent + */ + if (!supported_features) { + if (!receive_ufd_features(&supported_features)) { + error_report("%s failed", __func__); + return false; + } + } + + /* + * request features, even if asked_features is 0, due to + * kernel expects UFFD_API before UFFDIO_REGISTER, per + * userfault file descriptor + */ + if (!request_ufd_features(ufd, asked_features)) { + error_report("%s failed: features %" PRIu64, __func__, + asked_features); + return false; + } + if (getpagesize() !=3D ram_pagesize_summary()) { bool have_hp =3D false; /* We've got a huge page */ #ifdef UFFD_FEATURE_MISSING_HUGETLBFS - have_hp =3D api_struct.features & UFFD_FEATURE_MISSING_HUGETLBFS; + have_hp =3D supported_features & UFFD_FEATURE_MISSING_HUGETLBFS; #endif if (!have_hp) { error_report("Userfault on this host does not support huge pag= es"); @@ -149,7 +231,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 @@ -525,7 +607,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 May 4 07:43:44 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 1497640611122956.378834500475; Fri, 16 Jun 2017 12:16:51 -0700 (PDT) Received: from localhost ([::1]:60472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwjh-0002Yz-JH for importer@patchew.org; Fri, 16 Jun 2017 15:16:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfW-0007Aq-EP for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfS-0007RX-AP for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:30 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:12201) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfS-0007Qq-3e for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:26 -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 <0ORN00LR5MOO6I40@mailout2.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:24 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191223eucas1p10c3f863f649cd19ede2b319e0bd9f5bd~Ir-UnJXdW3158031580eucas1p1w; Fri, 16 Jun 2017 19:12:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id D9.48.04729.79D24495; Fri, 16 Jun 2017 20:12:23 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191222eucas1p186aab01cb769c9c2f7a1b61be48cd9a2~Ir-Tp8T4i0327603276eucas1p1W; Fri, 16 Jun 2017 19:12:22 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 23.9C.17452.69D24495; Fri, 16 Jun 2017 20:12:22 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:22 +0100 (BST) X-AuditID: cbfec7f4-f79806d000001279-46-59442d97e13b From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:12:02 +0300 Message-id: <1497640325-10960-6-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djPc7rTdV0iDW7+ErKYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ijuGxSUnMyy1KL9O0S uDIO9dxhKVgtWHH97jLmBsYevi5GTg4JAROJ5h/P2CFsMYkL99azdTFycQgJLGWUePZhIpTz Gci5vJUVpuP2ocXMEIlljBJ7L35nh3C6mSQ2Tl0DVMXBwSZgILHvni1Ig4iApMTvrtNgDcwC rYwS7X2PmEESwgJeEh/7LrGA2CwCqhJ/7z9jArF5BdwlJs9+zwKxTU7i5LHJYDM5BTwkjm/y A5kjIfCYTeLPkSY2kLiEgKzEpgPMEOUuElOvvoSyhSVeHd8C9ZqMRGfHQSaI3nZGie6dnawQ zgRGiTPT/0JV2UucunkV7AhmAT6JSdumM0Ms4JXoaBOCKPGQWHlwAtReR4lPr+wgfp/NKPGn 5x7bBEaZBYwMqxhFUkuLc9NTi030ihNzi0vz0vWS83M3MQKj9PS/4192MC4+ZnWIUYCDUYmH l+G2c6QQa2JZcWXuIUYJDmYlEV57HZdIId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxcp65FCAmk J5akZqemFqQWwWSZODilGhjtnp+8/2LCP5vph59cCHEoOH343f7zekFXOJZ8vich8CVB9b7m bTGzGiu/d5LbBZave2m/a6uxQ4nq5iZ7jZknjHdY5J2WSF//VPYUq/a+6PSZaqqHlV4sE/0o rz/r/F/bK0VXsj5Un+x6Kj7XQPpsaCWH05Q2qfcebioR73RXbE3/Jls1U+6dEktxRqKhFnNR cSIAlTArLc4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xy7rTdF0iDaZMlLOYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ij3GwyUhNTUosUUvOS 81My89JtlUJD3HQtlBTyEnNTbZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4JZxqOcOS8Fq wYrrd5cxNzD28HUxcnJICJhI3D60mBnCFpO4cG89WxcjF4eQwBJGifs7FzJBOL1MEgfvTWHt YuTgYBMwkNh3zxakQURAUuJ312lmkBpmgVZGiSeNs9hBEsICXhIf+y6xgNgsAqoSf+8/YwKx eQXcJSbPfs8CsU1O4uSxyWAzOQU8JI5v8gMJCwGVbNmyg2UCI+8CRoZVjCKppcW56bnFhnrF ibnFpXnpesn5uZsYgeG67djPzTsYL20MPsQowMGoxMPLcNs5Uog1say4MvcQowQHs5IIr72O S6QQb0piZVVqUX58UWlOavEhRlOgmyYyS4km5wNjKa8k3tDE0NzS0MjYwsLcyEhJnLfkw5Vw IYH0xJLU7NTUgtQimD4mDk6pBkbPKd7/D8jyt51ZZL5ONvbmzuOrvM+Esi0xya0WOPSJySOm 2yEoZqX5m5IUtSfLs+b+VrY8seGJhvGiNBkLtp+3TixwmRDRpt3TXKXwc9vuBWJLb3sY9yf+ vR7mZPp5X/7kY7YrVDe322Y9lOYWPfUt5NSNx4Kt+sUay1tbNPwicu4lBSx/t0KJpTgj0VCL uag4EQBvkbJgbQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191222eucas1p186aab01cb769c9c2f7a1b61be48cd9a2 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: 20170616191222eucas1p186aab01cb769c9c2f7a1b61be48cd9a2 X-RootMTR: 20170616191222eucas1p186aab01cb769c9c2f7a1b61be48cd9a2 References: <1497640325-10960-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 v9 5/8] 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, Alexey Perevalov , peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Right now it could be used on destination side to enable vCPU blocktime calculation for postcopy live migration. vCPU blocktime - it's time since vCPU thread was put into interruptible sleep, till memory page was copied and thread awake. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- migration/migration.c | 9 +++++++++ migration/migration.h | 1 + qapi-schema.json | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 56929dc..f920ddf 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1233,6 +1233,15 @@ bool migrate_zero_blocks(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } =20 +bool migrate_postcopy_blocktime(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME= ]; +} + bool migrate_use_compression(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 601e4ab..cf4d04e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -152,6 +152,7 @@ int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_decompress_threads(void); bool migrate_use_events(void); +bool migrate_postcopy_blocktime(void); =20 /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, diff --git a/qapi-schema.json b/qapi-schema.json index 4b50b65..e906953 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -900,12 +900,15 @@ # offers more flexibility. # (Since 2.10) # +# @postcopy-blocktime: Calculate downtime for postcopy live migration +# (since 2.10) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', - 'block' ] } + 'block', 'postcopy-blocktime'] } =20 ## # @MigrationCapabilityStatus: --=20 1.8.3.1 From nobody Sat May 4 07:43:44 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 1497640456557743.8179424852666; Fri, 16 Jun 2017 12:14:16 -0700 (PDT) Received: from localhost ([::1]:60457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwhD-0008UN-68 for importer@patchew.org; Fri, 16 Jun 2017 15:14:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfU-000794-OE for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfR-0007Qu-JV for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:28 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:20723) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfR-0007Px-D5 for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:25 -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 <0ORN00I5PMOOCW20@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:24 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191224eucas1p1c23cd89c5d0e95afe56e8e88e151c8e5~Ir-VHtpaC0328903289eucas1p1R; Fri, 16 Jun 2017 19:12:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id AA.B8.14140.A9D24495; Fri, 16 Jun 2017 20:12:26 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170616191223eucas1p26f48ecbb0f533561e9c43bbac1da3e04~Ir-UcCMHj0759607596eucas1p2_; Fri, 16 Jun 2017 19:12:23 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B8.D5.20206.79D24495; Fri, 16 Jun 2017 20:12:23 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:23 +0100 (BST) X-AuditID: cbfec7ef-f796a6d00000373c-a1-59442d9a6c24 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:12:03 +0300 Message-id: <1497640325-10960-7-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djPc7qzdF0iDRpfS1vMvXuexaJ32z12 iyvtP9kttuz/xm5xvHcHi8WdLX1MDmweT65tZvJ4v+8qm0ffllWMAcxRXDYpqTmZZalF+nYJ XBmrWqoKejUqml7NZGpg7FXoYuTkkBAwkZjzZh8bhC0mceHeejBbSGAZo8SlmRxdjFxA9mdG ifkHnzN3MXKANUx+qwQRB6qZen0rK0RDN5PEod+ZIDVsAgYS++7ZgoRFBCQlfnedZgapZxZo ZZRo73vEDJIQFoiWmLLwAdgyFgFViblH14PN4RVwl5g0exMTxEFyEiePTWYFmckp4CFxfJMf yBwJgftsEt/e7WKFuEdWYtMBqNNcJI5PM4ToFJZ4dXwLO4QtI3F5cjcLRGs7o0T3zk5WCGcC o8SZ6X+hquwlTt28CraXWYBPYtK26VBDeSU62oQgSjwkVt7azgxhO0o0HnnODAmH2YwS2/5N YJnAKLOAkWEVo0hqaXFuemqxoV5xYm5xaV66XnJ+7iZGYHSe/nf8/Q7Gp80hhxgFOBiVeHgZ bjtHCrEmlhVX5h5ilOBgVhLhtddxiRTiTUmsrEotyo8vKs1JLT7EKM3BoiTOy3vqWoSQQHpi SWp2ampBahFMlomDU6qBUeD891fTvMvaczZcenHt9ItrflGBrs8mVDSrcR4+GCwkFPH/stuM xdLih3lcm2w8A3+G2rx4fkfWbIWCoafm9aRridPuzGSQ/qVbanzs+8pCu1dl2zRPXKkLlz1/ e5/qqbg2bod3Z85V+SX1ccUXuC8tV3DrtfjbVp3MOn87Y4f0/9of6+e/U2Ipzkg01GIuKk4E AIJGHVDKAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRmVeSWpSXmKPExsVy+t/xy7rTdV0iDbZP57CYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ij3GwyUhNTUosUUvOS 81My89JtlUJD3HQtlBTyEnNTbZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4JaxqqWqoFej ounVTKYGxl6FLkYODgkBE4nJb5W6GDmBTDGJC/fWs3UxcnEICSxhlHh46DmU08skseX2YSaQ BjYBA4l992xBGkQEJCV+d51mBqlhFmhllHjSOIsdJCEsEC0xZeEDNhCbRUBVYu7R9awgNq+A u8Sk2ZuYILbJSZw8NpkVZCangIfE8U1+IGEhoJItW3awTGDkXcDIsIpRJLW0ODc9t9hIrzgx t7g0L10vOT93EyMwVLcd+7llB2PXu+BDjAIcjEo8vJF3nSOFWBPLiitzDzFKcDArifDa67hE CvGmJFZWpRblxxeV5qQWH2I0BbppIrOUaHI+MI7ySuINTQzNLQ2NjC0szI2MlMR5p364Ei4k kJ5YkpqdmlqQWgTTx8TBKdXA2N3Az7hIQjQ39nVkSH6jZvisbrnbX3Kex1R6RK25MnvDukUP C4J+LN5yJ/LOa8GJynOrg2zmRhxXPfIoWVDnTGL5LM2rL5gDlzx+cnxn6vFslWi+9SUli+67 1gXISf5yEluxM+TZ/IvGF0+Z5a35sXUDW8YZt/dNmSXMVUFKuyalTJ3G+fOroxJLcUaioRZz UXEiAKI0s1RrAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191223eucas1p26f48ecbb0f533561e9c43bbac1da3e04 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: 20170616191223eucas1p26f48ecbb0f533561e9c43bbac1da3e04 X-RootMTR: 20170616191223eucas1p26f48ecbb0f533561e9c43bbac1da3e04 References: <1497640325-10960-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 v9 6/8] migration: add postcopy blocktime ctx into MigrationIncomingState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: i.maximets@samsung.com, dgilbert@redhat.com, Alexey Perevalov , peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch adds request to kernel space for UFFD_FEATURE_THREAD_ID, in case when this feature is provided by kernel. PostcopyBlocktimeContext is incapsulated inside postcopy-ram.c, due to it's postcopy only feature. Also it defines PostcopyBlocktimeContext's instance live time. Information from PostcopyBlocktimeContext instance will be provided much after postcopy migration end, instance of PostcopyBlocktimeContext will live till QEMU exit, but part of it (vcpu_addr, page_fault_vcpu_time) used only during calculation, will be released when postcopy ended or failed. To enable postcopy blocktime calculation on destination, need to request proper capabiltiy (Patch for documentation will be at the tail of the patch set). As an example following command enable that capability, assume QEMU was started with -chardev socket,id=3Dcharmonitor,path=3D/var/lib/migrate-vm-monitor.sock option to control it [root@host]#printf "{\"execute\" : \"qmp_capabilities\"}\r\n \ {\"execute\": \"migrate-set-capabilities\" , \"arguments\": { \"capabilities\": [ { \"capability\": \"postcopy-blocktime\", \"state\": true } ] } }" | nc -U /var/lib/migrate-vm-monitor.sock Or just with HMP (qemu) migrate_set_capability postcopy-blocktime on Signed-off-by: Alexey Perevalov --- migration/migration.h | 8 ++++++ migration/postcopy-ram.c | 65 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 73 insertions(+) diff --git a/migration/migration.h b/migration/migration.h index cf4d04e..2697f6c 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -22,6 +22,8 @@ #include "exec/cpu-common.h" #include "qemu/coroutine_int.h" =20 +struct PostcopyBlocktimeContext; + /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -59,6 +61,12 @@ struct MigrationIncomingState { /* The coroutine we should enter (back) after failover */ Coroutine *migration_incoming_co; QemuSemaphore colo_incoming_sem; + + /* + * PostcopyBlocktimeContext to keep information for postcopy + * live migration, to calculate vCPU block time + * */ + struct PostcopyBlocktimeContext *blocktime_ctx; }; =20 MigrationIncomingState *migration_incoming_get_current(void); diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index d152f1a..990d143 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -63,6 +63,58 @@ struct PostcopyDiscardState { #include #include =20 +typedef struct PostcopyBlocktimeContext { + /* time when page fault initiated per vCPU */ + int64_t *page_fault_vcpu_time; + /* page address per vCPU */ + uint64_t *vcpu_addr; + int64_t total_blocktime; + /* blocktime per vCPU */ + int64_t *vcpu_blocktime; + /* point in time when last page fault was initiated */ + int64_t last_begin; + /* number of vCPU are suspended */ + int smp_cpus_down; + + /* + * Handler for exit event, necessary for + * releasing whole blocktime_ctx + */ + Notifier exit_notifier; + /* + * Handler for postcopy event, necessary for + * releasing unnecessary part of blocktime_ctx + */ + Notifier postcopy_notifier; +} PostcopyBlocktimeContext; + +static void destroy_blocktime_context(struct PostcopyBlocktimeContext *ctx) +{ + g_free(ctx->page_fault_vcpu_time); + g_free(ctx->vcpu_addr); + g_free(ctx->vcpu_blocktime); + g_free(ctx); +} + +static void migration_exit_cb(Notifier *n, void *data) +{ + PostcopyBlocktimeContext *ctx =3D container_of(n, PostcopyBlocktimeCon= text, + exit_notifier); + destroy_blocktime_context(ctx); +} + +static struct PostcopyBlocktimeContext *blocktime_context_new(void) +{ + PostcopyBlocktimeContext *ctx =3D g_new0(PostcopyBlocktimeContext, 1); + ctx->page_fault_vcpu_time =3D g_new0(int64_t, smp_cpus); + ctx->vcpu_addr =3D g_new0(uint64_t, smp_cpus); + ctx->vcpu_blocktime =3D g_new0(int64_t, smp_cpus); + + ctx->exit_notifier.notify =3D migration_exit_cb; + qemu_add_exit_notifier(&ctx->exit_notifier); + add_migration_state_change_notifier(&ctx->postcopy_notifier); + return ctx; +} =20 /** * receive_ufd_features: check userfault fd features, to request only supp= orted @@ -155,6 +207,19 @@ static bool ufd_check_and_apply(int ufd, MigrationInco= mingState *mis) } } =20 +#ifdef UFFD_FEATURE_THREAD_ID + if (migrate_postcopy_blocktime() && mis && + UFFD_FEATURE_THREAD_ID & supported_features) { + /* kernel supports that feature */ + /* don't create blocktime_context if it exists */ + if (!mis->blocktime_ctx) { + mis->blocktime_ctx =3D blocktime_context_new(); + } + + asked_features |=3D UFFD_FEATURE_THREAD_ID; + } +#endif + /* * request features, even if asked_features is 0, due to * kernel expects UFFD_API before UFFDIO_REGISTER, per --=20 1.8.3.1 From nobody Sat May 4 07:43:44 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 149764083968390.77151636235612; Fri, 16 Jun 2017 12:20:39 -0700 (PDT) Received: from localhost ([::1]:60492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwnO-0006TN-Cz for importer@patchew.org; Fri, 16 Jun 2017 15:20:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfX-0007BO-3A for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfS-0007Ra-9o for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:31 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:56702) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfS-0007Pu-3r for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:26 -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 <0ORN00KQ0MOPJJ40@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:25 +0100 (BST) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191224eucas1p1f94ee0b89608c94403b45c1fd9dd79da~Ir-VoLNZv0327503275eucas1p1U; Fri, 16 Jun 2017 19:12:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 8D.68.17464.89D24495; Fri, 16 Jun 2017 20:12:24 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170616191223eucas1p14025ca2f7c70d0edcad51f05458e0d9c~Ir-U2jfuU0327503275eucas1p1T; Fri, 16 Jun 2017 19:12:23 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 93.9C.17452.79D24495; Fri, 16 Jun 2017 20:12:23 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:23 +0100 (BST) X-AuditID: cbfec7f2-f797e6d000004438-fc-59442d988ebd From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:12:04 +0300 Message-id: <1497640325-10960-8-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7ozdF0iDR5ckLCYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ijuGxSUnMyy1KL9O0S uDIaVrxiKmj2rDhwbR9TA+MJ8y5GTg4JAROJq2+3s0PYYhIX7q1n62Lk4hASWMoosW/fL0YI 5zOjxIRV/UwwHfd2nmKCSCxjlNh84xkrSEJIoJtJ4tDvzC5GDg42AQOJffdsQcIiApISv7tO M4PUMwu0Mkq09z1iBkkIC7hLfG97AWazCKhKLJ18H2wOL1D84LRlUCfJSZw8NpkVZCangIfE 8U1+IHMkBO6zSaza8oINJC4hICux6QAzRLmLxIEtrawQtrDEq+NboMbISHR2HGSC6G1nlOje 2ckK4UxglDgz/S9Ulb3EqZtXwb5kFuCTmLRtOjPEAl6JjjYhiBIPiX/Nn9ghwo4Snw77QsJh NqPE5atb2SYwyixgZFjFKJJaWpybnlpsrFecmFtcmpeul5yfu4kRGKOn/x3/tIPx6wmrQ4wC HIxKPLwMt50jhVgTy4orcw8xSnAwK4nw2uu4RArxpiRWVqUW5ccXleakFh9ilOZgURLn5Tp1 LUJIID2xJDU7NbUgtQgmy8TBKdXA6C87p+DLhECmK+VrDy0uP/+Z2fHYQ86VSjvbLTfel7RP dWPvebpj2bVVp3UfOh1u65rDfNGL5/2vDZqLv/e9z+sq2P3p8PLWn7f0XCyCvsuudZqfoLvx /UJBd/l1fHckY/Tto8T/vJXISMxj8RcX7Lqfa5K31sHpToLChpQrpRPWdzLV7K55osRSnJFo qMVcVJwIAIEhZhLNAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xy7rTdV0iDdp3G1jMvXuexaJ32z12 iyvtP9kttuz/xm5xvHcHi8WdLX1MDmweT65tZvJ4v+8qm0ffllWMAcxRbjYZqYkpqUUKqXnJ +SmZeem2SqEhbroWSgp5ibmptkoRur4hQUoKZYk5pUCekQEacHAOcA9W0rdLcMtoWPGKqaDZ s+LAtX1MDYwnzLsYOTkkBEwk7u08xQRhi0lcuLeerYuRi0NIYAmjRH9DEwuE08skseX2YaAq Dg42AQOJffdsQRpEBCQlfnedZgapYRZoZZR40jiLHSQhLOAu8b3tBTOIzSKgKrF08n1WEJsX KH5w2jJ2iG1yEiePTWYFmckp4CFxfJMfSFgIqGTLlh0sExh5FzAyrGIUSS0tzk3PLTbUK07M LS7NS9dLzs/dxAgM123Hfm7ewXhpY/AhRgEORiUeXobbzpFCrIllxZW5hxglOJiVRHjtdVwi hXhTEiurUovy44tKc1KLDzGaAt00kVlKNDkfGEt5JfGGJobmloZGxhYW5kZGSuK8JR+uhAsJ pCeWpGanphakFsH0MXFwSjUwdogHt/9LipdVOerI9oVNTG734nqVYLvUjmezj7NeqTsZmJA3 Z4Yy84uWud84PNdEaDN/PmNXtT/2seBGBb+cMx1PFvIvvjO5Xf33Vu28+RGPtY0bTtk3xirr Hji83bXZ6ZBY2z7XqcUcFk6XrF+e17rF1Hm9Vu3Rq+6ZM356uN/9l3j1rqGdEktxRqKhFnNR cSIAfs4RiW0CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191223eucas1p14025ca2f7c70d0edcad51f05458e0d9c 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: 20170616191223eucas1p14025ca2f7c70d0edcad51f05458e0d9c X-RootMTR: 20170616191223eucas1p14025ca2f7c70d0edcad51f05458e0d9c References: <1497640325-10960-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 v9 7/8] 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, Alexey Perevalov , peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch provides blocktime calculation per vCPU, as a summary and as a overlapped value for all vCPUs. This approach was suggested by Peter Xu, as an improvements of previous approch where QEMU kept tree with faulted page address and cpus bi= tmask in it. Now QEMU is keeping array with faulted page address as value and vCPU as index. It helps to find proper vCPU at UFFD_COPY time. Also it keeps list for blocktime per vCPU (could be traced with page_fault_addr) Blocktime will not calculated if postcopy_blocktime field of MigrationIncomingState wasn't initialized. Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 137 +++++++++++++++++++++++++++++++++++++++++++= +++- migration/trace-events | 5 +- 2 files changed, 139 insertions(+), 3 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 990d143..3f36e4f 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -112,7 +112,6 @@ static struct PostcopyBlocktimeContext *blocktime_conte= xt_new(void) =20 ctx->exit_notifier.notify =3D migration_exit_cb; qemu_add_exit_notifier(&ctx->exit_notifier); - add_migration_state_change_notifier(&ctx->postcopy_notifier); return ctx; } =20 @@ -561,6 +560,136 @@ static int ram_block_enable_notify(const char *block_= name, void *host_addr, return 0; } =20 +static int get_mem_fault_cpu_index(uint32_t pid) +{ + CPUState *cpu_iter; + + CPU_FOREACH(cpu_iter) { + if (cpu_iter->thread_id =3D=3D pid) { + trace_get_mem_fault_cpu_index(cpu_iter->cpu_index, pid); + return cpu_iter->cpu_index; + } + } + trace_get_mem_fault_cpu_index(-1, pid); + return -1; +} + +/* + * This function is being called when pagefault occurs. It + * tracks down vCPU blocking time. + * + * @addr: faulted host virtual address + * @ptid: faulted process thread id + * @rb: ramblock appropriate to addr + */ +static void mark_postcopy_blocktime_begin(uint64_t addr, uint32_t ptid, + RAMBlock *rb) +{ + int cpu, already_received; + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *dc =3D mis->blocktime_ctx; + int64_t now_ms; + + if (!dc || ptid =3D=3D 0) { + return; + } + cpu =3D get_mem_fault_cpu_index(ptid); + if (cpu < 0) { + return; + } + + now_ms =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + if (dc->vcpu_addr[cpu] =3D=3D 0) { + atomic_inc(&dc->smp_cpus_down); + } + + atomic_xchg__nocheck(&dc->vcpu_addr[cpu], addr); + atomic_xchg__nocheck(&dc->last_begin, now_ms); + atomic_xchg__nocheck(&dc->page_fault_vcpu_time[cpu], now_ms); + + already_received =3D ramblock_recv_bitmap_test((void *)addr, rb); + if (already_received) { + atomic_xchg__nocheck(&dc->vcpu_addr[cpu], 0); + atomic_xchg__nocheck(&dc->page_fault_vcpu_time[cpu], 0); + atomic_sub(&dc->smp_cpus_down, 1); + } + trace_mark_postcopy_blocktime_begin(addr, dc, dc->page_fault_vcpu_time= [cpu], + cpu, already_received); +} + +/* + * This function just provide calculated blocktime per cpu and trace it. + * Total blocktime is calculated in mark_postcopy_blocktime_end. + * + * + * Assume we have 3 CPU + * + * S1 E1 S1 E1 + * -----***********------------xxx***************------------------------>= CPU1 + * + * S2 E2 + * ------------****************xxx--------------------------------------->= CPU2 + * + * S3 E3 + * ------------------------****xxx********------------------------------->= CPU3 + * + * We have sequence S1,S2,E1,S3,S1,E2,E3,E1 + * S2,E1 - doesn't match condition due to sequence S1,S2,E1 doesn't includ= e CPU3 + * S3,S1,E2 - sequence includes all CPUs, in this case overlap will be S1,= E2 - + * it's a part of total blocktime. + * S1 - here is last_begin + * Legend of the picture is following: + * * - means blocktime per vCPU + * x - means overlapped blocktime (total blocktime) + * + * @addr: host virtual address + */ +static void mark_postcopy_blocktime_end(uint64_t addr) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + PostcopyBlocktimeContext *dc =3D mis->blocktime_ctx; + int i, affected_cpu =3D 0; + int64_t now_ms; + bool vcpu_total_blocktime =3D false; + + if (!dc) { + return; + } + + now_ms =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + + /* lookup cpu, to clear it, + * that algorithm looks straighforward, but it's not + * optimal, more optimal algorithm is keeping tree or hash + * where key is address value is a list of */ + for (i =3D 0; i < smp_cpus; i++) { + uint64_t vcpu_blocktime =3D 0; + if (atomic_fetch_add(&dc->vcpu_addr[i], 0) !=3D addr) { + continue; + } + atomic_xchg__nocheck(&dc->vcpu_addr[i], 0); + vcpu_blocktime =3D now_ms - + atomic_fetch_add(&dc->page_fault_vcpu_time[i], 0); + affected_cpu +=3D 1; + /* we need to know is that mark_postcopy_end was due to + * faulted page, another possible case it's prefetched + * page and in that case we shouldn't be here */ + if (!vcpu_total_blocktime && + atomic_fetch_add(&dc->smp_cpus_down, 0) =3D=3D smp_cpus) { + vcpu_total_blocktime =3D true; + } + /* continue cycle, due to one page could affect several vCPUs */ + dc->vcpu_blocktime[i] +=3D vcpu_blocktime; + } + + atomic_sub(&dc->smp_cpus_down, affected_cpu); + if (vcpu_total_blocktime) { + dc->total_blocktime +=3D now_ms - atomic_fetch_add(&dc->last_begin= , 0); + } + trace_mark_postcopy_blocktime_end(addr, dc, dc->total_blocktime, + affected_cpu); +} + /* * Handle faults detected by the USERFAULT markings */ @@ -638,8 +767,11 @@ static void *postcopy_ram_fault_thread(void *opaque) rb_offset &=3D ~(qemu_ram_pagesize(rb) - 1); trace_postcopy_ram_fault_thread_request(msg.arg.pagefault.address, qemu_ram_get_idstr(rb), - rb_offset); + rb_offset, + msg.arg.pagefault.feat.pti= d); =20 + mark_postcopy_blocktime_begin((uintptr_t)(msg.arg.pagefault.addres= s), + msg.arg.pagefault.feat.ptid, rb); /* * Send the request to the source - we want to request one * of our host page sizes (which is >=3D TPS) @@ -716,6 +848,7 @@ static int qemu_ufd_copy_ioctl(int userfault_fd, void *= host_addr, * but gup betwean two following operation could be high, * and in this case blocktime for such small interval will be lost */ ramblock_recv_bitmap_set(host_addr, rb); + mark_postcopy_blocktime_end((uint64_t)(uintptr_t)host_addr); if (from_addr) { struct uffdio_copy copy_struct; copy_struct.dst =3D (uint64_t)(uintptr_t)host_addr; diff --git a/migration/trace-events b/migration/trace-events index cb2c4b5..13e6ecd 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -114,6 +114,8 @@ process_incoming_migration_co_end(int ret, int ps) "ret= =3D%d postcopy-state=3D%d" process_incoming_migration_co_postcopy_end_main(void) "" migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" migration_set_outgoing_channel(void *ioc, const char *ioctype, const char = *hostname) "ioc=3D%p ioctype=3D%s hostname=3D%s" +mark_postcopy_blocktime_begin(uint64_t addr, void *dd, int64_t time, int c= pu, int received) "addr: 0x%" PRIx64 ", dd: %p, time: %" PRId64 ", cpu: %d,= already_received: %d" +mark_postcopy_blocktime_end(uint64_t addr, void *dd, int64_t time, int aff= ected_cpu) "addr: 0x%" PRIx64 ", dd: %p, time: %" PRId64 ", affected_cpu: %= d" =20 # migration/rdma.c qemu_rdma_accept_incoming_migration(void) "" @@ -190,7 +192,7 @@ postcopy_ram_enable_notify(void) "" postcopy_ram_fault_thread_entry(void) "" postcopy_ram_fault_thread_exit(void) "" postcopy_ram_fault_thread_quit(void) "" -postcopy_ram_fault_thread_request(uint64_t hostaddr, const char *ramblock,= size_t offset) "Request for HVA=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 pid=3D%u" postcopy_ram_incoming_cleanup_closeuf(void) "" postcopy_ram_incoming_cleanup_entry(void) "" postcopy_ram_incoming_cleanup_exit(void) "" @@ -199,6 +201,7 @@ save_xbzrle_page_skipping(void) "" save_xbzrle_page_overflow(void) "" ram_save_iterate_big_wait(uint64_t milliconds, int iterations) "big wait: = %" PRIu64 " milliseconds, %d iterations" ram_load_complete(int ret, uint64_t seq_iter) "exit_code %d seq iteration = %" PRIu64 +get_mem_fault_cpu_index(int cpu, uint32_t pid) "cpu: %d, pid: %u" =20 # migration/exec.c migration_exec_outgoing(const char *cmd) "cmd=3D%s" --=20 1.8.3.1 From nobody Sat May 4 07:43:44 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 149764045383072.88879120017668; Fri, 16 Jun 2017 12:14:13 -0700 (PDT) Received: from localhost ([::1]:60456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwh9-0008SD-EC for importer@patchew.org; Fri, 16 Jun 2017 15:14:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLwfV-00079t-LG for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLwfT-0007SM-K1 for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:51962) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLwfT-0007Rs-EL for qemu-devel@nongnu.org; Fri, 16 Jun 2017 15:12:27 -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 <0ORN00MNMMOQQ340@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 16 Jun 2017 20:12:26 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170616191225eucas1p2bee18565b38928fb341cfeb46fc625c4~Ir-WqFT2D3055730557eucas1p2c; Fri, 16 Jun 2017 19:12:25 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 83.95.04459.99D24495; Fri, 16 Jun 2017 20:12:25 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170616191224eucas1p2e8c1ff33f630b6beaff096b73ab3462b~Ir-Vosm-p3070630706eucas1p2M; Fri, 16 Jun 2017 19:12:24 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 29.D5.20206.89D24495; Fri, 16 Jun 2017 20:12:24 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORN00K65MO9DC10@eusync1.samsung.com>; Fri, 16 Jun 2017 20:12:24 +0100 (BST) X-AuditID: cbfec7f1-f796e6d00000116b-ae-59442d995e90 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 22:12:05 +0300 Message-id: <1497640325-10960-9-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497640325-10960-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRmVeSWpSXmKPExsWy7djPc7ozdV0iDQ6tkLeYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ijuGxSUnMyy1KL9O0S uDLmz/vJXjCds2L/xnUsDYzX2LsYOTkkBEwkVh3Zwghhi0lcuLeerYuRi0NIYCmjxPZtu1kg nM+MEq9u/mfqYuQA62j4bgkRX8Yo0XatgQ2kW0igm0ni7INckBo2AQOJffdsQcIiApISv7tO M4PUMwu0Mkq09z1iBkkICzhLnNo/gxXEZhFQlZjaO40FxOYVcJfY+ng/K8RFchInj01mBZnJ KeAhcXyTH0T4PpvEjgNuEOfISmw6wAwRdpHY+foblC0s8er4FqgfZSQuT+4Ge0VCoJ1Rontn JyuEM4FR4sz0v1BV9hKnbl5lArGZBfgkJm2bzgyxgFeio00IosRDYu/PbqjTHCWOzH0BDZ/Z jBInD71nmcAos4CRYRWjSGppcW56arGRXnFibnFpXrpecn7uJkZghJ7+d/zjDsb3J6wOMQpw MCrx8DLcdo4UYk0sK67MPcQowcGsJMJrr+MSKcSbklhZlVqUH19UmpNafIhRmoNFSZyX69S1 CCGB9MSS1OzU1ILUIpgsEwenVAOjl04Gm/nN35t55kyzVLgwhTGkb2vjj5TzzMs8tn2q1VXa O9lkWcfiuslVCk8fLeF72vNU1CntR4WZ2Oa/qXve7dL9FhowKfztyxNbA+yumG3tWNBplMfc wfvxYuqnX0fVNDtiT3BsOykWcrSMT6ld+a2E9IeUiambdtaw/0x50TbHsKPIco2EEktxRqKh FnNRcSIA9JbGnMwCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsVy+t/xy7ozdF0iDU68lrSYe/c8i0Xvtnvs Flfaf7JbbNn/jd3ieO8OFos7W/qYHNg8nlzbzOTxft9VNo++LasYA5ij3GwyUhNTUosUUvOS 81My89JtlUJD3HQtlBTyEnNTbZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4JYxf95P9oLp nBX7N65jaWC8xt7FyMEhIWAi0fDdsouRE8gUk7hwbz1bFyMXh5DAEkaJ/mN9LBBOL5PEuiNf WUEa2AQMJPbdswVpEBGQlPjddZoZpIZZoJVR4knjLHaQhLCAs8Sp/TNYQWwWAVWJqb3TWEBs XgF3ia2P97NCbJOTOHlsMthMTgEPieOb/EDCQkAlW7bsYJnAyLuAkWEVo0hqaXFuem6xkV5x Ym5xaV66XnJ+7iZGYLBuO/Zzyw7GrnfBhxgFOBiVeHgj7zpHCrEmlhVX5h5ilOBgVhLhtddx iRTiTUmsrEotyo8vKs1JLT7EaAp000RmKdHkfGAk5ZXEG5oYmlsaGhlbWJgbGSmJ8079cCVc SCA9sSQ1OzW1ILUIpo+Jg1OqgXGx2q44jwXPjMzjD87e//3UElahgvhdPjPCXaasfMUtY+Ie r8nf1tTJlZM7j42rgV/Ct1nFxDmS/YnolY6iN36rHuytzVJ7uSbgnKXso08Vb+3eai19+evC R89HR0o7FIw/+qpNi3bXncT2Ze6PSfx+d5kqn6XfemnxuaJP0alIQK2V8Wf6ViWW4oxEQy3m ouJEAG7LWvtsAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170616191224eucas1p2e8c1ff33f630b6beaff096b73ab3462b 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: 20170616191224eucas1p2e8c1ff33f630b6beaff096b73ab3462b X-RootMTR: 20170616191224eucas1p2e8c1ff33f630b6beaff096b73ab3462b References: <1497640325-10960-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 v9 8/8] 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, Alexey Perevalov , peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Alexey Perevalov --- docs/devel/migration.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/devel/migration.txt b/docs/devel/migration.txt index 1b940a8..4b625ca 100644 --- a/docs/devel/migration.txt +++ b/docs/devel/migration.txt @@ -402,6 +402,16 @@ will now cause the transition from precopy to postcopy. It can be issued immediately after migration is started or any time later on. Issuing it after the end of a migration is harmless. =20 +Blocktime is a postcopy live migration metric, intended to show +how long the vCPU was in state of interruptable sleep due to pagefault. +This value is calculated on destination side. +To enable postcopy blocktime calculation, enter following command on desti= nation +monitor: + +migrate_set_capability postcopy-blocktime on + +Postcopy blocktime can be retrieved by query-migrate qmp command. + Note: During the postcopy phase, the bandwidth limits set using migrate_set_speed is ignored (to avoid delaying requested pages that the destination is waiting for). --=20 1.8.3.1