Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2227152/?format=api
{ "id": 2227152, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2227152/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423094438.43556-1-prtyagi@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/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": "" }, "msgid": "<20260423094438.43556-1-prtyagi@redhat.com>", "date": "2026-04-23T09:44:38", "name": "[v2] migration: Fix blocking in POSTCOPY_DEVICE during package load", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4072f7f7844ee54d18a881f33d75793e58a3b89c", "submitter": { "id": 93199, "url": "http://patchwork.ozlabs.org/api/1.1/people/93199/?format=api", "name": "Pranav Tyagi", "email": "prtyagi@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423094438.43556-1-prtyagi@redhat.com/mbox/", "series": [ { "id": 501168, "url": "http://patchwork.ozlabs.org/api/1.1/series/501168/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501168", "date": "2026-04-23T09:44:38", "name": "[v2] migration: Fix blocking in POSTCOPY_DEVICE during package load", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/501168/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227152/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227152/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=jJD5ifHT;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=lP88nE3B;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1WS65pZMz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 19:45:57 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFqcS-0007Re-ED; Thu, 23 Apr 2026 05:45:12 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <prtyagi@redhat.com>)\n id 1wFqcP-0007Pa-6l\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 05:45:09 -0400", "from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <prtyagi@redhat.com>)\n id 1wFqcM-0006qd-JE\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 05:45:08 -0400", "from mail-pg1-f200.google.com (mail-pg1-f200.google.com\n [209.85.215.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-639-NV_2cQlmNGeL2ZQRewiZvw-1; Thu, 23 Apr 2026 05:44:58 -0400", "by mail-pg1-f200.google.com with SMTP id\n 41be03b00d2f7-c70dd30025fso8103981a12.2\n for <qemu-devel@nongnu.org>; Thu, 23 Apr 2026 02:44:58 -0700 (PDT)", "from prtyagi-thinkpadt14sgen2i.bengluru.csb ([115.110.236.142])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82f8ebe6439sm19906405b3a.41.2026.04.23.02.44.52\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 23 Apr 2026 02:44:54 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776937502;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=QmkogQDdECBhNaRQBes03dQMuEaKIs7Fl8qVdGf49BI=;\n b=jJD5ifHTzpiuN7QobPdatcGXOwVZ0r4Gshi7xL1Mf0JdPmr/qdwnrVjhrpwlk0DT4wF/3g\n a4FLYUuruu2flf9y7WAgTkUOfDZGcAi79OOf2iv9V8JADUisavRZ33cSGyWDZ6vXkQKE+y\n Vbrhm1AtAZNZpR1YDA34Sn/+umj7neQ=", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1776937497; x=1777542297; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=QmkogQDdECBhNaRQBes03dQMuEaKIs7Fl8qVdGf49BI=;\n b=lP88nE3BTAZd07uoepU9IDiW+RwdfT09hIZpdAAyr7ZbXz4hgR+paGtWQMcwW78UNH\n quiIGwMDSOgHHRDHPq+5qCS1ENrp58MGHfrNPcT0At5t6krpgK5LlJWMMKUxVYEZW/Ox\n +2+7hUeVQWtd0mfQtCHUAZaW1949HhhFVIjDgqEzM5heTM8NeFd2EbhRfVUTH6Iu3u2x\n 3ZIXMB8vdNbZW6DjnmoRcYFJJqCJ53zku2WCTrnv+Nz/CLuUJL0XaqJfHmmdJOAFllrC\n buZGKSGgMLpX94iGXVcL118ajtTb0AiqRSjilVfIp5CKj4BijcvcQfY2xH7CE3gW8Uxo\n hz1A==" ], "X-MC-Unique": "NV_2cQlmNGeL2ZQRewiZvw-1", "X-Mimecast-MFC-AGG-ID": "NV_2cQlmNGeL2ZQRewiZvw_1776937498", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776937497; x=1777542297;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=QmkogQDdECBhNaRQBes03dQMuEaKIs7Fl8qVdGf49BI=;\n b=PRXRM4YV3TqAI8iA1N+pl8QPllayd/95lXv61RTBcAbN6OokJmscbnD45mAfYNxdpP\n 5XTnbS1nxJEDJcILMVqoMS0umqqpZ4S05EdW1BsQMYixg3+CS7NRIoYS8xhyjloBb5w8\n 8Mktlv42t8Ie1FkmgdrG5QWuJFA6tuX9YtigtRFtlY1DvYRVL6+Ei3WwQSjRSIgDifta\n uPvev4AmfQ92sMUeiTY9yMRM03Ley9nD9qlY4dDuLLUdBstTIAa8/l3iymFtdYihxQwc\n uswZ+4zLpgdmctFAcBwkXJHF373PyKf1rykh6CJ3c8iK+EUI2uyWnEFlBiwAKFAvOg1d\n xcYA==", "X-Gm-Message-State": "AOJu0YzKL1trHfstfUtC20RNUmuDDdKxhFRRXDLgyrqcNvtfRylESvyw\n wm5h0VL8mNgwYITqPOhIJDgawqGd6BV3hK/UlqdiFY0soS0rRwJoKIbnP2BgR634uV5tNpBc2rs\n AsI40A9vT761gmBUpNiWZAMX1NAhoHQM3azNxez3qnhaoxth62n32eQUYZD1UvNg9FdzNwh2iyi\n tOYxTlNUhV6qxxVtZBFnffAtpDIT9q+zTOkLIV0Vw=", "X-Gm-Gg": "AeBDieuy/NAdcVaRuS7td1TrDrV2Mj5tvD3y6S+RXqsvRLYjxPvrNal/SC2rgZtrMS1\n 7XrknPuUcF7GLwgRiumVQYDSK/GLtE7Q41Zb03unNDmIDeua2Mkj1p1BhNLbnWFQH6Ol8zrczUa\n OxSG8vk/H5nKyiaxMrARyEaqmAg7ARNunxhh+5ij5BsYoWsKtQlppqgh5aOMq08+aTrhasjC3Dn\n Ac4ziVR8cKjOqjf2iOIXOFVGNlTTmjIQq0G0hysDRq8g65+AMLnOuQeYucKrdRcG8InisW27g3u\n 5Tj7hwDKw67QK2fX+KVET1uU/qgllaJuJTbNbN2VZNbQDP86rp+5DW96En0Bv5LbJ8el3gwMc0r\n AyveYv97gXmID8+Qc3ZMcz4Xab6dNxSYCK7DagblK4CkcywHDi20BSYMMIUnFPnCBZ6GY", "X-Received": [ "by 2002:a05:6a00:17a0:b0:82c:f877:3d13 with SMTP id\n d2e1a72fcca58-82f8c8c905dmr30448290b3a.26.1776937497044;\n Thu, 23 Apr 2026 02:44:57 -0700 (PDT)", "by 2002:a05:6a00:17a0:b0:82c:f877:3d13 with SMTP id\n d2e1a72fcca58-82f8c8c905dmr30448243b3a.26.1776937496446;\n Thu, 23 Apr 2026 02:44:56 -0700 (PDT)" ], "From": "Pranav Tyagi <prtyagi@redhat.com>", "To": "qemu-devel@nongnu.org", "Cc": "Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,\n Juraj Marcin <jmarcin@redhat.com>, Prasad Pandit <ppandit@redhat.com>,\n Pranav Tyagi <prtyagi@redhat.com>", "Subject": "[PATCH v2] migration: Fix blocking in POSTCOPY_DEVICE during package\n load", "Date": "Thu, 23 Apr 2026 15:14:38 +0530", "Message-ID": "<20260423094438.43556-1-prtyagi@redhat.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=170.10.129.124; envelope-from=prtyagi@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "The package_loaded event is not set in case MIG_RP_MSG_PONG does not\narrive on the source from the destination in the return path thread. The\nmigration thread would then be blocked waiting for package_loaded event\nindefinitely in POSTCOPY_DEVICE state. Where as, in such a condition the\nsource VM can safely resume as the destination has not yet started. The\npong message can get lost in case of a network failure or destination\ncrash before sending the pong.\n\nThis patch removes the package_loaded event and uses rp_sem, instead of\nkicking multiple events. The error is detected in case of network\nfailure or destination crash and rp_sem is set in the out path of the\nreturn path thread. This will kick the migration thread out from a\ncondition of indefinitely waiting for rp_sem. The migration thread then\nfails early and breaks from the migration loop to resume the vm on the\nsource side.\n\nFixes: 7b842fe354c6 (\"migration: Introduce POSTCOPY_DEVICE state\")\nSigned-off-by: Pranav Tyagi <prtyagi@redhat.com>\n---\nV1: https://lore.kernel.org/all/20260421052227.8278-1-prtyagi@redhat.com/\n\nchanged in v2:\n- removed postcopy_package_loaded_event and using rp_sem to kick the\n migration thread\n- using migration_rp_wait() in place of qemu_event_wait() in the\n migration thread\n\n migration/migration.c | 48 ++++++++++++++++++++++++++++---------------\n migration/migration.h | 1 -\n 2 files changed, 31 insertions(+), 18 deletions(-)", "diff": "diff --git a/migration/migration.c b/migration/migration.c\nindex 5c9aaa6e58..6e4988a590 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -1661,7 +1661,6 @@ int migrate_init(MigrationState *s, Error **errp)\n migration_reset_vfio_bytes_transferred();\n \n s->postcopy_package_loaded = false;\n- qemu_event_reset(&s->postcopy_package_loaded_event);\n \n return 0;\n }\n@@ -2317,7 +2316,7 @@ static void *source_return_path_thread(void *opaque)\n if (tmp32 == QEMU_VM_PING_PACKAGED_LOADED) {\n trace_source_return_path_thread_postcopy_package_loaded();\n ms->postcopy_package_loaded = true;\n- qemu_event_set(&ms->postcopy_package_loaded_event);\n+ migration_rp_kick(ms);\n }\n break;\n \n@@ -2388,16 +2387,21 @@ out:\n trace_source_return_path_thread_bad_end();\n }\n \n- if (ms->state == MIGRATION_STATUS_POSTCOPY_RECOVER) {\n+ if (ms->state == MIGRATION_STATUS_POSTCOPY_RECOVER ||\n+ ms->state == MIGRATION_STATUS_POSTCOPY_DEVICE) {\n /*\n- * this will be extremely unlikely: that we got yet another network\n- * issue during recovering of the 1st network failure.. during this\n- * period the main migration thread can be waiting on rp_sem for\n- * this thread to sync with the other side.\n+ * The migration thread can get stuck waiting for rp_sem if the\n+ * return path fails to sync with the destination. This handles\n+ * two specific cases:\n *\n- * When this happens, explicitly kick the migration thread out of\n- * RECOVER stage and back to PAUSED, so the admin can try\n- * everything again.\n+ * POSTCOPY_RECOVER: A failure occurs during a recovery attempt.\n+ * We kick the migration thread back to PAUSED so the admin can\n+ * retry.\n+ *\n+ * POSTCOPY_DEVICE: The MIG_RP_MSG_PONG is lost due to a\n+ * network failure or destination crash. We kick the migration\n+ * thread out of its wait so it can fail the migration and safely\n+ * resume the VM on the source.\n */\n migration_rp_kick(ms);\n }\n@@ -3226,12 +3230,24 @@ static MigIterateState migration_iteration_run(MigrationState *s)\n if (s->state == MIGRATION_STATUS_POSTCOPY_DEVICE &&\n (s->postcopy_package_loaded || complete_ready)) {\n /*\n- * If package has been loaded, the event is set and we will\n- * immediatelly transition to POSTCOPY_ACTIVE. If we are ready for\n- * completion, we need to wait for destination to load the postcopy\n- * package before actually completing.\n+ * We will immediately transition to POSTCOPY_ACTIVE.\n+ * If we are ready for completion, we need to wait for\n+ * destination to load the postcopy package before actually\n+ * completing.\n */\n- qemu_event_wait(&s->postcopy_package_loaded_event);\n+ while (!s->postcopy_package_loaded) {\n+ if (migration_rp_wait(s)) {\n+ /*\n+ * Error happened. Migration thread was stuck waiting in\n+ * POSTCOPY_DEVICE for rp_sem which was never set.\n+ */\n+ migrate_set_state(&s->state,\n+ MIGRATION_STATUS_POSTCOPY_DEVICE,\n+ MIGRATION_STATUS_FAILING);\n+ return MIG_ITERATE_BREAK;\n+ }\n+ }\n+ /* Acknowledgement received from the destination */\n migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_DEVICE,\n MIGRATION_STATUS_POSTCOPY_ACTIVE);\n }\n@@ -3863,7 +3879,6 @@ static void migration_instance_finalize(Object *obj)\n qemu_sem_destroy(&ms->rp_state.rp_pong_acks);\n qemu_sem_destroy(&ms->postcopy_qemufile_src_sem);\n error_free(ms->error);\n- qemu_event_destroy(&ms->postcopy_package_loaded_event);\n }\n \n static void migration_instance_init(Object *obj)\n@@ -3885,7 +3900,6 @@ static void migration_instance_init(Object *obj)\n qemu_sem_init(&ms->wait_unplug_sem, 0);\n qemu_sem_init(&ms->postcopy_qemufile_src_sem, 0);\n qemu_mutex_init(&ms->qemu_file_lock);\n- qemu_event_init(&ms->postcopy_package_loaded_event, 0);\n }\n \n /*\ndiff --git a/migration/migration.h b/migration/migration.h\nindex b6888daced..9081e6a612 100644\n--- a/migration/migration.h\n+++ b/migration/migration.h\n@@ -512,7 +512,6 @@ struct MigrationState {\n bool rdma_migration;\n \n bool postcopy_package_loaded;\n- QemuEvent postcopy_package_loaded_event;\n \n GSource *hup_source;\n \n", "prefixes": [ "v2" ] }