From nobody Wed Nov 27 10:42:45 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=1699940576; cv=none; d=zohomail.com; s=zohoarc; b=ghvLFFcIzFpKv9dJ5XgJaWOj+VKLbKtQs+I0M4InZU8mn3QVon3NXwxNy5M+7sycwvMIKj6q4ORqh8CT+O4i1X7x+QE+hU6AJh8jqn1/vfdOeG1fi86UtyzoKBzirYY3d4WKiiux7DJQ9K/xCcIRrmRd0UwrK66cxM6yp0Kh5hY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699940576; 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=m1r1zQ1wix8p0/drY4otOIWoj+h39RPeRIVWFAAZ2w0=; b=jWrNg9Ys6komdee4L8tOdnepFY86H6sRpO2NPo0tlXUDcc+mdT1ULJsXW2oqtsu5GPmTcdio7D9ZXDrFRbXeUhNEdPl1d1p3qfEP2yCTwlpraF+3w4L6EGuC8JHGh97TBxcYePxpikAYllMni2G3G6nnlQ5gHzDYuYdYwRF4YxQ= 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 1699940576981978.3753761347862; Mon, 13 Nov 2023 21:42:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2mBS-0007F3-Rm; Tue, 14 Nov 2023 00:41:58 -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 1r2mBQ-0007Ed-OL for qemu-devel@nongnu.org; Tue, 14 Nov 2023 00:41:57 -0500 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2mBO-0001TN-Pi for qemu-devel@nongnu.org; Tue, 14 Nov 2023 00:41:56 -0500 Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-66d0f945893so43964976d6.1 for ; Mon, 13 Nov 2023 21:41:54 -0800 (PST) Received: from n231-230-216.byted.org ([130.44.212.104]) by smtp.gmail.com with ESMTPSA id w2-20020a05620a094200b0077891d2d12dsm2400367qkw.43.2023.11.13.21.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 21:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1699940514; x=1700545314; 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=m1r1zQ1wix8p0/drY4otOIWoj+h39RPeRIVWFAAZ2w0=; b=L1YLAbCY+wJPH3pvwinhWkrroN79JbWaZ3rC1mvQ2RpEnzc2phaoYg6KgFhgSOB0sq Iup4Y8LdhUoQNeWbpRE82NyYnWEuIR09TaM1rHDrWnQ900zf9sJHHv9Mo0Ao0pwDF1TT dipYgtFkNyc595pSpWcrDWDHxxSM7ksLgan8a58BIFUTsQm7zFW2chKbDY8kwZYrDsLi /qo0QDUZy8c1xLXQziUgx7yf+jvXQSr9xFC8KmIdrzyGiS+j07qej+ykmfRmDNh/rQZq +2aSX8KAFMB+GoUz4ZoqV81NEBOcXawHS/C0Oz3oAkXkc0VzAvdOKhCVDpWKA3i0/61Y woAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699940514; x=1700545314; 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=m1r1zQ1wix8p0/drY4otOIWoj+h39RPeRIVWFAAZ2w0=; b=vKxFoLDoepZqKI/PLnnrc2qhsHMX5jSHqAItjid62PXVdyenTk6psegi/yofrRhgOb yKZXinWlUnt6CRUI+A5g6XyU8zMZq84meKs0ROUasDzsj82YZuA2yIIOSRdmo0nZapBC TIHD/GMetyyxiyVAhxJMGRrHn8nCqxlCQrMemE/n1zMGhFomSFFImGzqbTxcOh5d3Z91 DokAkRCAGhxW1lukrYSV7LS9m+lGju3RhwhyPbh8EJqr36/hBIXRAxbkvdRdEF4xhLR1 XgQj93UInURmzCK0QmU5NExSdD1sWv1r2unhrYg0NFKincwBEZ4701Kgzoi7oCaTmp++ mjPg== X-Gm-Message-State: AOJu0YysG5R8mrI9J4s7Wlb3czcq15fnXq/6ZDSOuZuwc73IXsAVy3AZ LMb+mdvHZDLczRdcz1qoV3dyqw== X-Google-Smtp-Source: AGHT+IE5GToIbmWtFNvhu174v4ELtJkJjQBCUe87f2CJRVfx+6QqJic7xymCXnSqWlVIY2IEA3Hk+Q== X-Received: by 2002:a05:6214:2d01:b0:66d:670:d425 with SMTP id mz1-20020a0562142d0100b0066d0670d425mr2001134qvb.31.1699940513880; Mon, 13 Nov 2023 21:41:53 -0800 (PST) From: Hao Xiang To: farosas@suse.de, peter.maydell@linaro.org, quintela@redhat.com, peterx@redhat.com, marcandre.lureau@redhat.com, bryan.zhang@bytedance.com, qemu-devel@nongnu.org Cc: Hao Xiang Subject: [PATCH v2 12/20] migration/multifd: Add new migration option for multifd DSA offloading. Date: Tue, 14 Nov 2023 05:40:24 +0000 Message-Id: <20231114054032.1192027-13-hao.xiang@bytedance.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231114054032.1192027-1-hao.xiang@bytedance.com> References: <20231114054032.1192027-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::f2f; envelope-from=hao.xiang@bytedance.com; helo=mail-qv1-xf2f.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: 1699940577549100001 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 | 28 ++++++++++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 17 ++++++++++++++--- scripts/meson-buildoptions.sh | 6 +++--- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 86ae832176..d9451744dd 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 97d121d4d7..6e424b5d63 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), @@ -901,6 +903,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(); @@ -1025,6 +1034,7 @@ 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 s->parameters.multifd_dsa_accel; =20 return params; } @@ -1033,6 +1043,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; @@ -1362,6 +1373,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) @@ -1506,6 +1522,12 @@ 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_a= ccel->u.s); + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) @@ -1531,6 +1553,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 9783289bfc..a8e3b66d6f 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -879,6 +879,9 @@ # @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. (since 8.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -902,7 +905,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 +1070,9 @@ # @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. (since 8.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -1120,7 +1126,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 +1302,9 @@ # @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. (since 8.2) +# # Features: # # @deprecated: Member @block-incremental is deprecated. Use @@ -1345,7 +1355,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: diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index bf139e3fb4..35222ab63e 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -32,6 +32,7 @@ meson_options_help() { printf "%s\n" ' --enable-debug-stack-usage' printf "%s\n" ' measure coroutine stack usage' printf "%s\n" ' --enable-debug-tcg TCG debugging' + printf "%s\n" ' --enable-enqcmd MENQCMD optimizations' printf "%s\n" ' --enable-fdt[=3DCHOICE] Whether and how to find the = libfdt library' printf "%s\n" ' (choices: auto/disabled/enable= d/internal/system)' printf "%s\n" ' --enable-fuzzing build fuzzing targets' @@ -93,7 +94,6 @@ meson_options_help() { printf "%s\n" ' avx2 AVX2 optimizations' printf "%s\n" ' avx512bw AVX512BW optimizations' printf "%s\n" ' avx512f AVX512F optimizations' - printf "%s\n" ' enqcmd ENQCMD optimizations' printf "%s\n" ' blkio libblkio block device driver' printf "%s\n" ' bochs bochs image format support' printf "%s\n" ' bpf eBPF support' @@ -241,8 +241,6 @@ _meson_option_parse() { --disable-avx512bw) printf "%s" -Davx512bw=3Ddisabled ;; --enable-avx512f) printf "%s" -Davx512f=3Denabled ;; --disable-avx512f) printf "%s" -Davx512f=3Ddisabled ;; - --enable-enqcmd) printf "%s" -Denqcmd=3Dtrue ;; - --disable-enqcmd) printf "%s" -Denqcmd=3Dfalse ;; --enable-gcov) printf "%s" -Db_coverage=3Dtrue ;; --disable-gcov) printf "%s" -Db_coverage=3Dfalse ;; --enable-lto) printf "%s" -Db_lto=3Dtrue ;; @@ -309,6 +307,8 @@ _meson_option_parse() { --disable-docs) printf "%s" -Ddocs=3Ddisabled ;; --enable-dsound) printf "%s" -Ddsound=3Denabled ;; --disable-dsound) printf "%s" -Ddsound=3Ddisabled ;; + --enable-enqcmd) printf "%s" -Denqcmd=3Dtrue ;; + --disable-enqcmd) printf "%s" -Denqcmd=3Dfalse ;; --enable-fdt) printf "%s" -Dfdt=3Denabled ;; --disable-fdt) printf "%s" -Dfdt=3Ddisabled ;; --enable-fdt=3D*) quote_sh "-Dfdt=3D$2" ;; --=20 2.30.2