Skip to contentSkip to conversation

app/testpmd: Optimize membuf pool allocation

PATCH Superseded Phil Yang 6 participants 11 messages Aug 27, 2018 – Oct 11, 2018

lore
Share & tools
lore

Phil Yang

author
#0 lore raw

PATCH 1/1 app/testpmd: Optimize membuf pool allocation

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes d5aeab6542f ("app/testpmd: fix mempool creation by socket id")
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -2
index ee48db2..a56af2b 100644
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
 	nb_lc = 0;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
 		sock_num = rte_lcore_to_socket_id(i);
 		if (new_socket_id(sock_num)) {
 			if (num_sockets >= RTE_MAX_NUMA_NODES) {
@@ -485,8 +487,6 @@ set_default_fwd_lcores_config(void)
 			}
 			socket_ids[num_sockets++] = sock_num;
 		}
-		if (!rte_lcore_is_enabled(i))
-			continue;
 		if (i == rte_get_master_lcore())
 			continue;
 		fwd_lcores_cpuids[nb_lc++] = i;
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Phil Yang <[email protected]>
Sent: Monday, August 27, 2018 5:33 PM
To: [email protected]
Cc: nd <[email protected]>; Gavin Hu <[email protected]>
Subject: [PATCH] app/testpmd: Optimize membuf pool allocation

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Quoted 6 lines

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes d5aeab6542f ("app/testpmd: fix mempool creation by socket id")
Quoted 28 lines
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

ee48db2..a56af2b 100644

app/test-pmd/testpmd.c +2 -0
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
 	nb_lc = 0;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
 		sock_num = rte_lcore_to_socket_id(i);
 		if (new_socket_id(sock_num)) {
 			if (num_sockets >= RTE_MAX_NUMA_NODES) { @@ -

485,8 +487,6 @@ set_default_fwd_lcores_config(void)

app/test-pmd/testpmd.c +0 -3
 			}
 			socket_ids[num_sockets++] = sock_num;
 		}
-		if (!rte_lcore_is_enabled(i))
-			continue;
 		if (i == rte_get_master_lcore())
 			continue;
 		fwd_lcores_cpuids[nb_lc++] = i;
--

2.7.4

#2 lore raw
In reply to Phil Yang

Hi Gavin,

Quoted 43 lines

-----Original Message-----
From: dev [mailto:[email protected]]
Sent: Monday, August 27, 2018 10:33 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH] app/testpmd: Optimize membuf pool allocation

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes d5aeab6542f ("app/testpmd: fix mempool creation by socket id")
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

ee48db2..a56af2b 100644

app/test-pmd/testpmd.c +2 -0
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
 	nb_lc = 0;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
 		sock_num = rte_lcore_to_socket_id(i);
 		if (new_socket_id(sock_num)) {
 			if (num_sockets >= RTE_MAX_NUMA_NODES) { @@ -

485,8 +487,6 @@ set_default_fwd_lcores_config(void)

app/test-pmd/testpmd.c +0 -3
 			}
 			socket_ids[num_sockets++] = sock_num;
 		}
-		if (!rte_lcore_is_enabled(i))
-			continue;
 		if (i == rte_get_master_lcore())
 			continue;
 		fwd_lcores_cpuids[nb_lc++] = i;
--
Quoted 1 line

2.7.4

./dpdk/devtools/check-git-log.sh -1

Wrong headline uppercase:
app/testpmd: Optimize membuf pool allocation
Wrong 'Fixes' reference:

Fixes d5aeab6542f ("app/testpmd: fix mempool creation by socket id")

Regards,

Bernard.

#3 lore raw

Hi Bernard,

Thanks for you comments. I have updated the patch. Please review it.

Thanks,
Phil Yang

Quoted 65 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Iremonger, Bernard
Sent: Wednesday, September 12, 2018 12:23 AM
To: dev <[email protected]>; [email protected]
Cc: nd <[email protected]>; Gavin Hu (Arm Technology China) <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: Optimize membuf pool allocation

Hi Gavin,

Quoted 44 lines

-----Original Message-----
From: dev [mailto:[email protected]]
Sent: Monday, August 27, 2018 10:33 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH] app/testpmd: Optimize membuf pool allocation

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes d5aeab6542f ("app/testpmd: fix mempool creation by socket id")
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

