Просмотр исходного кода

Update contrib/libs/liburing to 2.4

thegeorg 1 год назад
Родитель
Сommit
3785d5f979

+ 18 - 0
contrib/libs/liburing/CHANGELOG

@@ -1,3 +1,21 @@
+liburing-2.4 release
+
+- Add io_uring_{major,minor,check}_version() functions.
+- Add IO_URING_{MAJOR,MINOR,CHECK}_VERSION() macros.
+- FFI support (for non-C/C++ languages integration).
+- Add io_uring_prep_msg_ring_cqe_flags() function.
+- Deprecate --nolibc configure option.
+- CONFIG_NOLIBC is always enabled on x86-64, x86, and aarch64.
+- Add support for IORING_REGISTER_USE_REGISTERED_RING and use if available.
+- Add io_uring_close_ring_fd() function.
+- Add io_uring_prep_msg_ring_fd_alloc function.
+- Add io_uring_free_buf_ring() and io_uring_setup_buf_ring() functions.
+- Ensure that io_uring_prep_accept_direct(), io_uring_prep_openat_direct(),
+  io_uring_prep_openat2_direct(), io_uring_prep_msg_ring_fd(), and
+  io_uring_prep_socket_direct() factor in being called with
+  IORING_FILE_INDEX_ALLOC for allocating a direct descriptor.
+- Add io_uring_prep_sendto() function.
+
 liburing-2.3 release
 
 - Support non-libc build for aarch64.

+ 2 - 0
contrib/libs/liburing/CMakeLists.linux-aarch64.txt

@@ -19,8 +19,10 @@ target_link_libraries(contrib-libs-liburing PUBLIC
   contrib-libs-linux-headers
 )
 target_sources(contrib-libs-liburing PRIVATE
+  ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/nolibc.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/queue.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/register.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/setup.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/syscall.c
+  ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/version.c
 )

+ 2 - 0
contrib/libs/liburing/CMakeLists.linux-x86_64.txt

@@ -19,8 +19,10 @@ target_link_libraries(contrib-libs-liburing PUBLIC
   contrib-libs-linux-headers
 )
 target_sources(contrib-libs-liburing PRIVATE
+  ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/nolibc.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/queue.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/register.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/setup.c
   ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/syscall.c
+  ${CMAKE_SOURCE_DIR}/contrib/libs/liburing/src/version.c
 )

+ 48 - 0
contrib/libs/liburing/README

@@ -47,6 +47,54 @@ the kernel io_uring support. Please note that this suite isn't expected to
 pass on older kernels, and may even crash or hang older kernels!
 
 
+Building liburing
+-----------------
+
+    #
+    # Prepare build config (optional).
+    #
+    #  --cc  specifies the C   compiler.
+    #  --cxx speficies the C++ compiler.
+    #
+    ./configure --cc=gcc --cxx=g++;
+
+    #
+    # Build liburing.
+    #
+    make -j$(nproc);
+
+    #
+    # Install liburing (headers, shared/static libs, and manpage).
+    #
+    sudo make install;
+
+See './configure --help' for more information about build config options.
+
+
+FFI support
+-----------
+
+By default, the build results in 4 lib files:
+
+    2 shared libs:
+
+        liburing.so
+        liburing-ffi.so
+
+    2 static libs:
+
+        liburing.a
+        liburing-ffi.a
+
+Languages and applications that can't use 'static inline' functions in
+liburing.h should use the FFI variants.
+
+liburing's main public interface lives in liburing.h as 'static inline'
+functions. Users wishing to consume liburing purely as a binary dependency
+should link against liburing-ffi. It contains definitions for every 'static
+inline' function.
+
+
 License
 -------
 

+ 3 - 0
contrib/libs/liburing/config-host.h

@@ -2,6 +2,7 @@
  * Automatically generated by configure - do not modify
  * Configured with: * './configure' * '--prefix=/var/empty/liburing' * '--includedir=/var/empty/tmp/out/include' * '--mandir=/var/empty/tmp/out/share/man'
  */
