From nobody Mon Apr 13 12:31:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1772832836; cv=none; d=zohomail.com; s=zohoarc; b=ZZGfIyWxQ3SZcVEBdAI+JH/jr8fIsS3x8ZGNu8jYL66LXbjIx0StgHwACOhypD2vDCUrY5VaZKAZSzKPz/5XKr0bBqbTwzfsSij7uDfVUEWx38oJEWysjP/8Wkqx8IhBsFbo+lTVCtKB672VFpVSbT5G3R3BOkZVWYh+6XRu1cU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772832836; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=N4Y1radWjpA6EiIkmYO9ZoubUfs8Xww6kKntiQsiv44=; b=FZAqPnsOr8JmLpZ6tlq+GLCLC8PUbZhKzLRJ1sPSM1Wpea9mRSFaOgaDL496g5yIV5PX2Ppe+18O/Qy0x0KAlDvzW0GBkPZUTTGDHds6UWILMcxZCwMHMwY5b9AyJ07uF20xg4D2Ob3QTcj3t0bALsxWf9p+L5pAJt1h+nIoeI0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772832836930888.0054895146984; Fri, 6 Mar 2026 13:33:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vycmx-000230-M6; Fri, 06 Mar 2026 16:32:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vycmv-00021V-D4 for qemu-devel@nongnu.org; Fri, 06 Mar 2026 16:32:49 -0500 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vycms-0007Hz-6m for qemu-devel@nongnu.org; Fri, 06 Mar 2026 16:32:49 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id A259780885; Sat, 07 Mar 2026 00:32:43 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:33::1:4]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id bW0W0m0BECg0-aRJeOCOB; Sat, 07 Mar 2026 00:32:43 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1772832763; bh=N4Y1radWjpA6EiIkmYO9ZoubUfs8Xww6kKntiQsiv44=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=rJXm6qLMNcdn2Lt8OffQdr2rXIXdOzF3Zj1OSJM4ZJCqJ+xIx0miytuz0xFpqyk8/ J+tvsdB2lXDirrIJuwW0eZUiZI2bJb2yXELb+vZvlySzDbufmM1MVy/Pg0IihsZM68 nf+6e9LKWoa5/OXQPI/ydpF5cWUf+FZDf2y91Cr4= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: jasowang@redhat.com, mst@redhat.com Cc: thuth@redhat.com, armbru@redhat.com, eblake@redhat.com, farosas@suse.de, peterx@redhat.com, zhao1.liu@intel.com, wangyanan55@huawei.com, philmd@linaro.org, marcel.apfelbaum@gmail.com, eduardo@habkost.net, davydov-max@yandex-team.ru, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, yc-core@yandex-team.ru, leiyang@redhat.com, raphael.s.norwitz@gmail.com, bchaney@akamai.com Subject: [PATCH v12 3/8] qapi: add local migration parameter Date: Sat, 7 Mar 2026 00:32:30 +0300 Message-ID: <20260306213235.216863-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260306213235.216863-1-vsementsov@yandex-team.ru> References: <20260306213235.216863-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c02:900:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=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 List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1772832838913158500 Content-Type: text/plain; charset="utf-8" We are going to implement local-migration feature: some devices will be able to transfer open file descriptors through migration stream (which must UNIX domain socket for that purpose). This allows to transfer the whole backend state without reconnecting and restarting the backend service. For example, virtio-net will migrate its attached TAP netdev, together with its connected file descriptors. In this commit we introduce a migration parameter, which enables the feature for supporting devices (no one at the moment). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Peter Xu --- include/migration/misc.h | 2 ++ migration/options.c | 18 +++++++++++++++++- qapi/migration.json | 15 +++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index 3159a5e53c3..b14dc70ea3d 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -156,4 +156,6 @@ bool multifd_device_state_save_thread_should_exit(void); void multifd_abort_device_state_save_threads(void); bool multifd_join_device_state_save_threads(void); =20 +bool migrate_local(void); + #endif diff --git a/migration/options.c b/migration/options.c index 1ffe85a2d8c..92144da3acb 100644 --- a/migration/options.c +++ b/migration/options.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qapi/util.h" #include "exec/target_page.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" @@ -24,6 +25,7 @@ #include "migration/colo.h" #include "migration/cpr.h" #include "migration/misc.h" +#include "migration/options.h" #include "migration.h" #include "migration-stats.h" #include "qemu-file.h" @@ -336,6 +338,12 @@ bool migrate_mapped_ram(void) return s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM]; } =20 +bool migrate_local(void) +{ + MigrationState *s =3D migrate_get_current(); + return s->parameters.local; +} + bool migrate_ignore_shared(void) { MigrationState *s =3D migrate_get_current(); @@ -1047,7 +1055,7 @@ static void migrate_mark_all_params_present(Migration= Parameters *p) &p->has_announce_step, &p->has_block_bitmap_mapping, &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, - &p->has_cpr_exec_command, + &p->has_cpr_exec_command, &p->has_local, }; =20 len =3D ARRAY_SIZE(has_fields); @@ -1386,6 +1394,10 @@ static void migrate_params_test_apply(MigrationParam= eters *params, if (params->has_cpr_exec_command) { dest->cpr_exec_command =3D params->cpr_exec_command; } + + if (params->has_local) { + dest->local =3D params->local; + } } =20 static void migrate_params_apply(MigrationParameters *params) @@ -1514,6 +1526,10 @@ static void migrate_params_apply(MigrationParameters= *params) s->parameters.cpr_exec_command =3D QAPI_CLONE(strList, params->cpr_exec_command); } + + if (params->has_local) { + s->parameters.local =3D params->local; + } } =20 void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) diff --git a/qapi/migration.json b/qapi/migration.json index f925e5541bf..2c8d85f5834 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -828,7 +828,8 @@ 'mode', 'zero-page-detection', 'direct-io', - 'cpr-exec-command'] } + 'cpr-exec-command', + 'local'] } =20 ## # @migrate-set-parameters: @@ -1004,6 +1005,15 @@ # is @cpr-exec. The first list element is the program's filename, # the remainder its arguments. (Since 10.2) # +# @local: Enable local migration feature for devices that support +# it. The feature is for local migration only and rely on the +# channel support for passing file descriptors (it must be a UNIX +# socket). In general that means that backend state and its file +# descriptors are passed to the destination in the migration +# channel. In general devices may have an option which in +# conjunction with @local set to true enables the local-migration +# feature for that device. (Since 11.0) +# # Features: # # @unstable: Members @x-checkpoint-delay and @@ -1043,7 +1053,8 @@ '*mode': 'MigMode', '*zero-page-detection': 'ZeroPageDetection', '*direct-io': 'bool', - '*cpr-exec-command': [ 'str' ]} } + '*cpr-exec-command': [ 'str' ], + '*local': 'bool' } } =20 ## # @query-migrate-parameters: --=20 2.52.0