elseif(FREEBSD)
set(HAVE_UDEV OFF)
set(HAVE_LIBAIO OFF)
+ set(HAVE_LIBDML OFF)
set(HAVE_BLKID OFF)
set(HAVE_KEYUTILS OFF)
else()
# POSIX AIO is integrated into FreeBSD kernel, and exposed by libc.
set(HAVE_POSIXAIO ON)
endif()
+
+ if(LINUX)
+ find_package(dml)
+ set(HAVE_LIBDML ${DML_FOUND})
+ endif()
endif()
# libcryptsetup is only available on linux
--- /dev/null
+# - Find libdml
+# Find the dml and dmlhl libraries and includes
+#
+# DML_INCLUDE_DIR - where to find dml.hpp etc.
+# DML_LIBRARIES - List of libraries when using dml.
+# DML_HL_LIBRARIES - List of libraries when using dmlhl.
+# DML_FOUND - True if DML found.
+
+
+find_path(DML_INCLUDE_DIR
+ dml/dml.hpp
+ PATHS
+ /usr/include
+ /usr/local/include)
+
+find_library(DML_LIBRARIES NAMES dml libdml PATHS
+ /usr/local/
+ /usr/local/lib64
+ /usr/lib64
+ /usr/lib)
+
+find_library(DML_HL_LIBRARIES NAMES dmlhl libdmlhl PATHS
+ /usr/local/
+ /usr/local/lib64
+ /usr/lib64
+ /usr/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(dml DEFAULT_MSG
+ DML_LIBRARIES
+ DML_INCLUDE_DIR
+ DML_HL_LIBRARIES)
+
+mark_as_advanced(
+ DML_LIBRARIES
+ DML_INCLUDE_DIR
+ DML_HL_LIBRARIES)
+
+if(DML_FOUND)
+ if(NOT (TARGET dml::dml))
+ add_library(dml::dml UNKNOWN IMPORTED)
+ set_target_properties(dml::dml PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${DML_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${DML_LIBRARIES}")
+ endif()
+
+ if(NOT (TARGET dml::dmlhl))
+ add_library(dml::dmlhl UNKNOWN IMPORTED)
+ set_target_properties(dml::dmlhl PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${DML_INCLUDE_DIR}"
+ INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}
+ INTERFACE_COMPILE_FEATURES cxx_std_17
+ INTERFACE_COMPILE_DEFINITIONS "DML_HW"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${DML_HL_LIBRARIES}")
+ endif()
+endif()
.. confval:: bluestore_min_alloc_size_ssd
.. confval:: bluestore_use_optimal_io_size_for_min_alloc_size
+DSA (Data Streaming Accelerator Usage)
+======================================
+
+If you want to use the DML library to drive DSA device for offloading
+read/write operations on Persist memory in Bluestore. You need to install
+`DML`_ and `idxd-config`_ library in your machine with SPR (Sapphire Rapids) CPU.
+
+.. _DML: https://github.com/intel/DML
+.. _idxd-config: https://github.com/intel/idxd-config
+
+After installing the DML software, you need to configure the shared
+work queues (WQs) with the following WQ configuration example via accel-config tool::
+
+$ accel-config config-wq --group-id=1 --mode=shared --wq-size=16 --threshold=15 --type=user --name="MyApp1" --priority=10 --block-on-fault=1 dsa0/wq0.1
+$ accel-config config-engine dsa0/engine0.1 --group-id=1
+$ accel-config enable-device dsa0
+$ accel-config enable-wq dsa0/wq0.1
endif()
if(WITH_BLUESTORE_PMEM)
+ if(HAVE_LIBDML)
+ target_link_libraries(blk PRIVATE dml::dml dml::dmlhl)
+ endif()
+
target_link_libraries(blk
PRIVATE pmem::pmem)
endif()
#include "common/debug.h"
#include "common/blkdev.h"
+#if defined(HAVE_LIBDML)
+#include <dml/dml.hpp>
+using execution_path = dml::automatic;
+#endif
+
#define dout_context cct
#define dout_subsys ceph_subsys_bdev
#undef dout_prefix
while (len) {
const char *data;
uint32_t l = p.get_ptr_and_advance(len, &data);
+
+#if defined(HAVE_LIBDML)
+ // Take care of the persistency issue
+ auto result = dml::execute<execution_path>(dml::mem_move, dml::make_view(data, l), dml::make_view(addr + off1, l));
+ ceph_assert(result.status == dml::status_code::ok);
+#else
pmem_memcpy_persist(addr + off1, data, l);
+#endif
len -= l;
off1 += l;
}
ceph_assert(is_valid_io(off, len));
bufferptr p = buffer::create_small_page_aligned(len);
+
+#if defined(HAVE_LIBDML)
+ auto result = dml::execute<execution_path>(dml::mem_move, dml::make_view(addr + off, len), dml::make_view(p.c_str(), len));
+ ceph_assert(result.status == dml::status_code::ok);
+#else
memcpy(p.c_str(), addr + off, len);
+#endif
pbl->clear();
pbl->push_back(std::move(p));
dout(5) << __func__ << " " << off << "~" << len << dendl;
ceph_assert(is_valid_io(off, len));
+
+#if defined(HAVE_LIBDML)
+ auto result = dml::execute<execution_path>(dml::mem_move, dml::make_view(addr + off, len), dml::make_view(buf, len));
+ ceph_assert(result.status == dml::status_code::ok);
+#else
memcpy(buf, addr + off, len);
+#endif
return 0;
}
/* Defined if you have libaio */
#cmakedefine HAVE_LIBAIO
+/* Defined if you have libdml */
+#cmakedefine HAVE_LIBDML
+
/* Defined if you have libzbd */
#cmakedefine HAVE_LIBZBD