From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5623FA00C5; Mon, 6 Jul 2020 16:18:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4187F1DB18; Mon, 6 Jul 2020 16:17:22 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id CA4B71DB18 for ; Mon, 6 Jul 2020 16:17:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594045039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=70TKtDuw7y+3lqLceIwuzDCQkVBmrGBx9BeUkr95NGo=; b=JtDaFua7LazGv2ZyKEPvsj5GPz38QgQ3fu0MiG9myoqqLxOk+XbQ9Gfm1DNJgjtPXBHvju Mm8G7mw3+zf630j2X4S3wRf0ByJGJYgxDe2bYlcnXxkyQRIwCeJ+I6Mdnl85sNVQ9gtJ+w Sm5XnUA2RhJAsDhx1tvbwrog/Kd9OP4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-CwfB6ojdPyWZHRRmNCdx-A-1; Mon, 06 Jul 2020 10:17:17 -0400 X-MC-Unique: CwfB6ojdPyWZHRRmNCdx-A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C5DD805729; Mon, 6 Jul 2020 14:17:15 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.195.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CBC75C298; Mon, 6 Jul 2020 14:17:10 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: jerinjacobk@gmail.com, bruce.richardson@intel.com, mdr@ashroe.eu, thomas@monjalon.net, arybchenko@solarflare.com, ktraynor@redhat.com, ian.stokes@intel.com, i.maximets@ovn.org, olivier.matz@6wind.com, konstantin.ananyev@intel.com, Anatoly Burakov , Neil Horman Date: Mon, 6 Jul 2020 16:16:06 +0200 Message-Id: <20200706141606.32134-11-david.marchand@redhat.com> In-Reply-To: <20200706141606.32134-1-david.marchand@redhat.com> References: <20200610144506.30505-1-david.marchand@redhat.com> <20200706141606.32134-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 10/10] eal: add multiprocess disable API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The multiprocess feature has been implicitly enabled so far. Applications might want to explicitly disable like when using with the non-EAL registering API. Signed-off-by: David Marchand --- app/test/test_mp_secondary.c | 7 +++++++ lib/librte_eal/common/eal_common_proc.c | 4 ++-- lib/librte_eal/common/eal_common_thread.c | 2 +- lib/librte_eal/common/eal_private.h | 5 ----- lib/librte_eal/include/rte_eal.h | 14 ++++++++++++++ lib/librte_eal/rte_eal_version.map | 1 + 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c index ac15ddbf20..3a655c3400 100644 --- a/app/test/test_mp_secondary.c +++ b/app/test/test_mp_secondary.c @@ -97,6 +97,13 @@ run_secondary_instances(void) (1 << rte_get_master_lcore())); ret |= launch_proc(argv1); + printf("### Testing rte_mp_disable() reject:\n"); + if (rte_mp_disable()) { + printf("Error: rte_mp_disable() has been accepted\n"); + ret |= -1; + } else { + printf("# Checked rte_mp_disable() is refused\n"); + } ret |= launch_proc(argv2); ret |= !(launch_proc(argv3)); diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index f0cf2b65d2..d35b9c0380 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -1236,7 +1236,7 @@ rte_mp_reply(struct rte_mp_msg *msg, const char *peer) /* 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_(dis|en)able yet, + * and there was no call to rte_mp_disable yet, * - "enabled" as soon as a secondary process attaches to a primary process, * - "disabled" when a primary process successfully called rte_mp_disable, */ @@ -1263,7 +1263,7 @@ set_mp_status(enum mp_status status) } bool -eal_disable_multiprocess(void) +rte_mp_disable(void) { return set_mp_status(MP_STATUS_DISABLED); } diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c index ea09a4f3e0..73a055902a 100644 --- a/lib/librte_eal/common/eal_common_thread.c +++ b/lib/librte_eal/common/eal_common_thread.c @@ -261,7 +261,7 @@ rte_thread_register(void) rte_errno = EINVAL; return -1; } - if (!eal_disable_multiprocess()) { + if (!rte_mp_disable()) { RTE_LOG(ERR, EAL, "Multiprocess in use, registering non-EAL threads is not supported.\n"); rte_errno = EINVAL; return -1; diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 535e008474..a917727e41 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -733,11 +733,6 @@ void __rte_thread_init(unsigned int lcore_id, rte_cpuset_t *cpuset); */ void __rte_thread_uninit(void); -/** - * Mark primary process as not supporting multi-process. - */ -bool eal_disable_multiprocess(void); - /** * Instruct primary process that a secondary process wants to attach. */ diff --git a/lib/librte_eal/include/rte_eal.h b/lib/librte_eal/include/rte_eal.h index 0913d1947c..fc7db2d427 100644 --- a/lib/librte_eal/include/rte_eal.h +++ b/lib/librte_eal/include/rte_eal.h @@ -151,6 +151,20 @@ int rte_eal_cleanup(void); */ int rte_eal_primary_proc_alive(const char *config_file_path); +/** + * Disable multiprocess. + * + * This function can be called to indicate that multiprocess won't be used for + * the rest of the application life. + * + * @return + * - true if called from a primary process that had no secondary processes + * attached, + * - false, otherwise. + */ +__rte_experimental +bool rte_mp_disable(void); + #define RTE_MP_MAX_FD_NUM 8 /* The max amount of fds */ #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 */ diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 3aeb5b11ab..d17f13f8d3 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -399,6 +399,7 @@ EXPERIMENTAL { rte_lcore_callback_unregister; rte_lcore_dump; rte_lcore_iterate; + rte_mp_disable; rte_thread_register; rte_thread_unregister; }; -- 2.23.0