Skip to contentSkip to conversation

service: add component useful work attribute

PATCH Superseded Harry van Haaren 4 participants 16 messages Sep 7, 2020 – Jan 14, 2021

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 service: add component useful work attribute

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

---
 lib/librte_eal/common/rte_service.c           | 19 +++++++++++++++++++
 lib/librte_eal/include/rte_service.h          |  5 +++++
 .../include/rte_service_component.h           | 12 ++++++++++++
 lib/librte_eal/rte_eal_version.map            |  3 +++
 4 files changed, 39 insertions(+)
lib/librte_eal/common/rte_service.c +19 -0
index 6a0e0ff65d..f9792a138b 100644
@@ -58,6 +58,7 @@ struct rte_service_spec_impl {
 	uint32_t num_mapped_cores;
 	uint64_t calls;
 	uint64_t cycles_spent;
+	uint8_t useful_work_last_iter;
 } __rte_cache_aligned;
 
 /* the internal values of a service core */
@@ -293,6 +294,21 @@ rte_service_component_unregister(uint32_t id)
 	return 0;
 }
 
+int32_t
+rte_service_component_attr_set(uint32_t id, uint32_t attr, uint64_t value)
+{
+	struct rte_service_spec_impl *s;
+	SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
+
+	switch (attr) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		s->useful_work_last_iter = value;
+		return 0;
+	default:
+		return -EINVAL;
+	};
+}
+
 int32_t
 rte_service_component_runstate_set(uint32_t id, uint32_t runstate)
 {
@@ -778,6 +794,9 @@ rte_service_attr_get(uint32_t id, uint32_t attr_id, uint64_t *attr_value)
 		return -EINVAL;
 
 	switch (attr_id) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		*attr_value = s->useful_work_last_iter;
+		return 0;
 	case RTE_SERVICE_ATTR_CYCLES:
 		*attr_value = s->cycles_spent;
 		return 0;
lib/librte_eal/include/rte_service.h +5 -0
index e2d0a6dd32..e9836a1a68 100644
@@ -370,6 +370,11 @@ int32_t rte_service_dump(FILE *f, uint32_t id);
  */
 #define RTE_SERVICE_ATTR_CALL_COUNT 1
 
+/**
+ * Returns if the last iteration of the service resulted in useful work done.
+ */
+#define RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER 2
+
 /**
  * Get an attribute from a service.
  *
lib/librte_eal/include/rte_service_component.h +12 -0
index 9e66ee7e29..2caa7981b5 100644
@@ -87,6 +87,18 @@ int32_t rte_service_component_register(const struct rte_service_spec *spec,
  */
 int32_t rte_service_component_unregister(uint32_t id);
 
+/**
+ * Set an attribute for this service.
+ *
+ * Note this API is to be called by the service implementation, to make the
+ * statistic available via the usual attr_get() service APIs.
+ *
+ * @retval 0 Success
+ * @retval -EINVAL Invalid service id or attribute provided
+ */
+int32_t rte_service_component_attr_set(uint32_t id, uint32_t attr,
+		uint64_t value);
+
 /**
  * Private function to allow EAL to initialized default mappings.
  *
lib/librte_eal/rte_eal_version.map +3 -0
index 0b18e2ef85..bb5e19ae9e 100644
@@ -397,6 +397,9 @@ EXPERIMENTAL {
 	rte_mp_disable;
 	rte_thread_register;
 	rte_thread_unregister;
+
+	# added in 20.11
+	rte_service_component_attr_set;
 };
 
 INTERNAL {
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 event/sw: add useful work done attribute

This commit exposes if useful work is done to the service instance. The normal service_attr_get() API can be used to retrieve the value of the attribute.

---

Cc: [email protected]
CC due to event/sw change, could be picked up by main tree as depends on 1/2?

 drivers/event/sw/sw_evdev_scheduler.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/event/sw/sw_evdev_scheduler.c +7 -0
index cff747da89..4e932612d5 100644
@@ -5,6 +5,9 @@
 #include <rte_ring.h>
 #include <rte_hash_crc.h>
 #include <rte_event_ring.h>
+
+#include <rte_service_component.h>
+
 #include "sw_evdev.h"
 #include "iq_chunk.h"
 
@@ -554,6 +557,10 @@ sw_event_schedule(struct rte_eventdev *dev)
 	sw->sched_no_iq_enqueues += (in_pkts_total == 0);
 	sw->sched_no_cq_enqueues += (out_pkts_total == 0);
 
+	uint64_t work_done = (in_pkts_total + out_pkts_total) != 0;
+	rte_service_component_attr_set(sw->service_id,
+			RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER, work_done);
+
 	/* push all the internal buffered QEs in port->cq_ring to the
 	 * worker cores: aka, do the ring transfers batched.
 	 */
Signature · 1 line
2.17.1
#2 lore raw
In reply to Harry van Haaren
Quoted 10 lines · Harry van Haaren
lib/librte_eal/include/rte_service_component.h +2 -0
index 9e66ee7e29..2caa7981b5 100644
@@ -87,6 +87,18 @@ int32_t rte_service_component_register(const struct rte_service_spec *spec,
  */
 int32_t rte_service_component_unregister(uint32_t id);
 
+/**
+ * Set an attribute for this service.

lib/librte_eal/include/rte_service_component.h int32_t rte_service_component_register(const struct rte_service_spec *spec, · line 101

Quoted 10 lines
lib/librte_eal/include/rte_service_component.h +10 -0
+ *
+ * Note this API is to be called by the service implementation, to make the
+ * statistic available via the usual attr_get() service APIs.
+ *
+ * @retval 0 Success
+ * @retval -EINVAL Invalid service id or attribute provided
+ */
+int32_t rte_service_component_attr_set(uint32_t id, uint32_t attr,
+               uint64_t value);
+

The experimental tag is missing for this declaration.

https://travis-ci.com/ovsrobot/dpdk/builds/183185060
http://mails.dpdk.org/archives/test-report/2020-September/150152.html

Quoted 20 lines
lib/librte_eal/include/rte_service_component.h +0 -0
 /**
  * Private function to allow EAL to initialized default mappings.
  *
lib/librte_eal/rte_eal_version.map +3 -1
index 0b18e2ef85..bb5e19ae9e 100644
@@ -397,6 +397,9 @@ EXPERIMENTAL {
        rte_mp_disable;
        rte_thread_register;
        rte_thread_unregister;
+
+       # added in 20.11
+       rte_service_component_attr_set;
 };
 
 INTERNAL {
--

2.17.1

Signature · 1 line
David Marchand
#3 lore raw
Quoted 34 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Monday, September 14, 2020 9:37 AM
To: Van Haaren, Harry <[email protected]>
Cc: dev <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/2] service: add component useful work attribute

Review

Quoted 1 line · Harry van Haaren
(quoted diff) +0 -0

b/lib/librte_eal/include/rte_service_component.h

lib/librte_eal/include/rte_service_component.h int32_t rte_service_component_register(const struct

Quoted 4 lines

index 9e66ee7e29..2caa7981b5 100644

lib/librte_eal/include/rte_service_component.h +0 -0
@@ -87,6 +87,18 @@ int32_t rte_service_component_register(const struct

rte_service_spec *spec,

Quoted 5 lines
lib/librte_eal/include/rte_service_component.h +2 -0
  */
 int32_t rte_service_component_unregister(uint32_t id);
 
+/**
+ * Set an attribute for this service.

lib/librte_eal/include/rte_service_component.h int32_t rte_service_component_register(const struct rte_service_spec *spec, · line 101

Quoted 10 lines
lib/librte_eal/include/rte_service_component.h +10 -0
+ *
+ * Note this API is to be called by the service implementation, to make the
+ * statistic available via the usual attr_get() service APIs.
+ *
+ * @retval 0 Success
+ * @retval -EINVAL Invalid service id or attribute provided
+ */
+int32_t rte_service_component_attr_set(uint32_t id, uint32_t attr,
+               uint64_t value);
+

The experimental tag is missing for this declaration.

Quoted 2 lines

https://travis-ci.com/ovsrobot/dpdk/builds/183185060
http://mails.dpdk.org/archives/test-report/2020-September/150152.html

Fixed, and v2 sent; thanks; http://patches.dpdk.org/project/dpdk/list/?series=12201

<snip>

#4 lore raw

PATCH v2 1/2 service: add component useful work attribute

In reply to Harry van Haaren

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

---

v2:
- Add experimental tag to new function.

---
 lib/librte_eal/common/rte_service.c           | 19 +++++++++++++++++++
 lib/librte_eal/include/rte_service.h          |  5 +++++
 .../include/rte_service_component.h           | 13 +++++++++++++
 lib/librte_eal/rte_eal_version.map            |  3 +++
 4 files changed, 40 insertions(+)
lib/librte_eal/common/rte_service.c +19 -0
index 6a0e0ff65d..f9792a138b 100644
@@ -58,6 +58,7 @@ struct rte_service_spec_impl {
 	uint32_t num_mapped_cores;
 	uint64_t calls;
 	uint64_t cycles_spent;
+	uint8_t useful_work_last_iter;
 } __rte_cache_aligned;
 
 /* the internal values of a service core */
@@ -293,6 +294,21 @@ rte_service_component_unregister(uint32_t id)
 	return 0;
 }
 
+int32_t
+rte_service_component_attr_set(uint32_t id, uint32_t attr, uint64_t value)
+{
+	struct rte_service_spec_impl *s;
+	SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
+
+	switch (attr) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		s->useful_work_last_iter = value;
+		return 0;
+	default:
+		return -EINVAL;
+	};
+}
+
 int32_t
 rte_service_component_runstate_set(uint32_t id, uint32_t runstate)
 {
@@ -778,6 +794,9 @@ rte_service_attr_get(uint32_t id, uint32_t attr_id, uint64_t *attr_value)
 		return -EINVAL;
 
 	switch (attr_id) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		*attr_value = s->useful_work_last_iter;
+		return 0;
 	case RTE_SERVICE_ATTR_CYCLES:
 		*attr_value = s->cycles_spent;
 		return 0;
lib/librte_eal/include/rte_service.h +5 -0
index e2d0a6dd32..e9836a1a68 100644
@@ -370,6 +370,11 @@ int32_t rte_service_dump(FILE *f, uint32_t id);
  */
 #define RTE_SERVICE_ATTR_CALL_COUNT 1
 
+/**
+ * Returns if the last iteration of the service resulted in useful work done.
+ */
+#define RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER 2
+
 /**
  * Get an attribute from a service.
  *
lib/librte_eal/include/rte_service_component.h +13 -0
index 9e66ee7e29..534f41f531 100644
@@ -87,6 +87,19 @@ int32_t rte_service_component_register(const struct rte_service_spec *spec,
  */
 int32_t rte_service_component_unregister(uint32_t id);
 
+/**
+ * Set an attribute for this service.
+ *
+ * Note this API is to be called by the service implementation, to make the
+ * statistic available via the usual attr_get() service APIs.
+ *
+ * @retval 0 Success
+ * @retval -EINVAL Invalid service id or attribute provided
+ */
+__rte_experimental
+int32_t rte_service_component_attr_set(uint32_t id, uint32_t attr,
+		uint64_t value);
+
 /**
  * Private function to allow EAL to initialized default mappings.
  *
lib/librte_eal/rte_eal_version.map +3 -0
index 0b18e2ef85..bb5e19ae9e 100644
@@ -397,6 +397,9 @@ EXPERIMENTAL {
 	rte_mp_disable;
 	rte_thread_register;
 	rte_thread_unregister;
+
+	# added in 20.11
+	rte_service_component_attr_set;
 };
 
 INTERNAL {
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 2/2 event/sw: add useful work done attribute

This commit exposes if useful work is done to the service instance. The normal service_attr_get() API can be used to retrieve the value of the attribute.

---
 drivers/event/sw/sw_evdev_scheduler.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/event/sw/sw_evdev_scheduler.c +7 -0
index cff747da89..4e932612d5 100644
@@ -5,6 +5,9 @@
 #include <rte_ring.h>
 #include <rte_hash_crc.h>
 #include <rte_event_ring.h>
+
+#include <rte_service_component.h>
+
 #include "sw_evdev.h"
 #include "iq_chunk.h"
 
@@ -554,6 +557,10 @@ sw_event_schedule(struct rte_eventdev *dev)
 	sw->sched_no_iq_enqueues += (in_pkts_total == 0);
 	sw->sched_no_cq_enqueues += (out_pkts_total == 0);
 
+	uint64_t work_done = (in_pkts_total + out_pkts_total) != 0;
+	rte_service_component_attr_set(sw->service_id,
+			RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER, work_done);
+
 	/* push all the internal buffered QEs in port->cq_ring to the
 	 * worker cores: aka, do the ring transfers batched.
 	 */
Signature · 1 line
2.17.1
#6 lore raw
In reply to Harry van Haaren

Hello Harry,

Quoted 10 lines · Harry van Haaren

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

This is missing a unit test.
Getting others' opinion on this addition would be good too.

Thanks.

Signature · 1 line
David Marchand
#7 lore raw
Quoted 19 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Monday, September 21, 2020 3:49 PM
To: Van Haaren, Harry <[email protected]>
Cc: dev <[email protected]>; Lukasz Wojciechowski <[email protected]>; Honnappa Nagarahalli <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Hello Harry,

Quoted 5 lines · Harry van Haaren

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Quoted 8 lines
Quoted 5 lines

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

This is missing a unit test.
Getting others' opinion on this addition would be good too.

Thanks for review, sure will add a unit test.

+CC Jerin and Mattias; Eventdev SW PMD usage, I'd like to indicate if there has been "useful work" done last iteration. Do you see any easy improvements? Concerns?

Regards, -Harry

#8 lore raw
In reply to David Marchand

<snip>

Quoted 10 lines

Hello Harry,

Quoted 5 lines · Harry van Haaren

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Quoted 8 lines
Quoted 5 lines

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

This is missing a unit test.
Getting others' opinion on this addition would be good too.

Yes, adding unit tests would be good.

Quoted 6 lines

Thanks.

--
David Marchand

#9 lore raw
In reply to Harry van Haaren
Quoted 7 lines · Harry van Haaren

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

How would that tracking be implemented? rte_service.c already keeps track of the amount of busy cycles per service. Would it be possible to reuse that mechanism to achieve the same goal?

We did some prototyping on dynamic load balancing for the service core framework, and then we extended the API is such a way that the service callback would return a bool indicating if forward progress was made, if I recall correctly. Sampling these counters allowed for tracking load on both a per-lcore and per-service basis.

Quoted 112 lines

---

v2:
- Add experimental tag to new function.

---
  lib/librte_eal/common/rte_service.c           | 19 +++++++++++++++++++
  lib/librte_eal/include/rte_service.h          |  5 +++++
  .../include/rte_service_component.h           | 13 +++++++++++++
  lib/librte_eal/rte_eal_version.map            |  3 +++
  4 files changed, 40 insertions(+)
lib/librte_eal/common/rte_service.c +19 -0
index 6a0e0ff65d..f9792a138b 100644
@@ -58,6 +58,7 @@ struct rte_service_spec_impl {
  	uint32_t num_mapped_cores;
  	uint64_t calls;
  	uint64_t cycles_spent;
+	uint8_t useful_work_last_iter;
  } __rte_cache_aligned;
 
  /* the internal values of a service core */
@@ -293,6 +294,21 @@ rte_service_component_unregister(uint32_t id)
  	return 0;
  }
 
