From patchwork Fri Mar 8 18:54:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 138134 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 54B7A43C27; Fri, 8 Mar 2024 19:54:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 230CB40291; Fri, 8 Mar 2024 19:54:14 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id 186B140274 for ; Fri, 8 Mar 2024 19:54:11 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1dc49b00bdbso8880955ad.3 for ; Fri, 08 Mar 2024 10:54:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709924051; x=1710528851; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OY6aA25f7jYng9ic0KvwPD2F/MMEGQBFE/PrMqVH3cU=; b=UkbLeI1QuBIhflzQIePyZbE+xpUfl0jCmXzUiaUtp87XvVgTrSkf5tyvUQNIAjo+w0 ZCloNhw1dIOnmi7yYBLMMUqjBJ/7uOA3PGHbfVBnKRpeRH8r9GUkEy9BWBULBFrybvi4 +xMJDm7k3D4jffjClv6ss9oM2kZNWrsjyS+9KvJra1X+JjaVwRnYbPaLhrf1HKUlDmTI 9ETQPA2t498g6IdFUaVmrqaYNZN8jyRLD01KLb27LkYHNmwdsimKVFl1pvXBN9ITLy+E bn0iOnKMHueqLqgU0INs10JZ1RSKcm+ofpsKqdjxCVVaryPzNsz16mKo46HAEWdEO1M6 2P2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709924051; x=1710528851; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OY6aA25f7jYng9ic0KvwPD2F/MMEGQBFE/PrMqVH3cU=; b=BO/2APultCl2MEbmsOw0m32ztcCVarnwEGhsmBdfqJlyltsixG/IOn3+NhGtA4SEzU wZEeVyiUbfdeBXmnqlNEdlaUd2gylD6u+MJOw8ag1mJr1lV0JDfNdcjjdjGlohmD7RYi L6NmNy01qBFrRC3t/zOtbRPnxvHlh8skjne11m0EXkvXHqpDnLisTjKX+qdXKXuGq1A+ RKScEenBqWou2GDLW5GkZdecoXQ0joIIq6SbZ1wTmTDC+Xkb8Kcn/395wZMZZTc729ms zdrTd3MDwfrUjYMDgGk6T26pbuu2WJtJDz1pe9y+LDlEgY7Myybt9OX3GtOf6DmurZqD bNgQ== X-Gm-Message-State: AOJu0YyllvcXRfLbXlC3EEcDI++CCFbn4XARjmcIIkgbf62wkMiR1qgE 0C+Xb1AD6ZjGcdNFukNvcy7mLDJaQbyPy1cgfugENU8F/+QtRb9GaGNYTGmOgvsUWepmRHG6lG+ hP80= X-Google-Smtp-Source: AGHT+IFgzUPNyerf+A69xSlb3q5Q+MGvl3dPR3OBMIVBPupFzM9xsfbrmTNUzPLJHGnS+dQXb3IacA== X-Received: by 2002:a17:902:7847:b0:1dd:6174:c63e with SMTP id e7-20020a170902784700b001dd6174c63emr3525892pln.54.1709924050964; Fri, 08 Mar 2024 10:54:10 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id jb5-20020a170903258500b001dcc29b985csm16649672plb.134.2024.03.08.10.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 10:54:10 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov Subject: [RFC] eal: increase the number of availble file descriptors for MP Date: Fri, 8 Mar 2024 10:54:01 -0800 Message-ID: <20240308185401.150651-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The current limit of file descriptors is too low, it should have been set to the maximum possible to send across an unix domain socket. This is an attempt to allow increasing it without breaking ABI. But in the process it exposes what is broken about how symbol versions are checked in check-symbol-maps.sh. That script is broken in that it won't allow adding a backwards compatiable version hook like this. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_proc.c | 118 ++++++++++++++++++++++++++----- lib/eal/common/meson.build | 2 + lib/eal/include/rte_eal.h | 13 +++- lib/eal/version.map | 9 +++ 4 files changed, 125 insertions(+), 17 deletions(-) diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c index d24093937c1d..c08113a8d9e0 100644 --- a/lib/eal/common/eal_common_proc.c +++ b/lib/eal/common/eal_common_proc.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "eal_memcfg.h" #include "eal_private.h" @@ -796,7 +797,7 @@ mp_send(struct rte_mp_msg *msg, const char *peer, int type) } static int -check_input(const struct rte_mp_msg *msg) +check_input(const struct rte_mp_msg *msg, int max_fd) { if (msg == NULL) { EAL_LOG(ERR, "Msg cannot be NULL"); @@ -825,9 +826,8 @@ check_input(const struct rte_mp_msg *msg) return -1; } - if (msg->num_fds > RTE_MP_MAX_FD_NUM) { - EAL_LOG(ERR, "Cannot send more than %d FDs", - RTE_MP_MAX_FD_NUM); + if (msg->num_fds > max_fd) { + EAL_LOG(ERR, "Cannot send more than %d FDs", max_fd); rte_errno = E2BIG; return -1; } @@ -835,13 +835,13 @@ check_input(const struct rte_mp_msg *msg) return 0; } -int -rte_mp_sendmsg(struct rte_mp_msg *msg) +static int +mp_sendmsg(struct rte_mp_msg *msg, int max_fd) { const struct internal_config *internal_conf = eal_get_internal_configuration(); - if (check_input(msg) != 0) + if (check_input(msg, max_fd) != 0) return -1; if (internal_conf->no_shconf) { @@ -854,6 +854,24 @@ rte_mp_sendmsg(struct rte_mp_msg *msg) return mp_send(msg, NULL, MP_MSG); } +int rte_mp_sendmsg_V23(struct rte_mp_old_msg *msg); +int rte_mp_sendmsg_V24(struct rte_mp_msg *msg); + +int +rte_mp_sendmsg_V23(struct rte_mp_old_msg *omsg) +{ + return mp_sendmsg((struct rte_mp_msg *)omsg, RTE_MP_MAX_OLD_FD_NUM); +} +VERSION_SYMBOL(rte_mp_sendmsg, _V23, 23); + +int +rte_mp_sendmsg_V24(struct rte_mp_msg *msg) +{ + return mp_sendmsg(msg, RTE_MP_MAX_FD_NUM); +} +BIND_DEFAULT_SYMBOL(rte_mp_sendmsg, _V24, 24); +MAP_STATIC_SYMBOL(int rte_mp_sendmsg(struct rte_mp_msg *msg), rte_mp_sendmsg_V24); + static int mp_request_async(const char *dst, struct rte_mp_msg *req, struct async_request_param *param, const struct timespec *ts) @@ -988,9 +1006,9 @@ mp_request_sync(const char *dst, struct rte_mp_msg *req, return 0; } -int -rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, - const struct timespec *ts) +static int +__rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, + const struct timespec *ts, int max_fd) { int dir_fd, ret = -1; DIR *mp_dir; @@ -1005,7 +1023,7 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, reply->nb_received = 0; reply->msgs = NULL; - if (check_input(req) != 0) + if (check_input(req, max_fd) != 0) goto end; if (internal_conf->no_shconf) { @@ -1085,9 +1103,34 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, return ret; } +int rte_mp_request_sync_V23(struct rte_mp_old_msg *req, struct rte_mp_reply *reply, + const struct timespec *ts); +int rte_mp_request_sync_V24(struct rte_mp_msg *req, struct rte_mp_reply *reply, + const struct timespec *ts); + + +int +rte_mp_request_sync_V23(struct rte_mp_old_msg *req, struct rte_mp_reply *reply, + const struct timespec *ts) +{ + return __rte_mp_request_sync((struct rte_mp_msg *)req, reply, ts, RTE_MP_MAX_OLD_FD_NUM); +} +VERSION_SYMBOL(rte_mp_request_sync, _V23, 23); + int -rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, - rte_mp_async_reply_t clb) +rte_mp_request_sync_V24(struct rte_mp_msg *req, struct rte_mp_reply *reply, + const struct timespec *ts) +{ + return __rte_mp_request_sync(req, reply, ts, RTE_MP_MAX_FD_NUM); +} +BIND_DEFAULT_SYMBOL(rte_mp_request_sync, _V24, 24); +MAP_STATIC_SYMBOL(int rte_mp_request_sync(struct rte_mp_msg *req, \ + struct rte_mp_reply *reply, \ + const struct timespec *ts), rte_mp_request_sync_V24); + +static int +__rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, + rte_mp_async_reply_t clb, int max_fd) { struct rte_mp_msg *copy; struct pending_request *dummy; @@ -1104,7 +1147,7 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, EAL_LOG(DEBUG, "request: %s", req->name); - if (check_input(req) != 0) + if (check_input(req, max_fd) != 0) return -1; if (internal_conf->no_shconf) { @@ -1237,14 +1280,38 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, return -1; } +int rte_mp_request_async_V23(struct rte_mp_old_msg *req, const struct timespec *ts, + rte_mp_async_reply_t clb); +int rte_mp_request_async_V24(struct rte_mp_msg *req, const struct timespec *ts, + rte_mp_async_reply_t clb); + int -rte_mp_reply(struct rte_mp_msg *msg, const char *peer) +rte_mp_request_async_V23(struct rte_mp_old_msg *req, const struct timespec *ts, + rte_mp_async_reply_t clb) +{ + return __rte_mp_request_async((struct rte_mp_msg *)req, ts, clb, RTE_MP_MAX_OLD_FD_NUM); +} +VERSION_SYMBOL(rte_mp_request_async, _V23, 23); + +int +rte_mp_request_async_V24(struct rte_mp_msg *req, const struct timespec *ts, + rte_mp_async_reply_t clb) +{ + return __rte_mp_request_async(req, ts, clb, RTE_MP_MAX_FD_NUM); +} +BIND_DEFAULT_SYMBOL(rte_mp_request_async, _V24, 24); +MAP_STATIC_SYMBOL(int rte_mp_request_async(struct rte_mp_msg *req, \ + const struct timespec *ts, \ + rte_mp_async_reply_t clb), rte_mp_request_async_V24); + +static int +mp_reply(struct rte_mp_msg *msg, const char *peer, int max_fd) { EAL_LOG(DEBUG, "reply: %s", msg->name); const struct internal_config *internal_conf = eal_get_internal_configuration(); - if (check_input(msg) != 0) + if (check_input(msg, max_fd) != 0) return -1; if (peer == NULL) { @@ -1261,6 +1328,25 @@ rte_mp_reply(struct rte_mp_msg *msg, const char *peer) return mp_send(msg, peer, MP_REP); } +int rte_mp_reply_V23(struct rte_mp_old_msg *msg, const char *peer); +int rte_mp_reply_V24(struct rte_mp_msg *msg, const char *peer); + +int +rte_mp_reply_V23(struct rte_mp_old_msg *msg, const char *peer) +{ + return mp_reply((struct rte_mp_msg *)msg, peer, RTE_MP_MAX_OLD_FD_NUM); +} +VERSION_SYMBOL(rte_mp_reply, _V23, 23); + +int +rte_mp_reply_V24(struct rte_mp_msg *msg, const char *peer) +{ + return mp_reply(msg, peer, RTE_MP_MAX_FD_NUM); +} +BIND_DEFAULT_SYMBOL(rte_mp_reply, _V24, 24); +MAP_STATIC_SYMBOL(int rte_mp_reply(struct rte_mp_msg *msg, const char *peer), rte_mp_reply_V24); + + /* Internally, the status of the mp feature is represented as a three-state: * - "unknown" as long as no secondary process attached to a primary process * and there was no call to rte_mp_disable yet, diff --git a/lib/eal/common/meson.build b/lib/eal/common/meson.build index 22a626ba6fc7..3faf0c20e798 100644 --- a/lib/eal/common/meson.build +++ b/lib/eal/common/meson.build @@ -3,6 +3,8 @@ includes += include_directories('.') +use_function_versioning = true + cflags += [ '-DABI_VERSION="@0@"'.format(abi_version) ] sources += files( diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h index c2256f832e51..0d0761c50409 100644 --- a/lib/eal/include/rte_eal.h +++ b/lib/eal/include/rte_eal.h @@ -155,9 +155,10 @@ int rte_eal_primary_proc_alive(const char *config_file_path); */ bool rte_mp_disable(void); -#define RTE_MP_MAX_FD_NUM 8 /* The max amount of fds */ +#define RTE_MP_MAX_FD_NUM 253 /* The max number of fds (SCM_MAX_FD) */ #define RTE_MP_MAX_NAME_LEN 64 /* The max length of action name */ #define RTE_MP_MAX_PARAM_LEN 256 /* The max length of param */ + struct rte_mp_msg { char name[RTE_MP_MAX_NAME_LEN]; int len_param; @@ -166,6 +167,16 @@ struct rte_mp_msg { int fds[RTE_MP_MAX_FD_NUM]; }; +/* Legacy API version */ +#define RTE_MP_MAX_OLD_FD_NUM 8 /* The legacy limit on fds */ +struct rte_mp_old_msg { + char name[RTE_MP_MAX_NAME_LEN]; + int len_param; + int num_fds; + uint8_t param[RTE_MP_MAX_PARAM_LEN]; + int fds[RTE_MP_MAX_OLD_FD_NUM]; +}; + struct rte_mp_reply { int nb_sent; int nb_received; diff --git a/lib/eal/version.map b/lib/eal/version.map index c06ceaad5097..264ff2d0818b 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -344,6 +344,15 @@ DPDK_24 { local: *; }; +DPDK_23 { + global: + + rte_mp_reply; + rte_mp_request_async; + rte_mp_request_sync; + rte_mp_sendmsg; +} DPDK_24; + EXPERIMENTAL { global: