Skip to contentSkip to conversation

examples/power: add baseline mode to PMD power

PATCH Superseded David Hunt 3 participants 7 messages May 31, 2021 – Jul 10, 2021

lore
Share & tools
lore

David Hunt

author
#0 lore raw

PATCH 1/1 examples/power: add baseline mode to PMD power

The PMD Power Management scheme currently has 3 modes, scale, monitor and pause. However, it would be nice to have a baseline mode for easy comparison of power savings with and without these modes.

This patch adds a 'baseline' mode were the pmd power management is not enabled. Use --pmg-mgmt=baseline.

---
 examples/l3fwd-power/main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
examples/l3fwd-power/main.c +8 -2
index f8dfed1634..34b0eaa401 100644
@@ -1617,7 +1617,7 @@ print_usage(const char *prgname)
 		" empty polls, full polls, and core busyness to telemetry\n"
 		" --interrupt-only: enable interrupt-only mode\n"
 		" --pmd-mgmt MODE: enable PMD power management mode. "
-		"Currently supported modes: monitor, pause, scale\n",
+		"Currently supported modes: baseline, monitor, pause, scale\n",
 		prgname);
 }
 
@@ -1714,6 +1714,7 @@ parse_pmd_mgmt_config(const char *name)
 #define PMD_MGMT_MONITOR "monitor"
 #define PMD_MGMT_PAUSE   "pause"
 #define PMD_MGMT_SCALE   "scale"
+#define PMD_MGMT_BASELINE  "baseline"
 
 	if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) {
 		pmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR;
@@ -1729,6 +1730,10 @@ parse_pmd_mgmt_config(const char *name)
 		pmgmt_type = RTE_POWER_MGMT_TYPE_SCALE;
 		return 0;
 	}
+	if (strncmp(PMD_MGMT_BASELINE, name, sizeof(PMD_MGMT_BASELINE)) == 0) {
+		pmgmt_type = -1;
+		return 0;
+	}
 	/* unknown PMD power management mode */
 	return -1;
 }
@@ -2767,7 +2772,8 @@ main(int argc, char **argv)
 						 "Fail to add ptype cb\n");
 			}
 
-			if (app_mode == APP_MODE_PMD_MGMT) {
+			if ((app_mode == APP_MODE_PMD_MGMT) &&
+					(pmgmt_type >= 0)) {
 				ret = rte_power_ethdev_pmgmt_queue_enable(
 						lcore_id, portid, queueid,
 						pmgmt_type);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 35 lines · David Hunt

The PMD Power Management scheme currently has 3 modes, scale, monitor and pause. However, it would be nice to have a baseline mode for easy comparison of power savings with and without these modes.

This patch adds a 'baseline' mode were the pmd power management is not enabled. Use --pmg-mgmt=baseline.

---
  examples/l3fwd-power/main.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
examples/l3fwd-power/main.c +2 -1
index f8dfed1634..34b0eaa401 100644
@@ -1617,7 +1617,7 @@ print_usage(const char *prgname)
  		" empty polls, full polls, and core busyness to telemetry\n"
  		" --interrupt-only: enable interrupt-only mode\n"
  		" --pmd-mgmt MODE: enable PMD power management mode. "
-		"Currently supported modes: monitor, pause, scale\n",
+		"Currently supported modes: baseline, monitor, pause, scale\n",
  		prgname);
  }
 
@@ -1714,6 +1714,7 @@ parse_pmd_mgmt_config(const char *name)
  #define PMD_MGMT_MONITOR "monitor"
  #define PMD_MGMT_PAUSE   "pause"
  #define PMD_MGMT_SCALE   "scale"
+#define PMD_MGMT_BASELINE  "baseline"
 
  	if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) {
  		pmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR;

examples/l3fwd-power/main.c parse_pmd_mgmt_config(const char *name) · line 1736

Quoted 7 lines
examples/l3fwd-power/main.c +4 -0
@@ -1729,6 +1730,10 @@ parse_pmd_mgmt_config(const char *name)
  		pmgmt_type = RTE_POWER_MGMT_TYPE_SCALE;
  		return 0;
  	}
+	if (strncmp(PMD_MGMT_BASELINE, name, sizeof(PMD_MGMT_BASELINE)) == 0) {
+		pmgmt_type = -1;
+		return 0;
+	}

I don't particularly like the enum abuse, type safety exists for a reason :) perhaps just add a bool that enables/disables this? you're effectively doing that anyway with pmgmt_type >= 0.

Quoted 14 lines
examples/l3fwd-power/main.c +2 -1
  	/* unknown PMD power management mode */
  	return -1;
  }
@@ -2767,7 +2772,8 @@ main(int argc, char **argv)
  						 "Fail to add ptype cb\n");
  			}
 
