test: fix option block

Message ID 20240314094626.1068059-1-mingjinx.ye@intel.com (mailing list archive)
State Changes Requested
Delegated to: Thomas Monjalon
Headers
Series test: fix option block |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Mingjin Ye March 14, 2024, 9:46 a.m. UTC
The options allow (-a) and block (-b) cannot be used at the same time.
Therefore, allow (-a) will not be added when block (-b) is present.

Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
Cc: stable@dpdk.org

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
 app/test/process.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
  

Comments

Jiale, SongX March 15, 2024, 6:49 a.m. UTC | #1
> -----Original Message-----
> From: Mingjin Ye <mingjinx.ye@intel.com>
> Sent: Thursday, March 14, 2024 5:46 PM
> To: dev@dpdk.org
> Cc: Ye, MingjinX <mingjinx.ye@intel.com>; stable@dpdk.org
> Subject: [PATCH] test: fix option block
> 
> The options allow (-a) and block (-b) cannot be used at the same time.
> Therefore, allow (-a) will not be added when block (-b) is present.
> 
> Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> ---

Tested-by: Jiale Song <songx.jiale@intel.com>
  
Stokes, Ian July 3, 2024, 2:35 p.m. UTC | #2
> > The options allow (-a) and block (-b) cannot be used at the same time.
> > Therefore, allow (-a) will not be added when block (-b) is present.
> >
> > Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>

Hi Mingjin, in general the patch looks ok to me.

A general question of the behaviour of block and allow, is it always the case that the two are not allowed to be used side by side?
I had a look through the EAL documentation and didn't see and mention of this behaviour, but maybe I missed it?