ee48db2..a56af2b 100644

app/test-pmd/testpmd.c +2 -0
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
 	nb_lc = 0;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
 		sock_num = rte_lcore_to_socket_id(i);
 		if (new_socket_id(sock_num)) {
 			if (num_sockets >= RTE_MAX_NUMA_NODES) { @@ -

485,8 +487,6 @@ set_default_fwd_lcores_config(void)

app/test-pmd/testpmd.c +0 -3
 			}
 			socket_ids[num_sockets++] = sock_num;
 		}
-		if (!rte_lcore_is_enabled(i))
-			continue;
 		if (i == rte_get_master_lcore())
 			continue;
 		fwd_lcores_cpuids[nb_lc++] = i;
--
Quoted 1 line

2.7.4

./dpdk/devtools/check-git-log.sh -1

Wrong headline uppercase:
app/testpmd: Optimize membuf pool allocation Wrong 'Fixes' reference:

Fixes d5aeab6542f ("app/testpmd: fix mempool creation by socket id")

Regards,

Bernard.

author
#4 lore raw

PATCH v2 1/1 app/testpmd: optimize membuf pool allocation

In reply to Phil Yang

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes c9cafcc ("app/testpmd: fix mempool creation by socket id")
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -2
index ee48db2..a56af2b 100644
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
 	nb_lc = 0;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
 		sock_num = rte_lcore_to_socket_id(i);
 		if (new_socket_id(sock_num)) {
 			if (num_sockets >= RTE_MAX_NUMA_NODES) {
@@ -485,8 +487,6 @@ set_default_fwd_lcores_config(void)
 			}
 			socket_ids[num_sockets++] = sock_num;
 		}
-		if (!rte_lcore_is_enabled(i))
-			continue;
 		if (i == rte_get_master_lcore())
 			continue;
 		fwd_lcores_cpuids[nb_lc++] = i;
Signature · 1 line
2.7.4
Acked-by on v2 1/1
#5 lore raw

Re: [PATCH v2] app/testpmd: optimize membuf pool allocation

Quoted 11 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, September 12, 2018 2:54 AM
To: [email protected]
Cc: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH v2] app/testpmd: optimize membuf pool allocation

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Quoted 7 lines

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes c9cafcc ("app/testpmd: fix mempool creation by socket id")
#6 lore raw

Re: [PATCH v2] app/testpmd: optimize membuf pool allocation

Quoted 7 lines
Quoted 7 lines

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes c9cafcc ("app/testpmd: fix mempool creation by socket id")
Fixes c9cafcc82de8 ("app/testpmd: fix mempool creation by socket id")
Quoted 4 lines
Quoted 2 lines

Applied, thanks

#7 lore raw

Re: [PATCH v2] app/testpmd: optimize membuf pool allocation

In reply to Phil Yang
Quoted 30 lines · On 9/12/2018 2:54 AM, [email protected] wrote:

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes c9cafcc ("app/testpmd: fix mempool creation by socket id")
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -0
index ee48db2..a56af2b 100644
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
 	nb_lc = 0;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
 		sock_num = rte_lcore_to_socket_id(i);
 		if (new_socket_id(sock_num)) {
 			if (num_sockets >= RTE_MAX_NUMA_NODES) {

app/test-pmd/testpmd.c set_default_fwd_lcores_config(void) · line 492

Quoted 8 lines
app/test-pmd/testpmd.c +0 -2
@@ -485,8 +487,6 @@ set_default_fwd_lcores_config(void)
 			}
 			socket_ids[num_sockets++] = sock_num;
 		}
-		if (!rte_lcore_is_enabled(i))
-			continue;
 		if (i == rte_get_master_lcore())
 			continue;
 		fwd_lcores_cpuids[nb_lc++] = i;

This is causing testpmd fail for the case all cores from socket 1 and added a virtual device which will try to allocate memory from socket 0.

 $ testpmd -l<cores from socket 1> --vdev net_pcap0,iface=lo -- -i
 ...
 Failed to setup RX queue:No mempool allocation on the socket 0
 EAL: Error - exiting with code: 1
   Cause: Start ports failed
#8 lore raw

Re: [PATCH v2] app/testpmd: optimize membuf pool allocation

