Skip to content

Commit 7297f34

Browse files
authored
Merge pull request ceph#58641 from hualongfeng/qat_doc
doc/radosgw/qat-accel: Update and Add QATlib information Reviewed-by: Zac Dover <[email protected]>
2 parents e20e5b7 + 98723d5 commit 7297f34

File tree

1 file changed

+129
-42
lines changed

1 file changed

+129
-42
lines changed

doc/radosgw/qat-accel.rst

Lines changed: 129 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,20 @@ QAT Environment Setup
3333
encryption and compression services. And QAT driver in kernel space have to
3434
be loaded to drive the hardware.
3535

36-
The driver package can be downloaded from `Intel Quickassist Technology`_.
36+
The out-of-tree QAT driver package can be downloaded from `Intel Quickassist
37+
Technology`_.
3738

38-
2. The implementation for QAT based encryption is directly base on QAT API which
39-
is included the driver package. But QAT support for compression depends on
40-
QATzip project, which is a user space library which builds on top of the QAT
41-
API. Currently, QATzip speeds up gzip compression and decompression at the
42-
time of writing.
39+
The QATlib can be downloaded from `qatlib`_, which is used for the in-tree QAT
40+
driver.
41+
42+
.. note::
43+
The out-of-tree QAT driver is gradually turning to intree driver+QATlib.
44+
45+
2. The implementation of QAT-based encryption is directly based on the QAT API,
46+
which is included the driver package. However, QAT support for compression
47+
depends on the QATzip project, which is a userspace library that builds on
48+
top of the QAT API. At the time of writing (July 2024), QATzip speeds up
49+
gzip compression and decompression.
4350

4451
See `QATzip`_.
4552

@@ -48,36 +55,40 @@ Implementation
4855
1. QAT based Encryption for RGW
4956

5057
`OpenSSL support for RGW encryption`_ has been merged into Ceph, and Intel also
51-
provides one `QAT Engine`_ for OpenSSL. So, theoretically speaking, QAT based
52-
encryption in Ceph can be directly supported through OpenSSl+QAT Engine.
58+
provides one `QAT Engine`_ for OpenSSL. Theoretically, QAT-based encryption in
59+
Ceph can be directly supported through OpenSSl+QAT Engine.
5360

54-
But the QAT Engine for OpenSSL currently supports chained operations only, and
55-
so Ceph will not be able to utilize QAT hardware feature for crypto operations
56-
based on OpenSSL crypto plugin. As a result, one QAT plugin based on native
57-
QAT API is added into crypto framework.
61+
However, the QAT Engine for OpenSSL currently supports only chained operations,
62+
which means that Ceph will not be able to utilize QAT hardware features for
63+
crypto operations based on the OpenSSL crypto plugin. As a result, one QAT plugin
64+
based on native QAT API is added into the crypto framework.
5865

5966
2. QAT Support for Compression
6067

61-
As mentioned above, QAT support for compression is based on QATzip library in
62-
user space, which is designed to take full advantage of the performance provided
63-
by QuickAssist Technology. Unlike QAT based encryption, QAT based compression
64-
is supported through a tool class for QAT acceleration rather than a compressor
65-
plugin. The common tool class can transparently accelerate the existing compression
66-
types, but only zlib compressor can be supported at the time of writing. So
67-
user is allowed to use it to speed up zlib compressor as long as the QAT
68-
hardware is available and QAT is capable to handle it.
68+
As mentioned above, QAT support for compression is based on the QATzip library
69+
in user space, which is designed to take full advantage of the performance that
70+
QuickAssist Technology provides. Unlike QAT-based encryption, QAT-based
71+
compression is supported through a tool class for QAT acceleration rather than
72+
a compressor plugin. This common tool class can transparently accelerate the
73+
existing compression types, but only zlib compressor is supported at the
74+
time of writing. This means that the user can use this tool class to speed up
75+
zlib compressor if the QAT hardware is available and if QAT is capable of
76+
handling it.
6977

7078
Configuration
7179
=============
7280
#. Prerequisites
7381

