* [RFC 0/3] Import Kernel uAPI header files
@ 2024-09-05 22:15 Maxime Coquelin
2024-09-05 22:15 ` [RFC 1/3] uapi: introduce kernel uAPI headers importation Maxime Coquelin
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Maxime Coquelin @ 2024-09-05 22:15 UTC (permalink / raw)
To: dev, techboard, david.marchand, thomas; +Cc: Maxime Coquelin
This series enables importing Linux Kernel uAPI headers
into the DPDK repository. It aims at solving alignment
issues between the build system and the system applications
linked ot DPDK libraries are run on.
It can also help simplify spaghetti code done to support
different versions of the Linux Kernel headers used by
the build system.
Guidelines and import script are also part of first patch.
Follow-up patches are an example of imported uAPI inclusion
of VDUSE header into the Vhost library.
Maxime Coquelin (3):
uapi: introduce kernel uAPI headers importation
uapi: import VDUSE header
vduse: use import VDUSE uAPI header
devtools/import-linux-uapi.sh | 48 ++++
doc/guides/contributing/index.rst | 1 +
doc/guides/contributing/linux_uapi.rst | 63 +++++
lib/vhost/meson.build | 6 +-
lib/vhost/vduse.c | 2 +-
lib/vhost/vduse.h | 22 --
linux-headers/uapi/linux/vduse.h | 353 +++++++++++++++++++++++++
meson.build | 4 +
8 files changed, 472 insertions(+), 27 deletions(-)
create mode 100755 devtools/import-linux-uapi.sh
create mode 100644 doc/guides/contributing/linux_uapi.rst
create mode 100644 linux-headers/uapi/linux/vduse.h
--
2.46.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC 1/3] uapi: introduce kernel uAPI headers importation
2024-09-05 22:15 [RFC 0/3] Import Kernel uAPI header files Maxime Coquelin
@ 2024-09-05 22:15 ` Maxime Coquelin
2024-09-06 6:46 ` Morten Brørup
` (2 more replies)
2024-09-05 22:15 ` [RFC 2/3] uapi: import VDUSE header Maxime Coquelin
2024-09-05 22:15 ` [RFC 3/3] vduse: use import VDUSE uAPI header Maxime Coquelin
2 siblings, 3 replies; 10+ messages in thread
From: Maxime Coquelin @ 2024-09-05 22:15 UTC (permalink / raw)
To: dev, techboard, david.marchand, thomas; +Cc: Maxime Coquelin
This patch introduces uAPI headers importation into the
DPDK repository. This import is possible thanks to Linux
Kernel licence exception for syscalls:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/LICENSES/exceptions/Linux-syscall-note
Header files are have to be explicitly imported, and
libraries and drivers have to explicitly enable their
inclusion.
Guidelines are provided in the documentation, and a helper
script is also provided to ensure proper importation of the
header (unmodified content from a released Kernel version).
Next version will introduce a script to check headers are
valids.
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
devtools/import-linux-uapi.sh | 48 ++++++++++++++++++++
doc/guides/contributing/index.rst | 1 +
doc/guides/contributing/linux_uapi.rst | 63 ++++++++++++++++++++++++++
meson.build | 4 ++
4 files changed, 116 insertions(+)
create mode 100755 devtools/import-linux-uapi.sh
create mode 100644 doc/guides/contributing/linux_uapi.rst
diff --git a/devtools/import-linux-uapi.sh b/devtools/import-linux-uapi.sh
new file mode 100755
index 0000000000..efeffdd332
--- /dev/null
+++ b/devtools/import-linux-uapi.sh
@@ -0,0 +1,48 @@
+#!/bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2024 Red Hat, Inc.
+
+#
+# Import Linux Kernel uAPI header file
+#
+
+base_url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/"
+base_path="linux-headers/uapi/"
+
+print_usage()
+{
+ echo "Usage: $(basename $0) [-h] [file] [version]"
+ echo "Example of valid file is linux/vfio.h"
+ echo "Example of valid version is v6.10"
+}
+
+while getopts hv ARG ; do
+ case $ARG in
+ h ) print_usage; exit 0 ;;
+ ? ) print_usage; exit 1 ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [ $# -ne 2 ]; then
+ print_usage; exit 1;
+fi
+
+file=$1
+version=$2
+
+url="${base_url}${file}?h=${version}"
+path="${base_path}${file}"
+
+# Move to the root of the DPDK tree
+cd $(dirname $0)/..
+
+# Check file and version are valid
+curl -s -o /dev/null -w "%{http_code}" $url | grep -q "200"
+
+# Create path if needed
+mkdir -p $(dirname $path)
+
+# Download the file
+curl -s -o $path $url
+
diff --git a/doc/guides/contributing/index.rst b/doc/guides/contributing/index.rst
index dcb9b1fbf0..603dc72654 100644
--- a/doc/guides/contributing/index.rst
+++ b/doc/guides/contributing/index.rst
@@ -19,3 +19,4 @@ Contributor's Guidelines
vulnerability
stable
cheatsheet
+ linux_uapi
diff --git a/doc/guides/contributing/linux_uapi.rst b/doc/guides/contributing/linux_uapi.rst
new file mode 100644
index 0000000000..3bfd05eb62
--- /dev/null
+++ b/doc/guides/contributing/linux_uapi.rst
@@ -0,0 +1,63 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2024 Red Hat, Inc.
+
+Linux uAPI header files
+=======================
+
+
+Rationale
+---------
+
+The system a DPDK library or driver is built on is not necessarily running the
+same Kernel version than the system that will run it. Importing Linux Kernel
+uAPI headers enable to build features that are not supported yet by the build
+system.
+
+For example, the build system runs upstream Kernel v5.19 and we would like to
+build a VDUSE application that will use VDUSE_IOTLB_GET_INFO ioctl() introduced
+in Linux Kernel v6.0.
+
+`Linux Kernel licence exception regarding syscalls
+<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/LICENSES/exceptions/Linux-syscall-note>`_
+enable importing unmodified Linux Kernel uAPI header files.
+
+Importing or updating an uAPI header file
+-----------------------------------------
+
+In order to ensure the imported uAPI headers are both unmodified and from a
+released version of the linux Kernel, a helper script is made available and
+MUST be used. Below is an example to import ``linux/vduse.h`` file from Linux
+``v6.10``:
+
+.. code-block:: console
+
+ ./devtools/import-linux-uapi.sh linux/vduse.h v6.10
+
+Once imported, the header files should be committed without any other change,
+and the commit message MUST specify the imported version using ``uAPI ID:``
+tag and title MUST be prefixed with uapi keywork. For example::
+
+ uapi: import VDUSE header file
+
+ This patch imports VDUSE uAPI header file.
+
+ uAPI Version: v6.10
+
+ Signed-off-by: Alex Smith <alex.smith@example.com>
+
+Header inclusion into library or driver
+---------------------------------------
+
+The library or driver willing to make use of imported uAPI headers needs to
+explicitly add uAPI headers path to the ``includes`` var in its ``meson.build``
+file:
+
+.. code-block:: python
+ includes += linux_uapi_inc
+
+Then, it can be included with ``uapi/`` prefix in C files. For example to
+include VDUSE uAPI:
+
+.. code-block:: c
+ #include <uapi/linux/vduse.h>
+
diff --git a/meson.build b/meson.build
index 8b248d4505..53cdaef558 100644
--- a/meson.build
+++ b/meson.build
@@ -77,6 +77,10 @@ global_inc = include_directories('.', 'config',
subdir('buildtools')
subdir('config')
+if is_linux
+ linux_uapi_inc = include_directories('linux-headers')
+endif
+
# build libs and drivers
subdir('lib')
subdir('drivers')
--
2.46.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC 2/3] uapi: import VDUSE header
2024-09-05 22:15 [RFC 0/3] Import Kernel uAPI header files Maxime Coquelin
2024-09-05 22:15 ` [RFC 1/3] uapi: introduce kernel uAPI headers importation Maxime Coquelin
@ 2024-09-05 22:15 ` Maxime Coquelin
2024-09-05 22:15 ` [RFC 3/3] vduse: use import VDUSE uAPI header Maxime Coquelin
2 siblings, 0 replies; 10+ messages in thread
From: Maxime Coquelin @ 2024-09-05 22:15 UTC (permalink / raw)
To: dev, techboard, david.marchand, thomas; +Cc: Maxime Coquelin
uAPI Version: v6.10
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
| 353 +++++++++++++++++++++++++++++++
1 file changed, 353 insertions(+)
create mode 100644 linux-headers/uapi/linux/vduse.h
--git a/linux-headers/uapi/linux/vduse.h b/linux-headers/uapi/linux/vduse.h
new file mode 100644
index 0000000000..11bd48c72c
--- /dev/null
+++ b/linux-headers/uapi/linux/vduse.h
@@ -0,0 +1,353 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_VDUSE_H_
+#define _UAPI_VDUSE_H_
+
+#include <linux/types.h>
+
+#define VDUSE_BASE 0x81
+
+/* The ioctls for control device (/dev/vduse/control) */
+
+#define VDUSE_API_VERSION 0
+
+/*
+ * Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION).
+ * This is used for future extension.
+ */
+#define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64)
+
+/* Set the version of VDUSE API that userspace supported. */
+#define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64)
+
+/**
+ * struct vduse_dev_config - basic configuration of a VDUSE device
+ * @name: VDUSE device name, needs to be NUL terminated
+ * @vendor_id: virtio vendor id
+ * @device_id: virtio device id
+ * @features: virtio features
+ * @vq_num: the number of virtqueues
+ * @vq_align: the allocation alignment of virtqueue's metadata
+ * @reserved: for future use, needs to be initialized to zero
+ * @config_size: the size of the configuration space
+ * @config: the buffer of the configuration space
+ *
+ * Structure used by VDUSE_CREATE_DEV ioctl to create VDUSE device.
+ */
+struct vduse_dev_config {
+#define VDUSE_NAME_MAX 256
+ char name[VDUSE_NAME_MAX];
+ __u32 vendor_id;
+ __u32 device_id;
+ __u64 features;
+ __u32 vq_num;
+ __u32 vq_align;
+ __u32 reserved[13];
+ __u32 config_size;
+ __u8 config[];
+};
+
+/* Create a VDUSE device which is represented by a char device (/dev/vduse/$NAME) */
+#define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config)
+
+/*
+ * Destroy a VDUSE device. Make sure there are no more references
+ * to the char device (/dev/vduse/$NAME).
+ */
+#define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX])
+
+/* The ioctls for VDUSE device (/dev/vduse/$NAME) */
+
+/**
+ * struct vduse_iotlb_entry - entry of IOTLB to describe one IOVA region [start, last]
+ * @offset: the mmap offset on returned file descriptor
+ * @start: start of the IOVA region
+ * @last: last of the IOVA region
+ * @perm: access permission of the IOVA region
+ *
+ * Structure used by VDUSE_IOTLB_GET_FD ioctl to find an overlapped IOVA region.
+ */
+struct vduse_iotlb_entry {
+ __u64 offset;
+ __u64 start;
+ __u64 last;
+#define VDUSE_ACCESS_RO 0x1
+#define VDUSE_ACCESS_WO 0x2
+#define VDUSE_ACCESS_RW 0x3
+ __u8 perm;
+};
+
+/*
+ * Find the first IOVA region that overlaps with the range [start, last]
+ * and return the corresponding file descriptor. Return -EINVAL means the
+ * IOVA region doesn't exist. Caller should set start and last fields.
+ */
+#define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry)
+
+/*
+ * Get the negotiated virtio features. It's a subset of the features in
+ * struct vduse_dev_config which can be accepted by virtio driver. It's
+ * only valid after FEATURES_OK status bit is set.
+ */
+#define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64)
+
+/**
+ * struct vduse_config_data - data used to update configuration space
+ * @offset: the offset from the beginning of configuration space
+ * @length: the length to write to configuration space
+ * @buffer: the buffer used to write from
+ *
+ * Structure used by VDUSE_DEV_SET_CONFIG ioctl to update device
+ * configuration space.
+ */
+struct vduse_config_data {
+ __u32 offset;
+ __u32 length;
+ __u8 buffer[];
+};
+
+/* Set device configuration space */
+#define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data)
+
+/*
+ * Inject a config interrupt. It's usually used to notify virtio driver
+ * that device configuration space has changed.
+ */
+#define VDUSE_DEV_INJECT_CONFIG_IRQ _IO(VDUSE_BASE, 0x13)
+
+/**
+ * struct vduse_vq_config - basic configuration of a virtqueue
+ * @index: virtqueue index
+ * @max_size: the max size of virtqueue
+ * @reserved: for future use, needs to be initialized to zero
+ *
+ * Structure used by VDUSE_VQ_SETUP ioctl to setup a virtqueue.
+ */
+struct vduse_vq_config {
+ __u32 index;
+ __u16 max_size;
+ __u16 reserved[13];
+};
+
+/*
+ * Setup the specified virtqueue. Make sure all virtqueues have been
+ * configured before the device is attached to vDPA bus.
+ */
+#define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config)
+
+/**
+ * struct vduse_vq_state_split - split virtqueue state
+ * @avail_index: available index
+ */
+struct vduse_vq_state_split {
+ __u16 avail_index;
+};
+
+/**
+ * struct vduse_vq_state_packed - packed virtqueue state
+ * @last_avail_counter: last driver ring wrap counter observed by device
+ * @last_avail_idx: device available index
+ * @last_used_counter: device ring wrap counter
+ * @last_used_idx: used index
+ */
+struct vduse_vq_state_packed {
+ __u16 last_avail_counter;
+ __u16 last_avail_idx;
+ __u16 last_used_counter;
+ __u16 last_used_idx;
+};
+
+/**
+ * struct vduse_vq_info - information of a virtqueue
+ * @index: virtqueue index
+ * @num: the size of virtqueue
+ * @desc_addr: address of desc area
+ * @driver_addr: address of driver area
+ * @device_addr: address of device area
+ * @split: split virtqueue state
+ * @packed: packed virtqueue state
+ * @ready: ready status of virtqueue
+ *
+ * Structure used by VDUSE_VQ_GET_INFO ioctl to get virtqueue's information.
+ */
+struct vduse_vq_info {
+ __u32 index;
+ __u32 num;
+ __u64 desc_addr;
+ __u64 driver_addr;
+ __u64 device_addr;
+ union {
+ struct vduse_vq_state_split split;
+ struct vduse_vq_state_packed packed;
+ };
+ __u8 ready;
+};
+
+/* Get the specified virtqueue's information. Caller should set index field. */
+#define VDUSE_VQ_GET_INFO _IOWR(VDUSE_BASE, 0x15, struct vduse_vq_info)
+
+/**
+ * struct vduse_vq_eventfd - eventfd configuration for a virtqueue
+ * @index: virtqueue index
+ * @fd: eventfd, -1 means de-assigning the eventfd
+ *
+ * Structure used by VDUSE_VQ_SETUP_KICKFD ioctl to setup kick eventfd.
+ */
+struct vduse_vq_eventfd {
+ __u32 index;
+#define VDUSE_EVENTFD_DEASSIGN -1
+ int fd;
+};
+
+/*
+ * Setup kick eventfd for specified virtqueue. The kick eventfd is used
+ * by VDUSE kernel module to notify userspace to consume the avail vring.
+ */
+#define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd)
+
+/*
+ * Inject an interrupt for specific virtqueue. It's used to notify virtio driver
+ * to consume the used vring.
+ */
+#define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
+
+/**
+ * struct vduse_iova_umem - userspace memory configuration for one IOVA region
+ * @uaddr: start address of userspace memory, it must be aligned to page size
+ * @iova: start of the IOVA region
+ * @size: size of the IOVA region
+ * @reserved: for future use, needs to be initialized to zero
+ *
+ * Structure used by VDUSE_IOTLB_REG_UMEM and VDUSE_IOTLB_DEREG_UMEM
+ * ioctls to register/de-register userspace memory for IOVA regions
+ */
+struct vduse_iova_umem {
+ __u64 uaddr;
+ __u64 iova;
+ __u64 size;
+ __u64 reserved[3];
+};
+
+/* Register userspace memory for IOVA regions */
+#define VDUSE_IOTLB_REG_UMEM _IOW(VDUSE_BASE, 0x18, struct vduse_iova_umem)
+
+/* De-register the userspace memory. Caller should set iova and size field. */
+#define VDUSE_IOTLB_DEREG_UMEM _IOW(VDUSE_BASE, 0x19, struct vduse_iova_umem)
+
+/**
+ * struct vduse_iova_info - information of one IOVA region
+ * @start: start of the IOVA region
+ * @last: last of the IOVA region
+ * @capability: capability of the IOVA regsion
+ * @reserved: for future use, needs to be initialized to zero
+ *
+ * Structure used by VDUSE_IOTLB_GET_INFO ioctl to get information of
+ * one IOVA region.
+ */
+struct vduse_iova_info {
+ __u64 start;
+ __u64 last;
+#define VDUSE_IOVA_CAP_UMEM (1 << 0)
+ __u64 capability;
+ __u64 reserved[3];
+};
+
+/*
+ * Find the first IOVA region that overlaps with the range [start, last]
+ * and return some information on it. Caller should set start and last fields.
+ */
+#define VDUSE_IOTLB_GET_INFO _IOWR(VDUSE_BASE, 0x1a, struct vduse_iova_info)
+
+/* The control messages definition for read(2)/write(2) on /dev/vduse/$NAME */
+
+/**
+ * enum vduse_req_type - request type
+ * @VDUSE_GET_VQ_STATE: get the state for specified virtqueue from userspace
+ * @VDUSE_SET_STATUS: set the device status
+ * @VDUSE_UPDATE_IOTLB: Notify userspace to update the memory mapping for
+ * specified IOVA range via VDUSE_IOTLB_GET_FD ioctl
+ */
+enum vduse_req_type {
+ VDUSE_GET_VQ_STATE,
+ VDUSE_SET_STATUS,
+ VDUSE_UPDATE_IOTLB,
+};
+
+/**
+ * struct vduse_vq_state - virtqueue state
+ * @index: virtqueue index
+ * @split: split virtqueue state
+ * @packed: packed virtqueue state
+ */
+struct vduse_vq_state {
+ __u32 index;
+ union {
+ struct vduse_vq_state_split split;
+ struct vduse_vq_state_packed packed;
+ };
+};
+
+/**
+ * struct vduse_dev_status - device status
+ * @status: device status
+ */
+struct vduse_dev_status {
+ __u8 status;
+};
+
+/**
+ * struct vduse_iova_range - IOVA range [start, last]
+ * @start: start of the IOVA range
+ * @last: last of the IOVA range
+ */
+struct vduse_iova_range {
+ __u64 start;
+ __u64 last;
+};
+
+/**
+ * struct vduse_dev_request - control request
+ * @type: request type
+ * @request_id: request id
+ * @reserved: for future use
+ * @vq_state: virtqueue state, only index field is available
+ * @s: device status
+ * @iova: IOVA range for updating
+ * @padding: padding
+ *
+ * Structure used by read(2) on /dev/vduse/$NAME.
+ */
+struct vduse_dev_request {
+ __u32 type;
+ __u32 request_id;
+ __u32 reserved[4];
+ union {
+ struct vduse_vq_state vq_state;
+ struct vduse_dev_status s;
+ struct vduse_iova_range iova;
+ __u32 padding[32];
+ };
+};
+
+/**
+ * struct vduse_dev_response - response to control request
+ * @request_id: corresponding request id
+ * @result: the result of request
+ * @reserved: for future use, needs to be initialized to zero
+ * @vq_state: virtqueue state
+ * @padding: padding
+ *
+ * Structure used by write(2) on /dev/vduse/$NAME.
+ */
+struct vduse_dev_response {
+ __u32 request_id;
+#define VDUSE_REQ_RESULT_OK 0x00
+#define VDUSE_REQ_RESULT_FAILED 0x01
+ __u32 result;
+ __u32 reserved[4];
+ union {
+ struct vduse_vq_state vq_state;
+ __u32 padding[32];
+ };
+};
+
+#endif /* _UAPI_VDUSE_H_ */
--
2.46.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC 3/3] vduse: use import VDUSE uAPI header
2024-09-05 22:15 [RFC 0/3] Import Kernel uAPI header files Maxime Coquelin
2024-09-05 22:15 ` [RFC 1/3] uapi: introduce kernel uAPI headers importation Maxime Coquelin
2024-09-05 22:15 ` [RFC 2/3] uapi: import VDUSE header Maxime Coquelin
@ 2024-09-05 22:15 ` Maxime Coquelin
2 siblings, 0 replies; 10+ messages in thread
From: Maxime Coquelin @ 2024-09-05 22:15 UTC (permalink / raw)
To: dev, techboard, david.marchand, thomas; +Cc: Maxime Coquelin
This patch makes use of the imported VDUSE headers.
The VDUSE support is now systematically built on Linux
systems, even if the build system does not support its
ioctl().
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
lib/vhost/meson.build | 6 ++----
lib/vhost/vduse.c | 2 +-
lib/vhost/vduse.h | 22 ----------------------
3 files changed, 3 insertions(+), 27 deletions(-)
diff --git a/lib/vhost/meson.build b/lib/vhost/meson.build
index 41b622a9be..ba9e4f690f 100644
--- a/lib/vhost/meson.build
+++ b/lib/vhost/meson.build
@@ -17,22 +17,20 @@ elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0'))
endif
dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h'))
cflags += '-fno-strict-aliasing'
+includes += linux_uapi_inc
sources = files(
'fd_man.c',
'iotlb.c',
'socket.c',
'vdpa.c',
+ 'vduse.c',
'vhost.c',
'vhost_crypto.c',
'vhost_user.c',
'virtio_net.c',
'virtio_net_ctrl.c',
)
-if cc.has_header('linux/vduse.h')
- sources += files('vduse.c')
- cflags += '-DVHOST_HAS_VDUSE'
-endif
headers = files(
'rte_vdpa.h',
'rte_vhost.h',
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index c66602905c..a41ff2024c 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -8,7 +8,7 @@
#include <fcntl.h>
-#include <linux/vduse.h>
+#include <uapi/linux/vduse.h>
#include <linux/virtio_net.h>
#include <sys/ioctl.h>
diff --git a/lib/vhost/vduse.h b/lib/vhost/vduse.h
index 0d8f3f1205..47ca97a064 100644
--- a/lib/vhost/vduse.h
+++ b/lib/vhost/vduse.h
@@ -9,29 +9,7 @@
#define VDUSE_NET_SUPPORTED_FEATURES VIRTIO_NET_SUPPORTED_FEATURES
-#ifdef VHOST_HAS_VDUSE
-
int vduse_device_create(const char *path, bool compliant_ol_flags);
int vduse_device_destroy(const char *path);
-#else
-
-static inline int
-vduse_device_create(const char *path, bool compliant_ol_flags)
-{
- RTE_SET_USED(compliant_ol_flags);
-
- VHOST_CONFIG_LOG(path, ERR, "VDUSE support disabled at build time");
- return -1;
-}
-
-static inline int
-vduse_device_destroy(const char *path)
-{
- VHOST_CONFIG_LOG(path, ERR, "VDUSE support disabled at build time");
- return -1;
-}
-
-#endif /* VHOST_HAS_VDUSE */
-
#endif /* _VDUSE_H */
--
2.46.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [RFC 1/3] uapi: introduce kernel uAPI headers importation
2024-09-05 22:15 ` [RFC 1/3] uapi: introduce kernel uAPI headers importation Maxime Coquelin
@ 2024-09-06 6:46 ` Morten Brørup
2024-09-06 7:01 ` Maxime Coquelin
2024-09-06 7:13 ` David Marchand
2024-09-09 0:02 ` Stephen Hemminger
2 siblings, 1 reply; 10+ messages in thread
From: Morten Brørup @ 2024-09-06 6:46 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: dev, techboard, david.marchand, thomas
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Friday, 6 September 2024 00.15
>
> This patch introduces uAPI headers importation into the
> DPDK repository. This import is possible thanks to Linux
> Kernel licence exception for syscalls:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/LICENS
> ES/exceptions/Linux-syscall-note
>
> Header files are have to be explicitly imported, and
> libraries and drivers have to explicitly enable their
> inclusion.
>
> Guidelines are provided in the documentation, and a helper
> script is also provided to ensure proper importation of the
> header (unmodified content from a released Kernel version).
>
> Next version will introduce a script to check headers are
> valids.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
Excellent solution, Maxime.
Minor suggestions and typos mentioned below.
Acked-by: Morten Brørup <mb@smartsharesystems.com>
> +print_usage()
> +{
> + echo "Usage: $(basename $0) [-h] [file] [version]"
> + echo "Example of valid file is linux/vfio.h"
> + echo "Example of valid version is v6.10"
Suggest:
+ echo "Example of valid file: linux/vfio.h"
+ echo "Example of valid version: v6.10"
> +Once imported, the header files should be committed without any other change,
> +and the commit message MUST specify the imported version using ``uAPI ID:``
> +tag and title MUST be prefixed with uapi keywork. For example::
"uAPI ID:" -> "uAPI Version"
"keywork" -> "keyword"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC 1/3] uapi: introduce kernel uAPI headers importation
2024-09-06 6:46 ` Morten Brørup
@ 2024-09-06 7:01 ` Maxime Coquelin
0 siblings, 0 replies; 10+ messages in thread
From: Maxime Coquelin @ 2024-09-06 7:01 UTC (permalink / raw)
To: Morten Brørup; +Cc: dev, techboard, david.marchand, thomas
On 9/6/24 08:46, Morten Brørup wrote:
>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>> Sent: Friday, 6 September 2024 00.15
>>
>> This patch introduces uAPI headers importation into the
>> DPDK repository. This import is possible thanks to Linux
>> Kernel licence exception for syscalls:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/LICENS
>> ES/exceptions/Linux-syscall-note
>>
>> Header files are have to be explicitly imported, and
>> libraries and drivers have to explicitly enable their
>> inclusion.
>>
>> Guidelines are provided in the documentation, and a helper
>> script is also provided to ensure proper importation of the
>> header (unmodified content from a released Kernel version).
>>
>> Next version will introduce a script to check headers are
>> valids.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>
> Excellent solution, Maxime.
>
> Minor suggestions and typos mentioned below.
>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
>
Thanks Morten, I'll fix below typos and several build failures caught by
CI in next revision.
>> +print_usage()
>> +{
>> + echo "Usage: $(basename $0) [-h] [file] [version]"
>> + echo "Example of valid file is linux/vfio.h"
>> + echo "Example of valid version is v6.10"
>
> Suggest:
> + echo "Example of valid file: linux/vfio.h"
> + echo "Example of valid version: v6.10"
>
>
>> +Once imported, the header files should be committed without any other change,
>> +and the commit message MUST specify the imported version using ``uAPI ID:``
>> +tag and title MUST be prefixed with uapi keywork. For example::
>
> "uAPI ID:" -> "uAPI Version"
> "keywork" -> "keyword"
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC 1/3] uapi: introduce kernel uAPI headers importation
2024-09-05 22:15 ` [RFC 1/3] uapi: introduce kernel uAPI headers importation Maxime Coquelin
2024-09-06 6:46 ` Morten Brørup
@ 2024-09-06 7:13 ` David Marchand
2024-09-06 8:29 ` Maxime Coquelin
2024-09-09 0:02 ` Stephen Hemminger
2 siblings, 1 reply; 10+ messages in thread
From: David Marchand @ 2024-09-06 7:13 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: dev, techboard, thomas
On Fri, Sep 6, 2024 at 12:15 AM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> This patch introduces uAPI headers importation into the
> DPDK repository. This import is possible thanks to Linux
> Kernel licence exception for syscalls:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/LICENSES/exceptions/Linux-syscall-note
>
> Header files are have to be explicitly imported, and
> libraries and drivers have to explicitly enable their
> inclusion.
>
> Guidelines are provided in the documentation, and a helper
> script is also provided to ensure proper importation of the
> header (unmodified content from a released Kernel version).
>
> Next version will introduce a script to check headers are
> valids.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> devtools/import-linux-uapi.sh | 48 ++++++++++++++++++++
> doc/guides/contributing/index.rst | 1 +
> doc/guides/contributing/linux_uapi.rst | 63 ++++++++++++++++++++++++++
> meson.build | 4 ++
> 4 files changed, 116 insertions(+)
> create mode 100755 devtools/import-linux-uapi.sh
> create mode 100644 doc/guides/contributing/linux_uapi.rst
>
> diff --git a/devtools/import-linux-uapi.sh b/devtools/import-linux-uapi.sh
> new file mode 100755
> index 0000000000..efeffdd332
> --- /dev/null
> +++ b/devtools/import-linux-uapi.sh
> @@ -0,0 +1,48 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright (c) 2024 Red Hat, Inc.
> +
> +#
> +# Import Linux Kernel uAPI header file
> +#
> +
> +base_url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/"
> +base_path="linux-headers/uapi/"
> +
> +print_usage()
> +{
> + echo "Usage: $(basename $0) [-h] [file] [version]"
file and version are not optional.
So they should not be surrounded with [].
> + echo "Example of valid file is linux/vfio.h"
> + echo "Example of valid version is v6.10"
> +}
> +
> +while getopts hv ARG ; do
> + case $ARG in
> + h ) print_usage; exit 0 ;;
> + ? ) print_usage; exit 1 ;;
> + esac
> +done
> +shift $(($OPTIND - 1))
> +
> +if [ $# -ne 2 ]; then
> + print_usage; exit 1;
For consistency with the rest of the script, don't use ;
> +fi
> +
> +file=$1
> +version=$2
> +
> +url="${base_url}${file}?h=${version}"
> +path="${base_path}${file}"
> +
> +# Move to the root of the DPDK tree
> +cd $(dirname $0)/..
> +
> +# Check file and version are valid
> +curl -s -o /dev/null -w "%{http_code}" $url | grep -q "200"
Can we rely on curl to report such errors?
-f is probably the right option.
@@ -37,12 +37,9 @@ path="${base_path}${file}"
# Move to the root of the DPDK tree
cd $(dirname $0)/..
-# Check file and version are valid
-curl -s -o /dev/null -w "%{http_code}" $url | grep -q "200"
-
# Create path if needed
mkdir -p $(dirname $path)
# Download the file
-curl -s -o $path $url
+curl -s -f -o $path $url
$ ./devtools/import-linux-uapi.sh linux/vdplop.h v6.10; echo $?
22
> +
> +# Create path if needed
> +mkdir -p $(dirname $path)
> +
> +# Download the file
> +curl -s -o $path $url
> +
No need for a blank line at the end of the file.
> diff --git a/doc/guides/contributing/index.rst b/doc/guides/contributing/index.rst
> index dcb9b1fbf0..603dc72654 100644
> --- a/doc/guides/contributing/index.rst
> +++ b/doc/guides/contributing/index.rst
> @@ -19,3 +19,4 @@ Contributor's Guidelines
> vulnerability
> stable
> cheatsheet
> + linux_uapi
> diff --git a/doc/guides/contributing/linux_uapi.rst b/doc/guides/contributing/linux_uapi.rst
> new file mode 100644
> index 0000000000..3bfd05eb62
> --- /dev/null
> +++ b/doc/guides/contributing/linux_uapi.rst
> @@ -0,0 +1,63 @@
> +.. SPDX-License-Identifier: BSD-3-Clause
> + Copyright(c) 2024 Red Hat, Inc.
> +
> +Linux uAPI header files
> +=======================
> +
> +
Single empty line.
> +Rationale
> +---------
> +
> +The system a DPDK library or driver is built on is not necessarily running the
> +same Kernel version than the system that will run it. Importing Linux Kernel
Please start sentences on a new line.
It won't affect the generated documentation and it slightly enhance
readability, code churn when updating another sentence etc...
> +uAPI headers enable to build features that are not supported yet by the build
> +system.
> +
> +For example, the build system runs upstream Kernel v5.19 and we would like to
> +build a VDUSE application that will use VDUSE_IOTLB_GET_INFO ioctl() introduced
> +in Linux Kernel v6.0.
> +
> +`Linux Kernel licence exception regarding syscalls
> +<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/LICENSES/exceptions/Linux-syscall-note>`_
> +enable importing unmodified Linux Kernel uAPI header files.
> +
> +Importing or updating an uAPI header file
> +-----------------------------------------
> +
> +In order to ensure the imported uAPI headers are both unmodified and from a
> +released version of the linux Kernel, a helper script is made available and
> +MUST be used. Below is an example to import ``linux/vduse.h`` file from Linux
> +``v6.10``:
> +
> +.. code-block:: console
> +
> + ./devtools/import-linux-uapi.sh linux/vduse.h v6.10
> +
> +Once imported, the header files should be committed without any other change,
> +and the commit message MUST specify the imported version using ``uAPI ID:``
> +tag and title MUST be prefixed with uapi keywork. For example::
> +
> + uapi: import VDUSE header file
For the very first import of header lambda.h, ok.
But can we make sure people will do better titles?
Importing such headers must be done only when needed (maybe put some
guidelines on this topic in the doc too?), and so the commit title
should reflect the reason why DPDK needs an update.
uapi: import awesome VDUSE feature definitions
> +
> + This patch imports VDUSE uAPI header file.
> +
> + uAPI Version: v6.10
uAPI ID ?
> +
> + Signed-off-by: Alex Smith <alex.smith@example.com>
> +
> +Header inclusion into library or driver
> +---------------------------------------
> +
> +The library or driver willing to make use of imported uAPI headers needs to
> +explicitly add uAPI headers path to the ``includes`` var in its ``meson.build``
> +file:
> +
> +.. code-block:: python
Missing an empty line here.
> + includes += linux_uapi_inc
I would rather have this hidden in global_inc meson.build.
> +
> +Then, it can be included with ``uapi/`` prefix in C files. For example to
> +include VDUSE uAPI:
> +
> +.. code-block:: c
Missing an empty line here.
> + #include <uapi/linux/vduse.h>
> +
> diff --git a/meson.build b/meson.build
> index 8b248d4505..53cdaef558 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -77,6 +77,10 @@ global_inc = include_directories('.', 'config',
> subdir('buildtools')
> subdir('config')
>
> +if is_linux
> + linux_uapi_inc = include_directories('linux-headers')
> +endif
s/linux_uapi_inc/global_inc/.
> +
> # build libs and drivers
> subdir('lib')
> subdir('drivers')
> --
> 2.46.0
>
--
David Marchand
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC 1/3] uapi: introduce kernel uAPI headers importation
2024-09-06 7:13 ` David Marchand
@ 2024-09-06 8:29 ` Maxime Coquelin
0 siblings, 0 replies; 10+ messages in thread
From: Maxime Coquelin @ 2024-09-06 8:29 UTC (permalink / raw)
To: David Marchand; +Cc: dev, techboard, thomas
On 9/6/24 09:13, David Marchand wrote:
> On Fri, Sep 6, 2024 at 12:15 AM Maxime Coquelin
> <maxime.coquelin@redhat.com> wrote:
>>
>> This patch introduces uAPI headers importation into the
>> DPDK repository. This import is possible thanks to Linux
>> Kernel licence exception for syscalls:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/LICENSES/exceptions/Linux-syscall-note
>>
>> Header files are have to be explicitly imported, and
>> libraries and drivers have to explicitly enable their
>> inclusion.
>>
>> Guidelines are provided in the documentation, and a helper
>> script is also provided to ensure proper importation of the
>> header (unmodified content from a released Kernel version).
>>
>> Next version will introduce a script to check headers are
>> valids.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>> devtools/import-linux-uapi.sh | 48 ++++++++++++++++++++
>> doc/guides/contributing/index.rst | 1 +
>> doc/guides/contributing/linux_uapi.rst | 63 ++++++++++++++++++++++++++
>> meson.build | 4 ++
>> 4 files changed, 116 insertions(+)
>> create mode 100755 devtools/import-linux-uapi.sh
>> create mode 100644 doc/guides/contributing/linux_uapi.rst
>>
>> diff --git a/devtools/import-linux-uapi.sh b/devtools/import-linux-uapi.sh
>> new file mode 100755
>> index 0000000000..efeffdd332
>> --- /dev/null
>> +++ b/devtools/import-linux-uapi.sh
>> @@ -0,0 +1,48 @@
>> +#!/bin/sh -e
>> +# SPDX-License-Identifier: BSD-3-Clause
>> +# Copyright (c) 2024 Red Hat, Inc.
>> +
>> +#
>> +# Import Linux Kernel uAPI header file
>> +#
>> +
>> +base_url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/"
>> +base_path="linux-headers/uapi/"
>> +
>> +print_usage()
>> +{
>> + echo "Usage: $(basename $0) [-h] [file] [version]"
>
> file and version are not optional.
> So they should not be surrounded with [].
Ok
>
>
>> + echo "Example of valid file is linux/vfio.h"
>> + echo "Example of valid version is v6.10"
>> +}
>> +
>> +while getopts hv ARG ; do
>> + case $ARG in
>> + h ) print_usage; exit 0 ;;
>> + ? ) print_usage; exit 1 ;;
>> + esac
>> +done
>> +shift $(($OPTIND - 1))
>> +
>> +if [ $# -ne 2 ]; then
>> + print_usage; exit 1;
>
> For consistency with the rest of the script, don't use ;
Ok
>
>> +fi
>> +
>> +file=$1
>> +version=$2
>> +
>> +url="${base_url}${file}?h=${version}"
>> +path="${base_path}${file}"
>> +
>> +# Move to the root of the DPDK tree
>> +cd $(dirname $0)/..
>> +
>> +# Check file and version are valid
>> +curl -s -o /dev/null -w "%{http_code}" $url | grep -q "200"
>
> Can we rely on curl to report such errors?
> -f is probably the right option.
>
> @@ -37,12 +37,9 @@ path="${base_path}${file}"
> # Move to the root of the DPDK tree
> cd $(dirname $0)/..
>
> -# Check file and version are valid
> -curl -s -o /dev/null -w "%{http_code}" $url | grep -q "200"
> -
> # Create path if needed
> mkdir -p $(dirname $path)
>
> # Download the file
> -curl -s -o $path $url
> +curl -s -f -o $path $url
>
> $ ./devtools/import-linux-uapi.sh linux/vdplop.h v6.10; echo $?
> 22
OK, what about this to get rid of the mkdir?
diff --git a/devtools/import-linux-uapi.sh b/devtools/import-linux-uapi.sh
index efeffdd332..3769da80bb 100755
--- a/devtools/import-linux-uapi.sh
+++ b/devtools/import-linux-uapi.sh
@@ -37,12 +37,6 @@ path="${base_path}${file}"
# Move to the root of the DPDK tree
cd $(dirname $0)/..
-# Check file and version are valid
-curl -s -o /dev/null -w "%{http_code}" $url | grep -q "200"
-
-# Create path if needed
-mkdir -p $(dirname $path)
-
# Download the file
-curl -s -o $path $url
+curl -s -f --create-dirs -o $path $url
The only downside in both your version and this one is that versus
initial one is that the directory gets created if curl failed.
We can though combine the best of both worlds:
$ git diff
diff --git a/devtools/import-linux-uapi.sh b/devtools/import-linux-uapi.sh
index efeffdd332..857d3dd33b 100755
--- a/devtools/import-linux-uapi.sh
+++ b/devtools/import-linux-uapi.sh
@@ -34,15 +34,9 @@ version=$2
url="${base_url}${file}?h=${version}"
path="${base_path}${file}"
-# Move to the root of the DPDK tree
-cd $(dirname $0)/..
-
-# Check file and version are valid
-curl -s -o /dev/null -w "%{http_code}" $url | grep -q "200"
-
-# Create path if needed
-mkdir -p $(dirname $path)
+# Check URL is valid
+curl -s -f -o /dev/null $url
# Download the file
-curl -s -o $path $url
+curl -s -f --create-dirs -o $path $url
$ ./devtools/import-linux-uapi.sh linux/vduse.h v6.10
$ ./devtools/import-linux-uapi.sh linuxxx/vduse.h v6.10
$ find linux-headers/
linux-headers/
linux-headers/uapi
linux-headers/uapi/.gitignore
linux-headers/uapi/linux
linux-headers/uapi/linux/vduse.h
What do you prefer?
>
>
>> +
>> +# Create path if needed
>> +mkdir -p $(dirname $path)
>> +
>> +# Download the file
>> +curl -s -o $path $url
>> +
>
> No need for a blank line at the end of the file.
Ack
>
>> diff --git a/doc/guides/contributing/index.rst b/doc/guides/contributing/index.rst
>> index dcb9b1fbf0..603dc72654 100644
>> --- a/doc/guides/contributing/index.rst
>> +++ b/doc/guides/contributing/index.rst
>> @@ -19,3 +19,4 @@ Contributor's Guidelines
>> vulnerability
>> stable
>> cheatsheet
>> + linux_uapi
>> diff --git a/doc/guides/contributing/linux_uapi.rst b/doc/guides/contributing/linux_uapi.rst
>> new file mode 100644
>> index 0000000000..3bfd05eb62
>> --- /dev/null
>> +++ b/doc/guides/contributing/linux_uapi.rst
>> @@ -0,0 +1,63 @@
>> +.. SPDX-License-Identifier: BSD-3-Clause
>> + Copyright(c) 2024 Red Hat, Inc.
>> +
>> +Linux uAPI header files
>> +=======================
>> +
>> +
>
> Single empty line.
Ack
>
>> +Rationale
>> +---------
>> +
>> +The system a DPDK library or driver is built on is not necessarily running the
>> +same Kernel version than the system that will run it. Importing Linux Kernel
>
> Please start sentences on a new line.
> It won't affect the generated documentation and it slightly enhance
> readability, code churn when updating another sentence etc...
>
>
>> +uAPI headers enable to build features that are not supported yet by the build
>> +system.
>> +
>> +For example, the build system runs upstream Kernel v5.19 and we would like to
>> +build a VDUSE application that will use VDUSE_IOTLB_GET_INFO ioctl() introduced
>> +in Linux Kernel v6.0.
>> +
>> +`Linux Kernel licence exception regarding syscalls
>> +<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/LICENSES/exceptions/Linux-syscall-note>`_
>> +enable importing unmodified Linux Kernel uAPI header files.
>> +
>> +Importing or updating an uAPI header file
>> +-----------------------------------------
>> +
>> +In order to ensure the imported uAPI headers are both unmodified and from a
>> +released version of the linux Kernel, a helper script is made available and
>> +MUST be used. Below is an example to import ``linux/vduse.h`` file from Linux
>> +``v6.10``:
>> +
>> +.. code-block:: console
>> +
>> + ./devtools/import-linux-uapi.sh linux/vduse.h v6.10
>> +
>> +Once imported, the header files should be committed without any other change,
>> +and the commit message MUST specify the imported version using ``uAPI ID:``
>> +tag and title MUST be prefixed with uapi keywork. For example::
>> +
>> + uapi: import VDUSE header file
>
> For the very first import of header lambda.h, ok.
>
> But can we make sure people will do better titles?
> Importing such headers must be done only when needed (maybe put some
> guidelines on this topic in the doc too?), and so the commit title
> should reflect the reason why DPDK needs an update.
> uapi: import awesome VDUSE feature definitions
I agree, I will update the guidelines to reflect this.
>
>
>> +
>> + This patch imports VDUSE uAPI header file.
>> +
>> + uAPI Version: v6.10
>
> uAPI ID ?
Will fix. Prefer version than ID.
>
>> +
>> + Signed-off-by: Alex Smith <alex.smith@example.com>
>> +
>> +Header inclusion into library or driver
>> +---------------------------------------
>> +
>> +The library or driver willing to make use of imported uAPI headers needs to
>> +explicitly add uAPI headers path to the ``includes`` var in its ``meson.build``
>> +file:
>> +
>> +.. code-block:: python
>
> Missing an empty line here.
OK, I think CI reported it.
>
>
>> + includes += linux_uapi_inc
>
> I would rather have this hidden in global_inc meson.build.
Ok, so to make it clear, you would be in favor of having these uAPI
available to all libs and drivers as soon as it is a Linux build.
I'm fine with it, but wanted to make sure other reviewers are aware and
agree. Note that the includes will have to be prefixed with uapi/, so it
will not change the default behaviour for existing linux/ includes
>> +
>> +Then, it can be included with ``uapi/`` prefix in C files. For example to
>> +include VDUSE uAPI:
>> +
>> +.. code-block:: c
>
> Missing an empty line here.
Ack
>
>> + #include <uapi/linux/vduse.h>
>> +
>> diff --git a/meson.build b/meson.build
>> index 8b248d4505..53cdaef558 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -77,6 +77,10 @@ global_inc = include_directories('.', 'config',
>> subdir('buildtools')
>> subdir('config')
>>
>> +if is_linux
>> + linux_uapi_inc = include_directories('linux-headers')
>> +endif
>
> s/linux_uapi_inc/global_inc/.
Ok.
I think I have some materials to post a second revision of the RFC, so
that build failures are fixed.
Thanks,
Maxime
>
>> +
>> # build libs and drivers
>> subdir('lib')
>> subdir('drivers')
>> --
>> 2.46.0
>>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC 1/3] uapi: introduce kernel uAPI headers importation
2024-09-05 22:15 ` [RFC 1/3] uapi: introduce kernel uAPI headers importation Maxime Coquelin
2024-09-06 6:46 ` Morten Brørup
2024-09-06 7:13 ` David Marchand
@ 2024-09-09 0:02 ` Stephen Hemminger
2024-09-09 7:43 ` Maxime Coquelin
2 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2024-09-09 0:02 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: dev, techboard, david.marchand, thomas
On Fri, 6 Sep 2024 00:15:26 +0200
Maxime Coquelin <maxime.coquelin@redhat.com> wrote:
> This patch introduces uAPI headers importation into the
> DPDK repository. This import is possible thanks to Linux
> Kernel licence exception for syscalls:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/LICENSES/exceptions/Linux-syscall-note
>
> Header files are have to be explicitly imported, and
> libraries and drivers have to explicitly enable their
> inclusion.
>
> Guidelines are provided in the documentation, and a helper
> script is also provided to ensure proper importation of the
> header (unmodified content from a released Kernel version).
>
> Next version will introduce a script to check headers are
> valids.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> devtools/import-linux-uapi.sh | 48 ++++++++++++++++++++
> doc/guides/contributing/index.rst | 1 +
> doc/guides/contributing/linux_uapi.rst | 63 ++++++++++++++++++++++++++
> meson.build | 4 ++
> 4 files changed, 116 insertions(+)
> create mode 100755 devtools/import-linux-uapi.sh
> create mode 100644 doc/guides/contributing/linux_uapi.rst
>
> diff --git a/devtools/import-linux-uapi.sh b/devtools/import-linux-uapi.sh
> new file mode 100755
> index 0000000000..efeffdd332
> --- /dev/null
> +++ b/devtools/import-linux-uapi.sh
> @@ -0,0 +1,48 @@
> +#!/bin/sh -e
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright (c) 2024 Red Hat, Inc.
> +
> +#
> +# Import Linux Kernel uAPI header file
> +#
> +
> +base_url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/"
> +base_path="linux-headers/uapi/"
Sorry, not a fan of this.
This must be optional. Most other projects don't do this and it risks
incompatibilities with the C library.
Did you make sure the headers are exactly the same as the distro uses (for the same kernel version).
Worried that this is not the exact same process that "make headers_install" might use.
Also, ideally the tool would be selective.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC 1/3] uapi: introduce kernel uAPI headers importation
2024-09-09 0:02 ` Stephen Hemminger
@ 2024-09-09 7:43 ` Maxime Coquelin
0 siblings, 0 replies; 10+ messages in thread
From: Maxime Coquelin @ 2024-09-09 7:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, techboard, david.marchand, thomas
On 9/9/24 02:02, Stephen Hemminger wrote:
> On Fri, 6 Sep 2024 00:15:26 +0200
> Maxime Coquelin <maxime.coquelin@redhat.com> wrote:
>
>> This patch introduces uAPI headers importation into the
>> DPDK repository. This import is possible thanks to Linux
>> Kernel licence exception for syscalls:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/LICENSES/exceptions/Linux-syscall-note
>>
>> Header files are have to be explicitly imported, and
>> libraries and drivers have to explicitly enable their
>> inclusion.
>>
>> Guidelines are provided in the documentation, and a helper
>> script is also provided to ensure proper importation of the
>> header (unmodified content from a released Kernel version).
>>
>> Next version will introduce a script to check headers are
>> valids.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>> devtools/import-linux-uapi.sh | 48 ++++++++++++++++++++
>> doc/guides/contributing/index.rst | 1 +
>> doc/guides/contributing/linux_uapi.rst | 63 ++++++++++++++++++++++++++
>> meson.build | 4 ++
>> 4 files changed, 116 insertions(+)
>> create mode 100755 devtools/import-linux-uapi.sh
>> create mode 100644 doc/guides/contributing/linux_uapi.rst
>>
>> diff --git a/devtools/import-linux-uapi.sh b/devtools/import-linux-uapi.sh
>> new file mode 100755
>> index 0000000000..efeffdd332
>> --- /dev/null
>> +++ b/devtools/import-linux-uapi.sh
>> @@ -0,0 +1,48 @@
>> +#!/bin/sh -e
>> +# SPDX-License-Identifier: BSD-3-Clause
>> +# Copyright (c) 2024 Red Hat, Inc.
>> +
>> +#
>> +# Import Linux Kernel uAPI header file
>> +#
>> +
>> +base_url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/"
>> +base_path="linux-headers/uapi/"
>
> Sorry, not a fan of this.
>
> This must be optional. Most other projects don't do this and it risks
> incompatibilities with the C library.
QEMU, libgpio at least do this.
Supporting new features is quite a mess in lib Vhost currently, because
we cannot know what is and what is not defined in the build OS headers.
For example:
https://github.com/DPDK/dpdk/blob/main/lib/vhost/vhost.h#L369
>
>
> Did you make sure the headers are exactly the same as the distro uses (for the same kernel version).
> Worried that this is not the exact same process that "make headers_install" might use.
We could have them picked from make headers_install. It would be heavier
to do, but could be done if you see any difference.
>
> Also, ideally the tool would be selective.
>
Selective about what?
Note that this current RFC is too simplistic, it misses nested headers
import. Will try to cover this in nect revision.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-09-09 7:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-05 22:15 [RFC 0/3] Import Kernel uAPI header files Maxime Coquelin
2024-09-05 22:15 ` [RFC 1/3] uapi: introduce kernel uAPI headers importation Maxime Coquelin
2024-09-06 6:46 ` Morten Brørup
2024-09-06 7:01 ` Maxime Coquelin
2024-09-06 7:13 ` David Marchand
2024-09-06 8:29 ` Maxime Coquelin
2024-09-09 0:02 ` Stephen Hemminger
2024-09-09 7:43 ` Maxime Coquelin
2024-09-05 22:15 ` [RFC 2/3] uapi: import VDUSE header Maxime Coquelin
2024-09-05 22:15 ` [RFC 3/3] vduse: use import VDUSE uAPI header Maxime Coquelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).