Quoted 45 lines · Ferruh Yigit
Quoted 30 lines · On 9/12/2018 2:54 AM, [email protected] wrote:

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes c9cafcc ("app/testpmd: fix mempool creation by socket id")
---
  app/test-pmd/testpmd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -0
index ee48db2..a56af2b 100644
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
  	nb_lc = 0;
  	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
  		sock_num = rte_lcore_to_socket_id(i);
  		if (new_socket_id(sock_num)) {
  			if (num_sockets >= RTE_MAX_NUMA_NODES) {

app/test-pmd/testpmd.c set_default_fwd_lcores_config(void) · line 492

Quoted 8 lines
app/test-pmd/testpmd.c +0 -2
@@ -485,8 +487,6 @@ set_default_fwd_lcores_config(void)
  			}
  			socket_ids[num_sockets++] = sock_num;
  		}
-		if (!rte_lcore_is_enabled(i))
-			continue;
  		if (i == rte_get_master_lcore())
  			continue;
  		fwd_lcores_cpuids[nb_lc++] = i;

This is causing testpmd fail for the case all cores from socket 1 and added a virtual device which will try to allocate memory from socket 0.

Quoted 7 lines
  $ testpmd -l<cores from socket 1> --vdev net_pcap0,iface=lo -- -i
  ...
  Failed to setup RX queue:No mempool allocation on the socket 0
  EAL: Error - exiting with code: 1
    Cause: Start ports failed

It's an open question as to why pcap driver tries to allocate on socket 0 when everything is on socket 1, but perhaps a better improvement would be to take into account not only socket ID's of lcores, but ethdev devices as well?

Signature · 2 lines
Thanks,
Anatoly
#9 lore raw

Re: [PATCH v2] app/testpmd: optimize membuf pool allocation

Quoted 66 lines

-----Original Message-----
From: Burakov, Anatoly <[email protected]>
Sent: Monday, October 8, 2018 7:36 PM
To: Ferruh Yigit <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Gavin Hu (Arm Technology China) <[email protected]>; [email protected]; Phil Yang (Arm Technology China) <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: optimize membuf pool allocation

Quoted 22 lines · Ferruh Yigit
Quoted 21 lines · On 9/12/2018 2:54 AM, [email protected] wrote:

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes c9cafcc ("app/testpmd: fix mempool creation by socket id")
---
  app/test-pmd/testpmd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

ee48db2..a56af2b 100644

app/test-pmd/testpmd.c +0 -0
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
Quoted 7 lines

app/test-pmd/testpmd.c set_default_fwd_lcores_config(void)

Quoted 7 lines
app/test-pmd/testpmd.c +2 -0
  nb_lc = 0;
  for (i = 0; i < RTE_MAX_LCORE; i++) {
+if (!rte_lcore_is_enabled(i))
+continue;
  sock_num = rte_lcore_to_socket_id(i);
  if (new_socket_id(sock_num)) {
  if (num_sockets >= RTE_MAX_NUMA_NODES) { @@ -

485,8 +487,6 @@

Quoted 16 lines

app/test-pmd/testpmd.c set_default_fwd_lcores_config(void) · line 492

Quoted 10 lines

set_default_fwd_lcores_config(void)
}
socket_ids[num_sockets++] = sock_num;
}

app/test-pmd/testpmd.c +0 -2
-if (!rte_lcore_is_enabled(i))
-continue;
  if (i == rte_get_master_lcore())
  continue;
  fwd_lcores_cpuids[nb_lc++] = i;

This is causing testpmd fail for the case all cores from socket 1 and added a virtual device which will try to allocate memory from socket 0.

Quoted 7 lines
  $ testpmd -l<cores from socket 1> --vdev net_pcap0,iface=lo -- -i
  ...
  Failed to setup RX queue:No mempool allocation on the socket 0
  EAL: Error - exiting with code: 1
    Cause: Start ports failed
Quoted 7 lines

It's an open question as to why pcap driver tries to allocate on socket 0 when everything is on socket 1, but perhaps a better improvement would be to take into account not only socket ID's of lcores, but ethdev devices as well?

--
Thanks,
Anatoly

Hi Anatoly,

Agree.

Since NUMA-aware is enabled default in testpmd, so it should be configurable for vdev port NUMA setting.

testpmd -l <cores from socket 1> --vdev net_pcap0,iface=lo --socket-mem=64 -- --numa --port-numa-config="(0,1)" --ring-numa-config="(0,1,1),(0,2,1)" -i

...
Configuring Port 0 (socket 0)
Failed to setup RX queue:No mempool allocation on the socket 0
EAL: Error - exiting with code: 1
Cause: Start ports failed

This should be a defect.

Thanks
Phil Yang
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#10 lore raw

Re: [PATCH v2] app/testpmd: optimize membuf pool allocation

Hi Anatoly/Yigit,

I've prepared a patch to fix this issue.
I will send out the patch once the internal review is done.

Thanks,
Phil Yang

Quoted 106 lines

-----Original Message-----
From: Phil Yang (Arm Technology China)
Sent: Thursday, October 11, 2018 3:12 PM
To: 'Burakov, Anatoly' <[email protected]>; Ferruh Yigit <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Gavin Hu (Arm Technology China) <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v2] app/testpmd: optimize membuf pool allocation