-			if (app_mode == APP_MODE_PMD_MGMT) {
+			if ((app_mode == APP_MODE_PMD_MGMT) &&
+					(pmgmt_type >= 0)) {
  				ret = rte_power_ethdev_pmgmt_queue_enable(
  						lcore_id, portid, queueid,
  						pmgmt_type);
Signature · 2 lines
Thanks,
Anatoly
author
#2 lore raw

PATCH v2 1/1 examples/power: add baseline mode to PMD power

In reply to David Hunt

The PMD Power Management scheme currently has 3 modes, scale, monitor and pause. However, it would be nice to have a baseline mode for easy comparison of power savings with and without these modes.

This patch adds a 'baseline' mode were the pmd power management is not enabled. Use --pmg-mgmt=baseline.

---
changes in v2
* added a bool for baseline mode rather than abusing enums

---
 examples/l3fwd-power/main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
examples/l3fwd-power/main.c +12 -2
index f8dfed1634..aeb2411e62 100644
@@ -207,6 +207,7 @@ enum appmode {
 enum appmode app_mode;
 
 static enum rte_power_pmd_mgmt_type pmgmt_type;
+bool baseline_enabled;
 
 enum freq_scale_hint_t
 {
@@ -1617,7 +1618,7 @@ print_usage(const char *prgname)
 		" empty polls, full polls, and core busyness to telemetry\n"
 		" --interrupt-only: enable interrupt-only mode\n"
 		" --pmd-mgmt MODE: enable PMD power management mode. "
-		"Currently supported modes: monitor, pause, scale\n",
+		"Currently supported modes: baseline, monitor, pause, scale\n",
 		prgname);
 }
 
@@ -1714,6 +1715,7 @@ parse_pmd_mgmt_config(const char *name)
 #define PMD_MGMT_MONITOR "monitor"
 #define PMD_MGMT_PAUSE   "pause"
 #define PMD_MGMT_SCALE   "scale"
+#define PMD_MGMT_BASELINE  "baseline"
 
 	if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) {
 		pmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR;
@@ -1729,6 +1731,10 @@ parse_pmd_mgmt_config(const char *name)
 		pmgmt_type = RTE_POWER_MGMT_TYPE_SCALE;
 		return 0;
 	}
+	if (strncmp(PMD_MGMT_BASELINE, name, sizeof(PMD_MGMT_BASELINE)) == 0) {
+		baseline_enabled = true;
+		return 0;
+	}
 	/* unknown PMD power management mode */
 	return -1;
 }
@@ -2528,6 +2534,9 @@ main(int argc, char **argv)
 	/* init RTE timer library to be used late */
 	rte_timer_subsystem_init();
 
+	/* if we're running pmd-mgmt mode, don't default to baseline mode */
+	baseline_enabled = false;
+
 	/* parse application arguments (after the EAL ones) */
 	ret = parse_args(argc, argv);
 	if (ret < 0)
@@ -2767,7 +2776,8 @@ main(int argc, char **argv)
 						 "Fail to add ptype cb\n");
 			}
 
-			if (app_mode == APP_MODE_PMD_MGMT) {
+			if ((app_mode == APP_MODE_PMD_MGMT) &&
+					(baseline_enabled == false)) {
 				ret = rte_power_ethdev_pmgmt_queue_enable(
 						lcore_id, portid, queueid,
 						pmgmt_type);
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#3 lore raw
Quoted 68 lines · David Hunt

The PMD Power Management scheme currently has 3 modes, scale, monitor and pause. However, it would be nice to have a baseline mode for easy comparison of power savings with and without these modes.

This patch adds a 'baseline' mode were the pmd power management is not enabled. Use --pmg-mgmt=baseline.

---
changes in v2
* added a bool for baseline mode rather than abusing enums

---
  examples/l3fwd-power/main.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
examples/l3fwd-power/main.c +10 -1
index f8dfed1634..aeb2411e62 100644
@@ -207,6 +207,7 @@ enum appmode {
  enum appmode app_mode;
 
  static enum rte_power_pmd_mgmt_type pmgmt_type;
+bool baseline_enabled;
 
  enum freq_scale_hint_t
  {
@@ -1617,7 +1618,7 @@ print_usage(const char *prgname)
  		" empty polls, full polls, and core busyness to telemetry\n"
  		" --interrupt-only: enable interrupt-only mode\n"
  		" --pmd-mgmt MODE: enable PMD power management mode. "
-		"Currently supported modes: monitor, pause, scale\n",
+		"Currently supported modes: baseline, monitor, pause, scale\n",
  		prgname);
  }
 
@@ -1714,6 +1715,7 @@ parse_pmd_mgmt_config(const char *name)
  #define PMD_MGMT_MONITOR "monitor"
  #define PMD_MGMT_PAUSE   "pause"
  #define PMD_MGMT_SCALE   "scale"
+#define PMD_MGMT_BASELINE  "baseline"
 
  	if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) {
  		pmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR;
@@ -1729,6 +1731,10 @@ parse_pmd_mgmt_config(const char *name)
  		pmgmt_type = RTE_POWER_MGMT_TYPE_SCALE;
  		return 0;
  	}
+	if (strncmp(PMD_MGMT_BASELINE, name, sizeof(PMD_MGMT_BASELINE)) == 0) {
+		baseline_enabled = true;
+		return 0;
+	}
  	/* unknown PMD power management mode */
  	return -1;
  }
