Skip to content

Commit

Permalink
power: fix number of uncore freqs
Browse files Browse the repository at this point in the history
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: 60b8a66 ("power: add Intel uncore frequency control")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
shemminger authored and ovsrobot committed Jul 22, 2024
1 parent fa8d2f7 commit 5c4cfd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions app/test/test_power_intel_uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 2 additions & 3 deletions lib/power/power_intel_uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5c4cfd2

Please sign in to comment.