Thanks
ian
> > ---
> >  app/test/process.h | 17 ++++++++++++++---
> >  1 file changed, 14 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test/process.h b/app/test/process.h index
> > 9fb2bf481c..388c7975cd 100644
> > --- a/app/test/process.h
> > +++ b/app/test/process.h
> > @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int max_capacity)
> >  	int count = 0;
> >
> >  	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
> > -		if (strlen(devargs->name) == 0)
> > +		if (strlen(devargs->name) == 0 || devargs->type !=
> > +RTE_DEVTYPE_ALLOWED)
> >  			continue;
> >
> >  		if (devargs->data == NULL || strlen(devargs->data) == 0)
> > { @@ -74,7 +74,7 @@ process_dup(const char *const argv[], int numargs,
> > const char *env_value)  {
> >  	int num = 0;
> >  	char **argv_cpy;
> > -	int allow_num;
> > +	int allow_num, block_num;
> >  	int argv_num;
> >  	int i, status;
> >  	char path[32];
> > @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int numargs,
> > const char *env_value)
> >  	if (pid < 0)
> >  		return -1;
> >  	else if (pid == 0) {
> > -		allow_num =
> > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > +		allow_num = 0;
> > +		block_num = 0;
> > +
> > +		/* If block (-b) is present, allow (-a) is not added. */
> > +		for (i = 0; i < numargs; i++) {
> > +			if (strcmp(argv[i], "-b") == 0 ||
> > +			    strcmp(argv[i], "-block") == 0)
> > +				block_num++;
> > +		}
> > +		if (!block_num)
> > +			allow_num =
> > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > +
> >  		argv_num = numargs + allow_num + 1;
> >  		argv_cpy = calloc(argv_num, sizeof(char *));
> >  		if (!argv_cpy)
> > --
> > 2.25.1
  
Mingjin Ye July 4, 2024, 8:09 a.m. UTC | #3
> -----Original Message-----
> From: Stokes, Ian <ian.stokes@intel.com>
> Sent: Wednesday, July 3, 2024 10:35 PM
> To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> Subject: [PATCH] test: fix option block
> 
> > > The options allow (-a) and block (-b) cannot be used at the same time.
> > > Therefore, allow (-a) will not be added when block (-b) is present.
> > >
> > > Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> 
> Hi Mingjin, in general the patch looks ok to me.
> 
> A general question of the behaviour of block and allow, is it always the case
> that the two are not allowed to be used side by side?
Both cannot be used at the same time.

> I had a look through the EAL documentation and didn't see and mention of
> this behaviour, but maybe I missed it?
The "eal_common_usage" function has a clear description, see below: lib/eal/common/eal_common_options.c:2206
> 
> Thanks
> ian
> > > ---
> > >  app/test/process.h | 17 ++++++++++++++---
> > >  1 file changed, 14 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/app/test/process.h b/app/test/process.h index
> > > 9fb2bf481c..388c7975cd 100644
> > > --- a/app/test/process.h
> > > +++ b/app/test/process.h
> > > @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int max_capacity)
> > >  	int count = 0;
> > >
> > >  	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
> > > -		if (strlen(devargs->name) == 0)
> > > +		if (strlen(devargs->name) == 0 || devargs->type !=
> > > +RTE_DEVTYPE_ALLOWED)
> > >  			continue;
> > >
> > >  		if (devargs->data == NULL || strlen(devargs->data) == 0)
> { @@
> > > -74,7 +74,7 @@ process_dup(const char *const argv[], int numargs,
> > > const char *env_value)  {
> > >  	int num = 0;
> > >  	char **argv_cpy;
> > > -	int allow_num;
> > > +	int allow_num, block_num;
> > >  	int argv_num;
> > >  	int i, status;
> > >  	char path[32];
> > > @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int
> > > numargs, const char *env_value)
> > >  	if (pid < 0)
> > >  		return -1;
> > >  	else if (pid == 0) {
> > > -		allow_num =
> > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > +		allow_num = 0;
> > > +		block_num = 0;
> > > +
> > > +		/* If block (-b) is present, allow (-a) is not added. */
> > > +		for (i = 0; i < numargs; i++) {
> > > +			if (strcmp(argv[i], "-b") == 0 ||
> > > +			    strcmp(argv[i], "-block") == 0)
> > > +				block_num++;
> > > +		}
> > > +		if (!block_num)
> > > +			allow_num =
> > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > +
> > >  		argv_num = numargs + allow_num + 1;
> > >  		argv_cpy = calloc(argv_num, sizeof(char *));
> > >  		if (!argv_cpy)
> > > --
> > > 2.25.1
  
Stokes, Ian July 4, 2024, 12:02 p.m. UTC | #4
> > -----Original Message-----
> > From: Stokes, Ian <ian.stokes@intel.com>
> > Sent: Wednesday, July 3, 2024 10:35 PM
> > To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> > Subject: [PATCH] test: fix option block
> >
> > > > The options allow (-a) and block (-b) cannot be used at the same time.
> > > > Therefore, allow (-a) will not be added when block (-b) is present.
> > > >
> > > > Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> >
> > Hi Mingjin, in general the patch looks ok to me.
> >
> > A general question of the behaviour of block and allow, is it always the case
> > that the two are not allowed to be used side by side?
> Both cannot be used at the same time.
> 
> > I had a look through the EAL documentation and didn't see and mention of
> > this behaviour, but maybe I missed it?
> The "eal_common_usage" function has a clear description, see below:
> lib/eal/common/eal_common_options.c:2206

I understand that, but that is a comment in code, I think the behaviour is worthy of being called out in documentation API too for usability factors.

Thanks
Ian

> >
> > Thanks
> > ian
> > > > ---
> > > >  app/test/process.h | 17 ++++++++++++++---
> > > >  1 file changed, 14 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/app/test/process.h b/app/test/process.h index
> > > > 9fb2bf481c..388c7975cd 100644
> > > > --- a/app/test/process.h
> > > > +++ b/app/test/process.h
> > > > @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int
> max_capacity)
> > > >  	int count = 0;
> > > >
> > > >  	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
> > > > -		if (strlen(devargs->name) == 0)
> > > > +		if (strlen(devargs->name) == 0 || devargs->type !=
> > > > +RTE_DEVTYPE_ALLOWED)
> > > >  			continue;
> > > >
> > > >  		if (devargs->data == NULL || strlen(devargs->data) == 0)
> > { @@
> > > > -74,7 +74,7 @@ process_dup(const char *const argv[], int numargs,
> > > > const char *env_value)  {
> > > >  	int num = 0;
> > > >  	char **argv_cpy;
> > > > -	int allow_num;
> > > > +	int allow_num, block_num;
> > > >  	int argv_num;
> > > >  	int i, status;
> > > >  	char path[32];
> > > > @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int
> > > > numargs, const char *env_value)
> > > >  	if (pid < 0)
> > > >  		return -1;
> > > >  	else if (pid == 0) {
> > > > -		allow_num =
> > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > +		allow_num = 0;
> > > > +		block_num = 0;
> > > > +
> > > > +		/* If block (-b) is present, allow (-a) is not added. */
> > > > +		for (i = 0; i < numargs; i++) {
> > > > +			if (strcmp(argv[i], "-b") == 0 ||
> > > > +			    strcmp(argv[i], "-block") == 0)
> > > > +				block_num++;
> > > > +		}
> > > > +		if (!block_num)
> > > > +			allow_num =
> > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > +
> > > >  		argv_num = numargs + allow_num + 1;
> > > >  		argv_cpy = calloc(argv_num, sizeof(char *));
> > > >  		if (!argv_cpy)
> > > > --
> > > > 2.25.1
  
Mingjin Ye July 5, 2024, 1:38 a.m. UTC | #5
> -----Original Message-----
> From: Stokes, Ian <ian.stokes@intel.com>
> Sent: Thursday, July 4, 2024 8:02 PM
> To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> Subject: RE: [PATCH] test: fix option block
> 
> > > -----Original Message-----
> > > From: Stokes, Ian <ian.stokes@intel.com>
> > > Sent: Wednesday, July 3, 2024 10:35 PM
> > > To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> > > Subject: [PATCH] test: fix option block
> > >
> > > > > The options allow (-a) and block (-b) cannot be used at the same time.
> > > > > Therefore, allow (-a) will not be added when block (-b) is present.
> > > > >
> > > > > Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> > > > > Cc: stable@dpdk.org
> > > > >
> > > > > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> > >
> > > Hi Mingjin, in general the patch looks ok to me.
> > >
> > > A general question of the behaviour of block and allow, is it always
> > > the case that the two are not allowed to be used side by side?
> > Both cannot be used at the same time.
> >
> > > I had a look through the EAL documentation and didn't see and
> > > mention of this behaviour, but maybe I missed it?
> > The "eal_common_usage" function has a clear description, see below:
> > lib/eal/common/eal_common_options.c:2206
> 
> I understand that, but that is a comment in code, I think the behaviour is
> worthy of being called out in documentation API too for usability factors.
Sorry for not providing complete information. There is processing logic in "eal_parse_common_option".
Unsatisfied condition outputs "Options allow (-a) and block (-b) can't be used at the same time".

> 
> Thanks
> Ian
> 
> > >
> > > Thanks
> > > ian
> > > > > ---
> > > > >  app/test/process.h | 17 ++++++++++++++---
> > > > >  1 file changed, 14 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/app/test/process.h b/app/test/process.h index
> > > > > 9fb2bf481c..388c7975cd 100644
> > > > > --- a/app/test/process.h
> > > > > +++ b/app/test/process.h
> > > > > @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int
> > max_capacity)
> > > > >  	int count = 0;
> > > > >
> > > > >  	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
> > > > > -		if (strlen(devargs->name) == 0)
> > > > > +		if (strlen(devargs->name) == 0 || devargs->type !=
> > > > > +RTE_DEVTYPE_ALLOWED)
> > > > >  			continue;
> > > > >
> > > > >  		if (devargs->data == NULL || strlen(devargs->data)
> == 0)
> > > { @@
> > > > > -74,7 +74,7 @@ process_dup(const char *const argv[], int
> > > > > numargs, const char *env_value)  {
> > > > >  	int num = 0;
> > > > >  	char **argv_cpy;
> > > > > -	int allow_num;
> > > > > +	int allow_num, block_num;
> > > > >  	int argv_num;
> > > > >  	int i, status;
> > > > >  	char path[32];
> > > > > @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int
> > > > > numargs, const char *env_value)
> > > > >  	if (pid < 0)
> > > > >  		return -1;
> > > > >  	else if (pid == 0) {
> > > > > -		allow_num =
> > > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > > +		allow_num = 0;
> > > > > +		block_num = 0;
> > > > > +
> > > > > +		/* If block (-b) is present, allow (-a) is not added. */
> > > > > +		for (i = 0; i < numargs; i++) {
> > > > > +			if (strcmp(argv[i], "-b") == 0 ||
> > > > > +			    strcmp(argv[i], "-block") == 0)
> > > > > +				block_num++;
> > > > > +		}
> > > > > +		if (!block_num)
> > > > > +			allow_num =
> > > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > > +
> > > > >  		argv_num = numargs + allow_num + 1;
> > > > >  		argv_cpy = calloc(argv_num, sizeof(char *));
> > > > >  		if (!argv_cpy)
> > > > > --
> > > > > 2.25.1
  
Stokes, Ian July 10, 2024, 9:02 a.m. UTC | #6
> -----Original Message-----
> From: Ye, MingjinX <mingjinx.ye@intel.com>
> Sent: Friday, July 5, 2024 2:39 AM
> To: Stokes, Ian <ian.stokes@intel.com>; dev@dpdk.org
> Subject: RE: [PATCH] test: fix option block
> 
> 
> 
> > -----Original Message-----
> > From: Stokes, Ian <ian.stokes@intel.com>
> > Sent: Thursday, July 4, 2024 8:02 PM
> > To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> > Subject: RE: [PATCH] test: fix option block
> >
> > > > -----Original Message-----
> > > > From: Stokes, Ian <ian.stokes@intel.com>
> > > > Sent: Wednesday, July 3, 2024 10:35 PM
> > > > To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> > > > Subject: [PATCH] test: fix option block
> > > >
> > > > > > The options allow (-a) and block (-b) cannot be used at the same time.
> > > > > > Therefore, allow (-a) will not be added when block (-b) is present.
> > > > > >
> > > > > > Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> > > > > > Cc: stable@dpdk.org
> > > > > >
> > > > > > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> > > >
> > > > Hi Mingjin, in general the patch looks ok to me.
> > > >
> > > > A general question of the behaviour of block and allow, is it always
> > > > the case that the two are not allowed to be used side by side?
> > > Both cannot be used at the same time.
> > >
> > > > I had a look through the EAL documentation and didn't see and
> > > > mention of this behaviour, but maybe I missed it?
> > > The "eal_common_usage" function has a clear description, see below:
> > > lib/eal/common/eal_common_options.c:2206
> >
> > I understand that, but that is a comment in code, I think the behaviour is
> > worthy of being called out in documentation API too for usability factors.
> Sorry for not providing complete information. There is processing logic in
> "eal_parse_common_option".
> Unsatisfied condition outputs "Options allow (-a) and block (-b) can't be used
> at the same time".
> 

Ah Ok, thanks for the clarification. I see this has been tested as well previously by Jiale Song. In that case this looks good to me.

Acked-by: Ian Stokes <ian.stokes@intel.com>

> >
> > Thanks
> > Ian
> >
> > > >
> > > > Thanks
> > > > ian
> > > > > > ---
> > > > > >  app/test/process.h | 17 ++++++++++++++---
> > > > > >  1 file changed, 14 insertions(+), 3 deletions(-)
> > > > > >
> > > > > > diff --git a/app/test/process.h b/app/test/process.h index
> > > > > > 9fb2bf481c..388c7975cd 100644
> > > > > > --- a/app/test/process.h
> > > > > > +++ b/app/test/process.h
> > > > > > @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int
> > > max_capacity)
> > > > > >  	int count = 0;
> > > > > >
> > > > > >  	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
> > > > > > -		if (strlen(devargs->name) == 0)
> > > > > > +		if (strlen(devargs->name) == 0 || devargs->type !=
> > > > > > +RTE_DEVTYPE_ALLOWED)
> > > > > >  			continue;
> > > > > >
> > > > > >  		if (devargs->data == NULL || strlen(devargs->data)
> > == 0)
> > > > { @@
> > > > > > -74,7 +74,7 @@ process_dup(const char *const argv[], int
> > > > > > numargs, const char *env_value)  {
> > > > > >  	int num = 0;
> > > > > >  	char **argv_cpy;
> > > > > > -	int allow_num;
> > > > > > +	int allow_num, block_num;
> > > > > >  	int argv_num;
> > > > > >  	int i, status;
> > > > > >  	char path[32];
> > > > > > @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int
> > > > > > numargs, const char *env_value)
> > > > > >  	if (pid < 0)
> > > > > >  		return -1;
> > > > > >  	else if (pid == 0) {
> > > > > > -		allow_num =
> > > > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > > > +		allow_num = 0;
> > > > > > +		block_num = 0;
> > > > > > +
> > > > > > +		/* If block (-b) is present, allow (-a) is not added. */
> > > > > > +		for (i = 0; i < numargs; i++) {
> > > > > > +			if (strcmp(argv[i], "-b") == 0 ||
> > > > > > +			    strcmp(argv[i], "-block") == 0)
> > > > > > +				block_num++;
> > > > > > +		}
> > > > > > +		if (!block_num)
> > > > > > +			allow_num =
> > > > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > > > +
> > > > > >  		argv_num = numargs + allow_num + 1;
> > > > > >  		argv_cpy = calloc(argv_num, sizeof(char *));
> > > > > >  		if (!argv_cpy)
> > > > > > --
> > > > > > 2.25.1
  
Stephen Hemminger Oct. 7, 2024, 5:02 p.m. UTC | #7
On Thu, 14 Mar 2024 09:46:26 +0000
Mingjin Ye <mingjinx.ye@intel.com> wrote:

> The options allow (-a) and block (-b) cannot be used at the same time.
> Therefore, allow (-a) will not be added when block (-b) is present.
> 
> Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> ---
>  app/test/process.h | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test/process.h b/app/test/process.h
> index 9fb2bf481c..388c7975cd 100644
> --- a/app/test/process.h
> +++ b/app/test/process.h
> @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int max_capacity)
>  	int count = 0;
>  
>  	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
> -		if (strlen(devargs->name) == 0)
> +		if (strlen(devargs->name) == 0 || devargs->type != RTE_DEVTYPE_ALLOWED)
>  			continue;
>  
>  		if (devargs->data == NULL || strlen(devargs->data) == 0) {
> @@ -74,7 +74,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
>  {
>  	int num = 0;
>  	char **argv_cpy;
> -	int allow_num;
> +	int allow_num, block_num;
>  	int argv_num;
>  	int i, status;
>  	char path[32];
> @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
>  	if (pid < 0)
>  		return -1;
>  	else if (pid == 0) {
> -		allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> +		allow_num = 0;
> +		block_num = 0;
> +
> +		/* If block (-b) is present, allow (-a) is not added. */
> +		for (i = 0; i < numargs; i++) {
> +			if (strcmp(argv[i], "-b") == 0 ||
> +			    strcmp(argv[i], "-block") == 0)

The long form of the option is "--block" not "-block".

Why is a test infrastructure adding both options anyway, seems like that is the real problem.
  

Patch

diff --git a/app/test/process.h b/app/test/process.h
index 9fb2bf481c..388c7975cd 100644
--- a/app/test/process.h
+++ b/app/test/process.h
@@ -44,7 +44,7 @@  add_parameter_allow(char **argv, int max_capacity)
 	int count = 0;
 
 	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
-		if (strlen(devargs->name) == 0)
+		if (strlen(devargs->name) == 0 || devargs->type != RTE_DEVTYPE_ALLOWED)
 			continue;
 
 		if (devargs->data == NULL || strlen(devargs->data) == 0) {
@@ -74,7 +74,7 @@  process_dup(const char *const argv[], int numargs, const char *env_value)
 {
 	int num = 0;
 	char **argv_cpy;
-	int allow_num;
+	int allow_num, block_num;
 	int argv_num;
 	int i, status;
 	char path[32];
@@ -89,7 +89,18 @@  process_dup(const char *const argv[], int numargs, const char *env_value)
 	if (pid < 0)
 		return -1;
 	else if (pid == 0) {
-		allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
+		allow_num = 0;
+		block_num = 0;
+
+		/* If block (-b) is present, allow (-a) is not added. */
+		for (i = 0; i < numargs; i++) {
+			if (strcmp(argv[i], "-b") == 0 ||
+			    strcmp(argv[i], "-block") == 0)
+				block_num++;
+		}
+		if (!block_num)
+			allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
+
 		argv_num = numargs + allow_num + 1;
 		argv_cpy = calloc(argv_num, sizeof(char *));
 		if (!argv_cpy)