Quoted 66 lines

-----Original Message-----
From: Burakov, Anatoly <[email protected]>
Sent: Monday, October 8, 2018 7:36 PM
To: Ferruh Yigit <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Gavin Hu (Arm Technology China) <[email protected]>; [email protected]; Phil Yang (Arm Technology China) <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: optimize membuf pool allocation

Quoted 22 lines · Ferruh Yigit
Quoted 21 lines · On 9/12/2018 2:54 AM, [email protected] wrote:

By default, testpmd will create membuf pool for all NUMA nodes and ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core list configuration. Optimized by only creating membuf pool for those nodes.

Fixes c9cafcc ("app/testpmd: fix mempool creation by socket id")
---
  app/test-pmd/testpmd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

ee48db2..a56af2b 100644

app/test-pmd/testpmd.c +0 -0
@@ -476,6 +476,8 @@ set_default_fwd_lcores_config(void)
 
Quoted 7 lines

app/test-pmd/testpmd.c set_default_fwd_lcores_config(void)

Quoted 7 lines
app/test-pmd/testpmd.c +2 -0
  	nb_lc = 0;
  	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (!rte_lcore_is_enabled(i))
+			continue;
  		sock_num = rte_lcore_to_socket_id(i);
  		if (new_socket_id(sock_num)) {
  			if (num_sockets >= RTE_MAX_NUMA_NODES) { @@ -

485,8 +487,6 @@

Quoted 16 lines

app/test-pmd/testpmd.c set_default_fwd_lcores_config(void) · line 492

Quoted 10 lines

set_default_fwd_lcores_config(void)
}
socket_ids[num_sockets++] = sock_num;
}

app/test-pmd/testpmd.c +0 -2
-		if (!rte_lcore_is_enabled(i))
-			continue;
  		if (i == rte_get_master_lcore())
  			continue;
  		fwd_lcores_cpuids[nb_lc++] = i;

This is causing testpmd fail for the case all cores from socket 1 and added a virtual device which will try to allocate memory from socket 0.

Quoted 7 lines
  $ testpmd -l<cores from socket 1> --vdev net_pcap0,iface=lo -- -i
  ...
  Failed to setup RX queue:No mempool allocation on the socket 0
  EAL: Error - exiting with code: 1
    Cause: Start ports failed
Quoted 4 lines

It's an open question as to why pcap driver tries to allocate on socket
0 when everything is on socket 1, but perhaps a better improvement would be to take into account not only socket ID's of lcores, but ethdev

devices as well?

Quoted 4 lines

--
Thanks,
Anatoly

Hi Anatoly,

Agree.

Since NUMA-aware is enabled default in testpmd, so it should be configurable for vdev port NUMA setting.

testpmd -l <cores from socket 1> --vdev net_pcap0,iface=lo --socket-mem=64 -- --numa --port-numa-config="(0,1)" --ring-numa-config="(0,1,1),(0,2,1)" -i

...
Configuring Port 0 (socket 0)
Failed to setup RX queue:No mempool allocation on the socket 0
EAL: Error - exiting with code: 1
Cause: Start ports failed

This should be a defect.

Thanks
Phil Yang