From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D64645681; Mon, 22 Jul 2024 17:58:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7599940431; Mon, 22 Jul 2024 17:58:06 +0200 (CEST) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mails.dpdk.org (Postfix) with ESMTP id 268BC40395 for ; Mon, 22 Jul 2024 17:58:05 +0200 (CEST) Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-70cec4aa1e4so2147565b3a.1 for ; Mon, 22 Jul 2024 08:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1721663884; x=1722268684; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XwlLyZ6wu5PhRovvzDHLYtVvuSfKdUpOleTNTUi5v64=; b=Y5Ub2ygS4Hsa8964NX/rhwDkciS7alcyqbRu+Div7Ejrf0bfqdPcI8S4mn82iaygy6 RoiNp8BUS8PWq5+4Nr2X0T2TfFRu+hX0I7kneleBU5K3Zpx4eY/gy97M5goUYTPbTBht M7+QVByD2h6uDAmqx2TvUEW8NGf35L5/194xBiuXcAGOiQ9uiRnUb8m5g7t1DaMg7Bat vnsE0EECvBHIBaadt7zBe+AbBIpQ1xdq+TgXuD6tzM2CeOMA3XbqLbAU9G8PKx20KuWR sLc76Py1II8XaCZeQ3dsvc7VuZKgw1K/lbBSsFPPSN+bKFq47FqZw9girX7By2wUIdD8 Nwug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721663884; x=1722268684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XwlLyZ6wu5PhRovvzDHLYtVvuSfKdUpOleTNTUi5v64=; b=JdrBAgNlC6DS6XLb4FQ/1whShaBnZgyniHxdst9sPILxcumo1P9WRGR5qQP24+p/yS dFIk+wYCtl62zi4JvpFR+mGwXFUQscHmP6EeJsVBaAAsFrllBZGGF233ruwxt7py7SVZ BqBR/nuD9UbCHP5HwEj5vKXZJsh3BBBRSB9ilb6hoithBUhxjE9qOFAm3kj8tV9tcFZo kzOupoqEonzKPM991iQ7NtyjenzlrR4Gq+7Ji3TUTdtR+uD0ws2BoboV142DlaWGrHVx TNjalhxBzqykJrl4o7ASf88F9mQxoNZhJ0Zjd2IldequNsCW5M8TwIZquxrFXcydK6Ef dM2Q== X-Gm-Message-State: AOJu0YxDK9GRuThc3Tn/7cE89padIbk+sEcog9YtA+HcTBBw5hH5MrCV XD0OletkRUr0yG9vsfd91FmN6CUon3KTSdfM/TQajOtcDrq/FdkTL8Ufv6LSOsKqwv1KKn+WsY5 w9wE= X-Google-Smtp-Source: AGHT+IFRWJDrB9NGTo2ai8Q2DBebkQysay5fDd8U+UpbwJ9nN8sblXTke6r1eM0uPgJz4/OYN4AoLg== X-Received: by 2002:a05:6a00:1a94:b0:70b:260:3e2c with SMTP id d2e1a72fcca58-70d3f8ae8famr487911b3a.28.1721663884074; Mon, 22 Jul 2024 08:58:04 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70d1c28cd98sm2884108b3a.178.2024.07.22.08.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 08:58:03 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov , David Hunt , Sivaprasad Tummala , Tadhg Kearney Subject: [PATCH v2] power: fix number of uncore freqs Date: Mon, 22 Jul 2024 08:57:36 -0700 Message-ID: <20240722155754.6975-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240721021806.67465-1-stephen@networkplumber.org> References: <20240721021806.67465-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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") Signed-off-by: Stephen Hemminger --- 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(-) diff --git a/app/test/test_power_intel_uncore.c b/app/test/test_power_intel_uncore.c index 80b45ce46e..049658627d 100644 --- a/app/test/test_power_intel_uncore.c +++ b/app/test/test_power_intel_uncore.c @@ -17,14 +17,12 @@ test_power_intel_uncore(void) #include #include -#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) { diff --git a/lib/power/power_intel_uncore.c b/lib/power/power_intel_uncore.c index 9c152e4ed2..0090ddd374 100644 --- a/lib/power/power_intel_uncore.c +++ b/lib/power/power_intel_uncore.c @@ -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; -- 2.43.0