Skip to contentSkip to conversation

power: fix number of uncore freqs

PATCH Superseded Stephen Hemminger 3 participants 5 messages Jul 21, 2024 – Jul 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: fix number of uncore freqs

The number of uncore frequencies was defined in three places, and two of them were too small leading to test failures. All places should be using RTE_MAX_UNCORE_FREQS.

Bugzilla ID: 1499

Fixes 60b8a661a957 ("power: add Intel uncore frequency control")
---
 app/test/test_power_intel_uncore.c |  4 +--
 lib/power/power_intel_uncore.c     | 55 ++++++++++++++++--------------
 2 files changed, 30 insertions(+), 29 deletions(-)
app/test/test_power_intel_uncore.c +1 -3
index 80b45ce46e..049658627d 100644
@@ -17,14 +17,12 @@ test_power_intel_uncore(void)
 #include <rte_power_uncore.h>
 #include <power_common.h>
 
-#define MAX_UNCORE_FREQS 32
-
 #define VALID_PKG 0
 #define VALID_DIE 0
 #define INVALID_PKG (rte_power_uncore_get_num_pkgs() + 1)
 #define INVALID_DIE (rte_power_uncore_get_num_dies(VALID_PKG) + 1)
 #define VALID_INDEX 1
-#define INVALID_INDEX (MAX_UNCORE_FREQS + 1)
+#define INVALID_INDEX (RTE_MAX_UNCORE_FREQS + 1)
 
 static int check_power_uncore_init(void)
 {
lib/power/power_intel_uncore.c +29 -26

171 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/1 power: fix number of uncore freqs

The number of uncore frequencies was defined in three places, and two of them were too small leading to test failures. All places should be using RTE_MAX_UNCORE_FREQS.

Bugzilla ID: 1499

Fixes 60b8a661a957 ("power: add Intel uncore frequency control")

---
v2 - drop the debug log changes

 app/test/test_power_intel_uncore.c | 4 +---
 lib/power/power_intel_uncore.c     | 5 ++---
 2 files changed, 3 insertions(+), 6 deletions(-)
app/test/test_power_intel_uncore.c +1 -3
index 80b45ce46e..049658627d 100644
@@ -17,14 +17,12 @@ test_power_intel_uncore(void)
 #include <rte_power_uncore.h>
 #include <power_common.h>
 
-#define MAX_UNCORE_FREQS 32
-
 #define VALID_PKG 0
 #define VALID_DIE 0
 #define INVALID_PKG (rte_power_uncore_get_num_pkgs() + 1)
 #define INVALID_DIE (rte_power_uncore_get_num_dies(VALID_PKG) + 1)
 #define VALID_INDEX 1
-#define INVALID_INDEX (MAX_UNCORE_FREQS + 1)
+#define INVALID_INDEX (RTE_MAX_UNCORE_FREQS + 1)
 
 static int check_power_uncore_init(void)
 {
lib/power/power_intel_uncore.c +2 -3
index 9c152e4ed2..0090ddd374 100644
@@ -11,7 +11,6 @@
 #include "power_intel_uncore.h"
 #include "power_common.h"
 
-#define MAX_UNCORE_FREQS 32
 #define MAX_NUMA_DIE 8
 #define BUS_FREQ     100000
 #define FILTER_LENGTH 18
@@ -32,7 +31,7 @@
 struct __rte_cache_aligned uncore_power_info {
 	unsigned int die;                  /* Core die id */
 	unsigned int pkg;                  /* Package id */
-	uint32_t freqs[MAX_UNCORE_FREQS];  /* Frequency array */
+	uint32_t freqs[RTE_MAX_UNCORE_FREQS]; /* Frequency array */
 	uint32_t nb_freqs;                 /* Number of available freqs */
 	FILE *f_cur_min;                   /* FD of scaling_min */
 	FILE *f_cur_max;                   /* FD of scaling_max */
@@ -221,7 +220,7 @@ power_get_available_uncore_freqs(struct uncore_power_info *ui)
 	uint32_t i, num_uncore_freqs = 0;
 
 	num_uncore_freqs = (ui->init_max_freq - ui->init_min_freq) / BUS_FREQ + 1;
-	if (num_uncore_freqs >= MAX_UNCORE_FREQS) {
+	if (num_uncore_freqs >= RTE_MAX_UNCORE_FREQS) {
 		POWER_LOG(ERR, "Too many available uncore frequencies: %d",
 				num_uncore_freqs);
 		goto out;
Signature · 1 line
2.43.0
#2 lore raw

PATCH v3 1/1 power: fix number of uncore freqs

In reply to Stephen Hemminger

The number of uncore frequencies was defined in three places, and two of them were too small leading to test failures. All places should be using RTE_MAX_UNCORE_FREQS.

Bugzilla ID: 1499

Fixes 60b8a661a957 ("power: add Intel uncore frequency control")

---

v3 - restore one change lost in V2

 app/test/test_power_intel_uncore.c | 4 +---
 lib/power/power_intel_uncore.c     | 7 +++----
 2 files changed, 4 insertions(+), 7 deletions(-)
app/test/test_power_intel_uncore.c +1 -3
index 80b45ce46e..049658627d 100644
@@ -17,14 +17,12 @@ test_power_intel_uncore(void)
 #include <rte_power_uncore.h>
 #include <power_common.h>
 
-#define MAX_UNCORE_FREQS 32
-
 #define VALID_PKG 0
 #define VALID_DIE 0
 #define INVALID_PKG (rte_power_uncore_get_num_pkgs() + 1)
 #define INVALID_DIE (rte_power_uncore_get_num_dies(VALID_PKG) + 1)
 #define VALID_INDEX 1
-#define INVALID_INDEX (MAX_UNCORE_FREQS + 1)
+#define INVALID_INDEX (RTE_MAX_UNCORE_FREQS + 1)
 
 static int check_power_uncore_init(void)
 {
lib/power/power_intel_uncore.c +3 -4
index 9c152e4ed2..4eb9c5900a 100644
@@ -11,7 +11,6 @@
 #include "power_intel_uncore.h"
 #include "power_common.h"
 
-#define MAX_UNCORE_FREQS 32
 #define MAX_NUMA_DIE 8
 #define BUS_FREQ     100000
 #define FILTER_LENGTH 18
@@ -32,7 +31,7 @@
 struct __rte_cache_aligned uncore_power_info {
 	unsigned int die;                  /* Core die id */
 	unsigned int pkg;                  /* Package id */
-	uint32_t freqs[MAX_UNCORE_FREQS];  /* Frequency array */
+	uint32_t freqs[RTE_MAX_UNCORE_FREQS]; /* Frequency array */
 	uint32_t nb_freqs;                 /* Number of available freqs */
 	FILE *f_cur_min;                   /* FD of scaling_min */
 	FILE *f_cur_max;                   /* FD of scaling_max */
@@ -51,7 +50,7 @@ set_uncore_freq_internal(struct uncore_power_info *ui, uint32_t idx)
 	uint32_t target_uncore_freq, curr_max_freq;
 	int ret;
 
-	if (idx >= MAX_UNCORE_FREQS || idx >= ui->nb_freqs) {
+	if (idx >= RTE_MAX_UNCORE_FREQS || idx >= ui->nb_freqs) {
 		POWER_LOG(DEBUG, "Invalid uncore frequency index %u, which "
 				"should be less than %u", idx, ui->nb_freqs);
 		return -1;
@@ -221,7 +220,7 @@ power_get_available_uncore_freqs(struct uncore_power_info *ui)
 	uint32_t i, num_uncore_freqs = 0;
 
 	num_uncore_freqs = (ui->init_max_freq - ui->init_min_freq) / BUS_FREQ + 1;
-	if (num_uncore_freqs >= MAX_UNCORE_FREQS) {
+	if (num_uncore_freqs >= RTE_MAX_UNCORE_FREQS) {
 		POWER_LOG(ERR, "Too many available uncore frequencies: %d",
 				num_uncore_freqs);
 		goto out;
Signature · 1 line
2.43.0
Acked-by on v3 1/1
#3 lore raw
Quoted 7 lines · Stephen Hemminger

The number of uncore frequencies was defined in three places, and two of them were too small leading to test failures. All places should be using RTE_MAX_UNCORE_FREQS.

Bugzilla ID: 1499

Fixes 60b8a661a957 ("power: add Intel uncore frequency control")
Quoted 8 lines

---

v3 - restore one change lost in V2

  app/test/test_power_intel_uncore.c | 4 +---
  lib/power/power_intel_uncore.c     | 7 +++----
  2 files changed, 4 insertions(+), 7 deletions(-)

--snip--

LGTM.

#4 lore raw

23/07/2024 13:40, Hunt, David:

Quoted 10 lines · Stephen Hemminger
Quoted 7 lines

The number of uncore frequencies was defined in three places, and two of them were too small leading to test failures. All places should be using RTE_MAX_UNCORE_FREQS.

Bugzilla ID: 1499

Fixes 60b8a661a957 ("power: add Intel uncore frequency control")

Applied, thanks.