Skip to content

Commit

Permalink
uadk: add uadk support
Browse files Browse the repository at this point in the history
This patch add UADK Acceleration for zlib compressor

[UADK: Userspace Acceleration Development Kit](https://github.com/Linaro/uadk)

1. Unity: one set of interfaces to support enc and comp acceleration
2. Efficiency: userspace zerocopy based on IOMMU & SVA(shared virtual address)
3. Security: the IOMMU limits the access rights and security boundaries of devices and processes
4. Compatibility: all acc devices can join this opensource project

Test on Kunpeng 920 platform, compression offload based on UadkAccel:

1. save almost 50% cpu usage compared with no-isal compression in RBD 4M workload
2. save almost 40% cpu usage compared with no-isal compression in RGW put op (4M) workload
3. lower cpu usage, better performance

Signed-off-by: Rongqi Sun <[email protected]>
  • Loading branch information
Svelar committed Aug 12, 2024
1 parent 3f3d249 commit 317465c
Show file tree
Hide file tree
Showing 10 changed files with 572 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,15 @@ if(WITH_QATZIP)
set(HAVE_QATZIP TRUE)
endif(WITH_QATZIP)

CMAKE_DEPENDENT_OPTION(WITH_UADK "Enable UADK" ON
"CMAKE_SYSTEM_PROCESSOR MATCHES aarch64" OFF)
if(WITH_UADK)
include(Builduadk)
build_uadk()
set(HAVE_UADK TRUE)
message("HAVE_UADK " ${HAVE_UADK})
endif(WITH_UADK)

# needs mds and? XXX
option(WITH_LIBCEPHFS "libcephfs client library" ON)

Expand Down
53 changes: 53 additions & 0 deletions cmake/modules/Builduadk.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
function(build_uadk)
set(UADK_INSTALL_DIR ${CMAKE_BINARY_DIR}/src/uadk/install)
set(UADK_INCLUDE_DIR ${UADK_INSTALL_DIR}/include)
set(UADK_LIBRARY_DIR ${UADK_INSTALL_DIR}/lib)
set(UADK_WD_LIBRARY ${UADK_LIBRARY_DIR}/libwd.a)
set(UADK_WD_COMP_LIBRARY ${UADK_LIBRARY_DIR}/libwd_comp.a)
set(UADK_WD_ZIP_LIBRARY ${UADK_LIBRARY_DIR}/uadk/libhisi_zip.a)
set(configure_cmd env ./configure --prefix=${UADK_INSTALL_DIR})
list(APPEND configure_cmd --with-pic --enable-static --disable-shared --with-static_drv)

include(ExternalProject)
ExternalProject_Add(uadk_ext
UPDATE_COMMAND "" # this disables rebuild on each run
GIT_REPOSITORY "https://github.com/Linaro/uadk.git"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW 1
GIT_TAG "master"
SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/uadk"
BUILD_IN_SOURCE 1
CMAKE_ARGS -DCMAKE_CXX_COMPILER=which g++
CONFIGURE_COMMAND ./autogen.sh COMMAND ${configure_cmd}
BUILD_COMMAND make
BUILD_BYPRODUCTS ${UADK_WD_LIBRARY} ${UADK_WD_COMP_LIBRARY} ${UADK_WD_ZIP_LIBRARY}
INSTALL_COMMAND make install
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON)

ExternalProject_Get_Property(uadk_ext source_dir)
set(UADK_INCLUDE_DIR ${UADK_INCLUDE_DIR} PARENT_SCOPE)

add_library(uadk::uadk UNKNOWN IMPORTED)
add_library(uadk::uadkwd UNKNOWN IMPORTED)
add_library(uadk::uadkzip UNKNOWN IMPORTED)
add_dependencies(uadk::uadk uadk_ext)
add_dependencies(uadk::uadkwd uadk_ext)
add_dependencies(uadk::uadkzip uadk_ext)
file(MAKE_DIRECTORY ${UADK_INCLUDE_DIR})
set_target_properties(uadk::uadk PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${UADK_INCLUDE_DIR}
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${UADK_WD_COMP_LIBRARY}")
set_target_properties(uadk::uadkwd PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${UADK_INCLUDE_DIR}
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${UADK_WD_LIBRARY}")
set_target_properties(uadk::uadkzip PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${UADK_INCLUDE_DIR}
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${UADK_WD_ZIP_LIBRARY}")
endfunction()
13 changes: 13 additions & 0 deletions src/common/options/global.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,19 @@ options:
level: advanced
desc: Set QAT busy bolling to reduce latency at the cost of potentially increasing CPU usage
default: false
- name: uadk_compressor_enabled
type: bool
level: advanced
desc: Enable UADK acceleration support for compression if available
default: false
with_legacy: true
- name: uadk_wd_sync_ctx_num
type: int
level: advanced
desc: Set the number of instances in the queue
default: 2
min: 2
max: 1024
- name: plugin_crypto_accelerator
type: str
level: advanced
Expand Down
9 changes: 9 additions & 0 deletions src/compressor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ if(HAVE_QATZIP AND HAVE_QAT)
)
endif()

if (HAVE_UADK)
add_library(uadk_compressor OBJECT UadkAccel.cc)
target_link_libraries(uadk_compressor PUBLIC
uadk::uadk
uadk::uadkwd
uadk::uadkzip
numa)
endif()

## compressor plugins

set(compressor_plugin_dir ${CEPH_INSTALL_PKGLIBDIR}/compressor)
Expand Down
Loading

0 comments on commit 317465c

Please sign in to comment.