Skip to contentSkip to conversation

app/testpmd: add option ring-bind-lcpu to bind Q with CPU

RFC PATCH Superseded [email protected] 2 participants 2 messages Jul 4, 2017 – Jan 5, 2018

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 app/testpmd: add option ring-bind-lcpu to bind Q with CPU

From: Simon Guo <[email protected]>

Currently the rx/tx queue is allocated from the buffer pool on socket of:
- port's socket if --port-numa-config specified
- or ring-numa-config setting per port

All the above will "bind" queue to single socket per port configuration. But it can actually archieve better performance if one port's queue can be spread across multiple NUMA nodes, and the rx/tx queue is allocated per lcpu socket.

With this patch, testpmd can utilize the PCI-e bus bandwidth on another NUMA nodes. with 64bytes package, When running in PowerPC with Mellanox CX-4 card, single port(100G), with 8 cores, fw mode:
- Without this patch: 52.5Mpps throughput
- With this patch: 66Mpps throughput

---
 app/test-pmd/parameters.c |  10 +++++
 app/test-pmd/testpmd.c    | 102 ++++++++++++++++++++++++++++++++--------------
 app/test-pmd/testpmd.h    |   1 +
 3 files changed, 82 insertions(+), 31 deletions(-)
app/test-pmd/parameters.c +10 -0
index fbe6284..d02059d 100644
@@ -130,6 +130,11 @@
 	       "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");
 	printf("  --socket-num=N: set socket from which all memory is allocated "
 	       "in NUMA mode.\n");
+	printf("  --ring-bind-lcpu: "
+		"specify TX/RX rings will be allocated on local socket of lcpu."
+		"It will overrridden ring-numa-config or port-numa-config if success."
+		"If local ring buffer is unavailable, it will use --ring-numa-config or port-numa-config instead."
+		"It allows one port binds to multiple NUMA nodes.\n");
 	printf("  --mbuf-size=N: set the data size of mbuf to N bytes.\n");
 	printf("  --total-num-mbufs=N: set the number of mbufs to be allocated "
 	       "in mbuf pools.\n");
@@ -563,6 +568,7 @@
 		{ "interactive",		0, 0, 0 },
 		{ "cmdline-file",		1, 0, 0 },
 		{ "auto-start",			0, 0, 0 },
+		{ "ring-bind-lcpu",		0, 0, 0 },
 		{ "eth-peers-configfile",	1, 0, 0 },
 		{ "eth-peer",			1, 0, 0 },
 #endif
@@ -674,6 +680,10 @@
 				printf("Auto-start selected\n");
 				auto_start = 1;
 			}
+			if (!strcmp(lgopts[opt_idx].name, "ring-bind-lcpu")) {
+				printf("RingBuffer bind with local CPU selected\n");
+				ring_bind_lcpu = 1;
+			}
 			if (!strcmp(lgopts[opt_idx].name,
 				    "eth-peers-configfile")) {
 				if (init_peer_eth_addrs(optarg) != 0)
app/test-pmd/testpmd.c +71 -31

132 lines not on this page · raw message

app/test-pmd/testpmd.h +1 -0
index 364502d..c45b2b8 100644
@@ -299,6 +299,7 @@ struct queue_stats_mappings {
 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
 extern uint8_t  interactive;
 extern uint8_t  auto_start;
+extern uint8_t  ring_bind_lcpu;
 extern char cmdline_filename[PATH_MAX]; /**< offline commands file */
 extern uint8_t  numa_support; /**< set by "--numa" parameter */
 extern uint16_t port_topology; /**< set by "--port-topology" parameter */
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Simon,

Quoted 23 lines

Currently the rx/tx queue is allocated from the buffer pool on socket of:
- port's socket if --port-numa-config specified
- or ring-numa-config setting per port

All the above will "bind" queue to single socket per port configuration. But it can actually archieve better performance if one port's queue can be spread across multiple NUMA nodes, and the rx/tx queue is allocated per lcpu socket.

With this patch, testpmd can utilize the PCI-e bus bandwidth on another NUMA nodes. with 64bytes package, When running in PowerPC with Mellanox CX-4 card, single port(100G), with 8 cores, fw mode:
- Without this patch: 52.5Mpps throughput
- With this patch: 66Mpps throughput

app/test-pmd/parameters.c +0 -0
index fbe6284..d02059d 100644

app/test-pmd/parameters.c line 137

Quoted 8 lines
app/test-pmd/parameters.c +5 -0
@@ -130,6 +130,11 @@
 	       "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");
 	printf("  --socket-num=N: set socket from which all memory is allocated "
 	       "in NUMA mode.\n");
+	printf("  --ring-bind-lcpu: "
+		"specify TX/RX rings will be allocated on local socket of lcpu."
+		"It will overrridden ring-numa-config or port-numa-config if success."
+		"If local ring buffer is unavailable, it will use --ring-numa-config or port-numa-config instead."
+		"It allows one port binds to multiple NUMA nodes.\n");

I think it's a good patch to give the APP an example about how to choose the appropriate core. Just have some concern about the priority. Maybe ring-numa-config and port-numa-config should have higher priority. Becuase if APP assigned the specific socket by some purpose, it's not good to overwrite it silently.

Quoted 3 lines
app/test-pmd/parameters.c +0 -0
 	printf("  --mbuf-size=N: set the data size of mbuf to N bytes.\n");
 	printf("  --total-num-mbufs=N: set the number of mbufs to be allocated "
 	       "in mbuf pools.\n");