{"id":815708,"url":"http://patchwork.ozlabs.org/api/patches/815708/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505839684-10046-3-git-send-email-a.perevalov@samsung.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505839684-10046-3-git-send-email-a.perevalov@samsung.com>","list_archive_url":null,"date":"2017-09-19T16:47:56","name":"[v10,02/10] migration: pass MigrationIncomingState* into migration check functions","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b83363918cc34aca2d84f9c8e9423b352e5ddffe","submitter":{"id":18164,"url":"http://patchwork.ozlabs.org/api/people/18164/?format=json","name":"Alexey Perevalov","email":"a.perevalov@samsung.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505839684-10046-3-git-send-email-a.perevalov@samsung.com/mbox/","series":[{"id":3930,"url":"http://patchwork.ozlabs.org/api/series/3930/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3930","date":"2017-09-19T16:48:03","name":"calculate blocktime for postcopy live migration","version":10,"mbox":"http://patchwork.ozlabs.org/series/3930/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815708/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815708/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xxV9L6BqQz9s7m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 03:24:22 +1000 (AEST)","from localhost ([::1]:44260 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duMFw-00074C-TB\n\tfor incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 13:24:20 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:42443)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <a.perevalov@samsung.com>) id 1duLhF-0001Cm-25\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <a.perevalov@samsung.com>) id 1duLhB-0006OF-VH\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:29 -0400","from mailout1.w1.samsung.com ([210.118.77.11]:33237)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <a.perevalov@samsung.com>)\n\tid 1duLhB-0006MD-LH\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:25 -0400","from eucas1p1.samsung.com (unknown [182.198.249.206])\n\tby mailout1.w1.samsung.com (KnoxPortal) with ESMTP id\n\t20170919164823euoutp0147d9ea48105c9e60861d707272282543~l0TtRZlHv2660026600euoutp01M;\n\tTue, 19 Sep 2017 16:48:23 +0000 (GMT)","from eusmges3.samsung.com (unknown [203.254.199.242]) by\n\teucas1p1.samsung.com (KnoxPortal) with ESMTP id\n\t20170919164822eucas1p1b56ea80125ae6452b068b0088db125aa~l0TsZThuB3070230702eucas1p14;\n\tTue, 19 Sep 2017 16:48:22 +0000 (GMT)","from eucas1p1.samsung.com ( [182.198.249.206]) by\n\teusmges3.samsung.com (EUCPMTA) with SMTP id BF.1F.12867.55A41C95;\n\tTue, 19 Sep 2017 17:48:21 +0100 (BST)","from eusmgms1.samsung.com (unknown [182.198.249.179]) by\n\teucas1p2.samsung.com (KnoxPortal) with ESMTP id\n\t20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453~l0Trv-qjn0223102231eucas1p2a;\n\tTue, 19 Sep 2017 16:48:21 +0000 (GMT)","from eusync1.samsung.com ( [203.254.199.211]) by\n\teusmgms1.samsung.com (EUCPMTA) with SMTP id 73.6C.18832.55A41C95;\n\tTue, 19 Sep 2017 17:48:21 +0100 (BST)","from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by\n\teusync1.samsung.com (Oracle Communications Messaging Server\n\t7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id\n\t<0OWJ003OHDC8XU40@eusync1.samsung.com>; \n\tTue, 19 Sep 2017 17:48:21 +0100 (BST)"],"X-AuditID":"cbfec7f2-f793b6d000003243-f6-59c14a5544a0","From":"Alexey Perevalov <a.perevalov@samsung.com>","To":"qemu-devel@nongnu.org","Date":"Tue, 19 Sep 2017 19:47:56 +0300","Message-id":"<1505839684-10046-3-git-send-email-a.perevalov@samsung.com>","X-Mailer":"git-send-email 1.9.1","In-reply-to":"<1505839684-10046-1-git-send-email-a.perevalov@samsung.com>","X-Brightmail-Tracker":["H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7qhXgcjDVb/MLeYe/c8i0Xvtnvs\n\tFhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu\n\tm5TUnMyy1CJ9uwSujEktM9kLWuQrns7+z97AeFOii5GTQ0LARGLrtJlsELaYxIV764FsLg4h\n\tgaWMEj0f77FCOJ8ZJ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mMvAsYGVYxiqSWFuem5xYb6hUn5haX5qXrJefnbmIEBtK2Yz8372C8tDH4EKMAB6MSD+8K\n\tm4ORQqyJZcWVuYcYJTiYlUR4XzsBhXhTEiurUovy44tKc1KLDzFKc7AoifP27lkdKSSQnliS\n\tmp2aWpBaBJNl4uCUamCs2PzmW/f7/1+02p+8e3DvZMtU8ZbFLCHyjAteHfz45Ki9eliVCbvb\n\tXK/5l03sg38aLBZy+sIsf69s76+Od7+sNp6qvZoT3871NCA3VaJJW2D92XXMm/WObO5wzJX9\n\tkzBVq3a3yc2r5qvOH/Cd+OVFcHj3jpMyr1Z9m+BybbrFn+zOX+eNo2SvK7EUZyQaajEXFScC\n\tAH2TKRwgAgAA"],"X-CMS-MailID":"20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453","X-Msg-Generator":"CA","X-Sender-IP":"182.198.249.179","X-Local-Sender":"=?utf-8?q?Alexey_Perevalov=1BSRR-Virtualization_Lab=1B?=\n\t=?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBFbmdpbmVlcg==?=","X-Global-Sender":"=?utf-8?q?Alexey_Perevalov=1BSRR-Virtualization_Lab=1BSa?=\n\t=?utf-8?q?msung_Electronics=1BSenior_Engineer?=","X-Sender-Code":"=?utf-8?q?C10=1BCISHQ=1BC10GD01GD010154?=","CMS-TYPE":"201P","X-CMS-RootMailID":"20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453","X-RootMTR":"20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453","References":"<1505839684-10046-1-git-send-email-a.perevalov@samsung.com>\n\t<CGME20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453@eucas1p2.samsung.com>","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 3.x [fuzzy]","X-Received-From":"210.118.77.11","Subject":"[Qemu-devel] [PATCH v10 02/10] migration: pass\n\tMigrationIncomingState* into migration check functions","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"heetae82.ahn@samsung.com, quintela@redhat.com,\n\tAlexey Perevalov <a.perevalov@samsung.com>, peterx@redhat.com,\n\tdgilbert@redhat.com, i.maximets@samsung.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"That tiny refactoring is necessary to be able to set\nUFFD_FEATURE_THREAD_ID while requesting features, and then\nto create downtime context in case when kernel supports it.\n\nSigned-off-by: Alexey Perevalov <a.perevalov@samsung.com>\n---\n migration/migration.c    |  3 ++-\n migration/postcopy-ram.c | 10 +++++-----\n migration/postcopy-ram.h |  2 +-\n migration/savevm.c       |  2 +-\n 4 files changed, 9 insertions(+), 8 deletions(-)","diff":"diff --git a/migration/migration.c b/migration/migration.c\nindex 959e8ec..e820d47 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -603,6 +603,7 @@ static bool migrate_caps_check(bool *cap_list,\n {\n     MigrationCapabilityStatusList *cap;\n     bool old_postcopy_cap;\n+    MigrationIncomingState *mis = migration_incoming_get_current();\n \n     old_postcopy_cap = cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM];\n \n@@ -636,7 +637,7 @@ static bool migrate_caps_check(bool *cap_list,\n          * special support.\n          */\n         if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) &&\n-            !postcopy_ram_supported_by_host()) {\n+            !postcopy_ram_supported_by_host(mis)) {\n             /* postcopy_ram_supported_by_host will have emitted a more\n              * detailed message\n              */\ndiff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c\nindex 7a414eb..4350dd0 100644\n--- a/migration/postcopy-ram.c\n+++ b/migration/postcopy-ram.c\n@@ -61,7 +61,7 @@ struct PostcopyDiscardState {\n #include <sys/eventfd.h>\n #include <linux/userfaultfd.h>\n \n-static bool ufd_version_check(int ufd)\n+static bool ufd_version_check(int ufd, MigrationIncomingState *mis)\n {\n     struct uffdio_api api_struct;\n     uint64_t ioctl_mask;\n@@ -124,7 +124,7 @@ static int test_ramblock_postcopiable(const char *block_name, void *host_addr,\n  * normally fine since if the postcopy succeeds it gets turned back on at the\n  * end.\n  */\n-bool postcopy_ram_supported_by_host(void)\n+bool postcopy_ram_supported_by_host(MigrationIncomingState *mis)\n {\n     long pagesize = getpagesize();\n     int ufd = -1;\n@@ -147,7 +147,7 @@ bool postcopy_ram_supported_by_host(void)\n     }\n \n     /* Version and features check */\n-    if (!ufd_version_check(ufd)) {\n+    if (!ufd_version_check(ufd, mis)) {\n         goto out;\n     }\n \n@@ -523,7 +523,7 @@ int postcopy_ram_enable_notify(MigrationIncomingState *mis)\n      * Although the host check already tested the API, we need to\n      * do the check again as an ABI handshake on the new fd.\n      */\n-    if (!ufd_version_check(mis->userfault_fd)) {\n+    if (!ufd_version_check(mis->userfault_fd, mis)) {\n         return -1;\n     }\n \n@@ -677,7 +677,7 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis)\n \n #else\n /* No target OS support, stubs just fail */\n-bool postcopy_ram_supported_by_host(void)\n+bool postcopy_ram_supported_by_host(MigrationIncomingState *mis)\n {\n     error_report(\"%s: No OS support\", __func__);\n     return false;\ndiff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h\nindex 78a3591..77ea0fd 100644\n--- a/migration/postcopy-ram.h\n+++ b/migration/postcopy-ram.h\n@@ -14,7 +14,7 @@\n #define QEMU_POSTCOPY_RAM_H\n \n /* Return true if the host supports everything we need to do postcopy-ram */\n-bool postcopy_ram_supported_by_host(void);\n+bool postcopy_ram_supported_by_host(MigrationIncomingState *mis);\n \n /*\n  * Make all of RAM sensitive to accesses to areas that haven't yet been written\ndiff --git a/migration/savevm.c b/migration/savevm.c\nindex 7a55023..6ed6d57 100644\n--- a/migration/savevm.c\n+++ b/migration/savevm.c\n@@ -1352,7 +1352,7 @@ static int loadvm_postcopy_handle_advise(MigrationIncomingState *mis)\n         return -1;\n     }\n \n-    if (!postcopy_ram_supported_by_host()) {\n+    if (!postcopy_ram_supported_by_host(mis)) {\n         postcopy_state_set(POSTCOPY_INCOMING_NONE);\n         return -1;\n     }\n","prefixes":["v10","02/10"]}