74-
Make sure the QAT driver with version v1.7.L.4.14.0 or higher has been installed.
75-
Remember to set an environment variable "ICP_ROOT" for your QAT driver package
76-
root directory.
82+
**For out-of-tree QAT**
7783

78-
To enable the QAT based encryption and compression, user needs to modify the QAT
79-
configuration files. For example, for Intel QuickAssist Adapter 8970 product, revise
80-
c6xx_dev0/1/2.conf in the directory ``/etc/`` and keep them the same, e.g.:
84+
Make sure the out-of-tree QAT driver with version v1.7.L.4.14.0 or higher
85+
has been installed. Remember to set an environment variable ``ICP_ROOT``
86+
for your QAT driver package root directory.
87+
88+
To enable the QAT based encryption and compression, the user must modify the
89+
QAT configuration files. For example, for the Intel QuickAssist Adapter 8970
90+
product, revise ``c6xx_dev0/1/2.conf`` in the directory ``/etc/`` and keep them
91+
the same. For example:
8192

8293
.. code-block:: ini
8394
@@ -101,55 +112,131 @@ Configuration
101112
# List of core affinities
102113
Dc0CoreAffinity = 0
103114
104-
#. QAT based Encryption for RGW
115+
**For in-tree QAT**
116+
117+
There are some prerequisites for using QATlib. Make sure that your system
118+
meets the `QATlib System Requirements`_ .
119+
120+
* To properly use the QATlib library, the Intel VT-d and SR-IOV parameters
121+
must be enabled in the platform BIOS.
122+
* Some qatlib features require a recent kernel driver or firmware version.
123+
See `QATlib Kernel Driver Releases`_.
124+
* The supported platform contains a 4xxx Intel Communications device or
125+
newer.
126+
* The ``intel_iommu`` parameter must be enabled. Verify that this setting is
127+
enabled by running the following commands:
128+
129+
.. prompt:: bash $
105130

106-
The CMake option ``WITH_QAT=ON`` must be configured. If you build Ceph from
131+
cat /proc/cmdline | grep intel_iommu=on
132+
sudo sh -c 'echo "@qat - memlock 204800" >> /etc/security/limits.conf'
133+
sudo su -l $USER
134+
135+
For configuration and Tuning see `QATlib Configuration and Tuning`_.
136+
137+
#. QAT-based Encryption for RGW
138+
139+
The CMake option ``WITH_QATDRV=ON`` must be set. If you build Ceph from
107140
source code (see: :ref:`build-ceph`), navigate to your cloned Ceph repository
108141
and execute the following:
109142

110143
.. prompt:: bash $
111144

112145
cd ceph
113-
./do_cmake.sh -DWITH_QAT=ON
146+
./do_cmake.sh -DWITH_QATDRV=ON
114147
cd build
115148
ininja
116149

117-
.. note::
118-
The section name of the QAT configuration files must be ``CEPH`` since
119-
the section name is set as "CEPH" in Ceph crypto source code.
150+
.. note:: The section name of the QAT configuration files must be ``CEPH``,
151+
because the section name is set as ``CEPH`` in the Ceph crypto source code.
120152

121-
Then, edit the Ceph configuration file to make use of QAT based crypto plugin::
153+
Edit the Ceph configuration file (usually ``ceph.conf``) to make use of the
154+
QAT-based crypto plugin::
122155

123156
plugin crypto accelerator = crypto_qat
124157

125158
#. QAT Support for Compression
126159

127-
Before starting, make sure both QAT driver and `QATzip`_ have been installed. Besides
128-
"ICP_ROOT", remember to set the environment variable "QZ_ROOT" for the root directory
129-
of your QATzip source tree.
160+
**For out-of-tree QAT**
130161

131-
The following CMake options have to be configured to trigger QAT based compression
132-
when building Ceph:
162+
For the out-of-tree QAT driver package, before starting ensure that both QAT
163+
driver and `QATzip`_ have been installed. Besides ``ICP_ROOT``, remember to
164+
set the environment variable ``QZ_ROOT`` to the root directory of your QATzip
165+
source tree.
166+
167+
The following CMake options have to be configured to trigger QAT-based
168+
compression when building Ceph:
133169

