Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/815700/?format=api
{ "id": 815700, "url": "http://patchwork.ozlabs.org/api/patches/815700/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505839684-10046-7-git-send-email-a.perevalov@samsung.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "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-7-git-send-email-a.perevalov@samsung.com>", "list_archive_url": null, "date": "2017-09-19T16:48:00", "name": "[v10,06/10] migration: add postcopy blocktime ctx into MigrationIncomingState", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ddcb0d9025be9f10fb58b49692944500733d1b3a", "submitter": { "id": 18164, "url": "http://patchwork.ozlabs.org/api/people/18164/?format=api", "name": "Alexey Perevalov", "email": "a.perevalov@samsung.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505839684-10046-7-git-send-email-a.perevalov@samsung.com/mbox/", "series": [ { "id": 3930, "url": "http://patchwork.ozlabs.org/api/series/3930/?format=api", "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/815700/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/815700/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 3xxTyJ2DMtz9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 03:14:48 +1000 (AEST)", "from localhost ([::1]:44211 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 1duM6g-0007I2-8w\n\tfor incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 13:14:46 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:42497)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <a.perevalov@samsung.com>) id 1duLhG-0001Ds-FC\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 1duLhD-0006QB-L8\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:30 -0400", "from mailout2.w1.samsung.com ([210.118.77.12]:46476)\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 1duLhD-0006PF-BT\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:27 -0400", "from eucas1p1.samsung.com (unknown [182.198.249.206])\n\tby mailout2.w1.samsung.com (KnoxPortal) with ESMTP id\n\t20170919164825euoutp0227ebde261a43cdc8881214fbb3da047e~l0Tv1Q-p82806628066euoutp022;\n\tTue, 19 Sep 2017 16:48:25 +0000 (GMT)", "from eusmges5.samsung.com (unknown [203.254.199.245]) by\n\teucas1p1.samsung.com (KnoxPortal) with ESMTP id\n\t20170919164825eucas1p17b36f8a15970098cab98a7d030e63f9f~l0TvFfD1I2430324303eucas1p1A;\n\tTue, 19 Sep 2017 16:48:25 +0000 (GMT)", "from eucas1p2.samsung.com ( [182.198.249.207]) by\n\teusmges5.samsung.com (EUCPMTA) with SMTP id FE.9B.12743.85A41C95;\n\tTue, 19 Sep 2017 17:48:24 +0100 (BST)", "from eusmgms1.samsung.com (unknown [182.198.249.179]) by\n\teucas1p2.samsung.com (KnoxPortal) with ESMTP id\n\t20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f~l0TuXb3Pc2115421154eucas1p2l;\n\tTue, 19 Sep 2017 16:48:24 +0000 (GMT)", "from eusync1.samsung.com ( [203.254.199.211]) by\n\teusmgms1.samsung.com (EUCPMTA) with SMTP id A5.6C.18832.85A41C95;\n\tTue, 19 Sep 2017 17:48:24 +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:24 +0100 (BST)" ], "X-AuditID": "cbfec7f5-f79d06d0000031c7-bf-59c14a582a73", "From": "Alexey Perevalov <a.perevalov@samsung.com>", "To": "qemu-devel@nongnu.org", "Date": "Tue, 19 Sep 2017 19:48:00 +0300", "Message-id": "<1505839684-10046-7-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+NgFtrOIsWRmVeSWpSXmKPExsWy7djP87oRXgcjDZ5PNrSYe/c8i0Xvtnvs\n\tFhPfrme1mPb5NrvFlfaf7BZb9n9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uTgYBMwkNh3zxakQURAUuJ312lmkBpmgS2MEhuPr2QEqREW\n\tiJPo2csOUsMioCrxZPMHVhCbV8BdYu/7nYwQy+QkTh6bDBbnFPCQuHV8LVi9EFDNjbXXmSYw\n\t8i5gZFjFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGEjbjv3cvIPx0sbgQ4wCHIxKPLwrbA5G\n\tCrEmlhVX5h5ilOBgVhLhfe0EFOJNSaysSi3Kjy8qzUktPsQozcGiJM7bu2d1pJBAemJJanZq\n\takFqEUyWiYNTqoFRWdvBIDj5maKNB8O9D9PUqy0iMk7eeW3Y/z79Yv0mq4gtv7w6zxpNeMe2\n\tVeOwQWrajFfeCyucXV+5HA7c+zvfZRNLodXt75JSK6RWnRfd/32jgNt8SS7ne26/VnvsO/ds\n\t7mtRt69mwsIcapcnhzI9V30cdUrJ9bTmFH8P76Uv9bz+KK08dDRZiaU4I9FQi7moOBEAnSV6\n\tWiACAAA=" ], "X-CMS-MailID": "20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f", "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": "20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f", "X-RootMTR": "20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f", "References": "<1505839684-10046-1-git-send-email-a.perevalov@samsung.com>\n\t<CGME20170919164824eucas1p23607e53e3ea38f8be4e885bb960e803f@eucas1p2.samsung.com>", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 3.x [fuzzy]", "X-Received-From": "210.118.77.12", "Subject": "[Qemu-devel] [PATCH v10 06/10] migration: add postcopy blocktime\n\tctx into MigrationIncomingState", "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": "This patch adds request to kernel space for UFFD_FEATURE_THREAD_ID,\nin case when this feature is provided by kernel.\n\nPostcopyBlocktimeContext is incapsulated inside postcopy-ram.c,\ndue to it's postcopy only feature.\nAlso it defines PostcopyBlocktimeContext's instance live time.\nInformation from PostcopyBlocktimeContext instance will be provided\nmuch after postcopy migration end, instance of PostcopyBlocktimeContext\nwill live till QEMU exit, but part of it (vcpu_addr,\npage_fault_vcpu_time) used only during calculation, will be released\nwhen postcopy ended or failed.\n\nTo enable postcopy blocktime calculation on destination, need to request\nproper capabiltiy (Patch for documentation will be at the tail of the patch\nset).\n\nAs an example following command enable that capability, assume QEMU was\nstarted with\n-chardev socket,id=charmonitor,path=/var/lib/migrate-vm-monitor.sock\noption to control it\n\n[root@host]#printf \"{\\\"execute\\\" : \\\"qmp_capabilities\\\"}\\r\\n \\\n{\\\"execute\\\": \\\"migrate-set-capabilities\\\" , \\\"arguments\\\": {\n\\\"capabilities\\\": [ { \\\"capability\\\": \\\"postcopy-blocktime\\\", \\\"state\\\":\ntrue } ] } }\" | nc -U /var/lib/migrate-vm-monitor.sock\n\nOr just with HMP\n(qemu) migrate_set_capability postcopy-blocktime on\n\nSigned-off-by: Alexey Perevalov <a.perevalov@samsung.com>\n---\n migration/migration.h | 8 ++++++\n migration/postcopy-ram.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 73 insertions(+)", "diff": "diff --git a/migration/migration.h b/migration/migration.h\nindex 56bf33c..770466b 100644\n--- a/migration/migration.h\n+++ b/migration/migration.h\n@@ -21,6 +21,8 @@\n #include \"qemu/coroutine_int.h\"\n #include \"hw/qdev.h\"\n \n+struct PostcopyBlocktimeContext;\n+\n /* State for the incoming migration */\n struct MigrationIncomingState {\n QEMUFile *from_src_file;\n@@ -58,6 +60,12 @@ struct MigrationIncomingState {\n /* The coroutine we should enter (back) after failover */\n Coroutine *migration_incoming_co;\n QemuSemaphore colo_incoming_sem;\n+\n+ /*\n+ * PostcopyBlocktimeContext to keep information for postcopy\n+ * live migration, to calculate vCPU block time\n+ * */\n+ struct PostcopyBlocktimeContext *blocktime_ctx;\n };\n \n MigrationIncomingState *migration_incoming_get_current(void);\ndiff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c\nindex bec6c2c..cc78981 100644\n--- a/migration/postcopy-ram.c\n+++ b/migration/postcopy-ram.c\n@@ -61,6 +61,58 @@ struct PostcopyDiscardState {\n #include <sys/eventfd.h>\n #include <linux/userfaultfd.h>\n \n+typedef struct PostcopyBlocktimeContext {\n+ /* time when page fault initiated per vCPU */\n+ int64_t *page_fault_vcpu_time;\n+ /* page address per vCPU */\n+ uint64_t *vcpu_addr;\n+ int64_t total_blocktime;\n+ /* blocktime per vCPU */\n+ int64_t *vcpu_blocktime;\n+ /* point in time when last page fault was initiated */\n+ int64_t last_begin;\n+ /* number of vCPU are suspended */\n+ int smp_cpus_down;\n+\n+ /*\n+ * Handler for exit event, necessary for\n+ * releasing whole blocktime_ctx\n+ */\n+ Notifier exit_notifier;\n+ /*\n+ * Handler for postcopy event, necessary for\n+ * releasing unnecessary part of blocktime_ctx\n+ */\n+ Notifier postcopy_notifier;\n+} PostcopyBlocktimeContext;\n+\n+static void destroy_blocktime_context(struct PostcopyBlocktimeContext *ctx)\n+{\n+ g_free(ctx->page_fault_vcpu_time);\n+ g_free(ctx->vcpu_addr);\n+ g_free(ctx->vcpu_blocktime);\n+ g_free(ctx);\n+}\n+\n+static void migration_exit_cb(Notifier *n, void *data)\n+{\n+ PostcopyBlocktimeContext *ctx = container_of(n, PostcopyBlocktimeContext,\n+ exit_notifier);\n+ destroy_blocktime_context(ctx);\n+}\n+\n+static struct PostcopyBlocktimeContext *blocktime_context_new(void)\n+{\n+ PostcopyBlocktimeContext *ctx = g_new0(PostcopyBlocktimeContext, 1);\n+ ctx->page_fault_vcpu_time = g_new0(int64_t, smp_cpus);\n+ ctx->vcpu_addr = g_new0(uint64_t, smp_cpus);\n+ ctx->vcpu_blocktime = g_new0(int64_t, smp_cpus);\n+\n+ ctx->exit_notifier.notify = migration_exit_cb;\n+ qemu_add_exit_notifier(&ctx->exit_notifier);\n+ add_migration_state_change_notifier(&ctx->postcopy_notifier);\n+ return ctx;\n+}\n \n /**\n * receive_ufd_features: check userfault fd features, to request only supported\n@@ -153,6 +205,19 @@ static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis)\n }\n }\n \n+#ifdef UFFD_FEATURE_THREAD_ID\n+ if (migrate_postcopy_blocktime() && mis &&\n+ UFFD_FEATURE_THREAD_ID & supported_features) {\n+ /* kernel supports that feature */\n+ /* don't create blocktime_context if it exists */\n+ if (!mis->blocktime_ctx) {\n+ mis->blocktime_ctx = blocktime_context_new();\n+ }\n+\n+ asked_features |= UFFD_FEATURE_THREAD_ID;\n+ }\n+#endif\n+\n /*\n * request features, even if asked_features is 0, due to\n * kernel expects UFFD_API before UFFDIO_REGISTER, per\n", "prefixes": [ "v10", "06/10" ] }