+int32_t
+rte_service_component_attr_set(uint32_t id, uint32_t attr, uint64_t value)
+{
+	struct rte_service_spec_impl *s;
+	SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
+
+	switch (attr) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		s->useful_work_last_iter = value;
+		return 0;
+	default:
+		return -EINVAL;
+	};
+}
+
  int32_t
  rte_service_component_runstate_set(uint32_t id, uint32_t runstate)
  {
@@ -778,6 +794,9 @@ rte_service_attr_get(uint32_t id, uint32_t attr_id, uint64_t *attr_value)
  		return -EINVAL;
 
  	switch (attr_id) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		*attr_value = s->useful_work_last_iter;
+		return 0;
  	case RTE_SERVICE_ATTR_CYCLES:
  		*attr_value = s->cycles_spent;
  		return 0;
lib/librte_eal/include/rte_service.h +5 -0
index e2d0a6dd32..e9836a1a68 100644
@@ -370,6 +370,11 @@ int32_t rte_service_dump(FILE *f, uint32_t id);
   */
  #define RTE_SERVICE_ATTR_CALL_COUNT 1
 
+/**
+ * Returns if the last iteration of the service resulted in useful work done.
+ */
+#define RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER 2
+
  /**
   * Get an attribute from a service.
   *
lib/librte_eal/include/rte_service_component.h +13 -0
index 9e66ee7e29..534f41f531 100644
@@ -87,6 +87,19 @@ int32_t rte_service_component_register(const struct rte_service_spec *spec,
   */
  int32_t rte_service_component_unregister(uint32_t id);
 
+/**
+ * Set an attribute for this service.
+ *
+ * Note this API is to be called by the service implementation, to make the
+ * statistic available via the usual attr_get() service APIs.
+ *
+ * @retval 0 Success
+ * @retval -EINVAL Invalid service id or attribute provided
+ */
+__rte_experimental
+int32_t rte_service_component_attr_set(uint32_t id, uint32_t attr,
+		uint64_t value);
+
  /**
   * Private function to allow EAL to initialized default mappings.
   *
lib/librte_eal/rte_eal_version.map +3 -0
index 0b18e2ef85..bb5e19ae9e 100644
@@ -397,6 +397,9 @@ EXPERIMENTAL {
  	rte_mp_disable;
  	rte_thread_register;
  	rte_thread_unregister;
+
+	# added in 20.11
+	rte_service_component_attr_set;
  };
 
  INTERNAL {
#10 lore raw
Quoted 7 lines

-----Original Message-----
From: Mattias Rönnblom <[email protected]>
Sent: Wednesday, September 23, 2020 12:40 PM
To: Van Haaren, Harry <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Hi Mattias,

Thanks for taking time to review & prompt reply!

Quoted 5 lines · Harry van Haaren
Quoted 3 lines

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Quoted 8 lines
Quoted 3 lines

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

How would that tracking be implemented? rte_service.c already keeps track of the amount of busy cycles per service. Would it be possible to reuse that mechanism to achieve the same goal?

Tracking "busy cycles" is not exactly the same - Eventdev SW PMD can spend cycles polling, and trying to move packets around its internal queues, but make no forward progress. Measuring cycles spent in the service would not indicate the correct "busyness" in that case.

In the suggested patchset, each service (e.g Eventdev SW PMD) can update a statistic itself, pushing an attribute value into the service-cores layer. This method allows each PMD to define "useful work" in its own way.

Quoted 5 lines

We did some prototyping on dynamic load balancing for the service core framework, and then we extended the API is such a way that the service callback would return a bool indicating if forward progress was made, if I recall correctly. Sampling these counters allowed for tracking load on both a per-lcore and per-service basis.

The service callback return value can be stored/inspected on the service-core itself, but how to show that to the application? It still requires an attribute API like proposed below re-using "attr_get" API I think.

So really the only difference in the prototype you mention is how the service itself communicates business to the service-cores infrastructure in EAL.

Perhaps re-purposing return-value is simpler, but it limits statistics from the service to just business, and the API change requires all services to change.

Pros of adding an API as this patchset proposes is to push attribute values to service-core in EAL is extensibility, and no API breakage.

Given that context, Ack / push-back to this suggested approach?

Quoted 74 lines
Quoted 7 lines

---

v2:
- Add experimental tag to new function.

Review

Quoted 8 lines
---
  lib/librte_eal/common/rte_service.c           | 19 +++++++++++++++++++
  lib/librte_eal/include/rte_service.h          |  5 +++++
  .../include/rte_service_component.h           | 13 +++++++++++++
  lib/librte_eal/rte_eal_version.map            |  3 +++
  4 files changed, 40 insertions(+)
(quoted diff) +0 -0

b/lib/librte_eal/common/rte_service.c

lib/librte_eal/common/rte_service.c rte_service_attr_get(uint32_t id, uint32_t attr_id,

Quoted 34 lines

index 6a0e0ff65d..f9792a138b 100644

lib/librte_eal/common/rte_service.c +16 -0
@@ -58,6 +58,7 @@ struct rte_service_spec_impl {
  	uint32_t num_mapped_cores;
  	uint64_t calls;
  	uint64_t cycles_spent;
+	uint8_t useful_work_last_iter;
  } __rte_cache_aligned;
 
  /* the internal values of a service core */
@@ -293,6 +294,21 @@ rte_service_component_unregister(uint32_t id)
  	return 0;
  }
 
