diff mbox series

[1/3] examples/flow_classify: fix check of port and core

Message ID 1616830818-3127-2-git-send-email-humin29@huawei.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series fix check of port and core | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Min Hu (Connor) March 27, 2021, 7:40 a.m. UTC
fix check of port and core in flow_classify example.

Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample application")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 examples/flow_classify/flow_classify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Monjalon April 20, 2021, 1:08 a.m. UTC | #1
27/03/2021 08:40, Min Hu (Connor):
> fix check of port and core in flow_classify example.
> 
> Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample application")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
>  	RTE_ETH_FOREACH_DEV(port)
> -		if (rte_eth_dev_socket_id(port) > 0 &&
> +		if (rte_eth_dev_socket_id(port) >= 0 &&
>  			rte_eth_dev_socket_id(port) != (int)rte_socket_id()) {
>  			printf("\n\n");
>  			printf("WARNING: port %u is on remote NUMA node\n",

Please explain which case is broken and why.
If I understand well, we don't detect remote NUMA if not running on first socket.
Min Hu (Connor) April 20, 2021, 2:26 a.m. UTC | #2
在 2021/4/20 9:08, Thomas Monjalon 写道:
> 27/03/2021 08:40, Min Hu (Connor):
>> fix check of port and core in flow_classify example.
>>
>> Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample application")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> ---
>>   	RTE_ETH_FOREACH_DEV(port)
>> -		if (rte_eth_dev_socket_id(port) > 0 &&
>> +		if (rte_eth_dev_socket_id(port) >= 0 &&
>>   			rte_eth_dev_socket_id(port) != (int)rte_socket_id()) {
>>   			printf("\n\n");
>>   			printf("WARNING: port %u is on remote NUMA node\n",
> 
> Please explain which case is broken and why.
> If I understand well, we don't detect remote NUMA if not running on first socket.
> 
Hi, the code is this:
*************************************************************************
	/*
	 * Check that the port is on the same NUMA node as the polling thread
	 * for best performance.
	 */
	RTE_ETH_FOREACH_DEV(port)
		if (rte_eth_dev_socket_id(port) > 0 &&
			rte_eth_dev_socket_id(port) != (int)rte_socket_id()) {
			printf("\n\n");
			printf("WARNING: port %u is on remote NUMA node\n",
			       port);
			printf("to polling thread.\n");
			printf("Performance will not be optimal.\n");
		}
	printf("\nCore %u forwarding packets. ", rte_lcore_id());
	printf("[Ctrl+C to quit]\n");
*************************************************************************

According to the comments and logging, the author just hope user to use
the core and device which are in the same numa node for optimal
performance. If not, A warning gives out.

For example in flow_classify:
./build/flow_classify -w 0000:7d:00.1  -l 93
Here:
0000:7d:00.1 is on numa node 0.
core 93  is on numa node 3.

the two are not in same numa node, but no warning gives out in old codes.

Well, using this patch, we can get the waring.

Thanks, Thomas.




> 
> .
>
Thomas Monjalon April 20, 2021, 9:40 a.m. UTC | #3
20/04/2021 04:26, Min Hu (Connor):
> 2021/4/20 9:08, Thomas Monjalon:
> > 27/03/2021 08:40, Min Hu (Connor):
> >> fix check of port and core in flow_classify example.
> >>
> >> Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample application")
> >> Cc: stable@dpdk.org
> >>
> >> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> >> ---
> >>   	RTE_ETH_FOREACH_DEV(port)
> >> -		if (rte_eth_dev_socket_id(port) > 0 &&
> >> +		if (rte_eth_dev_socket_id(port) >= 0 &&
> >>   			rte_eth_dev_socket_id(port) != (int)rte_socket_id()) {
> >>   			printf("\n\n");
> >>   			printf("WARNING: port %u is on remote NUMA node\n",
> > 
> > Please explain which case is broken and why.
> > If I understand well, we don't detect remote NUMA if not running on first socket.
> > 
> Hi, the code is this:
> *************************************************************************
> 	/*
> 	 * Check that the port is on the same NUMA node as the polling thread
> 	 * for best performance.
> 	 */
> 	RTE_ETH_FOREACH_DEV(port)
> 		if (rte_eth_dev_socket_id(port) > 0 &&
> 			rte_eth_dev_socket_id(port) != (int)rte_socket_id()) {
> 			printf("\n\n");
> 			printf("WARNING: port %u is on remote NUMA node\n",
> 			       port);
> 			printf("to polling thread.\n");
> 			printf("Performance will not be optimal.\n");
> 		}
> 	printf("\nCore %u forwarding packets. ", rte_lcore_id());
> 	printf("[Ctrl+C to quit]\n");
> *************************************************************************
> 
> According to the comments and logging, the author just hope user to use
> the core and device which are in the same numa node for optimal
> performance. If not, A warning gives out.
> 
> For example in flow_classify:
> ./build/flow_classify -w 0000:7d:00.1  -l 93
> Here:
> 0000:7d:00.1 is on numa node 0.
> core 93  is on numa node 3.
> 
> the two are not in same numa node, but no warning gives out in old codes.
> 
> Well, using this patch, we can get the waring.

You need to explain which case was broken in the commit log.
Thanks
Iremonger, Bernard April 27, 2021, 11:51 a.m. UTC | #4
Hi Min,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, April 20, 2021 10:41 AM
> To: Min Hu (Connor) <humin29@huawei.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Iremonger,
> Bernard <bernard.iremonger@intel.com>; Kantecki, Tomasz
> <tomasz.kantecki@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; david.marchand@redhat.com
> Subject: Re: [dpdk-dev] [PATCH 1/3] examples/flow_classify: fix check of
> port and core
> 
> 20/04/2021 04:26, Min Hu (Connor):
> > 2021/4/20 9:08, Thomas Monjalon:
> > > 27/03/2021 08:40, Min Hu (Connor):
> > >> fix check of port and core in flow_classify example.
> > >>
> > >> Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample
> > >> application")
> > >> Cc: stable@dpdk.org
> > >>
> > >> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> > >> ---
> > >>   	RTE_ETH_FOREACH_DEV(port)
> > >> -		if (rte_eth_dev_socket_id(port) > 0 &&
> > >> +		if (rte_eth_dev_socket_id(port) >= 0 &&

This fix works (I have tested it on my system)
However a cleaner fix would be to drop the above line and add the if on the next line instead (also tested on my system).

If (rte_eth_dev_socket_id(port) != (int)rte_socket_id())

> > >>   			rte_eth_dev_socket_id(port) != (int)rte_socket_id())
> {
> > >>   			printf("\n\n");
> > >>   			printf("WARNING: port %u is on remote NUMA
> node\n",
> > >
> > > Please explain which case is broken and why.
> > > If I understand well, we don't detect remote NUMA if not running on first
> socket.
> > >
> > Hi, the code is this:
> >
> **********************************************************
> ***************
> > 	/*
> > 	 * Check that the port is on the same NUMA node as the polling
> thread
> > 	 * for best performance.
> > 	 */
> > 	RTE_ETH_FOREACH_DEV(port)
> > 		if (rte_eth_dev_socket_id(port) > 0 &&
> > 			rte_eth_dev_socket_id(port) != (int)rte_socket_id())
> {
> > 			printf("\n\n");
> > 			printf("WARNING: port %u is on remote NUMA
> node\n",
> > 			       port);
> > 			printf("to polling thread.\n");
> > 			printf("Performance will not be optimal.\n");
> > 		}
> > 	printf("\nCore %u forwarding packets. ", rte_lcore_id());
> > 	printf("[Ctrl+C to quit]\n");
> >
> **********************************************************
> ************
> > ***
> >
> > According to the comments and logging, the author just hope user to
> > use the core and device which are in the same numa node for optimal
> > performance. If not, A warning gives out.
> >
> > For example in flow_classify:
> > ./build/flow_classify -w 0000:7d:00.1  -l 93
> > Here:
> > 0000:7d:00.1 is on numa node 0.
> > core 93  is on numa node 3.
> >
> > the two are not in same numa node, but no warning gives out in old codes.
> >
> > Well, using this patch, we can get the waring.
> 
> You need to explain which case was broken in the commit log.
> Thanks
> 
> 
Regards,

Bernard.
Min Hu (Connor) April 27, 2021, 12:23 p.m. UTC | #5
在 2021/4/27 19:51, Iremonger, Bernard 写道:
> Hi Min,
> 
>> -----Original Message-----
>> From: Thomas Monjalon <thomas@monjalon.net>
>> Sent: Tuesday, April 20, 2021 10:41 AM
>> To: Min Hu (Connor) <humin29@huawei.com>
>> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Iremonger,
>> Bernard <bernard.iremonger@intel.com>; Kantecki, Tomasz
>> <tomasz.kantecki@intel.com>; Richardson, Bruce
>> <bruce.richardson@intel.com>; Burakov, Anatoly
>> <anatoly.burakov@intel.com>; david.marchand@redhat.com
>> Subject: Re: [dpdk-dev] [PATCH 1/3] examples/flow_classify: fix check of
>> port and core
>>
>> 20/04/2021 04:26, Min Hu (Connor):
>>> 2021/4/20 9:08, Thomas Monjalon:
>>>> 27/03/2021 08:40, Min Hu (Connor):
>>>>> fix check of port and core in flow_classify example.
>>>>>
>>>>> Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample
>>>>> application")
>>>>> Cc: stable@dpdk.org
>>>>>
>>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>>>> ---
>>>>>    	RTE_ETH_FOREACH_DEV(port)
>>>>> -		if (rte_eth_dev_socket_id(port) > 0 &&
>>>>> +		if (rte_eth_dev_socket_id(port) >= 0 &&
> 
> This fix works (I have tested it on my system)
> However a cleaner fix would be to drop the above line and add the if on the next line instead (also tested on my system).
> 
Hi, 'rte_eth_dev_socket_id(port)' may return -1,  we should avoid this
situation.

> If (rte_eth_dev_socket_id(port) != (int)rte_socket_id())
> 
>>>>>    			rte_eth_dev_socket_id(port) != (int)rte_socket_id())
>> {
>>>>>    			printf("\n\n");
>>>>>    			printf("WARNING: port %u is on remote NUMA
>> node\n",
>>>>
>>>> Please explain which case is broken and why.
>>>> If I understand well, we don't detect remote NUMA if not running on first
>> socket.
>>>>
>>> Hi, the code is this:
>>>
>> **********************************************************
>> ***************
>>> 	/*
>>> 	 * Check that the port is on the same NUMA node as the polling
>> thread
>>> 	 * for best performance.
>>> 	 */
>>> 	RTE_ETH_FOREACH_DEV(port)
>>> 		if (rte_eth_dev_socket_id(port) > 0 &&
>>> 			rte_eth_dev_socket_id(port) != (int)rte_socket_id())
>> {
>>> 			printf("\n\n");
>>> 			printf("WARNING: port %u is on remote NUMA
>> node\n",
>>> 			       port);
>>> 			printf("to polling thread.\n");
>>> 			printf("Performance will not be optimal.\n");
>>> 		}
>>> 	printf("\nCore %u forwarding packets. ", rte_lcore_id());
>>> 	printf("[Ctrl+C to quit]\n");
>>>
>> **********************************************************
>> ************
>>> ***
>>>
>>> According to the comments and logging, the author just hope user to
>>> use the core and device which are in the same numa node for optimal
>>> performance. If not, A warning gives out.
>>>
>>> For example in flow_classify:
>>> ./build/flow_classify -w 0000:7d:00.1  -l 93
>>> Here:
>>> 0000:7d:00.1 is on numa node 0.
>>> core 93  is on numa node 3.
>>>
>>> the two are not in same numa node, but no warning gives out in old codes.
>>>
>>> Well, using this patch, we can get the waring.
>>
>> You need to explain which case was broken in the commit log.
>> Thanks
>>
>>
> Regards,
> 
> Bernard.
> .
>
Iremonger, Bernard April 27, 2021, 1:06 p.m. UTC | #6
Hi Min,

> -----Original Message-----
> From: Min Hu (Connor) <humin29@huawei.com>
> Sent: Tuesday, April 27, 2021 1:23 PM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Kantecki, Tomasz
> <tomasz.kantecki@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; david.marchand@redhat.com
> Subject: Re: [dpdk-dev] [PATCH 1/3] examples/flow_classify: fix check of
> port and core
> 
> 
> 
> 在 2021/4/27 19:51, Iremonger, Bernard 写道:
> > Hi Min,
> >
> >> -----Original Message-----
> >> From: Thomas Monjalon <thomas@monjalon.net>
> >> Sent: Tuesday, April 20, 2021 10:41 AM
> >> To: Min Hu (Connor) <humin29@huawei.com>
> >> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Iremonger,
> >> Bernard <bernard.iremonger@intel.com>; Kantecki, Tomasz
> >> <tomasz.kantecki@intel.com>; Richardson, Bruce
> >> <bruce.richardson@intel.com>; Burakov, Anatoly
> >> <anatoly.burakov@intel.com>; david.marchand@redhat.com
> >> Subject: Re: [dpdk-dev] [PATCH 1/3] examples/flow_classify: fix check
> >> of port and core
> >>
> >> 20/04/2021 04:26, Min Hu (Connor):
> >>> 2021/4/20 9:08, Thomas Monjalon:
> >>>> 27/03/2021 08:40, Min Hu (Connor):
> >>>>> fix check of port and core in flow_classify example.
> >>>>>
> >>>>> Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample
> >>>>> application")
> >>>>> Cc: stable@dpdk.org
> >>>>>
> >>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> >>>>> ---
> >>>>>    	RTE_ETH_FOREACH_DEV(port)
> >>>>> -		if (rte_eth_dev_socket_id(port) > 0 &&
> >>>>> +		if (rte_eth_dev_socket_id(port) >= 0 &&
> >
> > This fix works (I have tested it on my system) However a cleaner fix
> > would be to drop the above line and add the if on the next line instead
> (also tested on my system).
> >
> Hi, 'rte_eth_dev_socket_id(port)' may return -1,  we should avoid this
> situation.

Agreed.
Original fix is good.

> 
> > If (rte_eth_dev_socket_id(port) != (int)rte_socket_id())
> >
> >>>>>    			rte_eth_dev_socket_id(port) !=
> (int)rte_socket_id())
> >> {
> >>>>>    			printf("\n\n");
> >>>>>    			printf("WARNING: port %u is on remote
> NUMA
> >> node\n",
> >>>>
> >>>> Please explain which case is broken and why.
> >>>> If I understand well, we don't detect remote NUMA if not running on
> >>>> first
> >> socket.
> >>>>
> >>> Hi, the code is this:
> >>>
> >>
> **********************************************************
> >> ***************
> >>> 	/*
> >>> 	 * Check that the port is on the same NUMA node as the polling
> >> thread
> >>> 	 * for best performance.
> >>> 	 */
> >>> 	RTE_ETH_FOREACH_DEV(port)
> >>> 		if (rte_eth_dev_socket_id(port) > 0 &&
> >>> 			rte_eth_dev_socket_id(port) != (int)rte_socket_id())
> >> {
> >>> 			printf("\n\n");
> >>> 			printf("WARNING: port %u is on remote NUMA
> >> node\n",
> >>> 			       port);
> >>> 			printf("to polling thread.\n");
> >>> 			printf("Performance will not be optimal.\n");
> >>> 		}
> >>> 	printf("\nCore %u forwarding packets. ", rte_lcore_id());
> >>> 	printf("[Ctrl+C to quit]\n");
> >>>
> >>
> **********************************************************
> >> ************
> >>> ***
> >>>
> >>> According to the comments and logging, the author just hope user to
> >>> use the core and device which are in the same numa node for optimal
> >>> performance. If not, A warning gives out.
> >>>
> >>> For example in flow_classify:
> >>> ./build/flow_classify -w 0000:7d:00.1  -l 93
> >>> Here:
> >>> 0000:7d:00.1 is on numa node 0.
> >>> core 93  is on numa node 3.
> >>>
> >>> the two are not in same numa node, but no warning gives out in old
> codes.
> >>>
> >>> Well, using this patch, we can get the waring.
> >>
> >> You need to explain which case was broken in the commit log.
> >> Thanks
> >>
> >>
> > Regards,
> >
> > Bernard.
> > .
> >

Regards,

Bernard.
Iremonger, Bernard April 28, 2021, 9:26 a.m. UTC | #7
Hi Min,

<snip>

> > >>>
> > >>> According to the comments and logging, the author just hope user
> > >>> to use the core and device which are in the same numa node for
> > >>> optimal performance. If not, A warning gives out.
> > >>>
> > >>> For example in flow_classify:
> > >>> ./build/flow_classify -w 0000:7d:00.1  -l 93

The EAL option "-w" has been replaced by the "-a" option  in dpdk-20.05

> > >>> Here:
> > >>> 0000:7d:00.1 is on numa node 0.
> > >>> core 93  is on numa node 3.
> > >>>
> > >>> the two are not in same numa node, but no warning gives out in old
> > codes.
> > >>>
> > >>> Well, using this patch, we can get the waring.
> > >>
> > >> You need to explain which case was broken in the commit log.
> > >> Thanks

Regards,
 
 Bernard.
diff mbox series

Patch

diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c
index 335d7d2..277a2f5 100644
--- a/examples/flow_classify/flow_classify.c
+++ b/examples/flow_classify/flow_classify.c
@@ -284,7 +284,7 @@  lcore_main(struct flow_classifier *cls_app)
 	 * for best performance.
 	 */
 	RTE_ETH_FOREACH_DEV(port)
-		if (rte_eth_dev_socket_id(port) > 0 &&
+		if (rte_eth_dev_socket_id(port) >= 0 &&
 			rte_eth_dev_socket_id(port) != (int)rte_socket_id()) {
 			printf("\n\n");
 			printf("WARNING: port %u is on remote NUMA node\n",