DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: check coremask against detected lcores
@ 2014-04-15 13:50 David Marchand
  2014-04-15 13:57 ` Neil Horman
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2014-04-15 13:50 UTC (permalink / raw)
  To: dev

lcores that are set in coremask should be checked against lcores detected on
system. This way, we won't need to check them later.

Besides, if specifying an unavailable lcore, we currently panic in
eal_thread_loop() because pthread_setaffinity_np fails.
So this check will return an error with a more explicit message in
eal_parse_coremask().

"EAL: pthread_setaffinity_np failed
 PANIC in eal_thread_loop():
 cannot set affinity"

becomes :

"EAL: lcore 4 unavailable
 EAL: invalid coremask"

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d2753ec..04b2b32 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -441,6 +441,11 @@ eal_parse_coremask(const char *coremask)
 		val = xdigit2val(c);
 		for(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {
 			if((1 << j) & val) {
+				if (!lcore_config[idx].detected) {
+					RTE_LOG(ERR, EAL, "lcore %u "
+					        "unavailable\n", idx);
+					return -1;
+				}
 				cfg->lcore_role[idx] = ROLE_RTE;
 				if(count == 0)
 					cfg->master_lcore = idx;
-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: check coremask against detected lcores
  2014-04-15 13:50 [dpdk-dev] [PATCH] eal: check coremask against detected lcores David Marchand
@ 2014-04-15 13:57 ` Neil Horman
  2014-04-17 22:43   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Horman @ 2014-04-15 13:57 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Tue, Apr 15, 2014 at 03:50:42PM +0200, David Marchand wrote:
> lcores that are set in coremask should be checked against lcores detected on
> system. This way, we won't need to check them later.
> 
> Besides, if specifying an unavailable lcore, we currently panic in
> eal_thread_loop() because pthread_setaffinity_np fails.
> So this check will return an error with a more explicit message in
> eal_parse_coremask().
> 
> "EAL: pthread_setaffinity_np failed
>  PANIC in eal_thread_loop():
>  cannot set affinity"
> 
> becomes :
> 
> "EAL: lcore 4 unavailable
>  EAL: invalid coremask"
> 
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index d2753ec..04b2b32 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -441,6 +441,11 @@ eal_parse_coremask(const char *coremask)
>  		val = xdigit2val(c);
>  		for(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {
>  			if((1 << j) & val) {
> +				if (!lcore_config[idx].detected) {
> +					RTE_LOG(ERR, EAL, "lcore %u "
> +					        "unavailable\n", idx);
> +					return -1;
> +				}
>  				cfg->lcore_role[idx] = ROLE_RTE;
>  				if(count == 0)
>  					cfg->master_lcore = idx;
> -- 
> 1.7.10.4
> 
> 

Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: check coremask against detected lcores
  2014-04-15 13:57 ` Neil Horman
@ 2014-04-17 22:43   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2014-04-17 22:43 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

> > lcores that are set in coremask should be checked against lcores detected
> > on system. This way, we won't need to check them later.
> > 
> > Besides, if specifying an unavailable lcore, we currently panic in
> > eal_thread_loop() because pthread_setaffinity_np fails.
> > So this check will return an error with a more explicit message in
> > eal_parse_coremask().
> > 
> > "EAL: pthread_setaffinity_np failed
> > 
> >  PANIC in eal_thread_loop():
> >  cannot set affinity"
> > 
> > becomes :
> > 
> > "EAL: lcore 4 unavailable
> > 
> >  EAL: invalid coremask"
> > 
> > Signed-off-by: David Marchand <david.marchand@6wind.com>
> 
> Acked-by: Neil Horman <nhorman@tuxdriver.com>

Applied for version 1.6.0r2.

Thanks for this nice usability improvement
-- 
Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-17 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 13:50 [dpdk-dev] [PATCH] eal: check coremask against detected lcores David Marchand
2014-04-15 13:57 ` Neil Horman
2014-04-17 22:43   ` Thomas Monjalon

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).