+int32_t
+rte_service_component_attr_set(uint32_t id, uint32_t attr, uint64_t value)
+{
+	struct rte_service_spec_impl *s;
+	SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);
+
+	switch (attr) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		s->useful_work_last_iter = value;
+		return 0;
+	default:
+		return -EINVAL;
+	};
+}
+
  int32_t
  rte_service_component_runstate_set(uint32_t id, uint32_t runstate)
  {
@@ -778,6 +794,9 @@ rte_service_attr_get(uint32_t id, uint32_t attr_id,

uint64_t *attr_value)

Review

Quoted 10 lines
lib/librte_eal/common/rte_service.c +3 -0
  		return -EINVAL;
 
  	switch (attr_id) {
+	case RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:
+		*attr_value = s->useful_work_last_iter;
+		return 0;
  	case RTE_SERVICE_ATTR_CYCLES:
  		*attr_value = s->cycles_spent;
  		return 0;
(quoted diff) +0 -0

b/lib/librte_eal/include/rte_service.h

Quoted 12 lines

index e2d0a6dd32..e9836a1a68 100644

lib/librte_eal/include/rte_service.h +5 -0
@@ -370,6 +370,11 @@ int32_t rte_service_dump(FILE *f, uint32_t id);
   */
  #define RTE_SERVICE_ATTR_CALL_COUNT 1
 
+/**
+ * Returns if the last iteration of the service resulted in useful work done.
+ */
+#define RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER 2
+

<snip>

#11 lore raw
Quoted 16 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Van Haaren, Harry
Sent: Wednesday, September 23, 2020 3:17 PM
To: Mattias Rönnblom <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Quoted 7 lines

-----Original Message-----
From: Mattias Rönnblom <[email protected]>
Sent: Wednesday, September 23, 2020 12:40 PM
To: Van Haaren, Harry <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Quoted 3 lines

Hi Mattias,

Thanks for taking time to review & prompt reply!

Ping Mattias - any input based on follow up discussion below?

Quoted 36 lines
Quoted 5 lines · Harry van Haaren
Quoted 3 lines

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Quoted 8 lines
Quoted 3 lines

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

How would that tracking be implemented? rte_service.c already keeps track of the amount of busy cycles per service. Would it be possible to reuse that mechanism to achieve the same goal?

Tracking "busy cycles" is not exactly the same - Eventdev SW PMD can spend cycles polling, and trying to move packets around its internal queues, but make no forward progress. Measuring cycles spent in the service would not indicate the correct "busyness" in that case.

In the suggested patchset, each service (e.g Eventdev SW PMD) can update a statistic itself, pushing an attribute value into the service-cores layer. This method allows each PMD to define "useful work" in its own way.

Quoted 5 lines

We did some prototyping on dynamic load balancing for the service core framework, and then we extended the API is such a way that the service callback would return a bool indicating if forward progress was made, if I recall correctly. Sampling these counters allowed for tracking load on both a per-lcore and per-service basis.

The service callback return value can be stored/inspected on the service-core itself, but how to show that to the application? It still requires an attribute API like proposed below re-using "attr_get" API I think.

So really the only difference in the prototype you mention is how the service itself communicates business to the service-cores infrastructure in EAL.

Quoted 7 lines

Perhaps re-purposing return-value is simpler, but it limits statistics from the service to just business, and the API change requires all services to change.

Pros of adding an API as this patchset proposes is to push attribute values to service-core in EAL is extensibility, and no API breakage.

Given that context, Ack / push-back to this suggested approach?

<snip patch contents>

#12 lore raw
Quoted 16 lines · Harry
Quoted 16 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Van Haaren, Harry
Sent: Wednesday, September 23, 2020 3:17 PM
To: Mattias Rönnblom <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Quoted 7 lines

-----Original Message-----
From: Mattias Rönnblom <[email protected]>
Sent: Wednesday, September 23, 2020 12:40 PM
To: Van Haaren, Harry <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Quoted 50 lines
Quoted 3 lines

Hi Mattias,

Thanks for taking time to review & prompt reply!

Ping Mattias - any input based on follow up discussion below?

Quoted 43 lines
Quoted 5 lines · Harry van Haaren
Quoted 3 lines

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Quoted 8 lines
Quoted 3 lines

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

How would that tracking be implemented? rte_service.c already keeps track of the amount of busy cycles per service. Would it be possible to reuse that mechanism to achieve the same goal?

Tracking "busy cycles" is not exactly the same - Eventdev SW PMD can spend cycles polling, and trying to move packets around its internal queues, but make no forward progress. Measuring cycles spent in the service would not indicate the correct "busyness" in that case.

In the suggested patchset, each service (e.g Eventdev SW PMD) can update a statistic itself, pushing an attribute value into the service-cores layer. This method allows each PMD to define "useful work" in its own way.

Quoted 5 lines

We did some prototyping on dynamic load balancing for the service core framework, and then we extended the API is such a way that the service callback would return a bool indicating if forward progress was made, if I recall correctly. Sampling these counters allowed for tracking load on both a per-lcore and per-service basis.

The service callback return value can be stored/inspected on the service-core itself, but how to show that to the application? It still requires an attribute API like proposed below re-using "attr_get" API I think.

So really the only difference in the prototype you mention is how the service itself communicates business to the service-cores infrastructure in EAL.

Perhaps re-purposing return-value is simpler, but it limits statistics from the service to just business, and the API change requires all services to change.

Pros of adding an API as this patchset proposes is to push attribute values to service-core in EAL is extensibility, and no API breakage.

Given that context, Ack / push-back to this suggested approach?

I need a conclusion.
Is this required for 20.11?

Signature · 1 line
David Marchand
#13 lore raw
Quoted 76 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Friday, October 16, 2020 1:20 PM
To: Van Haaren, Harry <[email protected]>; Mattias Rönnblom <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Quoted 8 lines · Harry
Quoted 8 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Van Haaren, Harry
Sent: Wednesday, September 23, 2020 3:17 PM
To: Mattias Rönnblom <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

-----Original Message-----
From: Mattias Rönnblom <[email protected]>
Sent: Wednesday, September 23, 2020 12:40 PM
To: Van Haaren, Harry <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful

work

Quoted 25 lines
Quoted 5 lines
Quoted 1 line

attribute

Hi Mattias,

Thanks for taking time to review & prompt reply!

Ping Mattias - any input based on follow up discussion below?

Quoted 16 lines
Quoted 5 lines · Harry van Haaren
Quoted 3 lines

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Quoted 8 lines
Quoted 3 lines

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

How would that tracking be implemented? rte_service.c already keeps track of the amount of busy cycles per service. Would it be possible to reuse that mechanism to achieve the same goal?

Tracking "busy cycles" is not exactly the same - Eventdev SW PMD can spend cycles polling, and trying to move packets around its internal queues, but

make

Quoted 13 lines
Quoted 13 lines

no forward progress. Measuring cycles spent in the service would not indicate the correct "busyness" in that case.

In the suggested patchset, each service (e.g Eventdev SW PMD) can update a statistic itself, pushing an attribute value into the service-cores layer. This method allows each PMD to define "useful work" in its own way.

Quoted 5 lines

We did some prototyping on dynamic load balancing for the service core framework, and then we extended the API is such a way that the service callback would return a bool indicating if forward progress was made, if I recall correctly. Sampling these counters allowed for tracking load on both a per-lcore and per-service basis.

Quoted 6 lines
Quoted 6 lines

The service callback return value can be stored/inspected on the service-core itself, but how to show that to the application? It still requires an attribute API like proposed below re-using "attr_get" API I think.

So really the only difference in the prototype you mention is how the service itself communicates business to the service-cores infrastructure in

EAL.

Quoted 4 lines
Quoted 4 lines

Perhaps re-purposing return-value is simpler, but it limits statistics from the service to just business, and the API change requires all services to change.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Pros of adding an API as this patchset proposes is to push attribute values to service-core in EAL is extensibility, and no API breakage.

Given that context, Ack / push-back to this suggested approach?

I need a conclusion.
Is this required for 20.11?

Given timeline - lets leave this until 21.02 release.
I think the above solution is adequate, but don't want to rush folks.

Thanks for following up, chat next release. -Harry

#14 lore raw

Hello Harry, Mattias,

Quoted 46 lines · Harry
Quoted 46 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines · Harry van Haaren
Quoted 7 lines

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

How would that tracking be implemented? rte_service.c already keeps track of the amount of busy cycles per service. Would it be possible to reuse that mechanism to achieve the same goal?

Tracking "busy cycles" is not exactly the same - Eventdev SW PMD can spend cycles polling, and trying to move packets around its internal queues, but

make

Quoted 13 lines
Quoted 13 lines

no forward progress. Measuring cycles spent in the service would not indicate the correct "busyness" in that case.

In the suggested patchset, each service (e.g Eventdev SW PMD) can update a statistic itself, pushing an attribute value into the service-cores layer. This method allows each PMD to define "useful work" in its own way.

Quoted 5 lines

We did some prototyping on dynamic load balancing for the service core framework, and then we extended the API is such a way that the service callback would return a bool indicating if forward progress was made, if I recall correctly. Sampling these counters allowed for tracking load on both a per-lcore and per-service basis.

Quoted 6 lines
Quoted 6 lines

The service callback return value can be stored/inspected on the service-core itself, but how to show that to the application? It still requires an attribute API like proposed below re-using "attr_get" API I think.

So really the only difference in the prototype you mention is how the service itself communicates business to the service-cores infrastructure in

EAL.

Quoted 8 lines
Quoted 8 lines

Perhaps re-purposing return-value is simpler, but it limits statistics from the service to just business, and the API change requires all services to change.

Pros of adding an API as this patchset proposes is to push attribute values to service-core in EAL is extensibility, and no API breakage.

Given that context, Ack / push-back to this suggested approach?

Quoted 8 lines
Quoted 2 lines

I need a conclusion.
Is this required for 20.11?

Given timeline - lets leave this until 21.02 release.
I think the above solution is adequate, but don't want to rush folks.

Thanks for following up, chat next release. -Harry

Did some discussion happen?
21.02-rc1 is coming soon.

Signature · 1 line
David Marchand
#15 lore raw
Quoted 63 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Wednesday, January 13, 2021 2:43 PM
To: Van Haaren, Harry <[email protected]>; mattias.ronnblom <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] service: add component useful work attribute

Hello Harry, Mattias,

Quoted 24 lines · Harry
Quoted 24 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines · Harry van Haaren
Quoted 7 lines

This commit adds a new attribute which allows the service to indicate if the previous iteration of work was "useful". Useful work here implies forward progress was made.

Exposing this information via an attribute to the application allows tracking of CPU cycles as being useful or not-useful, and a CPU load estimate can be deduced from that information.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

How would that tracking be implemented? rte_service.c already keeps track of the amount of busy cycles per service. Would it be possible to reuse that mechanism to achieve the same goal?

Tracking "busy cycles" is not exactly the same - Eventdev SW PMD can spend cycles polling, and trying to move packets around its internal queues, but

make

Quoted 7 lines
Quoted 7 lines

no forward progress. Measuring cycles spent in the service would not indicate the correct "busyness" in that case.

In the suggested patchset, each service (e.g Eventdev SW PMD) can update a statistic itself, pushing an attribute value into the service-cores layer. This method allows each PMD to define "useful work" in its own way.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

We did some prototyping on dynamic load balancing for the service core framework, and then we extended the API is such a way that the service callback would return a bool indicating if forward progress was made, if I recall correctly. Sampling these counters allowed for tracking load on both a per-lcore and per-service basis.

The service callback return value can be stored/inspected on the service-core itself, but how to show that to the application? It still requires an attribute

API

Quoted 17 lines
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines

like proposed below re-using "attr_get" API I think.

So really the only difference in the prototype you mention is how the service itself communicates business to the service-cores infrastructure in

EAL.

Quoted 8 lines
Quoted 8 lines

Perhaps re-purposing return-value is simpler, but it limits statistics from the service to just business, and the API change requires all services to change.

Pros of adding an API as this patchset proposes is to push attribute values to service-core in EAL is extensibility, and no API breakage.

Given that context, Ack / push-back to this suggested approach?

I need a conclusion.
Is this required for 20.11?

Quoted 8 lines
Quoted 5 lines

Given timeline - lets leave this until 21.02 release.
I think the above solution is adequate, but don't want to rush folks.

Thanks for following up, chat next release. -Harry

Did some discussion happen?
21.02-rc1 is coming soon.

Thanks for flagging, I'm not aware of any continuation of the discussions. Mattias, do you have any updates?

This v2 currently fails to apply on a version.map file conflict, but otherwise is still fine IMO.