From nobody Sun Nov 24 19:23:50 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=1720666409; cv=none; d=zohomail.com; s=zohoarc; b=j4JlHbx9E/E5p8bOI/2pxVxGuR96gSWE+DJqPe3wPNC/l1yasdK9ty/7ptpL34tTpIIptz+bBjkkKWbMs1ELyDEl1ruHCNDi7eO5kNhsSdFTaEnCwHENHI0uCzQcPswol/zfYRxs9c2EHuegevxTze5tvg//8lvHFQIOXrdUv0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720666409; 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=+MGC2Kn8K5/OSwfmUdmDEoAYSPqg+YzbcoDs108eAWs=; b=FOzqDDXfaOfQKm6mENF5FFT2z668wVDyBWt/xS91xDrISmWPIv0fMf79Tm0Y7rH27oQdLQsjH6zh2+PzRLlMuOBDKYAs3rJ1XdXLS94ongskKDtL89CCzLgDGVeVWvjt+pUK5FoeBOiUwTlfmV08057vwXTRzDGjJhTHdsRBCLI= 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 1720666409751913.7430677302369; Wed, 10 Jul 2024 19:53:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRjvM-0003oN-K8; Wed, 10 Jul 2024 22:52:48 -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 1sRjvK-0003nG-M9 for qemu-devel@nongnu.org; Wed, 10 Jul 2024 22:52:46 -0400 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRjvG-0007rb-1t for qemu-devel@nongnu.org; Wed, 10 Jul 2024 22:52:46 -0400 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3d92df7e83cso654396b6e.0 for ; Wed, 10 Jul 2024 19:52:38 -0700 (PDT) Received: from DY4X0N7X05.bytedance.net ([208.184.112.130]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3daa12f4f7csm117827b6e.41.2024.07.10.19.52.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 10 Jul 2024 19:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1720666357; x=1721271157; 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=+MGC2Kn8K5/OSwfmUdmDEoAYSPqg+YzbcoDs108eAWs=; b=ExNa3LvoXrRwkFf1i9ZhIjwqfJVAwuewo7Cxh5lExirmog5OrJZYDOaOyyZBJjrySN NavgsLyZaj9v22ldIPd+mwgJ7zkzf//fsTiRj5PNXyFS44hxIihPPoQkmf14TG47hoj1 NQGY0FGlP5591Ye99r2A9p/C4H1mhUjOefBHeByttVf5ZfQ6wdGCNxcqajK6L2HkXCxS GuATY/FWOWOO5DbwPesYCl4qYg7MJoHR68pwBGM26omsVMx6TbKLLbRAOpEsiSHO9JjW MiZuBDihkALYGF6sCjvz2J37DkD9a35dsPdzC/uLa0O+fE+24Bjj4F11kn5xPFNmX/4F Nlqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720666357; x=1721271157; 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=+MGC2Kn8K5/OSwfmUdmDEoAYSPqg+YzbcoDs108eAWs=; b=MG73gam18hmEAmi3yFv8UlkOMh6gqAeooaHiAm2QiogRooAwA4EkfjGa+hI5I2MUpY 26rUxl3z3Opr303bYvl+KX0mba+2J4rUUTE7pPh9c7N6Ac2Qoal5lE2AMuyeCZ2POz+4 M//ewoQ35LfKua5qdCjKkRnMHGNm/GptZOzfs9s2Q5+I3lhjK49BxObpyp3DDIciXFLS np3ZFsXJJM44PoI3UyREGJMQzapzoj7I+3vfkaO7iyOdnrOFmFSbcNHc6NK5uVL0o7Q3 R0j3eUAfCaZGqL3mU3Yt6P90kY0aUQr5FCTG0B/fC7NITCUIhnDFHHEB48oI2qwmlT7y De6w== X-Forwarded-Encrypted: i=1; AJvYcCUgHwFTCInOvSomfLF0657TJR1+eEXNFhrzNECN3CUj/LswbaO25SrgFnbjuR6I0UzDo0Gy95Y0b2lTMnKuh9qJlmoJAfM= X-Gm-Message-State: AOJu0Yy6Z2QsMGlvHXQvTsTm4m9d9+3bvyRmnhDGKri5cRetFr0IHFxl 0+MqoPz2yxQ3T+qbGiE5ZlJ2esLo0MPGGEhp58Ng5DefGFy2+FwrQ55jFRpysyU= X-Google-Smtp-Source: AGHT+IF9q22DwXwIFfWUbgTPTCF6f2lNNsdBLCMDlh1lySiidxT1nNHUoL+C70/oStzmTmnnl9azRw== X-Received: by 2002:a05:6808:180c:b0:3d9:25ec:d9ff with SMTP id 5614622812f47-3da9feef910mr544537b6e.20.1720666357231; Wed, 10 Jul 2024 19:52:37 -0700 (PDT) From: Yichen Wang To: Peter Xu , Fabiano Rosas , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Markus Armbruster , Laurent Vivier , qemu-devel@nongnu.org Cc: "Hao Xiang" , "Liu, Yuan1" , "Zou, Nanhai" , "Ho-Ren (Jack) Chuang" , "Yichen Wang" Subject: [PATCH v5 1/5] docs/migration: add qatzip compression feature Date: Wed, 10 Jul 2024 19:52:25 -0700 Message-Id: <20240711025229.66260-2-yichen.wang@bytedance.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240711025229.66260-1-yichen.wang@bytedance.com> References: <20240711025229.66260-1-yichen.wang@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::22f; envelope-from=yichen.wang@bytedance.com; helo=mail-oi1-x22f.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 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: 1720666411672116600 Content-Type: text/plain; charset="utf-8" From: Yuan Liu add Intel QATzip compression method introduction Signed-off-by: Yuan Liu Reviewed-by: Nanhai Zou Reviewed-by: Peter Xu Reviewed-by: Yichen Wang --- docs/devel/migration/features.rst | 1 + docs/devel/migration/qatzip-compression.rst | 251 ++++++++++++++++++++ 2 files changed, 252 insertions(+) create mode 100644 docs/devel/migration/qatzip-compression.rst diff --git a/docs/devel/migration/features.rst b/docs/devel/migration/featu= res.rst index 58f8fd9e16..8f431d52f9 100644 --- a/docs/devel/migration/features.rst +++ b/docs/devel/migration/features.rst @@ -14,3 +14,4 @@ Migration has plenty of features to support different use= cases. CPR qpl-compression uadk-compression + qatzip-compression diff --git a/docs/devel/migration/qatzip-compression.rst b/docs/devel/migra= tion/qatzip-compression.rst new file mode 100644 index 0000000000..72fa3e2826 --- /dev/null +++ b/docs/devel/migration/qatzip-compression.rst @@ -0,0 +1,251 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +QATzip Compression +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +In scenarios with limited network bandwidth, the ``QATzip`` solution can h= elp +users save a lot of host CPU resources by accelerating compression and +decompression through the Intel QuickAssist Technology(``QAT``) hardware. + +``QATzip`` is a user space library which builds on top of the Intel QuickA= ssist +Technology user space library, to provide extended accelerated compression= and +decompression services. + +For more ``QATzip`` introduction, please refer to `QATzip Introduction +`_ + +QATzip Compression Framework +=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 + +:: + + +----------------+ + | MultiFd Thread | + +-------+--------+ + | + | compress/decompress + +-------+--------+ + | QATzip library | + +-------+--------+ + | + +-------+--------+ + | QAT library | + +-------+--------+ + | user space + --------+--------------------- + | kernel space + +------+-------+ + | QAT Driver | + +------+-------+ + | + +------+-------+ + | QAT Devices | + +--------------+ + + +QATzip Installation +------------------- + +The ``QATzip`` installation package has been integrated into some Linux +distributions and can be installed directly. For example, the Ubuntu Server +24.04 LTS system can be installed using below command + +.. code-block:: shell + + #apt search qatzip + libqatzip-dev/noble 1.2.0-0ubuntu3 amd64 + Intel QuickAssist user space library development files + + libqatzip3/noble 1.2.0-0ubuntu3 amd64 + Intel QuickAssist user space library + + qatzip/noble,now 1.2.0-0ubuntu3 amd64 [installed] + Compression user-space tool for Intel QuickAssist Technology + + #sudo apt install libqatzip-dev libqatzip3 qatzip + +If your system does not support the ``QATzip`` installation package, you c= an +use the source code to build and install, please refer to `QATzip source c= ode installation +`_ + +QAT Hardware Deployment +----------------------- + +``QAT`` supports physical functions(PFs) and virtual functions(VFs) for +deployment, and users can configure ``QAT`` resources for migration accord= ing +to actual needs. For more details about ``QAT`` deployment, please refer to +`Intel QuickAssist Technology Documentation +`_ + +For more ``QAT`` hardware introduction, please refer to `intel-quick-assis= t-technology-overview +`_ + +How To Use QATzip 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 + +1 - Install ``QATzip`` library + +2 - Build ``QEMU`` with ``--enable-qatzip`` parameter + + E.g. configure --target-list=3Dx86_64-softmmu --enable-kvm ``--enable-qa= tzip`` + +3 - Set ``migrate_set_parameter multifd-compression qatzip`` + +4 - Set ``migrate_set_parameter multifd-qatzip-level comp_level``, the def= ault +comp_level value is 1, and it supports levels from 1 to 9 + + +Performance Testing with QATzip +=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 + +Testing environment is being set as below: + +VM configuration:16 vCPU, 64G memory; + +VM Workload: all vCPUs are idle and 54G memory is filled with Silesia data; + +QAT Devices: 4; + +Sender migration parameters: + +.. code-block:: shell + + migrate_set_capability multifd on + migrate_set_parameter multifd-channels 2/4/8 + migrate_set_parameter max-bandwidth 1G/10G + migrate_set_parameter multifd-compression qatzip/zstd + +Receiver migration parameters: + +.. code-block:: shell + + migrate_set_capability multifd on + migrate_set_parameter multifd-channels 2 + migrate_set_parameter multifd-compression qatzip/zstd + +max-bandwidth: 1 GBps (Gbytes/sec) + +.. code-block:: text + + |-----------|--------|---------|----------|------|------| + |2 Channels |Total |down |throughput| send | recv | + | |time(ms)|time(ms) |(mbps) | cpu %| cpu% | + |-----------|--------|---------|----------|------|------| + |qatzip | 21607| 77| 8051| 88| 125| + |-----------|--------|---------|----------|------|------| + |zstd | 78351| 96| 2199| 204| 80| + |-----------|--------|---------|----------|------|------| + + |-----------|--------|---------|----------|------|------| + |4 Channels |Total |down |throughput| send | recv | + | |time(ms)|time(ms) |(mbps) | cpu %| cpu% | + |-----------|--------|---------|----------|------|------| + |qatzip | 20336| 25| 8557| 110| 190| + |-----------|--------|---------|----------|------|------| + |zstd | 39324| 31| 4389| 406| 160| + |-----------|--------|---------|----------|------|------| + + |-----------|--------|---------|----------|------|------| + |8 Channels |Total |down |throughput| send | recv | + | |time(ms)|time(ms) |(mbps) | cpu %| cpu% | + |-----------|--------|---------|----------|------|------| + |qatzip | 20208| 22| 8613| 125| 300| + |-----------|--------|---------|----------|------|------| + |zstd | 20515| 22| 8438| 800| 340| + |-----------|--------|---------|----------|------|------| + +max-bandwidth: 10 GBps (Gbytes/sec) + +.. code-block:: text + + |-----------|--------|---------|----------|------|------| + |2 Channels |Total |down |throughput| send | recv | + | |time(ms)|time(ms) |(mbps) | cpu %| cpu% | + |-----------|--------|---------|----------|------|------| + |qatzip | 22450| 77| 7748| 80| 125| + |-----------|--------|---------|----------|------|------| + |zstd | 78339| 76| 2199| 204| 80| + |-----------|--------|---------|----------|------|------| + + |-----------|--------|---------|----------|------|------| + |4 Channels |Total |down |throughput| send | recv | + | |time(ms)|time(ms) |(mbps) | cpu %| cpu% | + |-----------|--------|---------|----------|------|------| + |qatzip | 13017| 24| 13401| 180| 285| + |-----------|--------|---------|----------|------|------| + |zstd | 39466| 21| 4373| 406| 160| + |-----------|--------|---------|----------|------|------| + + |-----------|--------|---------|----------|------|------| + |8 Channels |Total |down |throughput| send | recv | + | |time(ms)|time(ms) |(mbps) | cpu %| cpu% | + |-----------|--------|---------|----------|------|------| + |qatzip | 10255| 22| 17037| 280| 590| + |-----------|--------|---------|----------|------|------| + |zstd | 20126| 77| 8595| 810| 340| + |-----------|--------|---------|----------|------|------| + +max-bandwidth: 1.25 GBps (Gbytes/sec) + +.. code-block:: text + + |-----------|--------|---------|----------|----------|------|------| + |8 Channels |Total |down |throughput|pages per | send | recv | + | |time(ms)|time(ms) |(mbps) |second | cpu %| cpu% | + |-----------|--------|---------|----------|----------|------|------| + |qatzip | 16630| 28| 10467| 2940235| 160| 360| + |-----------|--------|---------|----------|----------|------|------| + |zstd | 20165| 24| 8579| 2391465| 810| 340| + |-----------|--------|---------|----------|----------|------|------| + |none | 46063| 40| 10848| 330240| 45| 85| + |-----------|--------|---------|----------|----------|------|------| + +If the user has enabled compression in live migration, using QAT can save = the +host CPU resources. + +When compression is enabled, the bottleneck of migration is usually the +compression throughput on the sender side, since CPU decompression through= put +is higher than compression, some reference data +https://github.com/inikep/lzbench, so more CPU resources need to be alloca= ted +to the sender side. + +Summary: + +1. In the 1GBps case, QAT only uses 88% CPU utilization to reach 1GBps, but + ZSTD needs 800%. + +2. In the 10Gbps case, QAT uses 180% CPU utilization to reach 10GBps. but = ZSTD + still cannot reach 10Gbps even if it uses 810%. + +3. The QAT decompression CPU utilization is higher than compression and ZS= TD, + because: + + a. When using QAT compression, the data needs to be copied to the QAT m= emory + (for DMA operations), and the same for decompression. However, + do_user_addr_fault will be triggered during decompression because the Q= AT + decompressed data is copied to the VM address space for the first time,= in + addition, both compression and decompression are processed by QAT and d= o not + consume CPU resources, so the CPU utilization of the receiver is slight= ly + higher than the sender. + + b. Since zstd decompression decompresses data directly into the VM addr= ess + space, there is one less memory copy than QAT, so the CPU utilization o= n the + receiver is better than QAT. For the 1GBps case, the receiver CPU + utilization is 125%, and the memory copy occupies ~80% of CPU utilizati= on. + +How To Choose Between QATzip and QPL +=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 +Starting from Intel 4th Gen Intel Xeon Scalable processors, codenamed Sapp= hire +Rapids processor(``SPR``), it supports multiple build-in accelerators incl= uding +``QAT`` and ``IAA``, the former can accelerate ``QATzip``, and the latter = is +used to accelerate ``QPL``. + +Here are some suggestions: + +1 - If your live migration scenario is limited network bandwidth and ``QAT= `` +hardware resources exceed ``IAA``, then use the ``QATzip`` method, which +can save a lot of host CPU resources for compression. + +2 - If your system cannot support shared virtual memory(SVM) technology, p= lease +use ``QATzip`` method because ``QPL`` performance is not good without SVM +support. + +3 - For other scenarios, please use the ``QPL`` method first. --=20 Yichen Wang