From nobody Mon Nov 25 02:33:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717768499; cv=none; d=zohomail.com; s=zohoarc; b=jdfI+JPEhg1HUCJ8E5USOc6x8+tK4cVdBF/ZgZC5SPUGKieyey+I6UYQzWE+wEslwLnu/Pbd3U/gLXuF/p5gwkHOd6gtqP/XhAPgHmN21L3plNLHR2XdD7T7oBJg2vBL8oWKeS6HfnL9p//tLx3qtxjwuZxiJkWtIjIelbr0jJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717768499; h=Content-Type: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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=lqbDp3d845ekPQQSE47fJgAbZzAp6KhtwglyfBk2obY=; b=aKuJxth8QNqLLvaCD7DNsY3TxkhMMBlEGGgwDunybq9jGwrA9Y0iFamfnlO+F3JhWwG3bmr9s+Dyxkp9WTpXwnw48AOMaGeLuIsoc8Dp6RxxGnOMGY1cZCOZ4WYf4+evfFRANbjgaoCIbfc2b6LL2cAZ+iLdbj6PafHNmWJUxMk= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1717768499696691.3066745076685; Fri, 7 Jun 2024 06:54:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFa2p-0004pG-KT; Fri, 07 Jun 2024 09:54:15 -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 1sFa2o-0004ow-65 for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:14 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFa2l-00087a-Le for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:13 -0400 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VwjH85WDmz6H6sf; Fri, 7 Jun 2024 21:49:24 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 530ED140B55; Fri, 7 Jun 2024 21:54:07 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 14:53:59 +0100 To: , , CC: , , , , , , , , , , Subject: [PATCH v2 1/7] docs/migration: add uadk compression feature Date: Fri, 7 Jun 2024 14:53:04 +0100 Message-ID: <20240607135310.46320-2-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> References: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) 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=185.176.79.56; envelope-from=shameerali.kolothum.thodi@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Reply-to: Shameer Kolothum From: Shameer Kolothum via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717768500700100005 Document UADK(User Space Accelerator Development Kit) library details and how to use that for migration. Signed-off-by: Shameer Kolothum Reviewed-by: Zhangfei Gao --- docs/devel/migration/features.rst | 1 + docs/devel/migration/uadk-compression.rst | 144 ++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 docs/devel/migration/uadk-compression.rst diff --git a/docs/devel/migration/features.rst b/docs/devel/migration/featu= res.rst index bc98b65075..58f8fd9e16 100644 --- a/docs/devel/migration/features.rst +++ b/docs/devel/migration/features.rst @@ -13,3 +13,4 @@ Migration has plenty of features to support different use= cases. mapped-ram CPR qpl-compression + uadk-compression diff --git a/docs/devel/migration/uadk-compression.rst b/docs/devel/migrati= on/uadk-compression.rst new file mode 100644 index 0000000000..988b92631e --- /dev/null +++ b/docs/devel/migration/uadk-compression.rst @@ -0,0 +1,144 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +User Space Accelerator Development Kit (UADK) Compression +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +UADK is a general-purpose user space accelerator framework that uses shared +virtual addressing (SVA) to provide a unified programming interface for +hardware acceleration of cryptographic and compression algorithms. + +UADK includes Unified/User-space-access-intended Accelerator Framework (UA= CCE), +which enables hardware accelerators from different vendors that support SV= A to +adapt to UADK. + +Currently, HiSilicon Kunpeng hardware accelerators have been registered wi= th +UACCE. Through the UADK framework, users can run cryptographic and compres= sion +algorithms using hardware accelerators instead of CPUs, freeing up CPU +computing power and improving computing performance. + +https://github.com/Linaro/uadk/tree/master/docs + +UADK Framework +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +UADK consists of UACCE, vendors' drivers, and an algorithm layer. UADK req= uires +the hardware accelerator to support SVA, and the operating system to suppo= rt +IOMMU and SVA. Hardware accelerators from different vendors are registered= as +different character devices with UACCE by using kernel-mode drivers of the +vendors. A user can access the hardware accelerators by performing user-mo= de +operations on the character devices. + +:: + + +----------------------------------+ + | apps | + +----+------------------------+----+ + | | + | | + +-------+--------+ +-------+-------+ + | scheduler | | alg libraries | + +-------+--------+ +-------+-------+ + | | + | | + | | + | +--------+------+ + | | vendor drivers| + | +-+-------------+ + | | + | | + +--+------------------+--+ + | libwd | + User +----+-------------+-----+ + -------------------------------------------------- + Kernel +--+-----+ +------+ + | uacce | | smmu | + +---+----+ +------+ + | + +---+------------------+ + | vendor kernel driver | + +----------------------+ + -------------------------------------------------- + +----------------------+ + | HW Accelerators | + +----------------------+ + +UADK Installation +----------------- +Build UADK +^^^^^^^^^^ + +.. code-block:: shell + + git clone https://github.com/Linaro/uadk.git + cd uadk + mkdir build + ./autogen.sh + ./configure --prefix=3D$PWD/build + make + make install + +Without --prefix, UADK will be installed to /usr/local/lib by default. +If get error:"cannot find -lnuma", please install the libnuma-dev + +Run pkg-config libwd to ensure env is setup correctly +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* export PKG_CONFIG_PATH=3D$PWD/build/lib/pkgconfig +* pkg-config libwd --cflags --libs + -I/usr/local/include -L/usr/local/lib -lwd + +* export PKG_CONFIG_PATH is required on demand. + Not required if UADK is installed to /usr/local/lib + +UADK Host Kernel Requirements +----------------------------- +User needs to make sure that ``UACCE`` is already supported in Linux kerne= l. +The kernel version should be at least v5.9 with SVA (Shared Virtual +Addressing) enabled. + +Kernel Configuration +^^^^^^^^^^^^^^^^^^^^ + +``UACCE`` could be built as module or built-in. + +Here's an example to enable UACCE with hardware accelerator in HiSilicon +Kunpeng platform. + +* CONFIG_IOMMU_SVA_LIB=3Dy +* CONFIG_ARM_SMMU=3Dy +* CONFIG_ARM_SMMU_V3=3Dy +* CONFIG_ARM_SMMU_V3_SVA=3Dy +* CONFIG_PCI_PASID=3Dy +* CONFIG_UACCE=3Dy +* CONFIG_CRYPTO_DEV_HISI_QM=3Dy +* CONFIG_CRYPTO_DEV_HISI_ZIP=3Dy + +Make sure all these above kernel configurations are selected. + +Accelerator dev node permissions +-------------------------------- +Harware accelerators(eg: HiSilicon Kunpeng Zip accelerator) gets registere= d to +UADK and char devices are created in dev directory. In order to access res= ources +on hardware accelerator devices, write permission should be provided to us= er. + +.. code-block:: shell + + $ sudo chmod 777 /dev/hisi_zip-* + +How To Use UADK Compression In Qemu Migration +--------------------------------------------- +* Make sure UADK is installed as above +* Build ``Qemu`` with ``--enable-uadk`` parameter + + E.g. configure --target-list=3Daarch64-softmmu --enable-kvm ``--enable-u= adk`` + +* Enable ``UADK`` compression during migration + + Set ``migrate_set_parameter multifd-compression uadk`` + +Since UADK uses Shared Virtual Addressing(SVA) and device access virtual m= emory +directly it is possible that SMMUv3 may enounter page faults while walking= the +IO page tables. This may impact the performance. In order to mitigate this, +please make sure to specify ``-mem-prealloc`` parameter to the destination= VM +boot parameters. + +Though both UADK and ZLIB are based on the deflate compression=C2=A0algori= thm, UADK +is not fully compatible with ZLIB. Hence, please make sure to use ``uadk``= on +both source and destination during migration. --=20 2.34.1 From nobody Mon Nov 25 02:33:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717768500; cv=none; d=zohomail.com; s=zohoarc; b=n/5KrF7/8x9Z+yDvaTjHAfn5w42590aeSHfsoIdv4Nv+ENjCOUDkasFJjolzI2YrwXQN6Qm1GodQH/tkH8GTIsY3yONhZyKUVtv4e0MNCkTWVe19Qm5178ZKct69GgRCMeLPXEfN/9EqxXDWrnPM1uggnqYXjh7c441YzKWjM3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717768500; h=Content-Type: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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=MLO41XOL6qHHb5sClIMwCBVWdtPrMRqTkYbu2kePLJE=; b=dUBU4ldWG28r0KuxomVPjgL4BOw4F79IaojW++BvknO7V4ubz63ihgK2elm5pDdi9dNmc0f4G+/6mnqTXQsDqPJ9Nvk5JLAWF1qj2FPhPsbIbhUuAF7azm2bY0IcpGG2Jlydz02ppdRzolTJXqAQnGqXgytImPcDCcIG1hn6U6g= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1717768500262680.2752900899416; Fri, 7 Jun 2024 06:55:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFa2w-0004qb-Iv; Fri, 07 Jun 2024 09:54:22 -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 1sFa2u-0004pu-Qj for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:20 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFa2t-00087z-3E for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:20 -0400 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VwjHj19y3z6J9v7; Fri, 7 Jun 2024 21:49:53 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 5CDC1140B30; Fri, 7 Jun 2024 21:54:17 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 14:54:09 +0100 To: , , CC: , , , , , , , , , , Subject: [PATCH v2 2/7] configure: Add uadk option Date: Fri, 7 Jun 2024 14:53:05 +0100 Message-ID: <20240607135310.46320-3-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> References: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) 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=185.176.79.56; envelope-from=shameerali.kolothum.thodi@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Reply-to: Shameer Kolothum From: Shameer Kolothum via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717768502688100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add --enable-uadk and --disable-uadk options to enable and disable UADK compression accelerator. This is for using UADK based hardware accelerators for live migration. Reviewed-by: Fabiano Rosas Signed-off-by: Shameer Kolothum Reviewed-by: Zhangfei Gao --- meson.build | 14 ++++++++++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 19 insertions(+) diff --git a/meson.build b/meson.build index d97f312a42..849f1b4584 100644 --- a/meson.build +++ b/meson.build @@ -1203,6 +1203,18 @@ if not get_option('qpl').auto() or have_system required: get_option('qpl'), method: 'pkg-config') endif +uadk =3D not_found +if not get_option('uadk').auto() or have_system + libwd =3D dependency('libwd', version: '>=3D2.6', + required: get_option('uadk'), + method: 'pkg-config') + libwd_comp =3D dependency('libwd_comp', version: '>=3D2.6', + required: get_option('uadk'), + method: 'pkg-config') + if libwd.found() and libwd_comp.found() + uadk =3D declare_dependency(dependencies: [libwd, libwd_comp]) + endif +endif virgl =3D not_found =20 have_vhost_user_gpu =3D have_tools and host_os =3D=3D 'linux' and pixman.f= ound() @@ -2338,6 +2350,7 @@ config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('CONFIG_STATX_MNT_ID', has_statx_mnt_id) config_host_data.set('CONFIG_ZSTD', zstd.found()) config_host_data.set('CONFIG_QPL', qpl.found()) +config_host_data.set('CONFIG_UADK', uadk.found()) config_host_data.set('CONFIG_FUSE', fuse.found()) config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found()) config_host_data.set('CONFIG_SPICE_PROTOCOL', spice_protocol.found()) @@ -4447,6 +4460,7 @@ summary_info +=3D {'bzip2 support': libbzip2} summary_info +=3D {'lzfse support': liblzfse} summary_info +=3D {'zstd support': zstd} summary_info +=3D {'Query Processing Library support': qpl} +summary_info +=3D {'UADK Library support': uadk} summary_info +=3D {'NUMA host support': numa} summary_info +=3D {'capstone': capstone} summary_info +=3D {'libpmem support': libpmem} diff --git a/meson_options.txt b/meson_options.txt index dd680a5faf..7a79dd8970 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -261,6 +261,8 @@ option('zstd', type : 'feature', value : 'auto', description: 'zstd compression support') option('qpl', type : 'feature', value : 'auto', description: 'Query Processing Library support') +option('uadk', type : 'feature', value : 'auto', + description: 'UADK Library support') option('fuse', type: 'feature', value: 'auto', description: 'FUSE block device export') option('fuse_lseek', type : 'feature', value : 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 73ae8cedfc..58d49a447d 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -221,6 +221,7 @@ meson_options_help() { printf "%s\n" ' xkbcommon xkbcommon support' printf "%s\n" ' zstd zstd compression support' printf "%s\n" ' qpl Query Processing Library support' + printf "%s\n" ' uadk UADK Library support' } _meson_option_parse() { case $1 in @@ -561,6 +562,8 @@ _meson_option_parse() { --disable-zstd) printf "%s" -Dzstd=3Ddisabled ;; --enable-qpl) printf "%s" -Dqpl=3Denabled ;; --disable-qpl) printf "%s" -Dqpl=3Ddisabled ;; + --enable-uadk) printf "%s" -Duadk=3Denabled ;; + --disable-uadk) printf "%s" -Duadk=3Ddisabled ;; *) return 1 ;; esac } --=20 2.34.1 From nobody Mon Nov 25 02:33:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717768529; cv=none; d=zohomail.com; s=zohoarc; b=fY92M1SCRMsDiAw0IkkqtE2hueOry8eA/sRugvLf5S28YU+xZ6QiwdW4aPkJy1eUDlRsLSStE20blKiK/K+5dDWELBjTc+S5/3jk6v3vDFCNiYHV/o7siAhkU7sjKzeZymZ3uBPX6Gn1ewx3FfFmpOJ4US3NlH+xodDas6Qz+Ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717768529; h=Content-Type: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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=mjMcyCMHk4K8LYYZBbgPYh2mXu+6+uAKeyp+lhDLKPU=; b=L8OoyMD1yTYvUM2S3/IF1xKKHLptYUmFGIQUDI3K3s61ErahjmdlBb0Hf1+IGRACKGl9ZpdUIKh4f1G/JonWhyRtCG+Fgbx25wtDc7ovGC+18jDOtBSVGFw2tgkWv9ZMwWSJ9YmVDagEqXeThUDZ5/jx+A+wsvFDz1Yr08UwcXQ= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 171776852931949.583620942990024; Fri, 7 Jun 2024 06:55:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFa36-0004s6-4i; Fri, 07 Jun 2024 09:54:32 -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 1sFa34-0004rs-N0 for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:30 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFa32-00088f-Tp for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:30 -0400 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VwjHX512Hz6H7Tb; Fri, 7 Jun 2024 21:49:44 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 408FC140D26; Fri, 7 Jun 2024 21:54:27 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 14:54:19 +0100 To: , , CC: , , , , , , , , , , Subject: [PATCH v2 3/7] migration/multifd: add uadk compression framework Date: Fri, 7 Jun 2024 14:53:06 +0100 Message-ID: <20240607135310.46320-4-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> References: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) 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=185.176.79.56; envelope-from=shameerali.kolothum.thodi@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Reply-to: Shameer Kolothum From: Shameer Kolothum via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717768530483100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Adds the skeleton to support uadk compression method. Complete functionality will be added in subsequent patches. Acked-by: Markus Armbruster Reviewed-by: Fabiano Rosas Signed-off-by: Shameer Kolothum Reviewed-by: Zhangfei Gao --- hw/core/qdev-properties-system.c | 2 +- migration/meson.build | 1 + migration/multifd-uadk.c | 20 ++++++++++++++++++++ migration/multifd.h | 5 +++-- qapi/migration.json | 5 ++++- 5 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 migration/multifd-uadk.c diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 6ccd7224f6..f13350b4fb 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -659,7 +659,7 @@ const PropertyInfo qdev_prop_fdc_drive_type =3D { const PropertyInfo qdev_prop_multifd_compression =3D { .name =3D "MultiFDCompression", .description =3D "multifd_compression values, " - "none/zlib/zstd/qpl", + "none/zlib/zstd/qpl/uadk", .enum_table =3D &MultiFDCompression_lookup, .get =3D qdev_propinfo_get_enum, .set =3D qdev_propinfo_set_enum, diff --git a/migration/meson.build b/migration/meson.build index 5f146fe8a9..5ce2acb41e 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -40,6 +40,7 @@ endif system_ss.add(when: rdma, if_true: files('rdma.c')) system_ss.add(when: zstd, if_true: files('multifd-zstd.c')) system_ss.add(when: qpl, if_true: files('multifd-qpl.c')) +system_ss.add(when: uadk, if_true: files('multifd-uadk.c')) =20 specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: files('ram.c', diff --git a/migration/multifd-uadk.c b/migration/multifd-uadk.c new file mode 100644 index 0000000000..c2bb07535b --- /dev/null +++ b/migration/multifd-uadk.c @@ -0,0 +1,20 @@ +/* + * Multifd UADK compression accelerator implementation + * + * Copyright (c) 2024 Huawei Technologies R & D (UK) Ltd + * + * Authors: + * Shameer Kolothum + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/module.h" + +static void multifd_uadk_register(void) +{ + /* noop for now */ +} +migration_init(multifd_uadk_register); diff --git a/migration/multifd.h b/migration/multifd.h index 5b7d9b15f8..0ecd6f47d7 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -34,13 +34,14 @@ MultiFDRecvData *multifd_get_recv_data(void); /* Multifd Compression flags */ #define MULTIFD_FLAG_SYNC (1 << 0) =20 -/* We reserve 3 bits for compression methods */ -#define MULTIFD_FLAG_COMPRESSION_MASK (7 << 1) +/* We reserve 4 bits for compression methods */ +#define MULTIFD_FLAG_COMPRESSION_MASK (0xf << 1) /* we need to be compatible. Before compression value was 0 */ #define MULTIFD_FLAG_NOCOMP (0 << 1) #define MULTIFD_FLAG_ZLIB (1 << 1) #define MULTIFD_FLAG_ZSTD (2 << 1) #define MULTIFD_FLAG_QPL (4 << 1) +#define MULTIFD_FLAG_UADK (8 << 1) =20 /* This value needs to be a multiple of qemu_target_page_size() */ #define MULTIFD_PACKET_SIZE (512 * 1024) diff --git a/qapi/migration.json b/qapi/migration.json index f97bc3bb93..73cbd3fa4e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -558,12 +558,15 @@ # the deflate compression algorithm and use the Intel In-Memory Anal= ytics # Accelerator(IAA) accelerated compression and decompression. (Since= 9.1) # +# @uadk: use UADK library compression method. (Since 9.1) +# # Since: 5.0 ## { 'enum': 'MultiFDCompression', 'data': [ 'none', 'zlib', { 'name': 'zstd', 'if': 'CONFIG_ZSTD' }, - { 'name': 'qpl', 'if': 'CONFIG_QPL' } ] } + { 'name': 'qpl', 'if': 'CONFIG_QPL' }, + { 'name': 'uadk', 'if': 'CONFIG_UADK' } ] } =20 ## # @MigMode: --=20 2.34.1 From nobody Mon Nov 25 02:33:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717768535; cv=none; d=zohomail.com; s=zohoarc; b=epzBV24rIyAOwB/U0bCCOg5uRmBkmCRdwD+uMig70JZzjx+lxW6J1Tm2DlUwSHL+LMAMplblmMmEQw5cc+2cn+L8oSvSro1ZXxk+Fy5GzV/2PxrfHJagIhfn+2UEvxE9OxcIAV8hrusHjbnfDAGzap9SZaNfH3XGaO62I3V0TUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717768535; h=Content-Type: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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=vaxcQLpB5TrdOWCxbXgQdhFVFrjVLmO+mvKFicpuDMY=; b=hJHwospFJ34GBQxSvbcLUpRaPZcODDjBSyAnqXp5RsA5XvlCEQiAbLlmPEwlv9YaIDpH9WyM5nV0xTuMwJyMoTUJC/73hqqrGU7Yma8vbwP+cVisNinu8EklnsJMBlecOwRM7+uVXj1W9995H+R7Ao4SsFbjExwk4h2qE0WCsqI= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1717768535990424.4316811838461; Fri, 7 Jun 2024 06:55:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFa3H-0004w5-MA; Fri, 07 Jun 2024 09:54:43 -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 1sFa3F-0004ts-R5 for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:41 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFa3C-0008AT-W3 for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:41 -0400 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VwjJ50rQvz6JB86; Fri, 7 Jun 2024 21:50:13 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 51901140CB9; Fri, 7 Jun 2024 21:54:37 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 14:54:29 +0100 To: , , CC: , , , , , , , , , , Subject: [PATCH v2 4/7] migration/multifd: Add UADK initialization Date: Fri, 7 Jun 2024 14:53:07 +0100 Message-ID: <20240607135310.46320-5-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> References: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) 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=185.176.79.56; envelope-from=shameerali.kolothum.thodi@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Reply-to: Shameer Kolothum From: Shameer Kolothum via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717768536553100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Initialize UADK session and allocate buffers required. The actual compression/decompression will only be done in a subsequent patch. Signed-off-by: Shameer Kolothum Reviewed-by: Fabiano Rosas Reviewed-by: Zhangfei Gao --- migration/multifd-uadk.c | 209 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 208 insertions(+), 1 deletion(-) diff --git a/migration/multifd-uadk.c b/migration/multifd-uadk.c index c2bb07535b..535411a405 100644 --- a/migration/multifd-uadk.c +++ b/migration/multifd-uadk.c @@ -12,9 +12,216 @@ =20 #include "qemu/osdep.h" #include "qemu/module.h" +#include "qapi/error.h" +#include "migration.h" +#include "multifd.h" +#include "options.h" +#include "uadk/wd_comp.h" +#include "uadk/wd_sched.h" + +struct wd_data { + handle_t handle; + uint8_t *buf; + uint32_t *buf_hdr; +}; + +static bool uadk_hw_init(void) +{ + char alg[] =3D "zlib"; + int ret; + + ret =3D wd_comp_init2(alg, SCHED_POLICY_RR, TASK_HW); + if (ret && ret !=3D -WD_EEXIST) { + return false; + } else { + return true; + } +} + +static struct wd_data *multifd_uadk_init_sess(uint32_t count, + uint32_t page_size, + bool compress, Error **errp) +{ + struct wd_comp_sess_setup ss =3D {0}; + struct sched_params param =3D {0}; + uint32_t size =3D count * page_size; + struct wd_data *wd; + + if (!uadk_hw_init()) { + error_setg(errp, "multifd: UADK hardware not available"); + return NULL; + } + + wd =3D g_new0(struct wd_data, 1); + ss.alg_type =3D WD_ZLIB; + if (compress) { + ss.op_type =3D WD_DIR_COMPRESS; + /* Add an additional page for handling output > input */ + size +=3D page_size; + } else { + ss.op_type =3D WD_DIR_DECOMPRESS; + } + + /* We use default level 1 compression and 4K window size */ + param.type =3D ss.op_type; + ss.sched_param =3D ¶m; + + wd->handle =3D wd_comp_alloc_sess(&ss); + if (!wd->handle) { + error_setg(errp, "multifd: failed wd_comp_alloc_sess"); + goto out; + } + + wd->buf =3D g_try_malloc(size); + if (!wd->buf) { + error_setg(errp, "multifd: out of mem for uadk buf"); + goto out_free_sess; + } + wd->buf_hdr =3D g_new0(uint32_t, count); + return wd; + +out_free_sess: + wd_comp_free_sess(wd->handle); +out: + wd_comp_uninit2(); + g_free(wd); + return NULL; +} + +static void multifd_uadk_uninit_sess(struct wd_data *wd) +{ + wd_comp_free_sess(wd->handle); + wd_comp_uninit2(); + g_free(wd->buf); + g_free(wd->buf_hdr); + g_free(wd); +} + +/** + * multifd_uadk_send_setup: setup send side + * + * Returns 0 for success or -1 for error + * + * @p: Params for the channel that we are using + * @errp: pointer to an error + */ +static int multifd_uadk_send_setup(MultiFDSendParams *p, Error **errp) +{ + struct wd_data *wd; + + wd =3D multifd_uadk_init_sess(p->page_count, p->page_size, true, errp); + if (!wd) { + return -1; + } + + p->compress_data =3D wd; + assert(p->iov =3D=3D NULL); + /* + * Each page will be compressed independently and sent using an IOV. T= he + * additional two IOVs are used to store packet header and compressed = data + * length + */ + + p->iov =3D g_new0(struct iovec, p->page_count + 2); + return 0; +} + +/** + * multifd_uadk_send_cleanup: cleanup send side + * + * Close the channel and return memory. + * + * @p: Params for the channel that we are using + * @errp: pointer to an error + */ +static void multifd_uadk_send_cleanup(MultiFDSendParams *p, Error **errp) +{ + struct wd_data *wd =3D p->compress_data; + + multifd_uadk_uninit_sess(wd); + p->compress_data =3D NULL; +} + +/** + * multifd_uadk_send_prepare: prepare data to be able to send + * + * Create a compressed buffer with all the pages that we are going to + * send. + * + * Returns 0 for success or -1 for error + * + * @p: Params for the channel that we are using + * @errp: pointer to an error + */ +static int multifd_uadk_send_prepare(MultiFDSendParams *p, Error **errp) +{ + return -1; +} + +/** + * multifd_uadk_recv_setup: setup receive side + * + * Create the compressed channel and buffer. + * + * Returns 0 for success or -1 for error + * + * @p: Params for the channel that we are using + * @errp: pointer to an error + */ +static int multifd_uadk_recv_setup(MultiFDRecvParams *p, Error **errp) +{ + struct wd_data *wd; + + wd =3D multifd_uadk_init_sess(p->page_count, p->page_size, false, errp= ); + if (!wd) { + return -1; + } + p->compress_data =3D wd; + return 0; +} + +/** + * multifd_uadk_recv_cleanup: cleanup receive side + * + * Close the channel and return memory. + * + * @p: Params for the channel that we are using + */ +static void multifd_uadk_recv_cleanup(MultiFDRecvParams *p) +{ + struct wd_data *wd =3D p->compress_data; + + multifd_uadk_uninit_sess(wd); + p->compress_data =3D NULL; +} + +/** + * multifd_uadk_recv: read the data from the channel into actual pages + * + * Read the compressed buffer, and uncompress it into the actual + * pages. + * + * Returns 0 for success or -1 for error + * + * @p: Params for the channel that we are using + * @errp: pointer to an error + */ +static int multifd_uadk_recv(MultiFDRecvParams *p, Error **errp) +{ + return -1; +} + +static MultiFDMethods multifd_uadk_ops =3D { + .send_setup =3D multifd_uadk_send_setup, + .send_cleanup =3D multifd_uadk_send_cleanup, + .send_prepare =3D multifd_uadk_send_prepare, + .recv_setup =3D multifd_uadk_recv_setup, + .recv_cleanup =3D multifd_uadk_recv_cleanup, + .recv =3D multifd_uadk_recv, +}; =20 static void multifd_uadk_register(void) { - /* noop for now */ + multifd_register_ops(MULTIFD_COMPRESSION_UADK, &multifd_uadk_ops); } migration_init(multifd_uadk_register); --=20 2.34.1 From nobody Mon Nov 25 02:33:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717768546; cv=none; d=zohomail.com; s=zohoarc; b=E9U5EOHs0AFMx0WRTDQ0lYEbD8U/qqzLZ+k8R2zUxQPDrUh4VZN/j+dyj+QgmelaeimQqoHFV7QL/H3vWehblVIgqi61S4+Rww1TbSdZQrKwy4PLwWJMw/2i5Z/qMUMrBueCaVdUhPBtoYzC/cYmW5kH2g7nRXOwVJ43NVr/aqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717768546; h=Content-Type: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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=YTlpLupgwuhmQhjbZ30Vu9whGmN+he/tzyqci9ivF1k=; b=jliPkyJNoNfQyRR7fxAnkTL4EswobyIW5x63/DjPZS/UT9hu7NCzxgLj5b++8udbcRrSS17pnRKuN4nlEE4VOV4E+UfEujPFWE9ya9utxuSJISzX6sAJlgeKk6BomKzj1Oie6itywNTtYTmu9IwWo/84Ij7LVZcegYqc7yo2M0o= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1717768546289452.63944702076105; Fri, 7 Jun 2024 06:55:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFa3Q-0005Jl-6m; Fri, 07 Jun 2024 09:54:52 -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 1sFa3O-0005J6-M1 for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:50 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFa3M-0008As-Te for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:54:50 -0400 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VwjHw4tQyz6H7KH; Fri, 7 Jun 2024 21:50:04 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 3D4E4140B33; Fri, 7 Jun 2024 21:54:47 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 14:54:39 +0100 To: , , CC: , , , , , , , , , , Subject: [PATCH v2 5/7] migration/multifd: Add UADK based compression and decompression Date: Fri, 7 Jun 2024 14:53:08 +0100 Message-ID: <20240607135310.46320-6-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> References: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) 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=185.176.79.56; envelope-from=shameerali.kolothum.thodi@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Reply-to: Shameer Kolothum From: Shameer Kolothum via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717768546558100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Uses UADK wd_do_comp_sync() API to (de)compress a normal page using hardware accelerator. Reviewed-by: Fabiano Rosas Signed-off-by: Shameer Kolothum Reviewed-by: Zhangfei Gao --- migration/multifd-uadk.c | 132 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 2 deletions(-) diff --git a/migration/multifd-uadk.c b/migration/multifd-uadk.c index 535411a405..70bba92eaa 100644 --- a/migration/multifd-uadk.c +++ b/migration/multifd-uadk.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qapi/error.h" +#include "exec/ramblock.h" #include "migration.h" #include "multifd.h" #include "options.h" @@ -142,6 +143,15 @@ static void multifd_uadk_send_cleanup(MultiFDSendParam= s *p, Error **errp) p->compress_data =3D NULL; } =20 +static inline void prepare_next_iov(MultiFDSendParams *p, void *base, + uint32_t len) +{ + p->iov[p->iovs_num].iov_base =3D (uint8_t *)base; + p->iov[p->iovs_num].iov_len =3D len; + p->next_packet_size +=3D len; + p->iovs_num++; +} + /** * multifd_uadk_send_prepare: prepare data to be able to send * @@ -155,7 +165,56 @@ static void multifd_uadk_send_cleanup(MultiFDSendParam= s *p, Error **errp) */ static int multifd_uadk_send_prepare(MultiFDSendParams *p, Error **errp) { - return -1; + struct wd_data *uadk_data =3D p->compress_data; + uint32_t hdr_size; + uint8_t *buf =3D uadk_data->buf; + int ret =3D 0; + + if (!multifd_send_prepare_common(p)) { + goto out; + } + + hdr_size =3D p->pages->normal_num * sizeof(uint32_t); + /* prepare the header that stores the lengths of all compressed data */ + prepare_next_iov(p, uadk_data->buf_hdr, hdr_size); + + for (int i =3D 0; i < p->pages->normal_num; i++) { + struct wd_comp_req creq =3D { + .op_type =3D WD_DIR_COMPRESS, + .src =3D p->pages->block->host + p->pages->offset[i], + .src_len =3D p->page_size, + .dst =3D buf, + /* Set dst_len to double the src in case compressed out >=3D p= age_size */ + .dst_len =3D p->page_size * 2, + }; + + ret =3D wd_do_comp_sync(uadk_data->handle, &creq); + if (ret || creq.status) { + error_setg(errp, "multifd %u: failed compression, ret %d statu= s %d", + p->id, ret, creq.status); + return -1; + } + if (creq.dst_len < p->page_size) { + uadk_data->buf_hdr[i] =3D cpu_to_be32(creq.dst_len); + prepare_next_iov(p, buf, creq.dst_len); + buf +=3D creq.dst_len; + } else { + /* + * Send raw data if compressed out >=3D page_size. We might be= better + * off sending raw data if output is slightly less than page_s= ize + * as well because at the receive end we can skip the decompre= ssion. + * But it is tricky to find the right number here. + */ + uadk_data->buf_hdr[i] =3D cpu_to_be32(p->page_size); + prepare_next_iov(p, p->pages->block->host + p->pages->offset[i= ], + p->page_size); + buf +=3D p->page_size; + } + } +out: + p->flags |=3D MULTIFD_FLAG_UADK; + multifd_send_fill_packet(p); + return 0; } =20 /** @@ -208,7 +267,76 @@ static void multifd_uadk_recv_cleanup(MultiFDRecvParam= s *p) */ static int multifd_uadk_recv(MultiFDRecvParams *p, Error **errp) { - return -1; + struct wd_data *uadk_data =3D p->compress_data; + uint32_t in_size =3D p->next_packet_size; + uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; + uint32_t hdr_len =3D p->normal_num * sizeof(uint32_t); + uint32_t data_len =3D 0; + uint8_t *buf =3D uadk_data->buf; + int ret =3D 0; + + if (flags !=3D MULTIFD_FLAG_UADK) { + error_setg(errp, "multifd %u: flags received %x flags expected %x", + p->id, flags, MULTIFD_FLAG_ZLIB); + return -1; + } + + multifd_recv_zero_page_process(p); + if (!p->normal_num) { + assert(in_size =3D=3D 0); + return 0; + } + + /* read compressed data lengths */ + assert(hdr_len < in_size); + ret =3D qio_channel_read_all(p->c, (void *) uadk_data->buf_hdr, + hdr_len, errp); + if (ret !=3D 0) { + return ret; + } + + for (int i =3D 0; i < p->normal_num; i++) { + uadk_data->buf_hdr[i] =3D be32_to_cpu(uadk_data->buf_hdr[i]); + data_len +=3D uadk_data->buf_hdr[i]; + assert(uadk_data->buf_hdr[i] <=3D p->page_size); + } + + /* read compressed data */ + assert(in_size =3D=3D hdr_len + data_len); + ret =3D qio_channel_read_all(p->c, (void *)buf, data_len, errp); + if (ret !=3D 0) { + return ret; + } + + for (int i =3D 0; i < p->normal_num; i++) { + struct wd_comp_req creq =3D { + .op_type =3D WD_DIR_DECOMPRESS, + .src =3D buf, + .src_len =3D uadk_data->buf_hdr[i], + .dst =3D p->host + p->normal[i], + .dst_len =3D p->page_size, + }; + + if (uadk_data->buf_hdr[i] =3D=3D p->page_size) { + memcpy(p->host + p->normal[i], buf, p->page_size); + buf +=3D p->page_size; + continue; + } + + ret =3D wd_do_comp_sync(uadk_data->handle, &creq); + if (ret || creq.status) { + error_setg(errp, "multifd %u: failed decompression, ret %d sta= tus %d", + p->id, ret, creq.status); + return -1; + } + if (creq.dst_len !=3D p->page_size) { + error_setg(errp, "multifd %u: decompressed length error", p->i= d); + return -1; + } + buf +=3D uadk_data->buf_hdr[i]; + } + + return 0; } =20 static MultiFDMethods multifd_uadk_ops =3D { --=20 2.34.1 From nobody Mon Nov 25 02:33:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717768548; cv=none; d=zohomail.com; s=zohoarc; b=TAHnS+B4Ms9vdwj6XNhIExM210NKUZ+kBZ/ya2m1ejIU6KRMDULdgP7LuaEZYM1Ywhj62nNVG+m/luUgqdH76ltKXijST9cexBEfXQuD13lGUZbSG7FL0YJBam8cXfUoEHRVzWyjhzvPmGUW7M9V84F0dcTAtOOerFoiWLF5Td8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717768548; h=Content-Type: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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=neT8fN4Ep1xdtLreVi4NSq96KL0t6PFKpMNYpIylvBo=; b=Y1qng5FTX6P7jFkd0tb/OMdFOvoT++YUWfqSabc7B1FrfK2VCUYGSIaV+nA1dzKrBf1P1xicQr3Lv3vUzlbcqKVLdxU4AU8Y69ESwPU1gx5UjmbaI8fNKghtFfl8l5IGnU/RQpBCGYt+rbM1PclrSuhaWVwGc66lqYhh7ynOW7s= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 171776854882723.75629863932363; Fri, 7 Jun 2024 06:55:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFa3b-00060B-6w; Fri, 07 Jun 2024 09:55:03 -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 1sFa3a-0005zk-28 for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:55:02 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFa3X-0008CR-TA for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:55:01 -0400 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VwjJT13Mzz6JB6P; Fri, 7 Jun 2024 21:50:33 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id B75E3140DAF; Fri, 7 Jun 2024 21:54:57 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 14:54:48 +0100 To: , , CC: , , , , , , , , , , Subject: [PATCH v2 6/7] migration/multifd: Switch to no compression when no hardware support Date: Fri, 7 Jun 2024 14:53:09 +0100 Message-ID: <20240607135310.46320-7-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> References: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) 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=185.176.79.56; envelope-from=shameerali.kolothum.thodi@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Reply-to: Shameer Kolothum From: Shameer Kolothum via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717768550612100003 Send raw packets over if UADK hardware support is not available. This=C2=A0= is to satisfy=C2=A0 Qemu qtest CI which may run on platforms that don't have UADK hardware support. Subsequent patch will add support for uadk migration qtest. Reviewed-by: Fabiano Rosas Signed-off-by: Shameer Kolothum Reviewed-by: Zhangfei Gao --- migration/multifd-uadk.c | 92 +++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 39 deletions(-) diff --git a/migration/multifd-uadk.c b/migration/multifd-uadk.c index 70bba92eaa..d12353fb21 100644 --- a/migration/multifd-uadk.c +++ b/migration/multifd-uadk.c @@ -17,6 +17,7 @@ #include "migration.h" #include "multifd.h" #include "options.h" +#include "qemu/error-report.h" #include "uadk/wd_comp.h" #include "uadk/wd_sched.h" =20 @@ -48,29 +49,29 @@ static struct wd_data *multifd_uadk_init_sess(uint32_t = count, uint32_t size =3D count * page_size; struct wd_data *wd; =20 - if (!uadk_hw_init()) { - error_setg(errp, "multifd: UADK hardware not available"); - return NULL; - } - wd =3D g_new0(struct wd_data, 1); - ss.alg_type =3D WD_ZLIB; - if (compress) { - ss.op_type =3D WD_DIR_COMPRESS; - /* Add an additional page for handling output > input */ - size +=3D page_size; - } else { - ss.op_type =3D WD_DIR_DECOMPRESS; - } - - /* We use default level 1 compression and 4K window size */ - param.type =3D ss.op_type; - ss.sched_param =3D ¶m; =20 - wd->handle =3D wd_comp_alloc_sess(&ss); - if (!wd->handle) { - error_setg(errp, "multifd: failed wd_comp_alloc_sess"); - goto out; + if (uadk_hw_init()) { + ss.alg_type =3D WD_ZLIB; + if (compress) { + ss.op_type =3D WD_DIR_COMPRESS; + /* Add an additional page for handling output > input */ + size +=3D page_size; + } else { + ss.op_type =3D WD_DIR_DECOMPRESS; + } + /* We use default level 1 compression and 4K window size */ + param.type =3D ss.op_type; + ss.sched_param =3D ¶m; + + wd->handle =3D wd_comp_alloc_sess(&ss); + if (!wd->handle) { + error_setg(errp, "multifd: failed wd_comp_alloc_sess"); + goto out; + } + } else { + /* For CI test use */ + warn_report_once("UADK hardware not available. Switch to no compre= ssion mode"); } =20 wd->buf =3D g_try_malloc(size); @@ -82,7 +83,9 @@ static struct wd_data *multifd_uadk_init_sess(uint32_t co= unt, return wd; =20 out_free_sess: - wd_comp_free_sess(wd->handle); + if (wd->handle) { + wd_comp_free_sess(wd->handle); + } out: wd_comp_uninit2(); g_free(wd); @@ -91,7 +94,9 @@ out: =20 static void multifd_uadk_uninit_sess(struct wd_data *wd) { - wd_comp_free_sess(wd->handle); + if (wd->handle) { + wd_comp_free_sess(wd->handle); + } wd_comp_uninit2(); g_free(wd->buf); g_free(wd->buf_hdr); @@ -188,23 +193,26 @@ static int multifd_uadk_send_prepare(MultiFDSendParam= s *p, Error **errp) .dst_len =3D p->page_size * 2, }; =20 - ret =3D wd_do_comp_sync(uadk_data->handle, &creq); - if (ret || creq.status) { - error_setg(errp, "multifd %u: failed compression, ret %d statu= s %d", - p->id, ret, creq.status); - return -1; + if (uadk_data->handle) { + ret =3D wd_do_comp_sync(uadk_data->handle, &creq); + if (ret || creq.status) { + error_setg(errp, "multifd %u: failed compression, ret %d s= tatus %d", + p->id, ret, creq.status); + return -1; + } + if (creq.dst_len < p->page_size) { + uadk_data->buf_hdr[i] =3D cpu_to_be32(creq.dst_len); + prepare_next_iov(p, buf, creq.dst_len); + buf +=3D creq.dst_len; + } } - if (creq.dst_len < p->page_size) { - uadk_data->buf_hdr[i] =3D cpu_to_be32(creq.dst_len); - prepare_next_iov(p, buf, creq.dst_len); - buf +=3D creq.dst_len; - } else { - /* - * Send raw data if compressed out >=3D page_size. We might be= better - * off sending raw data if output is slightly less than page_s= ize - * as well because at the receive end we can skip the decompre= ssion. - * But it is tricky to find the right number here. - */ + /* + * Send raw data if no UADK hardware or if compressed out >=3D pag= e_size. + * We might be better off sending raw data if output is slightly l= ess + * than page_size as well because at the receive end we can skip t= he + * decompression. But it is tricky to find the right number here. + */ + if (!uadk_data->handle || creq.dst_len >=3D p->page_size) { uadk_data->buf_hdr[i] =3D cpu_to_be32(p->page_size); prepare_next_iov(p, p->pages->block->host + p->pages->offset[i= ], p->page_size); @@ -323,6 +331,12 @@ static int multifd_uadk_recv(MultiFDRecvParams *p, Err= or **errp) continue; } =20 + if (unlikely(!uadk_data->handle)) { + error_setg(errp, "multifd %u: UADK HW not available for decomp= ression", + p->id); + return -1; + } + ret =3D wd_do_comp_sync(uadk_data->handle, &creq); if (ret || creq.status) { error_setg(errp, "multifd %u: failed decompression, ret %d sta= tus %d", --=20 2.34.1 From nobody Mon Nov 25 02:33:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717768559; cv=none; d=zohomail.com; s=zohoarc; b=nVFLW4lRBjIkyNt+eo+Kdc333//qoVc7ITAwmv4jhw6HkLlaV4MC1ZQi7aTs8Ks3hdgTdg5zyT5LflC/CboXh+TceoMEm7VN/7Ol5C3wbDh+rysA++iKGrNrNO30+Tn08tkLQj43vStWFJT923FwuzsuKcW4klsHfcTopNGe7ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717768559; h=Content-Type: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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=c/p4V2AY7Z8Hn5D08QjXn9saeO9YVT/xafi9VltgIRQ=; b=jyXQLr69B9cATDvWnR1AutGKnTkjjog5Pe7uZXY3dBydPW/Mia56eUHGaqXw2pPZ2b8jja3ta+JJRDH+YggNfPMLF4rPfEZStIIQ02owzI4KQuVT1tC6hIArV83JuBPgPZlpkOqJEYEVNjXpiG7ypn+wgOOnLWHOA8O7hvMTqOg= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1717768559280561.2661240076698; Fri, 7 Jun 2024 06:55:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFa3l-0006Kc-1Q; Fri, 07 Jun 2024 09:55:13 -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 1sFa3j-0006JD-2j for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:55:11 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFa3g-0008QT-UK for qemu-devel@nongnu.org; Fri, 07 Jun 2024 09:55:10 -0400 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VwjNK1FB7z6D8rX; Fri, 7 Jun 2024 21:53:53 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 26B0C140C98; Fri, 7 Jun 2024 21:55:07 +0800 (CST) Received: from A2303104131.china.huawei.com (10.202.227.28) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 14:54:58 +0100 To: , , CC: , , , , , , , , , , Subject: [PATCH v2 7/7] tests/migration-test: add uadk compression test Date: Fri, 7 Jun 2024 14:53:10 +0100 Message-ID: <20240607135310.46320-8-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> References: <20240607135310.46320-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500005.china.huawei.com (7.191.163.240) 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=185.176.79.56; envelope-from=shameerali.kolothum.thodi@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Reply-to: Shameer Kolothum From: Shameer Kolothum via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717768560589100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reviewed-by: Fabiano Rosas Signed-off-by: Shameer Kolothum --- tests/qtest/migration-test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index ef0c3f5e28..056d8790ec 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2669,6 +2669,14 @@ test_migrate_precopy_tcp_multifd_qpl_start(QTestStat= e *from, return test_migrate_precopy_tcp_multifd_start_common(from, to, "qpl"); } #endif /* CONFIG_QPL */ +#ifdef CONFIG_UADK +static void * +test_migrate_precopy_tcp_multifd_uadk_start(QTestState *from, + QTestState *to) +{ + return test_migrate_precopy_tcp_multifd_start_common(from, to, "uadk"); +} +#endif /* CONFIG_UADK */ =20 static void test_multifd_tcp_uri_none(void) { @@ -2761,6 +2769,17 @@ static void test_multifd_tcp_qpl(void) } #endif =20 +#ifdef CONFIG_UADK +static void test_multifd_tcp_uadk(void) +{ + MigrateCommon args =3D { + .listen_uri =3D "defer", + .start_hook =3D test_migrate_precopy_tcp_multifd_uadk_start, + }; + test_precopy_common(&args); +} +#endif + #ifdef CONFIG_GNUTLS static void * test_migrate_multifd_tcp_tls_psk_start_match(QTestState *from, @@ -3650,6 +3669,10 @@ int main(int argc, char **argv) migration_test_add("/migration/multifd/tcp/plain/qpl", test_multifd_tcp_qpl); #endif +#ifdef CONFIG_UADK + migration_test_add("/migration/multifd/tcp/plain/uadk", + test_multifd_tcp_uadk); +#endif #ifdef CONFIG_GNUTLS migration_test_add("/migration/multifd/tcp/tls/psk/match", test_multifd_tcp_tls_psk_match); --=20 2.34.1