@@ -2528,6 +2534,9 @@ main(int argc, char **argv)
  	/* init RTE timer library to be used late */
  	rte_timer_subsystem_init();
 
+	/* if we're running pmd-mgmt mode, don't default to baseline mode */
+	baseline_enabled = false;
+
  	/* parse application arguments (after the EAL ones) */
  	ret = parse_args(argc, argv);
  	if (ret < 0)

examples/l3fwd-power/main.c main(int argc, char **argv) · line 2780

Quoted 6 lines
examples/l3fwd-power/main.c +2 -1
@@ -2767,7 +2776,8 @@ main(int argc, char **argv)
  						 "Fail to add ptype cb\n");
  			}
 
-			if (app_mode == APP_MODE_PMD_MGMT) {
+			if ((app_mode == APP_MODE_PMD_MGMT) &&
+					(baseline_enabled == false)) {

Nitpicking, !baseline_enabled

Otherwise,

Quoted 4 lines
examples/l3fwd-power/main.c +0 -0
  				ret = rte_power_ethdev_pmgmt_queue_enable(
  						lcore_id, portid, queueid,
  						pmgmt_type);
Signature · 2 lines
Thanks,
Anatoly
author
#4 lore raw
Quoted 64 lines · Anatoly
Quoted 63 lines · David Hunt

The PMD Power Management scheme currently has 3 modes, scale, monitor and pause. However, it would be nice to have a baseline mode for easy comparison of power savings with and without these modes.

This patch adds a 'baseline' mode were the pmd power management is not enabled. Use --pmg-mgmt=baseline.

---
changes in v2
* added a bool for baseline mode rather than abusing enums
---
  examples/l3fwd-power/main.c | 14 ++++++++++++--

  1 file changed, 12 insertions(+), 2 deletions(-)
examples/l3fwd-power/main.c +1 -0
index f8dfed1634..aeb2411e62 100644
@@ -207,6 +207,7 @@ enum appmode {
   enum appmode app_mode;
     static enum rte_power_pmd_mgmt_type pmgmt_type;
+bool baseline_enabled;

    enum freq_scale_hint_t
  {

examples/l3fwd-power/main.c +0 -0
@@ -1617,7 +1618,7 @@ print_usage(const char *prgname)

          " empty polls, full polls, and core busyness to telemetry\n" " --interrupt-only: enable interrupt-only mode\n"
          " --pmd-mgmt MODE: enable PMD power management mode. " -        "Currently supported modes: monitor, pause, scale\n",
+        "Currently supported modes: baseline, monitor, pause, scale\n", prgname);
  }
  @@ -1714,6 +1715,7 @@ parse_pmd_mgmt_config(const char *name) #define PMD_MGMT_MONITOR "monitor"
  #define PMD_MGMT_PAUSE   "pause"
  #define PMD_MGMT_SCALE   "scale"
+#define PMD_MGMT_BASELINE  "baseline"
        if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) { pmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR;

examples/l3fwd-power/main.c +4 -0
@@ -1729,6 +1731,10 @@ parse_pmd_mgmt_config(const char *name)
           pmgmt_type = RTE_POWER_MGMT_TYPE_SCALE;
           return 0;
       }
+    if (strncmp(PMD_MGMT_BASELINE, name, sizeof(PMD_MGMT_BASELINE)) 
 == 0) {
+        baseline_enabled = true;
+        return 0;
+    }
       /* unknown PMD power management mode */
       return -1;

  }

examples/l3fwd-power/main.c +0 -0
@@ -2528,6 +2534,9 @@ main(int argc, char **argv)
       /* init RTE timer library to be used late */
       rte_timer_subsystem_init();

  +    /* if we're running pmd-mgmt mode, don't default to baseline mode */ +    baseline_enabled = false;
+
      /* parse application arguments (after the EAL ones) */ ret = parse_args(argc, argv);
      if (ret < 0)

Quoted 9 lines

examples/l3fwd-power/main.c main(int argc, char **argv) · line 2780

