event/sw: report idle when no work is performed

Have the SW event device conform to the service core convention, where
-EAGAIN is return in case no work was performed.

Prior to this patch, for an idle SW event device, a service lcore load
estimate based on RTE_SERVICE_ATTR_CYCLES would suggest 48% core
load.

At 7% of its maximum capacity, the SW event device needs about 15% of
the available CPU cycles* to perform its duties, but
RTE_SERVICE_ATTR_CYCLES would suggest the SW service used 48% of the
service core.

After this change, load deduced from RTE_SERVICE_ATTR_CYCLES will only
be a minor overestimation of the actual cycles used.

* The SW scheduler becomes more efficient at higher loads.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
This commit is contained in:
Mattias Rönnblom 2022-10-05 11:16:14 +02:00 committed by David Marchand
parent 809bd244a1
commit 4689c579e7
3 changed files with 6 additions and 5 deletions

View File

@ -934,8 +934,7 @@ set_refill_once(const char *key __rte_unused, const char *value, void *opaque)
static int32_t sw_sched_service_func(void *args)
{
struct rte_eventdev *dev = args;
sw_event_schedule(dev);
return 0;
return sw_event_schedule(dev);
}
static int

View File

@ -295,7 +295,7 @@ uint16_t sw_event_enqueue_burst(void *port, const struct rte_event ev[],
uint16_t sw_event_dequeue(void *port, struct rte_event *ev, uint64_t wait);
uint16_t sw_event_dequeue_burst(void *port, struct rte_event *ev, uint16_t num,
uint64_t wait);
void sw_event_schedule(struct rte_eventdev *dev);
int32_t sw_event_schedule(struct rte_eventdev *dev);
int sw_xstats_init(struct sw_evdev *dev);
int sw_xstats_uninit(struct sw_evdev *dev);
int sw_xstats_get_names(const struct rte_eventdev *dev,

View File

@ -506,7 +506,7 @@ end_qe:
return pkts_iter;
}
void
int32_t
sw_event_schedule(struct rte_eventdev *dev)
{
struct sw_evdev *sw = sw_pmd_priv(dev);
@ -517,7 +517,7 @@ sw_event_schedule(struct rte_eventdev *dev)
sw->sched_called++;
if (unlikely(!sw->started))
return;
return -EAGAIN;
do {
uint32_t in_pkts_this_iteration = 0;
@ -610,4 +610,6 @@ sw_event_schedule(struct rte_eventdev *dev)
sw->sched_last_iter_bitmask = cqs_scheds_last_iter;
if (unlikely(sw->port_count >= 64))
sw->sched_last_iter_bitmask = UINT64_MAX;
return work_done ? 0 : -EAGAIN;
}