134170
.. prompt:: bash $
135171

136-
./do_cmake.sh -DWITH_QAT=ON -DWITH_QATZIP=ON
172+
./do_cmake.sh -DWITH_QATDRV=ON -DWITH_QATZIP=ON -DWITH_SYSTEM_QATZIP=ON -DWITH_QATLIB=OFF
137173

138-
Then, set an environment variable to clarify the section name of User Process Instance
139-
Section in QAT configuration files, e.g.:
174+
Set an environment variable to clarify the section name of User Process
175+
Instance Section in the QAT configuration files. For example:
140176

141177
.. prompt:: bash $
142178

143179
export QAT_SECTION_NAME=CEPH
144180

145-
Next, edit the Ceph configuration file to enable QAT support for compression::
181+
**For in-tree QAT**
182+
183+
For in-tree QAT, make sure that your system meets the `QATlib System
184+
Requirements`_. QATlib can be installed from pre-built packages or from
185+
source code. See `QATlib Installation`_ . After QATlib is installed, you
186+
can run ``cpa_sample_code`` to check if the QAT environment is OK.
187+
188+
If you are using QATlib source code, Ceph cmake build has the compilation
189+
options of qatlib and qatzip enabled by default. Our normal compilation
190+
already includes QAT-compressor-related code.
191+
192+
.. prompt:: bash $
193+
194+
./do_cmake.sh
195+
196+
If you are using pre-built packages installed on the system, the following
197+
CMake options have to be configured when building Ceph:
198+
199+
.. prompt:: bash $
200+
201+
./do_cmake.sh -DWITH_SYSTEM_QATLIB=ON -DWITH_SYSTEM_QATZIP=ON
202+
203+
204+
**For both out-of-tree QAT and in-tree QAT**
205+
206+
Edit the Ceph configuration file (usually ``ceph.conf``) to enable QAT
207+
support for *zlib* compression::
146208

147209
qat compressor enabled=true
148210

211+
Set the RGW compression method:
212+
213+
.. prompt:: bash $
214+
215+
# for storage class(STANDARD)
216+
radosgw-admin zone placement modify --rgw-zone=default --placement-id=default-placement --compression=zlib
217+
# or create a new storage class(COLD) and define data pool(default.rgw.cold.data)
218+
radosgw-admin zonegroup placement add --rgw-zonegroup default --placement-id default-placement --storage-class COLD
219+
radosgw-admin zone placement add --rgw-zone default --placement-id default-placement --storage-class COLD --compression zlib --data-pool default.rgw.cold.data
220+
221+
CONFIG REFERENCE
222+
================
223+
The following QAT-related settings can be added to the Ceph configuration file
224+
(usually `ceph.conf`) under the ``[client.rgw.{instance-name}]`` section.
225+
226+
.. confval:: qat_compressor_session_max_number
227+
.. confval:: qat_compressor_busy_polling
228+
229+
149230

150231
.. _QAT Support for Compression: https://github.com/ceph/ceph/pull/19714
151232
.. _QAT based Encryption for RGW: https://github.com/ceph/ceph/pull/19386
152233
.. _Intel Quickassist Technology: https://01.org/intel-quickassist-technology
153234
.. _QATzip: https://github.com/intel/QATzip
154235
.. _OpenSSL support for RGW encryption: https://github.com/ceph/ceph/pull/15168
155236
.. _QAT Engine: https://github.com/intel/QAT_Engine
237+
.. _qatlib: https://github.com/intel/qatlib
238+
.. _QATlib User's Guide: https://intel.github.io/quickassist/qatlib/index.html
239+
.. _QATlib System Requirements: https://intel.github.io/quickassist/qatlib/requirements.html
240+
.. _QATlib Installation: https://intel.github.io/quickassist/qatlib/install.html
241+
.. _QATlib Configuration and Tuning: https://intel.github.io/quickassist/qatlib/configuration.html
242+
.. _QATlib Kernel Driver Releases: https://intel.github.io/quickassist/RN/In-Tree/in_tree_firmware_RN.html#qat-kernel-driver-releases-features

0 commit comments

Comments
 (0)