From nobody Sun Feb 8 18:29:45 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=linux.dev ARC-Seal: i=1; a=rsa-sha256; t=1714011954; cv=none; d=zohomail.com; s=zohoarc; b=kLtWSwW9j1itJ0JyD8J3ZhkRB933IkCujRgQsSTXI65Dk3jdyOgy/hbNjTgtwGTFTXso1SevQzxftpbeloleiT/fK3orDlzNh/CPKbj6f1hKoLZcmrjlJGFb59I2yZztkN2ovpipKiorpLtSti5yKMJwS6n2O07qPrHcUZ21PhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714011954; 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=QzuSJ1zKYkpx7ByvuyAxfu5NoEWY50aKxHnWj75q2gE=; b=lV70Z9aWw98A1IQHTKR1PMMBnTpTsH2Gxs0cdeKKPVaqWUJDSd8B1SENIO+JmuDkogwJDKT6XwUL2U2kPlZ/Jx2/fwHglNFIM8BWkj4PwL7EjsaOxOMrv7YNZ83TufFtvzt+Wf2A5BWH69Quj9JDuxqRE4Ip+DtJoj2k6Q3MkDw= 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 1714011954816971.5758840655802; Wed, 24 Apr 2024 19:25:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzol5-0000Xy-Oc; Wed, 24 Apr 2024 22:22:47 -0400 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 1rzol3-0000X9-5g for qemu-devel@nongnu.org; Wed, 24 Apr 2024 22:22:45 -0400 Received: from out-173.mta1.migadu.com ([95.215.58.173]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzol1-0005IL-An for qemu-devel@nongnu.org; Wed, 24 Apr 2024 22:22:44 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714011762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QzuSJ1zKYkpx7ByvuyAxfu5NoEWY50aKxHnWj75q2gE=; b=IOsynXx6S5B89y3R2OsL6G69El2xPkzR4+iWqeJ3Z4HKiGZ4LZIxM2aGa3nIfsKLuMZSOK 6PknMF91LaNpo6f4ugRtGCMHLjVFMXjpP1SknXWFYDaJ3fCGFc+BgsEuywkm9AsSuvos8d Evco26giDoklEmzP/Bdi2U3obVlbL4Y= From: Hao Xiang To: marcandre.lureau@redhat.com, peterx@redhat.com, farosas@suse.de, armbru@redhat.com, lvivier@redhat.com, qemu-devel@nongnu.org Cc: Hao Xiang Subject: [PATCH v4 08/14] migration/multifd: Add new migration option for multifd DSA offloading. Date: Thu, 25 Apr 2024 02:21:11 +0000 Message-Id: <20240425022117.4035031-9-hao.xiang@linux.dev> In-Reply-To: <20240425022117.4035031-1-hao.xiang@linux.dev> References: <20240425022117.4035031-1-hao.xiang@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT 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=95.215.58.173; envelope-from=hao.xiang@linux.dev; helo=out-173.mta1.migadu.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, 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 Precedence: list List-Id: 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 @linux.dev) X-ZM-MESSAGEID: 1714011955987100005 Content-Type: text/plain; charset="utf-8" Intel DSA offloading is an optional feature that turns on if proper hardware and software stack is available. To turn on DSA offloading in multifd live migration: multifd-dsa-accel=3D"[dsa_dev_path1] [dsa_dev_path2] ... [dsa_dev_pathX]" This feature is turned off by default. Signed-off-by: Hao Xiang --- migration/migration-hmp-cmds.c | 8 ++++++++ migration/options.c | 30 ++++++++++++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 26 +++++++++++++++++++++++--- 4 files changed, 62 insertions(+), 3 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 7e96ae6ffd..7e9bb278c9 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -358,6 +358,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) monitor_printf(mon, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), params->tls_authz); + monitor_printf(mon, "%s: '%s'\n", + MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_DSA_ACCEL), + params->multifd_dsa_accel); =20 if (params->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; @@ -622,6 +625,11 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_block_incremental =3D true; visit_type_bool(v, param, &p->block_incremental, &err); break; + case MIGRATION_PARAMETER_MULTIFD_DSA_ACCEL: + p->multifd_dsa_accel =3D g_new0(StrOrNull, 1); + p->multifd_dsa_accel->type =3D QTYPE_QSTRING; + visit_type_str(v, param, &p->multifd_dsa_accel->u.s, &err); + break; case MIGRATION_PARAMETER_MULTIFD_CHANNELS: p->has_multifd_channels =3D true; visit_type_uint8(v, param, &p->multifd_channels, &err); diff --git a/migration/options.c b/migration/options.c index 239f5ecfb4..dc8642df81 100644 --- a/migration/options.c +++ b/migration/options.c @@ -182,6 +182,8 @@ Property migration_properties[] =3D { DEFINE_PROP_ZERO_PAGE_DETECTION("zero-page-detection", MigrationState, parameters.zero_page_detection, ZERO_PAGE_DETECTION_MULTIFD), + DEFINE_PROP_STRING("multifd-dsa-accel", MigrationState, + parameters.multifd_dsa_accel), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -920,6 +922,13 @@ const char *migrate_tls_creds(void) return s->parameters.tls_creds; } =20 +const char *migrate_multifd_dsa_accel(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.multifd_dsa_accel; +} + const char *migrate_tls_hostname(void) { MigrationState *s =3D migrate_get_current(); @@ -1060,6 +1069,8 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) params->mode =3D s->parameters.mode; params->has_zero_page_detection =3D true; params->zero_page_detection =3D s->parameters.zero_page_detection; + params->multifd_dsa_accel =3D g_strdup(s->parameters.multifd_dsa_accel= ? + s->parameters.multifd_dsa_accel := ""); =20 return params; } @@ -1068,6 +1079,7 @@ void migrate_params_init(MigrationParameters *params) { params->tls_hostname =3D g_strdup(""); params->tls_creds =3D g_strdup(""); + params->multifd_dsa_accel =3D g_strdup(""); =20 /* Set has_* up only for parameter checks */ params->has_compress_level =3D true; @@ -1416,6 +1428,11 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, if (params->has_zero_page_detection) { dest->zero_page_detection =3D params->zero_page_detection; } + + if (params->multifd_dsa_accel) { + assert(params->multifd_dsa_accel->type =3D=3D QTYPE_QSTRING); + dest->multifd_dsa_accel =3D params->multifd_dsa_accel->u.s; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -1570,6 +1587,13 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) if (params->has_zero_page_detection) { s->parameters.zero_page_detection =3D params->zero_page_detection; } + + if (params->multifd_dsa_accel) { + g_free(s->parameters.multifd_dsa_accel); + assert(params->multifd_dsa_accel->type =3D=3D QTYPE_QSTRING); + s->parameters.multifd_dsa_accel =3D + g_strdup(params->multifd_dsa_accel->u.s); + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) @@ -1595,6 +1619,12 @@ void qmp_migrate_set_parameters(MigrateSetParameters= *params, Error **errp) params->tls_authz->type =3D QTYPE_QSTRING; params->tls_authz->u.s =3D strdup(""); } + if (params->multifd_dsa_accel + && params->multifd_dsa_accel->type =3D=3D QTYPE_QNULL) { + qobject_unref(params->multifd_dsa_accel->u.n); + params->multifd_dsa_accel->type =3D QTYPE_QSTRING; + params->multifd_dsa_accel->u.s =3D strdup(""); + } =20 migrate_params_test_apply(params, &tmp); =20 diff --git a/migration/options.h b/migration/options.h index ab8199e207..1cb3393be9 100644 --- a/migration/options.h +++ b/migration/options.h @@ -91,6 +91,7 @@ const char *migrate_tls_creds(void); const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); +const char *migrate_multifd_dsa_accel(void); =20 /* parameters setters */ =20 diff --git a/qapi/migration.json b/qapi/migration.json index 8c65b90328..934fa8839e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -914,6 +914,12 @@ # See description in @ZeroPageDetection. Default is 'multifd'. # (since 9.0) # +# @multifd-dsa-accel: If enabled, use DSA accelerator offloading for +# certain memory operations. Enable DSA accelerator offloading by +# setting this string to a list of DSA device path separated by space +# characters. Setting this string to an empty string means disabling +# DSA accelerator offloading. Defaults to an empty string. (since 9.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -937,7 +943,7 @@ 'cpu-throttle-initial', 'cpu-throttle-increment', 'cpu-throttle-tailslow', 'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth', - 'avail-switchover-bandwidth', 'downtime-limit', + 'avail-switchover-bandwidth', 'downtime-limit', 'multifd-dsa-ac= cel', { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] }, { 'name': 'block-incremental', 'features': [ 'deprecated' ] }, 'multifd-channels', @@ -1122,6 +1128,12 @@ # See description in @ZeroPageDetection. Default is 'multifd'. # (since 9.0) # +# @multifd-dsa-accel: If enabled, use DSA accelerator offloading for +# certain memory operations. Enable DSA accelerator offloading by +# setting this string to a list of DSA device path separated by space +# characters. Setting this string to an empty string means disabling +# DSA accelerator offloading. Defaults to an empty string. (since 9.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -1176,7 +1188,8 @@ 'features': [ 'unstable' ] }, '*vcpu-dirty-limit': 'uint64', '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection'} } + '*zero-page-detection': 'ZeroPageDetection', + '*multifd-dsa-accel': 'StrOrNull'} } =20 ## # @migrate-set-parameters: @@ -1354,6 +1367,12 @@ # See description in @ZeroPageDetection. Default is 'multifd'. # (since 9.0) # +# @multifd-dsa-accel: If enabled, use DSA accelerator offloading for +# certain memory operations. Enable DSA accelerator offloading by +# setting this string to a list of DSA device path separated by space +# characters. Setting this string to an empty string means disabling +# DSA accelerator offloading. Defaults to an empty string. (since 9.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -1405,7 +1424,8 @@ 'features': [ 'unstable' ] }, '*vcpu-dirty-limit': 'uint64', '*mode': 'MigMode', - '*zero-page-detection': 'ZeroPageDetection'} } + '*zero-page-detection': 'ZeroPageDetection', + '*multifd-dsa-accel': 'str'} } =20 ## # @query-migrate-parameters: --=20 2.30.2