DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/eal: check invalid cpu value
@ 2020-06-12 12:09 ` Kevin Traynor
  2020-07-08 23:04   ` Lukasz Wojciechowski
  2020-07-20 10:17   ` Kevin Traynor
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Traynor @ 2020-06-12 12:09 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, Kevin Traynor

When using --lcores option, CPU_SETSIZE allows a range of
0-1023. Check it is not being exceeded.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 app/test/test_eal_flags.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 4ee809e3d..044cc1c59 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -528,4 +528,7 @@ test_missing_c_flag(void)
 				 "--lcores",
 				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
+	/* check an invalid cpu value >= CPU_SETSIZE */
+	const char * const argv30[] = { prgname, prefix, mp_flag,
+				 "--lcores", "3@1024" };
 
 	if (launch_proc(argv2) != 0) {
@@ -577,5 +580,6 @@ test_missing_c_flag(void)
 	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
 	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
-	    launch_proc(argv28) == 0) {
+	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
+
 		printf("Error - "
 		       "process ran without error with invalid --lcore flag\n");
-- 
2.21.3


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

* Re: [dpdk-dev] [PATCH] test/eal: check invalid cpu value
  2020-06-12 12:09 ` [dpdk-dev] [PATCH] test/eal: check invalid cpu value Kevin Traynor
@ 2020-07-08 23:04   ` Lukasz Wojciechowski
  2020-07-20 10:20     ` Kevin Traynor
  2020-07-20 10:17   ` Kevin Traynor
  1 sibling, 1 reply; 7+ messages in thread
From: Lukasz Wojciechowski @ 2020-07-08 23:04 UTC (permalink / raw)
  To: Kevin Traynor, dev; +Cc: david.marchand


W dniu 12.06.2020 o 14:09, Kevin Traynor pisze:
> When using --lcores option, CPU_SETSIZE allows a range of
> 0-1023. Check it is not being exceeded.
>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
>   app/test/test_eal_flags.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
> index 4ee809e3d..044cc1c59 100644
> --- a/app/test/test_eal_flags.c
> +++ b/app/test/test_eal_flags.c
> @@ -528,4 +528,7 @@ test_missing_c_flag(void)
>   				 "--lcores",
>   				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
> +	/* check an invalid cpu value >= CPU_SETSIZE */
> +	const char * const argv30[] = { prgname, prefix, mp_flag,
> +				 "--lcores", "3@1024" };
>   
The proper cpu values are in range 0-CPU_SETSIZE, but the CPU_SETSIZE is 
not always equal to 1024 (currently it is on Linux).
Check lib/librte_eal/windows/include/sched.h:17 :

#ifndef CPU_SETSIZE
#define CPU_SETSIZE RTE_MAX_LCORE
#endif

so to make your patch better, you can use CPU_SETSIZE value directly:

const char * const argv30[] = { prgname, prefix, mp_flag, "--lcores", "3@" RTE_STR(CPU_SETSIZE) };


>   	if (launch_proc(argv2) != 0) {
> @@ -577,5 +580,6 @@ test_missing_c_flag(void)
>   	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
>   	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
> -	    launch_proc(argv28) == 0) {
> +	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
> +
>   		printf("Error - "
>   		       "process ran without error with invalid --lcore flag\n");

Best regards

-- 
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com


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

* [dpdk-dev] [PATCH] test/eal: check invalid cpu value
  2020-06-12 12:09 ` [dpdk-dev] [PATCH] test/eal: check invalid cpu value Kevin Traynor
  2020-07-08 23:04   ` Lukasz Wojciechowski
@ 2020-07-20 10:17   ` Kevin Traynor
  2020-07-20 10:19     ` [dpdk-dev] [PATCH v2] " Kevin Traynor
  1 sibling, 1 reply; 7+ messages in thread
From: Kevin Traynor @ 2020-07-20 10:17 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, l.wojciechow, Kevin Traynor

When using --lcores option, there is a limit of CPU_SETSIZE.
Currently that allows 0..1023 on Linux.

Check it is caught when this limit is exceeded.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 app/test/test_eal_flags.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 4ee809e3d..b019656b2 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -528,4 +528,7 @@ test_missing_c_flag(void)
 				 "--lcores",
 				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
+	/* check an invalid cpu value >= CPU_SETSIZE */
+	const char * const argv30[] = { prgname, prefix, mp_flag,
+				 "--lcores", "3@" RTE_STR(CPU_SETSIZE) };
 
 	if (launch_proc(argv2) != 0) {
@@ -577,5 +580,5 @@ test_missing_c_flag(void)
 	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
 	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
-	    launch_proc(argv28) == 0) {
+	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
 		printf("Error - "
 		       "process ran without error with invalid --lcore flag\n");
-- 
2.21.3


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

* [dpdk-dev] [PATCH v2] test/eal: check invalid cpu value
  2020-07-20 10:17   ` Kevin Traynor
@ 2020-07-20 10:19     ` Kevin Traynor
  2020-07-20 11:08       ` Lukasz Wojciechowski
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Traynor @ 2020-07-20 10:19 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, l.wojciechow, Kevin Traynor

When using --lcores option, there is a limit of CPU_SETSIZE.
Currently that allows 0..1023 on Linux.

Check it is caught when this limit is exceeded.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 app/test/test_eal_flags.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 4ee809e3d..b019656b2 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -528,4 +528,7 @@ test_missing_c_flag(void)
 				 "--lcores",
 				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
