From nobody Sun Nov 24 11:57:41 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=1724173797; cv=none; d=zohomail.com; s=zohoarc; b=nvOrNDJZxfaRVCKH58Mm/WKZFGEJEjV0YY9FNfMk5z7nF4nRNP0MUqy5wNX7lUE38n7tymLY+6fso7vvLN6AptkbTvoqLt1gRHcUOjwT+24Vxc+cXRYZ4iw5s8UBMskMdT7vQ74xDL9IXxZTZ6xNksIf5gvQeVYFCw6LEcYh5kk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724173797; 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=neQQWEIsPFABUcyeRkFJVB5t97KxMXB5egl1r8Ec8hk=; b=mBySkyu3RJoWw+qVb5c9txnWQ/dIy4Bcyp7KPzsDiOXkJ8zTdix7ZW3Er5zuDfUCrVjEKb6ukgfIcpJ4+653B8ZQoQld6893kCiZt+pvXLJxFpsixgSFMZPdibjSmZ4jDuPq1llupYa4OU6NoikE7453wuwc4nkrvvQyaRK6Hss= 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 1724173797480517.665648299849; Tue, 20 Aug 2024 10:09:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgSMJ-0006Hc-BN; Tue, 20 Aug 2024 13:09:27 -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 1sgSMF-000602-Ez for qemu-devel@nongnu.org; Tue, 20 Aug 2024 13:09:23 -0400 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgSMA-0007gk-I7 for qemu-devel@nongnu.org; Tue, 20 Aug 2024 13:09:23 -0400 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-44ff7bdb5a6so33967771cf.3 for ; Tue, 20 Aug 2024 10:09:16 -0700 (PDT) Received: from DY4X0N7X05.bytedance.net (ec2-52-8-182-0.us-west-1.compute.amazonaws.com. [52.8.182.0]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bf6fef2372sm53599576d6.114.2024.08.20.10.09.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 20 Aug 2024 10:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1724173755; x=1724778555; 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=neQQWEIsPFABUcyeRkFJVB5t97KxMXB5egl1r8Ec8hk=; b=RUGA0laOaiWXIKA1cv/i1OhYhr9Vpo4V/n0PidHuDxqL5Tg9mKlrC0U9lLn5hsiFja TF2acq9rYMQnchi/+AlAL/S2NMUSwdZbJVWf4w22v9/4PME+Emdp3feUOZXiSbMqBMId M1v43UcDOFIuasGUbVJWEJP1/KD45XvPmHKhGK9ofA4ub3f2l73zu7qb6u21pxJI2PMC n36zunu6tdM0vVR/wwB17Xdar06FeJGu37acHhnCfHleFMbUcBKsFrYHmoFR+ca6o/+L m15oKQZlSOpbceKZ77zEq1XLs1SZ+R2du8FTGutP15PigjTKIQpO0IXz9p+9dDGJcQ+d nVPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724173755; x=1724778555; 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=neQQWEIsPFABUcyeRkFJVB5t97KxMXB5egl1r8Ec8hk=; b=QrKlqJndDkdmuDs0k68jEDveT3XlSSsm2UHN+viXokE/r13bydnbaA3Fk+X6hIctsN paT189vtpiGZuOztvmQsgSrXhHBYhQjmGPR77I/mmt9NHqmdpq+kLoILx1FuAa1lUHa1 Q5bLQigtBbpkn2jVdZDqCh0yLFRUg2YPWnC8WpPuyK4inevcfH/AVXbzqGtQ9YoXGYr6 EJ50bnM8hMjI/v48appCk7DZCOr+OK9vXxbjad3y19W7mtLE7WoLQhz6RU/AMMyFl5YE +kAn9Lc7ZkBNhpEcDCBkhQ4Yhza9KOoyvEYD8qpma7S9eSQwUh4TcrLzmzAvfWd84C1J Sb1g== X-Forwarded-Encrypted: i=1; AJvYcCWq/Hnmf4W5cw1scvqdyDpMC8Gqpv16zHmNJOsXn4PZ1iJ3sYVQG+S0/wMxAkQTy7httVNvfC8SBaWq@nongnu.org X-Gm-Message-State: AOJu0YwT0qanj51s7FE2BY7eOyEikaS+ldqJ89CLJMNAD+jiI2hDAxxM oOevKaeVAvzLkwpX5865CXmjb34m4+iKO9HIRnxN4dUqM8k3o31r162N1vS01vQ= X-Google-Smtp-Source: AGHT+IHuLLwZlh5nYuCf6hK1kuG6uVxTnkexmI2Q6gksCyVYidgZcP89wbGkCq/lbXP0xTECQ7n6MA== X-Received: by 2002:a05:6214:419d:b0:6b7:8be3:3da0 with SMTP id 6a1803df08f44-6bf7cda7f30mr158376866d6.19.1724173755269; Tue, 20 Aug 2024 10:09:15 -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 , qemu-devel@nongnu.org Cc: "Hao Xiang" , "Liu, Yuan1" , "Zou, Nanhai" , "Ho-Ren (Jack) Chuang" , "Yichen Wang" , "Xiaoning Ding" Subject: [PATCH v8 1/5] docs/migration: add qatzip compression feature Date: Tue, 20 Aug 2024 10:09:03 -0700 Message-Id: <20240820170907.6788-2-yichen.wang@bytedance.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240820170907.6788-1-yichen.wang@bytedance.com> References: <20240820170907.6788-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::82e; envelope-from=yichen.wang@bytedance.com; helo=mail-qt1-x82e.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: 1724173798888116600 Content-Type: text/plain; charset="utf-8" From: Yuan Liu add Intel QATzip compression method introduction Reviewed-by: Nanhai Zou Reviewed-by: Peter Xu Signed-off-by: Yuan Liu Signed-off-by: Yichen Wang Reviewed-by: Fabiano Rosas --- docs/devel/migration/features.rst | 1 + docs/devel/migration/qatzip-compression.rst | 165 ++++++++++++++++++++ 2 files changed, 166 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..862b383164 --- /dev/null +++ b/docs/devel/migration/qatzip-compression.rst @@ -0,0 +1,165 @@ +=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. + + +The following test was conducted using 8 multifd channels and 10Gbps netwo= rk +bandwidth. The results show that, compared to zstd, ``QATzip`` significant= ly +saves CPU resources on the sender and reduces migration time. Compared to = the +uncompressed solution, ``QATzip`` greatly improves the dirty page processi= ng +capability, indicated by the Pages per Second metric, and also reduces the +total migration time. + +:: + + VM Configuration: 16 vCPU and 64G memory + VM Workload: all vCPUs are idle and 54G memory is filled with Silesia d= ata. + QAT Devices: 4 + |-----------|--------|---------|----------|----------|------|------| + |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| + |-----------|--------|---------|----------|----------|------|------| + + +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 + +``QATzip`` is a user space library which builds on top of the Intel QuickA= ssist +Technology to provide extended accelerated compression and decompression +services. + +For more ``QATzip`` introduction, please refer to `QATzip Introduction +`_ + +:: + + +----------------+ + | 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 + +QAT Memory Requirements +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The user needs to reserve system memory for the QAT memory management to +allocate DMA memory. The size of the reserved system memory depends on the +number of devices used for migration and the number of multifd channels. + +Because memory usage depends on QAT configuration, please refer to `QAT Me= mory +Driver Queries +`_ +for memory usage calculation. + +.. list-table:: An example of a PF used for migration + :header-rows: 1 + + * - Number of channels + - Sender memory usage + - Receiver memory usage + * - 2 + - 10M + - 10M + * - 4 + - 12M + - 14M + * - 8 + - 16M + - 20M + +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 4th Gen Intel Xeon Scalable processors, codenamed Sapphire R= apids +processor(``SPR``), multiple built-in accelerators are supported including +``QAT`` and ``IAA``. The former can accelerate ``QATzip`` and the latter = is +used to accelerate ``QPL``. + +Here are some suggestions: + +1 - If the live migration scenario is limited by network bandwidth and ``Q= AT`` +hardware resources exceed ``IAA``, use the ``QATzip`` method, which can sa= ve a +lot of host CPU resources for compression. + +2 - If the system cannot support shared virtual memory (SVM) technology, u= se +the ``QATzip`` method because ``QPL`` performance is not good without SVM +support. + +3 - For other scenarios, use the ``QPL`` method first. --=20 Yichen Wang