From nobody Tue Nov 26 22:19:20 2024 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=quarantine dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1704329430; cv=none; d=zohomail.com; s=zohoarc; b=PVaclixcuXoU5670kwU/818w1M5AejaHUqT5RSzzy3j8pJt0sNdMpi93nouG0rMfvkTN+SHBRHPcZesgb/Z9si7to3VhPH9cS8ycfCqpfbpKkjllHlBKU1f9sGr9HmwEGyVo90+0R/fiRG68skHl8LGv4zoPwM6dmX2n27tte6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704329430; 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=KpA/Kj66rISFQ/iHtkD7zXF8SxLl+/TJ5O3hi3eQFdo=; b=esuDZBfwxgkqGaViEIW/pLgEw6Z+Q1weW6SAmAi+w0nBIKcGWMtrgv8Yjgk3ViXFH1GFsxb55f1JsblGyFiIpLlHmqDung6Iwf0iIev0ZW+vA0W+hYTJVgy1ZF5qT6F9/vXF55M8blXgtq3mh1Qolt8qk1/Wtf5DKAoATFvTHs0= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704329430123914.7789466293384; Wed, 3 Jan 2024 16:50:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLBs3-0008Kp-VQ; Wed, 03 Jan 2024 19:46:03 -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 1rLBrq-0008Hf-CR for qemu-devel@nongnu.org; Wed, 03 Jan 2024 19:45:51 -0500 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLBro-0007TY-9D for qemu-devel@nongnu.org; Wed, 03 Jan 2024 19:45:50 -0500 Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-67ff241c2bcso11816d6.1 for ; Wed, 03 Jan 2024 16:45:47 -0800 (PST) Received: from n231-230-216.byted.org ([147.160.184.87]) by smtp.gmail.com with ESMTPSA id x19-20020ae9f813000000b0077d66e5b2e6sm10646087qkh.3.2024.01.03.16.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 16:45:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1704329147; x=1704933947; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KpA/Kj66rISFQ/iHtkD7zXF8SxLl+/TJ5O3hi3eQFdo=; b=H3MObuQ9DJFjlsPkAUtIjzebELDBgWLJbpyGCOlaySurAg329xWJ/fOkbPqVpPFMj6 J6sXk0Wh96Yk8l3XFDRr4PVUPogzVPltnOCz1MhOWg58T2bO7lyftsgRH4kHddAigiOH AKf9oiJhWSJLGIAQiUklCcxdWOS4d6LQeDgI1BwXH3NVRqum11Bnq2c8C//ZXsNJ8qg5 L0bAJ8zIFqqm6WGvIfnHsprOAAK0A28uTLEMu6cyp/mPleIxS/8bVOinPzsbiM7Xv9rq KIZkJWMe37ApuReZ+/wCA8jvipJwwNSmPEq9NvevNipBdThfU/05ZWiGHxgaMsYQvrQE 8ljQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704329147; x=1704933947; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KpA/Kj66rISFQ/iHtkD7zXF8SxLl+/TJ5O3hi3eQFdo=; b=O6ACLSAZq/Kqhbjn0A1ODyg9oEt6ziDiD2h2HML3YSF1b8+BYbwk4AIp13GiKHNbfz XpBPJYzZc0c/nC95gCoSFrY+FkG6XcNU6s8CKZ0X8vlKw8pFymciIIGWj9dfgcZkZq/d /bTPY7D1PB3KNhnfSR4cgVm1ShhyDnrQyTV2kmp1Z3Mmlns+FW+u6pflTAgoKFQHvxSC 7d175Tcgox+B6ewxKW/U+pzF7klsvE7gAoezRZL0x3pB5WUiDlr6rKESJuBnx6wC9VE1 HKhgFqirECQZkH7fFGiZj8TggVN0UtaAQxunTokvbRg2/fKK8+QcuXKMUOMlI3015crw 94KQ== X-Gm-Message-State: AOJu0YzCg/6KURRLGrsv2m+aJ2pr6o/S39AP4GsiP2a2+selVFNlJZ6R oF/fwrnUXBO+yT9ttx1wKKdYdc6vc+7u9g== X-Google-Smtp-Source: AGHT+IGsQA9kH+au0DUSHnYs3/9oSqfusxwYvlH4I8TNshkQxKpa9T//gY+Jgvk4kW6ofCGI5GxxHQ== X-Received: by 2002:ad4:5d42:0:b0:67f:8107:12a7 with SMTP id jk2-20020ad45d42000000b0067f810712a7mr38956044qvb.31.1704329147384; Wed, 03 Jan 2024 16:45:47 -0800 (PST) From: Hao Xiang To: farosas@suse.de, peter.maydell@linaro.org, peterx@redhat.com, marcandre.lureau@redhat.com, bryan.zhang@bytedance.com, qemu-devel@nongnu.org Cc: Hao Xiang Subject: [PATCH v3 12/20] migration/multifd: Add new migration option for multifd DSA offloading. Date: Thu, 4 Jan 2024 00:44:44 +0000 Message-Id: <20240104004452.324068-13-hao.xiang@bytedance.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240104004452.324068-1-hao.xiang@bytedance.com> References: <20240104004452.324068-1-hao.xiang@bytedance.com> 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=2607:f8b0:4864:20::f36; envelope-from=hao.xiang@bytedance.com; helo=mail-qv1-xf36.google.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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @bytedance.com) X-ZM-MESSAGEID: 1704329431539100003 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 99710c8ffb..761d6d54de 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -353,6 +353,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; @@ -615,6 +618,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 180698a8f5..b5f69031a9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -179,6 +179,8 @@ Property migration_properties[] =3D { DEFINE_PROP_MIG_MODE("mode", MigrationState, parameters.mode, MIG_MODE_NORMAL), + DEFINE_PROP_STRING("multifd-dsa-accel", MigrationState, + parameters.multifd_dsa_accel), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -903,6 +905,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(); @@ -1027,6 +1036,8 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; params->has_mode =3D true; params->mode =3D s->parameters.mode; + params->multifd_dsa_accel =3D g_strdup(s->parameters.multifd_dsa_accel= ? + s->parameters.multifd_dsa_accel := ""); =20 return params; } @@ -1035,6 +1046,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; @@ -1364,6 +1376,11 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, if (params->has_mode) { dest->mode =3D params->mode; } + + 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) @@ -1508,6 +1525,13 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) if (params->has_mode) { s->parameters.mode =3D params->mode; } + + 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) @@ -1533,6 +1557,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 c901eb57c6..56100961a9 100644 --- a/migration/options.h +++ b/migration/options.h @@ -94,6 +94,7 @@ const char *migrate_tls_authz(void); const char *migrate_tls_creds(void); const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); +const char *migrate_multifd_dsa_accel(void); =20 /* parameters setters */ =20 diff --git a/qapi/migration.json b/qapi/migration.json index 4c7a42e364..74465bc821 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -879,6 +879,12 @@ # @mode: Migration mode. See description in @MigMode. Default is 'normal'. # (Since 8.2) # +# @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 8.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -902,7 +908,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', @@ -1067,6 +1073,12 @@ # @mode: Migration mode. See description in @MigMode. Default is 'normal'. # (Since 8.2) # +# @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 8.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -1120,7 +1132,8 @@ '*x-vcpu-dirty-limit-period': { 'type': 'uint64', 'features': [ 'unstable' ] }, '*vcpu-dirty-limit': 'uint64', - '*mode': 'MigMode'} } + '*mode': 'MigMode', + '*multifd-dsa-accel': 'StrOrNull'} } =20 ## # @migrate-set-parameters: @@ -1295,6 +1308,12 @@ # @mode: Migration mode. See description in @MigMode. Default is 'normal'. # (Since 8.2) # +# @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 8.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -1345,7 +1364,8 @@ '*x-vcpu-dirty-limit-period': { 'type': 'uint64', 'features': [ 'unstable' ] }, '*vcpu-dirty-limit': 'uint64', - '*mode': 'MigMode'} } + '*mode': 'MigMode', + '*multifd-dsa-accel': 'str'} } =20 ## # @query-migrate-parameters: --=20 2.30.2