event/sw: performance improvements
PATCH 1/1 event/sw: performance improvements
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
--- drivers/event/sw/sw_evdev.h | 11 +++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 13 deletions(-)
drivers/event/sw/sw_evdev.h +10 -1
@@ -29,7 +29,13 @@/* report dequeue burst sizes in buckets */ #define SW_DEQ_STAT_BUCKET_SHIFT 2/* how many packets pulled from port by sched */ -#define SCHED_DEQUEUE_BURST_SIZE 32 +#define SCHED_DEQUEUE_BURST_SIZE 64 + +#define SCHED_MIN_BURST_SIZE 8 +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/ +#define SCHED_REFILL_ONCE_PER_CALL 1 +#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH)/* size of our history list */ #define NUM_SAMPLES 64/* how many data points use for average stats */
@@ -214,6 +220,9 @@ struct sw_evdev {uint32_t xstats_count_mode_port;uint32_t xstats_count_mode_queue; +uint16_t sched_flush_count; +uint16_t sched_min_burst; +/* Contains all ports - load balanced and directed */ struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;
drivers/event/sw/sw_evdev_scheduler.c +71 -12
150 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 8 lines
-----Original Message-----
From: Nicolau, Radu <[email protected]>
Sent: Tuesday, September 8, 2020 11:52 AM
To: [email protected]
Cc: [email protected]; Van Haaren, Harry <[email protected]>; Nicolau, Radu <[email protected]>
Subject: [PATCH v1] event/sw: performance improvements
Quoted 5 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau <[email protected]>
Thanks for the patch, a few comments inline.
Quoted 10 lines
--- drivers/event/sw/sw_evdev.h | 11 +++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 13 deletions(-)drivers/event/sw/sw_evdev.h +0
-0
drivers/event/sw/sw_evdev.h line 37
Quoted 10 lines
drivers/event/sw/sw_evdev.h +6
-1@@ -29,7 +29,13 @@/* report dequeue burst sizes in buckets */ #define SW_DEQ_STAT_BUCKET_SHIFT 2/* how many packets pulled from port by sched */ -#define SCHED_DEQUEUE_BURST_SIZE 32 +#define SCHED_DEQUEUE_BURST_SIZE 64 + +#define SCHED_MIN_BURST_SIZE 8 +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/ +#define SCHED_REFILL_ONCE_PER_CALL 1
Is it possible to make the above #define a runtime option? Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
Quoted 115 lines
drivers/event/sw/sw_evdev.h +1
-0+#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH)/* size of our history list */ #define
NUM_SAMPLES64 /* how many data points use for average stats */drivers/event/sw/sw_evdev.h +3
-0@@ -214,6 +220,9 @@ struct sw_evdev {uint32_t xstats_count_mode_port;uint32_t xstats_count_mode_queue; +uint16_t sched_flush_count; +uint16_t sched_min_burst; +/* Contains all ports - load balanced and directed */ struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;drivers/event/sw/sw_evdev_scheduler.c +26
-3@@ -26,6 +26,29 @@/* use cheap bit mixing, we only need to lose a few bits */ #define SW_HASH_FLOWID (f) (((f) ^ (f >> 10)) & FLOWID_MASK) + +/* single object enq and deq for non MT ring */ +static __rte_always_inline void +sw_nonmt_ring_dequeue (struct rte_ring *r,void **obj) +{ +if ((r->prod.tail - r->cons.tail) <1 ) +return ; +void **ring = (void **)&r[1 ]; + *obj = ring[r->cons.tail & r->mask]; + r->cons.tail++; +} +static __rte_always_inline int +sw_nonmt_ring_enqueue (struct rte_ring *r,void *obj) +{ +if ((r->capacity + r->cons.tail - r->prod.tail) <1 ) +return 0 ; +void **ring = (void **)&r[1 ]; + ring[r->prod.tail & r->mask] = obj; + r->prod.tail++; +return 1 ; +} + +static inline uint32_t sw_schedule_atomic_to_cq (struct sw_evdev *sw,struct sw_qid *const qid,uint32_t iq_num,unsigned int count)@@ -146,9 +169,9 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, structsw_qid *const qid, cq_idx =0 ; cq = qid->cq_map[cq_idx++]; - }while (rte_event_ring_free_count ( - sw->ports[cq].cq_worker_ring) ==0 || - sw->ports[cq].inflights ==SW_PORT_HIST_LIST ); + }while (sw->ports[cq].inflights ==SW_PORT_HIST_LIST || +rte_event_ring_free_count ( + sw->ports[cq].cq_worker_ring) ==0 );struct sw_port *p = &sw->ports[cq];drivers/event/sw/sw_evdev_scheduler.c +1
-1if (sw->cq_ring_space[cq] == 0 ||@@ -164,7 +187,7 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, structsw_qid *const qid, p->hist_list[head].qid = qid_id;if (keep_order) -rte_ring_sc_dequeue (qid->reorder_buffer_freelist, +sw_nonmt_ring_dequeue (qid->reorder_buffer_freelist, (void *)&p->hist_list[head].rob_entry);drivers/event/sw/sw_evdev_scheduler.c +2
-2sw->ports[cq].cq_buf[sw->ports[cq].cq_buf_count++] = *qe;@@ -229,7 +252,7 @@ sw_schedule_qid_to_cq(struct sw_evdev *sw)uint32_t pkts_done =0 ;uint32_t count =iq_count (&qid->iq[iq_num]); -if (count >0 ) { +if (count >= sw->sched_min_burst) {if (type ==SW_SCHED_TYPE_DIRECT ) pkts_done +=sw_schedule_dir_to_cq (sw, qid, iq_num, count);@@ -267,7 +290,7 @@ sw_schedule_reorder(struct sw_evdev *sw, int qid_start, int qid_end)for (; qid_start < qid_end; qid_start++) {struct sw_qid *qid = &sw->qids[qid_start]; -int i, num_entries_in_use; +unsigned int i, num_entries_in_use;if (qid->type !=RTE_SCHED_TYPE_ORDERED )drivers/event/sw/sw_evdev_scheduler.c +3
-0continue ;@@ -275,6 +298,9 @@ sw_schedule_reorder(struct sw_evdev *sw, int qid_start, int qid_end) num_entries_in_use =rte_ring_free_count ( qid->reorder_buffer_freelist); +if (num_entries_in_use < sw->sched_min_burst) + num_entries_in_use =0 ; +for (i =0 ; i < num_entries_in_use; i++) {struct reorder_buffer_entry *entry;drivers/event/sw/sw_evdev_scheduler.c +1
-1int j;@@ -320,7 +346,7 @@ sw_schedule_reorder(struct sw_evdev *sw, int qid_start, int qid_end)if (!entry->ready) { entry->fragment_index =0 ; -rte_ring_sp_enqueue ( +sw_nonmt_ring_enqueue ( qid->reorder_buffer_freelist, entry);
drivers/event/sw/sw_evdev_scheduler.c __pull_port_lb(struct sw_evdev *sw, uint32_t port_id, int · line 383
Quoted 9 lines
drivers/event/sw/sw_evdev_scheduler.c +2
-0@@ -349,9 +375,11 @@ __pull_port_lb(struct sw_evdev *sw, uint32_t port_id, int allow_reorder)uint32_t pkts_iter =0 ;struct sw_port *port = &sw->ports[port_id]; +#if !SCHED_REFILL_ONCE_PER_CALL /* If shadow ring has 0 pkts, pull from worker ring */ if (port->pp_buf_count ==0 )sw_refill_pp_buf (sw, port); +#endif
As per above comment, this #if would become a runtime check. Similar for the below #if comments.
Quoted 65 lines
drivers/event/sw/sw_evdev_scheduler.c +2
-0while (port->pp_buf_count) {const struct rte_event *qe = &port->pp_buf[port->pp_buf_start];@@ -467,9 +495,11 @@ sw_schedule_pull_port_dir(struct sw_evdev *sw, uint32_t port_id)uint32_t pkts_iter =0 ;struct sw_port *port = &sw->ports[port_id]; +#if !SCHED_REFILL_ONCE_PER_CALL /* If shadow ring has 0 pkts, pull from worker ring */ if (port->pp_buf_count ==0 )sw_refill_pp_buf (sw, port); +#endif while (port->pp_buf_count) {drivers/event/sw/sw_evdev_scheduler.c +34
-5const struct rte_event *qe = &port->pp_buf[port->pp_buf_start];@@ -557,12 +587,41 @@ sw_event_schedule(struct rte_eventdev *dev)/* push all the internal buffered QEs in port->cq_ring to the * worker cores: aka, do the ring transfers batched. */ +int no_enq =1 ;for (i =0 ; i < sw->port_count; i++) { -struct rte_event_ring *worker = sw->ports[i].cq_worker_ring; -rte_event_ring_enqueue_burst (worker, sw->ports[i].cq_buf, - sw->ports[i].cq_buf_count, - &sw->cq_ring_space[i]); - sw->ports[i].cq_buf_count =0 ; +struct sw_port *port = &sw->ports[i]; +struct rte_event_ring *worker = port->cq_worker_ring; + +#if SCHED_REFILL_ONCE_PER_CALL +/* If shadow ring has 0 pkts, pull from worker ring */ +if (port->pp_buf_count ==0 ) +sw_refill_pp_buf (sw, port); +#endif + +if (port->cq_buf_count >= sw->sched_min_burst) { +rte_event_ring_enqueue_burst (worker, + port->cq_buf, + port->cq_buf_count, + &sw->cq_ring_space[i]); + port->cq_buf_count =0 ; + no_enq =0 ; + }else { + sw->cq_ring_space[i] = +rte_event_ring_free_count (worker) - + port->cq_buf_count; + } + } + +if (no_enq) { +if (unlikely (sw->sched_flush_count >SCHED_NO_ENQ_CYCLE_FLUSH )) + sw->sched_min_burst =1 ; +else + sw->sched_flush_count++; + }else { +if (sw->sched_flush_count) + sw->sched_flush_count--; +else + sw->sched_min_burst =SCHED_MIN_BURST_SIZE ; }}
--
2.17.1
<snip>
Quoted 70 lines
Quoted 6 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau <[email protected]>Thanks for the patch, a few comments inline.
Quoted 15 lines
--- drivers/event/sw/sw_evdev.h | 11 +++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 13 deletions(-)drivers/event/sw/sw_evdev.h +0
-0@@ -29,7 +29,13 @@ /* report dequeue burst sizes in buckets */ #define
SW_DEQ_STAT_BUCKET_SHIFT2
/* how many packets pulled from port by sched */ -#defineSCHED_DEQUEUE_BURST_SIZE32drivers/event/sw/sw_evdev.h line 37
Quoted 6 lines
drivers/event/sw/sw_evdev.h +6
-0+#define SCHED_DEQUEUE_BURST_SIZE 64 + +#define SCHED_MIN_BURST_SIZE 8 +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/ +#define SCHED_REFILL_ONCE_PER_CALL 1Is it possible to make the above #define a runtime option? Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
Quoted 34 lines
+
#define
SW_PORT_HIST_LIST(MAX_SW_PROD_Q_DEPTH) /* size of our
history list */ #defineNUM_SAMPLES64 /* how many data points use for average stats */ @@ -214,6 +220,9 @@ structsw_evdev{drivers/event/sw/sw_evdev.h +3
-0uint32_t xstats_count_mode_port;uint32_t xstats_count_mode_queue; +uint16_t sched_flush_count; +uint16_t sched_min_burst; +/* Contains all ports - load balanced and directed */ struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;drivers/event/sw/sw_evdev_scheduler.c +11
-0@@ -26,6 +26,29 @@/* use cheap bit mixing, we only need to lose a few bits */ #define SW_HASH_FLOWID (f) (((f) ^ (f >> 10)) & FLOWID_MASK) + +/* single object enq and deq for non MT ring */ static +__rte_always_inline void sw_nonmt_ring_dequeue(struct rte_ring *r, +void **obj) { +if ((r->prod.tail - r->cons.tail) <1 ) +return ; +void **ring = (void **)&r[1 ]; + *obj = ring[r->cons.tail & r->mask]; + r->cons.tail++; +} +static __rte_always_inline int
Quoted 8 lines
drivers/event/sw/sw_evdev_scheduler.c line 50
Quoted 8 lines
drivers/event/sw/sw_evdev_scheduler.c +8
-0+sw_nonmt_ring_enqueue(struct rte_ring *r, void *obj) { +if ((r->capacity + r->cons.tail - r->prod.tail) <1 ) +return 0 ; +void **ring = (void **)&r[1 ]; + ring[r->prod.tail & r->mask] = obj; + r->prod.tail++; +return 1 ; +
Why not make these APIs part of the rte_ring library? You could further optimize them by keeping the indices on the same cacheline.
Quoted 159 lines
drivers/event/sw/sw_evdev_scheduler.c sw_schedule_parallel_to_cq(struct sw_evdev *sw,
Quoted 6 lines
drivers/event/sw/sw_evdev_scheduler.c +2
-0+ +static inline uint32_t sw_schedule_atomic_to_cq (struct sw_evdev *sw,struct sw_qid *const qid,uint32_t iq_num,unsigned int count)@@ -146,9 +169,9 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw,struct
drivers/event/sw/sw_evdev_scheduler.c sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
Quoted 7 lines
drivers/event/sw/sw_evdev_scheduler.c +0
-3sw_qid *const qid, cq_idx =0 ; cq = qid->cq_map[cq_idx++]; - }while (rte_event_ring_free_count ( - sw->ports[cq].cq_worker_ring) ==0 || - sw->ports[cq].inflights ==
SW_PORT_HIST_LIST);drivers/event/sw/sw_evdev_scheduler.c sw_schedule_parallel_to_cq(struct sw_evdev *sw,
Quoted 7 lines
drivers/event/sw/sw_evdev_scheduler.c +3
-0+ }while (sw->ports[cq].inflights ==SW_PORT_HIST_LIST || +rte_event_ring_free_count ( + sw->ports[cq].cq_worker_ring) ==0 );struct sw_port *p = &sw->ports[cq];drivers/event/sw/sw_evdev_scheduler.c +0
-0if (sw->cq_ring_space[cq] == 0 ||@@ -164,7 +187,7 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw,struct
drivers/event/sw/sw_evdev_scheduler.c sw_schedule_reorder(struct sw_evdev *sw, int
Quoted 19 lines
drivers/event/sw/sw_evdev_scheduler.c +1
-1sw_qid *const qid, p->hist_list[head].qid = qid_id;if (keep_order) -rte_ring_sc_dequeue (qid->reorder_buffer_freelist, +sw_nonmt_ring_dequeue (qid->reorder_buffer_freelist, (void *)&p->hist_list[head].rob_entry);drivers/event/sw/sw_evdev_scheduler.c +1
-1sw->ports[cq].cq_buf[sw->ports[cq].cq_buf_count++] = *qe;@@ -229,7 +252,7 @@ sw_schedule_qid_to_cq(struct sw_evdev *sw)uint32_t pkts_done =0 ;uint32_t count =iq_count (&qid->iq[iq_num]); -if (count >0 ) { +if (count >= sw->sched_min_burst) {if (type ==SW_SCHED_TYPE_DIRECT ) pkts_done +=sw_schedule_dir_to_cq (sw, qid, iq_num, count);@@ -267,7 +290,7 @@ sw_schedule_reorder(struct sw_evdev *sw, int
qid_start, intdrivers/event/sw/sw_evdev_scheduler.c sw_schedule_reorder(struct sw_evdev *sw, int
Quoted 10 lines
drivers/event/sw/sw_evdev_scheduler.c +1
-1qid_end)for (; qid_start < qid_end; qid_start++) {struct sw_qid *qid = &sw->qids[qid_start]; -int i, num_entries_in_use; +unsigned int i, num_entries_in_use;if (qid->type !=RTE_SCHED_TYPE_ORDERED )drivers/event/sw/sw_evdev_scheduler.c +0
-0continue ;@@ -275,6 +298,9 @@ sw_schedule_reorder(struct sw_evdev *sw, int
qid_start, intdrivers/event/sw/sw_evdev_scheduler.c sw_schedule_reorder(struct sw_evdev *sw, int
Quoted 11 lines
drivers/event/sw/sw_evdev_scheduler.c +3
-0qid_end) num_entries_in_use =rte_ring_free_count ( qid->reorder_buffer_freelist); +if (num_entries_in_use < sw->sched_min_burst) + num_entries_in_use =0 ; +for (i =0 ; i < num_entries_in_use; i++) {struct reorder_buffer_entry *entry;drivers/event/sw/sw_evdev_scheduler.c +0
-0int j;@@ -320,7 +346,7 @@ sw_schedule_reorder(struct sw_evdev *sw, int
qid_start, intdrivers/event/sw/sw_evdev_scheduler.c __pull_port_lb(struct sw_evdev *sw, uint32_t port_id,
Quoted 10 lines
drivers/event/sw/sw_evdev_scheduler.c +1
-1qid_end)if (!entry->ready) { entry->fragment_index =0 ; -rte_ring_sp_enqueue ( +sw_nonmt_ring_enqueue ( qid->reorder_buffer_freelist, entry);@@ -349,9 +375,11 @@ __pull_port_lb(struct sw_evdev *sw, uint32_t port_id,int
drivers/event/sw/sw_evdev_scheduler.c __pull_port_lb(struct sw_evdev *sw, uint32_t port_id, int allow_reorder) · line 382
Quoted 9 lines
drivers/event/sw/sw_evdev_scheduler.c +2
-0allow_reorder)uint32_t pkts_iter =0 ;struct sw_port *port = &sw->ports[port_id]; +#if !SCHED_REFILL_ONCE_PER_CALL /* If shadow ring has 0 pkts, pull from worker ring */ if (port->pp_buf_count ==0 )sw_refill_pp_buf (sw, port); +#endif As per above comment, this #if would become a runtime check. Similar for the below #if comments.
drivers/event/sw/sw_evdev_scheduler.c sw_schedule_pull_port_dir(struct sw_evdev *sw,
Quoted 4 lines
drivers/event/sw/sw_evdev_scheduler.c +0
-0while (port->pp_buf_count) { const struct rte_event *qe = &port->pp_buf[port-
pp_buf_start];drivers/event/sw/sw_evdev_scheduler.c +0
-0@@ -467,9 +495,11 @@ sw_schedule_pull_port_dir(struct sw_evdev *sw,
uint32_tQuoted 63 lines
drivers/event/sw/sw_evdev_scheduler.c +2
-0port_id)uint32_t pkts_iter =0 ;struct sw_port *port = &sw->ports[port_id]; +#if !SCHED_REFILL_ONCE_PER_CALL /* If shadow ring has 0 pkts, pull from worker ring */ if (port->pp_buf_count ==0 )sw_refill_pp_buf (sw, port); +#endif while (port->pp_buf_count) {const struct
rte_event*qe = &port->pp_buf[port-pp_buf_start];drivers/event/sw/sw_evdev_scheduler.c +34
-5@@ -557,12 +587,41 @@ sw_event_schedule(struct rte_eventdev *dev)/* push all the internal buffered QEs in port->cq_ring to the * worker cores: aka, do the ring transfers batched. */ +int no_enq =1 ;for (i =0 ; i < sw->port_count; i++) { -struct rte_event_ring *worker = sw->ports[i].cq_worker_ring; -rte_event_ring_enqueue_burst (worker, sw->ports[i].cq_buf, - sw->ports[i].cq_buf_count, - &sw->cq_ring_space[i]); - sw->ports[i].cq_buf_count =0 ; +struct sw_port *port = &sw->ports[i]; +struct rte_event_ring *worker = port->cq_worker_ring; + +#if SCHED_REFILL_ONCE_PER_CALL +/* If shadow ring has 0 pkts, pull from worker ring */ +if (port->pp_buf_count ==0 ) +sw_refill_pp_buf (sw, port); +#endif + +if (port->cq_buf_count >= sw->sched_min_burst) { +rte_event_ring_enqueue_burst (worker, + port->cq_buf, + port->cq_buf_count, + &sw->cq_ring_space[i]); + port->cq_buf_count =0 ; + no_enq =0 ; + }else { + sw->cq_ring_space[i] = +rte_event_ring_free_count (worker) - + port->cq_buf_count; + } + } + +if (no_enq) { +if (unlikely (sw->sched_flush_count >SCHED_NO_ENQ_CYCLE_FLUSH )) + sw->sched_min_burst =1 ; +else + sw->sched_flush_count++; + }else { +if (sw->sched_flush_count) + sw->sched_flush_count--; +else + sw->sched_min_burst =SCHED_MIN_BURST_SIZE ; }}
--
2.17.1
On 9/24/2020 12:10 AM, Honnappa Nagarahalli wrote:
<snip>
Add minimum burst throughout the scheduler pipeline and a flush counter.
Replace ring API calls with local single threaded implementation where
possible.
Thanks for the patch, a few comments inline.
---
drivers/event/sw/sw_evdev.h | 11 +++-
drivers/event/sw/sw_evdev_scheduler.c | 83
+++++++++++++++++++++++----
2 files changed, 81 insertions(+), 13 deletions(-)
drivers/event/sw/sw_evdev.h +0 -0
index 7c77b2495..95e51065f 100644
--- a/drivers/event/sw/sw_evdev.h
+++ b/drivers/event/sw/sw_evdev.h
@@ -29,7 +29,13 @@
/* report dequeue burst sizes in buckets */ #define
SW_DEQ_STAT_BUCKET_SHIFT 2
/* how many packets pulled from port by sched */ -#define
SCHED_DEQUEUE_BURST_SIZE 32
+#define SCHED_DEQUEUE_BURST_SIZE 64
+
+#define SCHED_MIN_BURST_SIZE 8
+#define SCHED_NO_ENQ_CYCLE_FLUSH 256
+/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/
+#define SCHED_REFILL_ONCE_PER_CALL 1
Is it possible to make the above #define a runtime option?
Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
+
#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH) /* size of our
history list */ #define NUM_SAMPLES 64 /* how many data points use
for average stats */ @@ -214,6 +220,9 @@ struct sw_evdev {
uint32_t xstats_count_mode_port;
uint32_t xstats_count_mode_queue;+ uint16_t sched_flush_count;
+ uint16_t sched_min_burst;
+
/* Contains all ports - load balanced and directed */
struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;(quoted diff) +0 -0
b/drivers/event/sw/sw_evdev_scheduler.c
index cff747da8..ca6d1caff 100644
--- a/drivers/event/sw/sw_evdev_scheduler.c
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -26,6 +26,29 @@
/* use cheap bit mixing, we only need to lose a few bits */ #define
SW_HASH_FLOWID(f) (((f) ^ (f >> 10)) & FLOWID_MASK)
+
+/* single object enq and deq for non MT ring */ static
+__rte_always_inline void sw_nonmt_ring_dequeue(struct rte_ring *r,
+void **obj) {
+ if ((r->prod.tail - r->cons.tail) < 1)
+ return;
+ void **ring = (void **)&r[1];
+ *obj = ring[r->cons.tail & r->mask];
+ r->cons.tail++;
+}
+static __rte_always_inline int
+sw_nonmt_ring_enqueue(struct rte_ring *r, void *obj) {
+ if ((r->capacity + r->cons.tail - r->prod.tail) < 1)
+ return 0;
+ void **ring = (void **)&r[1];
+ ring[r->prod.tail & r->mask] = obj;
+ r->prod.tail++;
+ return 1;
+
Why not make these APIs part of the rte_ring library? You could further optimize them by keeping the indices on the same cacheline.
I'm not sure there is any need for non thread-safe rings outside this particular case.
<snip>
Add minimum burst throughout the scheduler pipeline and a flush counter.
Replace ring API calls with local single threaded implementation where
possible.
Thanks for the patch, a few comments inline.
---
drivers/event/sw/sw_evdev.h | 11 +++-
drivers/event/sw/sw_evdev_scheduler.c | 83
+++++++++++++++++++++++----
2 files changed, 81 insertions(+), 13 deletions(-)
drivers/event/sw/sw_evdev.h +0 -0
index 7c77b2495..95e51065f 100644
--- a/drivers/event/sw/sw_evdev.h
+++ b/drivers/event/sw/sw_evdev.h
@@ -29,7 +29,13 @@
/* report dequeue burst sizes in buckets */ #define
SW_DEQ_STAT_BUCKET_SHIFT 2
/* how many packets pulled from port by sched */ -#define
SCHED_DEQUEUE_BURST_SIZE 32
+#define SCHED_DEQUEUE_BURST_SIZE 64
+
+#define SCHED_MIN_BURST_SIZE 8
+#define SCHED_NO_ENQ_CYCLE_FLUSH 256
+/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/
+#define SCHED_REFILL_ONCE_PER_CALL 1
Is it possible to make the above #define a runtime option?
Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
+
#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH) /* size of our
history list */ #define NUM_SAMPLES 64 /* how many data points use
for average stats */ @@ -214,6 +220,9 @@ struct sw_evdev {
uint32_t xstats_count_mode_port;
uint32_t xstats_count_mode_queue;+ uint16_t sched_flush_count;
+ uint16_t sched_min_burst;
+
/* Contains all ports - load balanced and directed */
struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;(quoted diff) +0 -0
b/drivers/event/sw/sw_evdev_scheduler.c
index cff747da8..ca6d1caff 100644
--- a/drivers/event/sw/sw_evdev_scheduler.c
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -26,6 +26,29 @@
/* use cheap bit mixing, we only need to lose a few bits */ #define
SW_HASH_FLOWID(f) (((f) ^ (f >> 10)) & FLOWID_MASK)
+
+/* single object enq and deq for non MT ring */ static
+__rte_always_inline void sw_nonmt_ring_dequeue(struct rte_ring *r,
+void **obj) {
+ if ((r->prod.tail - r->cons.tail) < 1)
+ return;
+ void **ring = (void **)&r[1];
+ *obj = ring[r->cons.tail & r->mask];
+ r->cons.tail++;
+}
+static __rte_always_inline int
+sw_nonmt_ring_enqueue(struct rte_ring *r, void *obj) {
+ if ((r->capacity + r->cons.tail - r->prod.tail) < 1)
+ return 0;
+ void **ring = (void **)&r[1];
+ ring[r->prod.tail & r->mask] = obj;
+ r->prod.tail++;
+ return 1;
+
Why not make these APIs part of the rte_ring library? You could further optimize them by keeping the indices on the same cacheline.
I'm not sure there is any need for non thread-safe rings outside this particular case.
[Honnappa] I think if we add the APIs, we will find the use cases.
But, more than that, I understand that rte_ring structure is exposed to the application. The reason for doing that is the inline functions that rte_ring provides. IMO, we should still maintain modularity and should not use the internals of the rte_ring structure outside of the library.
<snip>
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Thanks for the patch, a few comments inline.
--- drivers/event/sw/sw_evdev.h | 11 +++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 13 deletions(-)
drivers/event/sw/sw_evdev.h +0 -0
@@ -29,7 +29,13 @@ /* report dequeue burst sizes in buckets */ #define
SW_DEQ_STAT_BUCKET_SHIFT 2
/* how many packets pulled from port by sched */ -#defineSCHED_DEQUEUE_BURST_SIZE 32
+#define SCHED_DEQUEUE_BURST_SIZE 64
+
+#define SCHED_MIN_BURST_SIZE 8
+#define SCHED_NO_ENQ_CYCLE_FLUSH 256
+/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/ +#define SCHED_REFILL_ONCE_PER_CALL 1
Is it possible to make the above #define a runtime option? Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
+
#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH) /* size of our
history list */ #define NUM_SAMPLES 64 /* how many data points use for average stats */ @@ -214,6 +220,9 @@ struct sw_evdev {
uint32_t xstats_count_mode_port;
uint32_t xstats_count_mode_queue;
+ uint16_t sched_flush_count;
+ uint16_t sched_min_burst;
+
/* Contains all ports - load balanced and directed */ struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;
(quoted diff) +0 -0
b/drivers/event/sw/sw_evdev_scheduler.c
index cff747da8..ca6d1caff 100644
drivers/event/sw/sw_evdev_scheduler.c +0 -0
@@ -26,6 +26,29 @@ /* use cheap bit mixing, we only need to lose a few bits */ #define
SW_HASH_FLOWID(f) (((f) ^ (f >> 10)) & FLOWID_MASK)
+
+/* single object enq and deq for non MT ring */ static
+__rte_always_inline void sw_nonmt_ring_dequeue(struct rte_ring *r,
+void **obj) {
+ if ((r->prod.tail - r->cons.tail) < 1)
+ return;
+ void **ring = (void **)&r[1];
+ *obj = ring[r->cons.tail & r->mask];
+ r->cons.tail++;
+}
+static __rte_always_inline int
+sw_nonmt_ring_enqueue(struct rte_ring *r, void *obj) {
+ if ((r->capacity + r->cons.tail - r->prod.tail) < 1)
+ return 0;
+ void **ring = (void **)&r[1];
+ ring[r->prod.tail & r->mask] = obj;
+ r->prod.tail++;
+ return 1;
+
Why not make these APIs part of the rte_ring library? You could further optimize them by keeping the indices on the same cacheline.
I'm not sure there is any need for non thread-safe rings outside this particular case.
[Honnappa] I think if we add the APIs, we will find the use cases.
But, more than that, I understand that rte_ring structure is exposed to the application. The reason for doing that is the inline functions that rte_ring provides. IMO, we should still maintain modularity and should not use the internals of the rte_ring structure outside of the library.
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
Quoted 87 lines · Konstantin
<snip>
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
--- drivers/event/sw/sw_evdev.h | 11 +++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 13 deletions(-)drivers/event/sw/sw_evdev.h +0
-0@@ -29,7 +29,13 @@ /* report dequeue burst sizes in buckets */ #define
SW_DEQ_STAT_BUCKET_SHIFT2
/* how many packets pulled from port by sched */ -#defineSCHED_DEQUEUE_BURST_SIZE32drivers/event/sw/sw_evdev.h +6
-0+#define SCHED_DEQUEUE_BURST_SIZE 64 + +#define SCHED_MIN_BURST_SIZE 8 +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/ +#define SCHED_REFILL_ONCE_PER_CALL 1Is it possible to make the above #define a runtime option? Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
+
#define
SW_PORT_HIST_LIST(MAX_SW_PROD_Q_DEPTH) /* size of our
history list */ #defineNUM_SAMPLES64 /* how many data points use for average stats */ @@ -214,6 +220,9 @@ structsw_evdev{
uint32_txstats_count_mode_port;
uint32_txstats_count_mode_queue;+
uint16_tsched_flush_count;
+uint16_tsched_min_burst;drivers/event/sw/sw_evdev.h +1
-0+ /* Contains all ports - load balanced and directed */ struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;drivers/event/sw/sw_evdev_scheduler.c +19
-0@@ -26,6 +26,29 @@ /* use cheap bit mixing, we only need to lose a few bits */ #defineSW_HASH_FLOWID (f) (((f) ^ (f >> 10)) & FLOWID_MASK) + +/* single object enq and deq for non MT ring */ static +__rte_always_inline void sw_nonmt_ring_dequeue(struct rte_ring *r, +void **obj) { + if ((r->prod.tail - r->cons.tail) < 1) + return; + void **ring = (void **)&r[1]; + *obj = ring[r->cons.tail & r->mask]; + r->cons.tail++; +} +static __rte_always_inline int +sw_nonmt_ring_enqueue (struct rte_ring *r,void *obj) { + if ((r->capacity + r->cons.tail - r->prod.tail) < 1) + return 0; + void **ring = (void **)&r[1]; + ring[r->prod.tail & r->mask] = obj; + r->prod.tail++; + return 1; +Why not make these APIs part of the
rte_ringlibrary? You could further optimize them by keeping the indices on the same cacheline.
I'm not sure there is any need for non thread-safe rings outside this particular case.
[Honnappa] I think if we add the APIs, we will find the use cases.
But, more than that, I understand thatrte_ringstructure is exposed to the application. The reason for doing that is the inline functions thatrte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.
Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
<snip>
Quoted 82 lines
Quoted 72 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
--- drivers/event/sw/sw_evdev.h���������� | 11 +++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 13 deletions(-)drivers/event/sw/sw_evdev.h +0
-0@@ -29,7 +29,13 @@ /* report dequeue burst sizes in buckets */� #define
SW_DEQ_STAT_BUCKET_SHIFT2
/* how many packets pulled from port by sched */ -#defineSCHED_DEQUEUE_BURST_SIZE32drivers/event/sw/sw_evdev.h +6
-0+#define SCHED_DEQUEUE_BURST_SIZE 64 + +#define SCHED_MIN_BURST_SIZE 8 +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/ +#define SCHED_REFILL_ONCE_PER_CALL 1Is it possible to make the above #define a runtime option? Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
+
#define
SW_PORT_HIST_LIST(MAX_SW_PROD_Q_DEPTH) /* size of our
history list */� #defineNUM_SAMPLES64 /* how many data points use for average stats */ @@ -214,6 +220,9 @@ structsw_evdev{ ���uint32_txstats_count_mode_port; ���uint32_txstats_count_mode_queue;+���
uint16_tsched_flush_count; ���uint16_tdrivers/event/sw/sw_evdev.h +2
-0+sched_min_burst ; + ��� /* Contains all ports - load balanced and directed */��� struct
sw_portports[SW_PORTS_MAX]__rte_cache_aligned;drivers/event/sw/sw_evdev_scheduler.c +13
-0@@ -26,6 +26,29 @@ /* use cheap bit mixing, we only need to lose a few bits */�#define SW_HASH_FLOWID (f) (((f) ^ (f >> 10)) & FLOWID_MASK) + +/* single object enq and deq for non MT ring */ static +__rte_always_inline void sw_nonmt_ring_dequeue(struct rte_ring *r, +void **obj) { ��� if ((r->prod.tail - r->cons.tail) < 1) +����������� return; ��� void **ring = +(void **)&r[1]; ��� *obj = ring[r->cons.tail & r->mask]; +��� r->cons.tail++; } static __rte_always_inline int +sw_nonmt_ring_enqueue(struct rte_ring *r, void *obj) { ��� if +((r->capacity + r->cons.tail - r->prod.tail) <1 ) +����������� return 0; ��� void **ring = +(void **)&r[1]; ��� ring[r->prod.tail & r->mask] = obj; +��� r->prod.tail++; ��� return 1; +Quoted 1 line
Why not make these APIs part of the
rte_ringlibrary? You could furtheroptimize them by keeping the indices on the same cacheline.
Quoted 1 line
I'm not sure there is any need for non thread-safe rings outside this
particular case.
Quoted 2 lines
[Honnappa] I think if we add the APIs, we will find the use cases. But, more than that, I understand that
rte_ringstructure is exposed to theapplication. The reason for doing that is the inline functions that
rte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.Quoted 1 line
Quoted 8 lines
Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
IMO, the ring library is pretty organized with the recent addition of HTS/RTS modes. This can be one of the modes and should allow us to use the existing functions (though additional functions are required as well). The other concern I have is, this implementation can be further optimized by using a single cache line for the pointers. It uses 2 cache lines just because of the layout of the rte_ring structure. There was a question earlier about the performance improvements of this patch? Are there any % performance improvements that can be shared?
It is also possible to change the above functions to use the head/tail pointers from producer or the consumer cache line alone to check for perf differences.
Quoted 85 lines · Honnappa Nagarahalli
<snip>
Quoted 84 lines
Quoted 72 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
--- drivers/event/sw/sw_evdev.h���������� | 11 +++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 13 deletions(-)drivers/event/sw/sw_evdev.h +0
-0@@ -29,7 +29,13 @@ /* report dequeue burst sizes in buckets */� #define
SW_DEQ_STAT_BUCKET_SHIFT2
/* how many packets pulled from port by sched */ -#defineSCHED_DEQUEUE_BURST_SIZE32drivers/event/sw/sw_evdev.h +6
-0+#define SCHED_DEQUEUE_BURST_SIZE 64 + +#define SCHED_MIN_BURST_SIZE 8 +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +/* set SCHED_DEQUEUE_BURST_SIZE to 64 or 128 when setting this to 1*/ +#define SCHED_REFILL_ONCE_PER_CALL 1Is it possible to make the above #define a runtime option? Eg, --vdev event_sw,refill_iter=1
That would allow packaged versions of DPDK to be usable in both modes.
+
#define
SW_PORT_HIST_LIST(MAX_SW_PROD_Q_DEPTH) /* size of our
history list */� #defineNUM_SAMPLES64 /* how many data points use for average stats */ @@ -214,6 +220,9 @@ structsw_evdev{ ���uint32_txstats_count_mode_port; ���uint32_txstats_count_mode_queue;+���
uint16_tsched_flush_count; ���uint16_tdrivers/event/sw/sw_evdev.h +2
-0+sched_min_burst ; + ��� /* Contains all ports - load balanced and directed */��� struct
sw_portports[SW_PORTS_MAX]__rte_cache_aligned;drivers/event/sw/sw_evdev_scheduler.c +13
-0@@ -26,6 +26,29 @@ /* use cheap bit mixing, we only need to lose a few bits */�#define SW_HASH_FLOWID (f) (((f) ^ (f >> 10)) & FLOWID_MASK) + +/* single object enq and deq for non MT ring */ static +__rte_always_inline void sw_nonmt_ring_dequeue(struct rte_ring *r, +void **obj) { ��� if ((r->prod.tail - r->cons.tail) < 1) +����������� return; ��� void **ring = +(void **)&r[1]; ��� *obj = ring[r->cons.tail & r->mask]; +��� r->cons.tail++; } static __rte_always_inline int +sw_nonmt_ring_enqueue(struct rte_ring *r, void *obj) { ��� if +((r->capacity + r->cons.tail - r->prod.tail) <1 ) +����������� return 0; ��� void **ring = +(void **)&r[1]; ��� ring[r->prod.tail & r->mask] = obj; +��� r->prod.tail++; ��� return 1; +Quoted 1 line
Why not make these APIs part of the
rte_ringlibrary? You could furtheroptimize them by keeping the indices on the same cacheline.
Quoted 1 line
I'm not sure there is any need for non thread-safe rings outside this
particular case.
Quoted 2 lines
[Honnappa] I think if we add the APIs, we will find the use cases. But, more than that, I understand that
rte_ringstructure is exposed to theapplication. The reason for doing that is the inline functions that
rte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
Quoted 8 lines
Quoted 4 lines
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
IMO, the ring library is pretty organized with the recent addition of HTS/RTS modes. This can be one of the modes and should allow us to use the existing functions (though additional functions are required as well). The other concern I have is, this implementation can be further optimized by using a single cache line for the pointers. It uses 2 cache lines just because of the layout of the
rte_ringstructure. There was a question earlier about the performance improvements of this patch? Are there any % performance improvements that can be shared?
It is also possible to change the above functions to use the head/tail pointers from producer or the consumer cache line alone to check for perf differences.
I don't have a % for the final improvement for this change alone, but there was some improvement in the memory overhead measurable during development, which very likely resulted in the whole optimization having more headroom.
I agree that this may be further optimized, maybe by having a local implementation of a ring-like container instead.
Quoted 34 lines · Radu
Quoted 22 lines · Honnappa Nagarahalli
<snip>
Quoted 21 lines
Quoted 10 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
Why not make these APIs part of the
rte_ringlibrary? You could furtheroptimize them by keeping the indices on the same cacheline.
Quoted 1 line
I'm not sure there is any need for non thread-safe rings outside this
particular case.
Quoted 2 lines
[Honnappa] I think if we add the APIs, we will find the use cases. But, more than that, I understand that
rte_ringstructure is exposed to theapplication. The reason for doing that is the inline functions that
rte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
Quoted 8 lines
Quoted 4 lines
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
IMO, the ring library is pretty organized with the recent addition of HTS/RTS modes. This can be one of the modes and should allow us to use the existing functions (though additional functions are required as well). The other concern I have is, this implementation can be further optimized by using a single cache line for the pointers. It uses 2 cache lines just because of the layout of the
rte_ringstructure. There was a question earlier about the performance improvements of this patch? Are there any % performance improvements that can be shared?
It is also possible to change the above functions to use the head/tail pointers from producer or the consumer cache line alone to check for perf differences.
Quoted 7 lines
I don't have a % for the final improvement for this change alone, but there was some improvement in the memory overhead measurable during development, which very likely resulted in the whole optimization having more headroom.
I agree that this may be further optimized, maybe by having a local implementation of a ring-like container instead.
Have we decided on the next steps for this patch? Is the plan to supersede this patch and have different
one in rte_ring subsystem,
Quoted 1 line
Quoted 57 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 22 lines · Radu
Quoted 19 lines · Honnappa Nagarahalli
<snip>
Quoted 18 lines
Quoted 10 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
Why not make these APIs part of the
rte_ringlibrary? You could furtheroptimize them by keeping the indices on the same cacheline.
Quoted 1 line
I'm not sure there is any need for non thread-safe rings outside this
particular case.
Quoted 2 lines
[Honnappa] I think if we add the APIs, we will find the use cases. But, more than that, I understand that
rte_ringstructure is exposed to theapplication. The reason for doing that is the inline functions that
rte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
IMO, the ring library is pretty organized with the recent addition of HTS/RTS
modes. This can be one of the modes and should allow us to use the existing functions (though additional functions are required as well).
Quoted 1 line
Quoted 1 line
The other concern I have is, this implementation can be further optimized by
using a single cache line for the pointers. It uses 2 cache lines just because of the layout of the
rte_ringstructure.Quoted 1 line
Quoted 1 line
There was a question earlier about the performance improvements of this
patch? Are there any % performance improvements that can be shared?
Quoted 1 line
Quoted 1 line
It is also possible to change the above functions to use the head/tail pointers
from producer or the consumer cache line alone to check for perf differences.
Quoted 6 lines
I don't have a % for the final improvement for this change alone, but there was some improvement in the memory overhead measurable during development, which very likely resulted in the whole optimization having more headroom.
Quoted 6 lines
Quoted 2 lines
I agree that this may be further optimized, maybe by having a local implementation of a ring-like container instead.
Have we decided on the next steps for this patch? Is the plan to supersede this patch and have different
one inrte_ringsubsystem,
My preference is to merge this version of the patch;
1) The ring helper functions are stripped to the SW PMD usage, and not valid to use in the general.
2) Adding static inline APIs in an LTS without extensive doesn't seem a good idea.
If Honnappa is OK with the above solution for 20.11, we can see about moving the rings part of the code to rte_ring library location in 21.02, and give ourselves some time to settle the usage/API before the next LTS.
Regards, -Harry
Quoted 66 lines
Quoted 59 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 22 lines · Radu
Quoted 19 lines · Honnappa Nagarahalli
<snip>
Quoted 18 lines
Quoted 10 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
Why not make these APIs part of the
rte_ringlibrary? You could furtheroptimize them by keeping the indices on the same cacheline.
Quoted 1 line
I'm not sure there is any need for non thread-safe rings outside this
particular case.
Quoted 2 lines
[Honnappa] I think if we add the APIs, we will find the use cases. But, more than that, I understand that
rte_ringstructure is exposed to theapplication. The reason for doing that is the inline functions that
rte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
IMO, the ring library is pretty organized with the recent addition of HTS/RTS
modes. This can be one of the modes and should allow us to use the existing functions (though additional functions are required as well).
Quoted 1 line
Quoted 1 line
The other concern I have is, this implementation can be further optimized by
using a single cache line for the pointers. It uses 2 cache lines just because of the layout of the
rte_ringstructure.Quoted 1 line
Quoted 1 line
There was a question earlier about the performance improvements of this
patch? Are there any % performance improvements that can be shared?
Quoted 1 line
Quoted 1 line
It is also possible to change the above functions to use the head/tail pointers
from producer or the consumer cache line alone to check for perf differences.
Quoted 6 lines
I don't have a % for the final improvement for this change alone, but there was some improvement in the memory overhead measurable during development, which very likely resulted in the whole optimization having more headroom.
Quoted 6 lines
Quoted 2 lines
I agree that this may be further optimized, maybe by having a local implementation of a ring-like container instead.
Have we decided on the next steps for this patch? Is the plan to supersede this patch and have different
one inrte_ringsubsystem,
Quoted 8 lines
My preference is to merge this version of the patch;
1) The ring helper functions are stripped to the SW PMD usage, and not valid to use in the general.
2) Adding static inline APIs in an LTS without extensive doesn't seem a good idea.If Honnappa is OK with the above solution for 20.11, we can see about moving the rings part of the code to
rte_ringlibrary location in 21.02, and give ourselves some time to settle the usage/API before the next LTS.
As ring library maintainer I share Honnappa concern that another library not uses public ring API, but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?
Quoted 67 lines · Konstantin
Quoted 59 lines
Quoted 54 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 20 lines · Radu
Quoted 18 lines · Honnappa Nagarahalli
<snip>
Quoted 17 lines
Quoted 9 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
Why not make these APIs part of the
rte_ringlibrary? You could furtheroptimize them by keeping the indices on the same cacheline.
Quoted 1 line
I'm not sure there is any need for non thread-safe rings outside this
particular case.
Quoted 2 lines
[Honnappa] I think if we add the APIs, we will find the use cases. But, more than that, I understand that
rte_ringstructure is exposed to theapplication. The reason for doing that is the inline functions that
rte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
IMO, the ring library is pretty organized with the recent addition of HTS/RTS
modes. This can be one of the modes and should allow us to use the existing functions (though additional functions are required as well).
Quoted 1 line
Quoted 1 line
The other concern I have is, this implementation can be further optimized by
using a single cache line for the pointers. It uses 2 cache lines just because of the layout of the
rte_ringstructure.Quoted 1 line
Quoted 1 line
There was a question earlier about the performance improvements of this
patch? Are there any % performance improvements that can be shared?
Quoted 1 line
Quoted 1 line
It is also possible to change the above functions to use the head/tail pointers
from producer or the consumer cache line alone to check for perf differences.
Quoted 5 lines
I don't have a % for the final improvement for this change alone, but there was some improvement in the memory overhead measurable during development, which very likely resulted in the whole optimization having more headroom.
Quoted 5 lines
Quoted 2 lines
I agree that this may be further optimized, maybe by having a local implementation of a ring-like container instead.
Have we decided on the next steps for this patch? Is the plan to supersede this patch and have different
one inrte_ringsubsystem,Quoted 8 lines
My preference is to merge this version of the patch;
1) The ring helper functions are stripped to the SW PMD usage, and not valid to use in the general.
2) Adding static inline APIs in an LTS without extensive doesn't seem a good idea.If Honnappa is OK with the above solution for 20.11, we can see about moving the rings part of the code to
rte_ringlibrary location in 21.02, and give ourselves some time to settle the usage/API before the next LTS.
Quoted 6 lines
As ring library maintainer I share Honnappa concern that another library not uses public ring API, but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?
The change itself came after I analyzed the memory bound sections of the code, and I just did a quick test, I got about 3.5% improvement in throughput, maybe not so much but significant for such a small change, and depending on the usecase it may be more.
As for the implementation itself, I would favour having a custom ring like container in the PMD code, this will solve the issue of using rte_ring internals while still allow for full optimisation. If this is acceptable, I will follow up by tomorrow.
Quoted 80 lines · Konstantin
Quoted 67 lines
Quoted 59 lines
Quoted 54 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 20 lines · Radu
Quoted 18 lines · Honnappa Nagarahalli
<snip>
Quoted 17 lines
Quoted 9 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau mailto:[email protected]Thanks for the patch, a few comments inline.
Why not make these APIs part of the
rte_ringlibrary? You could furtheroptimize them by keeping the indices on the same cacheline.
Quoted 1 line
I'm not sure there is any need for non thread-safe rings outside this
particular case.
Quoted 2 lines
[Honnappa] I think if we add the APIs, we will find the use cases. But, more than that, I understand that
rte_ringstructure is exposed to theapplication. The reason for doing that is the inline functions that
rte_ringprovides. IMO, we should still maintain modularity and should not use the internals of therte_ringstructure outside of the library.Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
+1 to that.
BTW, is there any real perf benefit from such micor-optimisation?
I'd tend to view these as use-case specific, and I'm not sure we should clutter up the ring library with yet more functions, especially since they can't be mixed with the existing enqueue/dequeue functions, since they don't use the head pointers.
IMO, the ring library is pretty organized with the recent addition of HTS/RTS
modes. This can be one of the modes and should allow us to use the existing functions (though additional functions are required as well).
Quoted 1 line
Quoted 1 line
The other concern I have is, this implementation can be further optimized by
using a single cache line for the pointers. It uses 2 cache lines just because of the layout of the
rte_ringstructure.Quoted 1 line
Quoted 1 line
There was a question earlier about the performance improvements of this
patch? Are there any % performance improvements that can be shared?
Quoted 1 line
Quoted 1 line
It is also possible to change the above functions to use the head/tail pointers
from producer or the consumer cache line alone to check for perf differences.
Quoted 5 lines
I don't have a % for the final improvement for this change alone, but there was some improvement in the memory overhead measurable during development, which very likely resulted in the whole optimization having more headroom.
Quoted 5 lines
Quoted 2 lines
I agree that this may be further optimized, maybe by having a local implementation of a ring-like container instead.
Have we decided on the next steps for this patch? Is the plan to supersede this patch and have different
one inrte_ringsubsystem,Quoted 8 lines
My preference is to merge this version of the patch;
1) The ring helper functions are stripped to the SW PMD usage, and not valid to use in the general.
2) Adding static inline APIs in an LTS without extensive doesn't seem a good idea.If Honnappa is OK with the above solution for 20.11, we can see about moving the rings part of the code to
rte_ringlibrary location in 21.02, and give ourselves some time to settle the usage/API before the next LTS.Quoted 6 lines
As ring library maintainer I share Honnappa concern that another library not uses public ring API, but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?The change itself came after I analyzed the memory bound sections of the code, and I just did a quick test, I got about 3.5% improvement in throughput, maybe not so much but significant for such a small change, and depending on the usecase it may be more.
Quoted 4 lines
As for the implementation itself, I would favour having a custom ring like container in the PMD code, this will solve the issue of using
rte_ringinternals while still allow for full optimisation. If this is acceptable, I will follow up by tomorrow.
Sounds ok to me.
Thanks
Konstantin
Quoted 13 lines · Konstantin
Quoted 13 lines · Konstantin
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvements
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Radu
Quoted 1 line
a concern that another library not uses public ring API,
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?The change itself came after I analyzed the memory bound sections of the code, and I just did a quick test, I got about 3.5% improvement in throughput, maybe not so much but significant for such a small change, and depending on the usecase it may be more.
Quoted 6 lines
Quoted 4 lines
As for the implementation itself, I would favour having a custom ring like container in the PMD code, this will solve the issue of using
rte_ringinternals while still allow for full optimisation. If this is acceptable, I will follow up by tomorrow.Sounds ok to me.
Nicolau Radu,
Could you supersede this patch, if the plan is to send it to a new version based on a custom ring?
Quoted 3 lines
Thanks
Konstantin
Quoted 30 lines · Jerin Jacob
Quoted 12 lines · Konstantin
Quoted 12 lines · Konstantin
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Radu
a concern that another library not uses public ring API,
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?The change itself came after I analyzed the memory bound sections of the code, and I just did a quick test, I got about 3.5% improvement in throughput, maybe not so much but significant for such a small change, and depending on the usecase it may be more.
As for the implementation itself, I would favour having a custom ring like container in the PMD code, this will solve the issue of using
rte_ringinternals while still allow for full optimisation. If this is acceptable, I will follow up by tomorrow.
Quoted 5 lines
Quoted 1 line
Sounds ok to me.
Nicolau Radu,
Could you supersede this patch, if the plan is to send it to a new version based on a custom ring?
The v3 (https://patchwork.dpdk.org/patch/79879/) sent last week implements the custom ring and does not use the rte_ring internals. v1 and v2 are superseded.
Quoted 33 lines · Radu
Quoted 30 lines · Jerin Jacob
Quoted 12 lines · Konstantin
Quoted 12 lines · Konstantin
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Radu
a concern that another library not uses public ring API,
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?The change itself came after I analyzed the memory bound sections of the code, and I just did a quick test, I got about 3.5% improvement in throughput, maybe not so much but significant for such a small change, and depending on the usecase it may be more.
As for the implementation itself, I would favour having a custom ring like container in the PMD code, this will solve the issue of using
rte_ringinternals while still allow for full optimisation. If this is acceptable, I will follow up by tomorrow.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Sounds ok to me.
Nicolau Radu,
Could you supersede this patch, if the plan is to send it to a new version based on a custom ring?
The v3 (https://patchwork.dpdk.org/patch/79879/) sent last week implements the custom ring and does not use the
rte_ringinternals. v1 and v2 are superseded.
Ok. Looks good to me. @Honnappa Nagarahalli @Ananyev, Konstantin , I will merge this patch if there are no more objections for v3.
Quoted 40 lines · Radu
Quoted 36 lines · Jerin Jacob
Quoted 33 lines
Quoted 12 lines · Konstantin
Quoted 12 lines · Konstantin
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Radu
a concern that another library not uses public ring API,
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?The change itself came after I analyzed the memory bound sections of the code, and I just did a quick test, I got about 3.5% improvement in throughput, maybe not so much but significant for such a small change, and depending on the usecase it may be more.
Quoted 5 lines
Quoted 4 lines
As for the implementation itself, I would favour having a custom ring like container in the PMD code, this will solve the issue of using
rte_ringinternals while still allow for full optimisation. If this is acceptable, I will follow up by tomorrow.Sounds ok to me.
Nicolau Radu,
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Could you supersede this patch, if the plan is to send it to a new version based on a custom ring?
The v3 (https://patchwork.dpdk.org/patch/79879/) sent last week implements the custom ring and does not use the
rte_ringinternals. v1 and v2 are superseded.Ok. Looks good to me. @Honnappa Nagarahalli @Ananyev, Konstantin , I will merge this patch if there are no more objections for v3.
No objections from me.
Jerin Jacob
AppliedQuoted 43 lines · Konstantin
Quoted 43 lines · Radu
Quoted 38 lines · Jerin Jacob
Quoted 35 lines
Quoted 12 lines · Konstantin
Quoted 12 lines · Konstantin
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Monday, October 5, 2020 5:35 PM
To: Nicolau, Radu <[email protected]>
Cc: Honnappa Nagarahalli <[email protected]>; Richardson, Bruce <[email protected]>; Ananyev, Konstantin <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] event/sw: performance improvementsQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Radu
a concern that another library not uses public ring API,
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
but instead accesses ring internals directly. Obviously such coding practice is not welcomed as it makes harder to maintain/extend ring library in future.
About 2) - these new API can(/shoud) be marked an experimental anyway.
As another thing - it is still unclear what a performance gain we are talking about here. Is it really worth it comparing to just using SP/SC?The change itself came after I analyzed the memory bound sections of the code, and I just did a quick test, I got about 3.5% improvement in throughput, maybe not so much but significant for such a small change, and depending on the usecase it may be more.
Quoted 5 lines
Quoted 4 lines
As for the implementation itself, I would favour having a custom ring like container in the PMD code, this will solve the issue of using
rte_ringinternals while still allow for full optimisation. If this is acceptable, I will follow up by tomorrow.Sounds ok to me.
Nicolau Radu,
Could you supersede this patch, if the plan is to send it to a new version based on a custom ring?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The v3 (https://patchwork.dpdk.org/patch/79879/) sent last week implements the custom ring and does not use the
rte_ringinternals. v1 and v2 are superseded.Ok. Looks good to me. @Honnappa Nagarahalli @Ananyev, Konstantin , I will merge this patch if there are no more objections for v3.
No objections from me.
Applied to dpdk-next-eventdev/for-main. Thanks.
Quoted 1 line
PATCH v2 1/1 event/sw: performance improvements
In reply to Radu NicolauAdd minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
--- doc/guides/eventdevs/sw.rst | 22 +++++++ doc/guides/rel_notes/release_20_11.rst | 4 ++ drivers/event/sw/sw_evdev.c | 82 ++++++++++++++++++++++++- drivers/event/sw/sw_evdev.h | 20 ++++++- drivers/event/sw/sw_evdev_scheduler.c | 83 +++++++++++++++++++++----- 5 files changed, 191 insertions(+), 20 deletions(-)
doc/guides/eventdevs/sw.rst +22 -0
@@ -87,6 +87,28 @@ verify possible gains. --vdev="event_sw0,credit_quanta=64" +Scheduler tuning arguments +~~~~~~~~~~~~~ + +The scheduler minimum number of events that are processed can be increased to +reduce per event overhead and increase internal burst sizes, which can +improve throughput. + +* ``min_burst`` specifies the minimum number of inflight events that can be + moved to the next stage in the scheduler. Default value is 1. + +* ``refill_once`` is a switch that when set instructs the scheduler to deque + the events waiting in the ingress rings only once per call. The default + behavior is to dequeue as needed. + +* ``deq_burst`` is the burst size used to dequeue from the port rings. + Default value is 32, and it should be increased to 64 or 128 when setting + ``refill_once=1``. + +.. code-block:: console + + --vdev="event_sw0,min_burst=8,deq_burst=64,refill_once=1" + Limitations -----------
doc/guides/rel_notes/release_20_11.rst +4 -0
@@ -78,6 +78,10 @@ New Features ``--portmask=N`` where N represents the hexadecimal bitmask of ports used. +* **Updated Software Eventdev driver.** + + Added performance tuning arguments to allow tuning the scheduler for + better throughtput in high core count use cases. Removed Items -------------
drivers/event/sw/sw_evdev.c +79 -3
127 lines not on this page · raw message
drivers/event/sw/sw_evdev.h +18 -2
@@ -29,7 +29,13 @@/* report dequeue burst sizes in buckets */ #define SW_DEQ_STAT_BUCKET_SHIFT 2/* how many packets pulled from port by sched */ -#define SCHED_DEQUEUE_BURST_SIZE 32 +#define SCHED_DEQUEUE_DEFAULT_BURST_SIZE 32 +/* max buffer size */ +#define SCHED_DEQUEUE_MAX_BURST_SIZE 256 + +/* Flush the pipeline after this many no enq to cq */ +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH)/* size of our history list */ #define NUM_SAMPLES 64/* how many data points use for average stats */
@@ -197,7 +203,7 @@ struct sw_port {uint32_t pp_buf_start;uint32_t pp_buf_count;uint16_t cq_buf_count; -struct rte_event pp_buf[SCHED_DEQUEUE_BURST_SIZE ]; +struct rte_event pp_buf[SCHED_DEQUEUE_MAX_BURST_SIZE ];struct rte_event cq_buf[MAX_SW_CONS_Q_DEPTH ];uint8_t num_qids_mapped;
@@ -214,6 +220,16 @@ struct sw_evdev {uint32_t xstats_count_mode_port;uint32_t xstats_count_mode_queue; +/* Minimum burst size*/ + uint32_t sched_min_burst_size __rte_cache_aligned; +/* Port dequeue burst size*/ +uint32_t sched_deq_burst_size; +/* Refill pp buffers only once per scheduler call*/ +uint32_t refill_once_per_iter; +/* Current values */ +uint32_t sched_flush_count; +uint32_t sched_min_burst; +/* Contains all ports - load balanced and directed */ struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;
drivers/event/sw/sw_evdev_scheduler.c +68 -15
150 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 10 lines
-----Original Message-----
From: Nicolau, Radu <[email protected]>
Sent: Monday, September 28, 2020 9:29 AM
To: [email protected]
Cc: [email protected]; Van Haaren, Harry <[email protected]>; [email protected]; Ananyev, Konstantin <[email protected]>; Richardson, Bruce <[email protected]>; Nicolau, Radu <[email protected]>
Subject: [PATCH v2] event/sw: performance improvements
Quoted 5 lines
Add minimum burst throughout the scheduler pipeline and a flush counter. Replace ring API calls with local single threaded implementation where possible.
Signed-off-by Radu Nicolau <[email protected]>
PATCH v3 1/1 event/sw: performance improvements
In reply to Radu NicolauAdd minimum burst throughout the scheduler pipeline and a flush counter. Use a single threaded ring implementation for the reorder buffer free list.
--- doc/guides/eventdevs/sw.rst | 22 +++++ doc/guides/rel_notes/release_20_11.rst | 5 ++ drivers/event/sw/event_ring.h | 109 ++++++------------------ drivers/event/sw/sw_evdev.c | 110 ++++++++++++++++++++----- drivers/event/sw/sw_evdev.h | 22 ++++- drivers/event/sw/sw_evdev_scheduler.c | 66 +++++++++++---- 6 files changed, 210 insertions(+), 124 deletions(-)
doc/guides/eventdevs/sw.rst +22 -0
@@ -87,6 +87,28 @@ verify possible gains. --vdev="event_sw0,credit_quanta=64" +Scheduler tuning arguments +~~~~~~~~~~~~~ + +The scheduler minimum number of events that are processed can be increased to +reduce per event overhead and increase internal burst sizes, which can +improve throughput. + +* ``min_burst`` specifies the minimum number of inflight events that can be + moved to the next stage in the scheduler. Default value is 1. + +* ``refill_once`` is a switch that when set instructs the scheduler to deque + the events waiting in the ingress rings only once per call. The default + behavior is to dequeue as needed. + +* ``deq_burst`` is the burst size used to dequeue from the port rings. + Default value is 32, and it should be increased to 64 or 128 when setting + ``refill_once=1``. + +.. code-block:: console + + --vdev="event_sw0,min_burst=8,deq_burst=64,refill_once=1" + Limitations -----------
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -105,6 +105,11 @@ New Features ``--portmask=N`` where N represents the hexadecimal bitmask of ports used. +* **Updated Software Eventdev driver.** + + Added performance tuning arguments to allow tuning the scheduler for + better throughtput in high core count use cases. + * **Updated the pipeline library for alignment with the P4 language.** Added new Software Switch (SWX) pipeline type that provides more
drivers/event/sw/event_ring.h +27 -82
158 lines not on this page · raw message
drivers/event/sw/sw_evdev.c +88 -22
199 lines not on this page · raw message
drivers/event/sw/sw_evdev.h +19 -3
@@ -29,7 +29,13 @@/* report dequeue burst sizes in buckets */ #define SW_DEQ_STAT_BUCKET_SHIFT 2/* how many packets pulled from port by sched */ -#define SCHED_DEQUEUE_BURST_SIZE 32 +#define SCHED_DEQUEUE_DEFAULT_BURST_SIZE 32 +/* max buffer size */ +#define SCHED_DEQUEUE_MAX_BURST_SIZE 256 + +/* Flush the pipeline after this many no enq to cq */ +#define SCHED_NO_ENQ_CYCLE_FLUSH 256 +#define SW_PORT_HIST_LIST (MAX_SW_PROD_Q_DEPTH)/* size of our history list */ #define NUM_SAMPLES 64/* how many data points use for average stats */
@@ -122,7 +128,7 @@ struct sw_qid {/* Track packet order for reordering when needed */ struct reorder_buffer_entry *reorder_buffer;/*< pkts await reorder */ -struct rte_ring *reorder_buffer_freelist;/* available reorder slots */ +struct rob_ring *reorder_buffer_freelist;/* available reorder slots */ uint32_t reorder_buffer_index;/* oldest valid reorder buffer entry */ uint32_t window_size;/* Used to wrap reorder_buffer_index */
@@ -197,7 +203,7 @@ struct sw_port {uint32_t pp_buf_start;uint32_t pp_buf_count;uint16_t cq_buf_count; -struct rte_event pp_buf[SCHED_DEQUEUE_BURST_SIZE ]; +struct rte_event pp_buf[SCHED_DEQUEUE_MAX_BURST_SIZE ];struct rte_event cq_buf[MAX_SW_CONS_Q_DEPTH ];uint8_t num_qids_mapped;
@@ -214,6 +220,16 @@ struct sw_evdev {uint32_t xstats_count_mode_port;uint32_t xstats_count_mode_queue; +/* Minimum burst size*/ + uint32_t sched_min_burst_size __rte_cache_aligned; +/* Port dequeue burst size*/ +uint32_t sched_deq_burst_size; +/* Refill pp buffers only once per scheduler call*/ +uint32_t refill_once_per_iter; +/* Current values */ +uint32_t sched_flush_count; +uint32_t sched_min_burst; +/* Contains all ports - load balanced and directed */ struct sw_port ports[SW_PORTS_MAX] __rte_cache_aligned;
drivers/event/sw/sw_evdev_scheduler.c +49 -17
145 lines not on this page · raw message
Signature · 1 line
2.17.1