DPDK patches and discussions
 help / color / mirror / Atom feed
From: Flavio Leitner <fbl@sysclose.org>
To: dpdk <dev@dpdk.org>
Cc: Flavio Leitner <fbl@sysclose.org>
Subject: [dpdk-dev] [PATCH] eal: check cpu flags at init
Date: Fri, 23 Sep 2016 11:47:31 -0300	[thread overview]
Message-ID: <1474642051-9973-1-git-send-email-fbl@sysclose.org> (raw)

An application might be linked to DPDK but not really use it,
so move the cpu flag check to the EAL initialization instead.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
---
 lib/librte_eal/bsdapp/eal/eal.c             | 3 +++
 lib/librte_eal/common/eal_common_cpuflags.c | 6 ------
 lib/librte_eal/linuxapp/eal/eal.c           | 3 +++
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index a0c8f8c..c4b22af 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -496,6 +496,9 @@ rte_eal_init(int argc, char **argv)
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 	char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
+	/* checks if the machine is adequate */
+	rte_cpu_check_supported();
+
 	if (!rte_atomic32_test_and_set(&run_once))
 		return -1;
 
diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c
index ecb1240..b5f76f7 100644
--- a/lib/librte_eal/common/eal_common_cpuflags.c
+++ b/lib/librte_eal/common/eal_common_cpuflags.c
@@ -39,14 +39,8 @@
 /**
  * Checks if the machine is adequate for running the binary. If it is not, the
  * program exits with status 1.
- * The function attribute forces this function to be called before main(). But
- * with ICC, the check is generated by the compiler.
  */
-#ifndef __INTEL_COMPILER
-void __attribute__ ((__constructor__))
-#else
 void
-#endif
 rte_cpu_check_supported(void)
 {
 	/* This is generated at compile-time by the build system */
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d5b81a3..4e88cfc 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -740,6 +740,9 @@ rte_eal_init(int argc, char **argv)
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 	char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
+	/* checks if the machine is adequate */
+	rte_cpu_check_supported();
+
 	if (!rte_atomic32_test_and_set(&run_once))
 		return -1;
 
-- 
2.7.4

             reply	other threads:[~2016-09-23 14:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 14:47 Flavio Leitner [this message]
2016-09-26 15:43 ` Aaron Conole
2016-09-27 18:32   ` Flavio Leitner
2016-09-29 20:42     ` Aaron Conole
2016-10-03 14:13       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474642051-9973-1-git-send-email-fbl@sysclose.org \
    --to=fbl@sysclose.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).