+#define CONFIG_NOLIBC
 #define CONFIG_HAVE_KERNEL_RWF_T
 #define CONFIG_HAVE_KERNEL_TIMESPEC
 #define CONFIG_HAVE_OPEN_HOW
@@ -11,3 +12,5 @@
 #define CONFIG_HAVE_UCONTEXT
 #define CONFIG_HAVE_STRINGOP_OVERFLOW
 #define CONFIG_HAVE_ARRAY_BOUNDS
+#define CONFIG_HAVE_NVME_URING
+#define CONFIG_HAVE_FANOTIFY

+ 1 - 1
contrib/libs/liburing/src/arch/aarch64/lib.h

@@ -21,7 +21,7 @@ static inline long __get_page_size(void)
 		ssize_t x;
 
 		x = __sys_read(fd, buf, sizeof(buf));
-		if (x < sizeof(buf))
+		if (x < (long) sizeof(buf))
 			break;
 
 		if (buf[0] == AT_PAGESZ) {

Разница между файлами не показана из-за своего большого размера
+ 208 - 146
contrib/libs/liburing/src/include/liburing.h


+ 2 - 0
contrib/libs/liburing/src/include/liburing/compat.h

@@ -3,6 +3,8 @@
 #define LIBURING_COMPAT_H
 
 #include <linux/time_types.h>
+/* <linux/time_types.h> is included above and not needed again */
+#define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H 1
 
 #include <linux/openat2.h>
 

+ 49 - 21
contrib/libs/liburing/src/include/liburing/io_uring.h

@@ -12,12 +12,11 @@
 #include <linux/types.h>
 /*
  * this file is shared with liburing and that has to autodetect
- * if linux/time_types.h is available
+ * if linux/time_types.h is available or not, it can
+ * define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H
+ * if linux/time_types.h is not available
  */
-#ifdef __KERNEL__
-#define HAVE_LINUX_TIME_TYPES_H 1
-#endif
-#ifdef HAVE_LINUX_TIME_TYPES_H
+#ifndef UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H
 #include <linux/time_types.h>
 #endif
 
@@ -231,7 +230,7 @@ enum io_uring_op {
 
 /*
  * sqe->uring_cmd_flags
- * IORING_URING_CMD_FIXED	use registered buffer; pass thig flag
+ * IORING_URING_CMD_FIXED	use registered buffer; pass this flag
  *				along with setting sqe->buf_index.
  */
 #define IORING_URING_CMD_FIXED	(1U << 0)
@@ -251,6 +250,7 @@ enum io_uring_op {
 #define IORING_TIMEOUT_REALTIME		(1U << 3)
 #define IORING_LINK_TIMEOUT_UPDATE	(1U << 4)
 #define IORING_TIMEOUT_ETIME_SUCCESS	(1U << 5)
+#define IORING_TIMEOUT_MULTISHOT	(1U << 6)
 #define IORING_TIMEOUT_CLOCK_MASK	(IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)
 #define IORING_TIMEOUT_UPDATE_MASK	(IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)
 /*
@@ -305,10 +305,28 @@ enum io_uring_op {
  *
  * IORING_RECVSEND_FIXED_BUF	Use registered buffers, the index is stored in
  *				the buf_index field.
+ *
+ * IORING_SEND_ZC_REPORT_USAGE
+ *				If set, SEND[MSG]_ZC should report
+ *				the zerocopy usage in cqe.res
+ *				for the IORING_CQE_F_NOTIF cqe.
+ *				0 is reported if zerocopy was actually possible.
+ *				IORING_NOTIF_USAGE_ZC_COPIED if data was copied
+ *				(at least partially).
  */
 #define IORING_RECVSEND_POLL_FIRST	(1U << 0)
 #define IORING_RECV_MULTISHOT		(1U << 1)
 #define IORING_RECVSEND_FIXED_BUF	(1U << 2)
+#define IORING_SEND_ZC_REPORT_USAGE	(1U << 3)
+
+/*
+ * cqe.res for IORING_CQE_F_NOTIF if
+ * IORING_SEND_ZC_REPORT_USAGE was requested
+ *
+ * It should be treated as a flag, all other
+ * bits of cqe.res should be treated as reserved!
+ */
+#define IORING_NOTIF_USAGE_ZC_COPIED    (1U << 31)
 
 /*
  * accept flags stored in sqe->ioprio
@@ -330,6 +348,8 @@ enum {
  *				applicable for IORING_MSG_DATA, obviously.
  */
 #define IORING_MSG_RING_CQE_SKIP	(1U << 0)
+/* Pass through the flags from sqe->file_index to cqe->flags */
+#define IORING_MSG_RING_FLAGS_PASS	(1U << 1)
 
 /*
  * IO completion data structure (Completion Queue Entry)
@@ -370,6 +390,9 @@ enum {
 #define IORING_OFF_SQ_RING		0ULL
 #define IORING_OFF_CQ_RING		0x8000000ULL
 #define IORING_OFF_SQES			0x10000000ULL
+#define IORING_OFF_PBUF_RING		0x80000000ULL
+#define IORING_OFF_PBUF_SHIFT		16
+#define IORING_OFF_MMAP_MASK		0xf8000000ULL
 
 /*
  * Filled with the offset for mmap(2)
@@ -453,6 +476,7 @@ struct io_uring_params {
 #define IORING_FEAT_RSRC_TAGS		(1U << 10)
 #define IORING_FEAT_CQE_SKIP		(1U << 11)
 #define IORING_FEAT_LINKED_FILE		(1U << 12)
+#define IORING_FEAT_REG_REG_RING	(1U << 13)
 
 /*
  * io_uring_register(2) opcodes and arguments
@@ -500,7 +524,10 @@ enum {
 	IORING_REGISTER_FILE_ALLOC_RANGE	= 25,
 
 	/* this goes last */
-	IORING_REGISTER_LAST
+	IORING_REGISTER_LAST,
+
+	/* flag added to the opcode to use a registered ring fd */
+	IORING_REGISTER_USE_REGISTERED_RING	= 1U << 31
 };
 
 /* io-wq worker categories */
@@ -545,19 +572,6 @@ struct io_uring_rsrc_update2 {
 	__u32 resv2;
 };
 
-struct io_uring_notification_slot {
-	__u64 tag;
-	__u64 resv[3];
-};
-
-struct io_uring_notification_register {
-	__u32 nr_slots;
-	__u32 resv;
-	__u64 resv2;
-	__u64 data;
-	__u64 resv3;
-};
-
 /* Skip updating fd indexes set to this value in the fd table */
 #define IORING_REGISTER_FILES_SKIP	(-2)
 
@@ -612,12 +626,26 @@ struct io_uring_buf_ring {
 	};
 };
 
+/*
+ * Flags for IORING_REGISTER_PBUF_RING.
+ *
+ * IOU_PBUF_RING_MMAP:	If set, kernel will allocate the memory for the ring.
+ *			The application must not set a ring_addr in struct
+ *			io_uring_buf_reg, instead it must subsequently call
+ *			mmap(2) with the offset set as:
+ *			IORING_OFF_PBUF_RING | (bgid << IORING_OFF_PBUF_SHIFT)
+ *			to get a virtual mapping for the ring.
+ */
+enum {
+	IOU_PBUF_RING_MMAP	= 1,
+};
+
 /* argument for IORING_(UN)REGISTER_PBUF_RING */
 struct io_uring_buf_reg {
 	__u64	ring_addr;
 	__u32	ring_entries;
 	__u16	bgid;
-	__u16	pad;
+	__u16	flags;
 	__u64	resv[3];
 };
 

+ 8 - 0
contrib/libs/liburing/src/include/liburing/io_uring_version.h

@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef LIBURING_VERSION_H
+#define LIBURING_VERSION_H
+
+#define IO_URING_VERSION_MAJOR 2
+#define IO_URING_VERSION_MINOR 4
+
+#endif

Некоторые файлы не были показаны из-за большого количества измененных файлов