+	/* check an invalid cpu value >= CPU_SETSIZE */
+	const char * const argv30[] = { prgname, prefix, mp_flag,
+				 "--lcores", "3@" RTE_STR(CPU_SETSIZE) };
 
 	if (launch_proc(argv2) != 0) {
@@ -577,5 +580,5 @@ test_missing_c_flag(void)
 	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
 	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
-	    launch_proc(argv28) == 0) {
+	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
 		printf("Error - "
 		       "process ran without error with invalid --lcore flag\n");
-- 
2.21.3


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

* Re: [dpdk-dev] [PATCH] test/eal: check invalid cpu value
  2020-07-08 23:04   ` Lukasz Wojciechowski
@ 2020-07-20 10:20     ` Kevin Traynor
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Traynor @ 2020-07-20 10:20 UTC (permalink / raw)
  To: Lukasz Wojciechowski, dev; +Cc: david.marchand

On 09/07/2020 00:04, Lukasz Wojciechowski wrote:
> 
> W dniu 12.06.2020 o 14:09, Kevin Traynor pisze:
>> When using --lcores option, CPU_SETSIZE allows a range of
>> 0-1023. Check it is not being exceeded.
>>
>> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
>> ---
>>   app/test/test_eal_flags.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
>> index 4ee809e3d..044cc1c59 100644
>> --- a/app/test/test_eal_flags.c
>> +++ b/app/test/test_eal_flags.c
>> @@ -528,4 +528,7 @@ test_missing_c_flag(void)
>>   				 "--lcores",
>>   				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
>> +	/* check an invalid cpu value >= CPU_SETSIZE */
>> +	const char * const argv30[] = { prgname, prefix, mp_flag,
>> +				 "--lcores", "3@1024" };
>>   
> The proper cpu values are in range 0-CPU_SETSIZE, but the CPU_SETSIZE is 
> not always equal to 1024 (currently it is on Linux).
> Check lib/librte_eal/windows/include/sched.h:17 :
> 
> #ifndef CPU_SETSIZE
> #define CPU_SETSIZE RTE_MAX_LCORE
> #endif
> 
> so to make your patch better, you can use CPU_SETSIZE value directly:
> 
> const char * const argv30[] = { prgname, prefix, mp_flag, "--lcores", "3@" RTE_STR(CPU_SETSIZE) };
> 

Thanks Lukasz. You are right, this is better. I just sent a v2.

Kevin.

> 
>>   	if (launch_proc(argv2) != 0) {
>> @@ -577,5 +580,6 @@ test_missing_c_flag(void)
>>   	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
>>   	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
>> -	    launch_proc(argv28) == 0) {
>> +	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
>> +
>>   		printf("Error - "
>>   		       "process ran without error with invalid --lcore flag\n");
> 
> Best regards
> 


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

* Re: [dpdk-dev] [PATCH v2] test/eal: check invalid cpu value
  2020-07-20 10:19     ` [dpdk-dev] [PATCH v2] " Kevin Traynor
@ 2020-07-20 11:08       ` Lukasz Wojciechowski
  2020-07-21 18:58         ` David Marchand
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Wojciechowski @ 2020-07-20 11:08 UTC (permalink / raw)
  To: Kevin Traynor, dev; +Cc: david.marchand


W dniu 20.07.2020 o 12:19, Kevin Traynor pisze:
> When using --lcores option, there is a limit of CPU_SETSIZE.
> Currently that allows 0..1023 on Linux.
>
> Check it is caught when this limit is exceeded.
>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
>   app/test/test_eal_flags.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
> index 4ee809e3d..b019656b2 100644
> --- a/app/test/test_eal_flags.c
> +++ b/app/test/test_eal_flags.c
> @@ -528,4 +528,7 @@ test_missing_c_flag(void)
>   				 "--lcores",
>   				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
> +	/* check an invalid cpu value >= CPU_SETSIZE */
> +	const char * const argv30[] = { prgname, prefix, mp_flag,
> +				 "--lcores", "3@" RTE_STR(CPU_SETSIZE) };
>   
>   	if (launch_proc(argv2) != 0) {
> @@ -577,5 +580,5 @@ test_missing_c_flag(void)
>   	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
>   	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
> -	    launch_proc(argv28) == 0) {
> +	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
>   		printf("Error - "
>   		       "process ran without error with invalid --lcore flag\n");
Now it's perfect.

Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>


-- 
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com


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

* Re: [dpdk-dev] [PATCH v2] test/eal: check invalid cpu value
  2020-07-20 11:08       ` Lukasz Wojciechowski
@ 2020-07-21 18:58         ` David Marchand
  0 siblings, 0 replies; 7+ messages in thread
From: David Marchand @ 2020-07-21 18:58 UTC (permalink / raw)
  To: Lukasz Wojciechowski; +Cc: Kevin Traynor, dev

On Mon, Jul 20, 2020 at 1:08 PM Lukasz Wojciechowski
<l.wojciechow@partner.samsung.com> wrote:

> W dniu 20.07.2020 o 12:19, Kevin Traynor pisze:
> > When using --lcores option, there is a limit of CPU_SETSIZE.
> > Currently that allows 0..1023 on Linux.
> >
> > Check it is caught when this limit is exceeded.
> Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>

Applied, thanks Kevin.


-- 
David Marchand


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

end of thread, other threads:[~2020-07-21 18:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200612121031eucas1p2e5d39ccf4ebc398d4b4655fb9f5ac6e1@eucas1p2.samsung.com>
2020-06-12 12:09 ` [dpdk-dev] [PATCH] test/eal: check invalid cpu value Kevin Traynor
2020-07-08 23:04   ` Lukasz Wojciechowski
2020-07-20 10:20     ` Kevin Traynor
2020-07-20 10:17   ` Kevin Traynor
2020-07-20 10:19     ` [dpdk-dev] [PATCH v2] " Kevin Traynor
2020-07-20 11:08       ` Lukasz Wojciechowski
2020-07-21 18:58         ` David Marchand

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