Quoted 6 lines
examples/l3fwd-power/main.c +2 -0
@@ -2767,7 +2776,8 @@ main(int argc, char **argv)
                            "Fail to add ptype cb\n");
               }
   -            if (app_mode == APP_MODE_PMD_MGMT) {
+            if ((app_mode == APP_MODE_PMD_MGMT) &&
+                    (baseline_enabled == false)) {

Nitpicking, !baseline_enabled

Thanks, Anatoly. I don't feel a re-spin is needed for this, but I'll take this format into consideration for future patches, OK?

Quoted 5 lines

Otherwise,

#5 lore raw
Quoted 75 lines · David Hunt
Quoted 64 lines · Anatoly
Quoted 63 lines · David Hunt

The PMD Power Management scheme currently has 3 modes, scale, monitor and pause. However, it would be nice to have a baseline mode for easy comparison of power savings with and without these modes.

This patch adds a 'baseline' mode were the pmd power management is not enabled. Use --pmg-mgmt=baseline.

---
changes in v2
* added a bool for baseline mode rather than abusing enums
---
  examples/l3fwd-power/main.c | 14 ++++++++++++--

  1 file changed, 12 insertions(+), 2 deletions(-)
examples/l3fwd-power/main.c +1 -0
index f8dfed1634..aeb2411e62 100644
@@ -207,6 +207,7 @@ enum appmode {
   enum appmode app_mode;
     static enum rte_power_pmd_mgmt_type pmgmt_type;
+bool baseline_enabled;

    enum freq_scale_hint_t
  {

examples/l3fwd-power/main.c +0 -0
@@ -1617,7 +1618,7 @@ print_usage(const char *prgname)

          " empty polls, full polls, and core busyness to telemetry\n" " --interrupt-only: enable interrupt-only mode\n"
          " --pmd-mgmt MODE: enable PMD power management mode. " -        "Currently supported modes: monitor, pause, scale\n",
+        "Currently supported modes: baseline, monitor, pause, scale\n", prgname);
  }
  @@ -1714,6 +1715,7 @@ parse_pmd_mgmt_config(const char *name) #define PMD_MGMT_MONITOR "monitor"
  #define PMD_MGMT_PAUSE   "pause"
  #define PMD_MGMT_SCALE   "scale"
+#define PMD_MGMT_BASELINE  "baseline"
        if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) { pmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR;

examples/l3fwd-power/main.c +4 -0
@@ -1729,6 +1731,10 @@ parse_pmd_mgmt_config(const char *name)
           pmgmt_type = RTE_POWER_MGMT_TYPE_SCALE;
           return 0;
       }
+    if (strncmp(PMD_MGMT_BASELINE, name, sizeof(PMD_MGMT_BASELINE)) 
 == 0) {
+        baseline_enabled = true;
+        return 0;
+    }
       /* unknown PMD power management mode */
       return -1;

  }

examples/l3fwd-power/main.c +0 -0
@@ -2528,6 +2534,9 @@ main(int argc, char **argv)
       /* init RTE timer library to be used late */
       rte_timer_subsystem_init();

  +    /* if we're running pmd-mgmt mode, don't default to baseline mode */ +    baseline_enabled = false;
+
      /* parse application arguments (after the EAL ones) */ ret = parse_args(argc, argv);
      if (ret < 0)

Quoted 9 lines

examples/l3fwd-power/main.c main(int argc, char **argv) · line 2780

Quoted 6 lines
examples/l3fwd-power/main.c +2 -0
@@ -2767,7 +2776,8 @@ main(int argc, char **argv)
                            "Fail to add ptype cb\n");
               }
   -            if (app_mode == APP_MODE_PMD_MGMT) {
+            if ((app_mode == APP_MODE_PMD_MGMT) &&
+                    (baseline_enabled == false)) {

Nitpicking, !baseline_enabled

Quoted 1 line

Thanks, Anatoly. I don't feel a re-spin is needed for this, but I'll take this format into consideration for future patches, OK?

Yep, i'm fine either way. Maybe someone can fix it on apply :)

Quoted 7 lines
Quoted 7 lines

Otherwise,

Signature · 2 lines
Thanks,
Anatoly
#6 lore raw

23/06/2021 16:14, Burakov, Anatoly:

Quoted 18 lines · David Hunt
Quoted 17 lines · Anatoly
Quoted 16 lines · David Hunt
Quoted 14 lines

The PMD Power Management scheme currently has 3 modes, scale, monitor and pause. However, it would be nice to have a baseline mode for easy comparison of power savings with and without these modes.

This patch adds a 'baseline' mode were the pmd power management is not enabled. Use --pmg-mgmt=baseline.

---
- if (app_mode == APP_MODE_PMD_MGMT) {

examples/l3fwd-power/main.c +2 -0
+            if ((app_mode == APP_MODE_PMD_MGMT) &&
+                    (baseline_enabled == false)) {
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Nitpicking, !baseline_enabled

Thanks, Anatoly. I don't feel a re-spin is needed for this, but I'll take this format into consideration for future patches, OK?

Yep, i'm fine either way. Maybe someone can fix it on apply :)

Applied with the change.