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 978B645680; Mon, 22 Jul 2024 22:15:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83A56402EA; Mon, 22 Jul 2024 22:15:48 +0200 (CEST) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mails.dpdk.org (Postfix) with ESMTP id AD37C4028B for ; Mon, 22 Jul 2024 22:15:46 +0200 (CEST) Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2cd5e3c27c5so858417a91.3 for ; Mon, 22 Jul 2024 13:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1721679346; x=1722284146; 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=ZGP+Aa745F7ypJ+Dkyr+61df7ZjE3gfM1rIDKtPIxDc=; b=F+u5GmlK3ua9s26Xd3I/rlgFenHFASJp4mUv1+DYxj3dJ1cRHwKXwwxcT43v+FY6MT Mx125f+RPT/23xl7vcQu3FBU4eNEDNlpVRlbSDPvGr8h+NzPZd8EUGdY8sTh4O6D6iz5 mg3qLnhdSR1WJAyBQgZuIpz4hZZtPCKFLmaGXpECap2had3nnO5Kn2x87jQ06X7hM4uN eJLioyLX/k/3nZ1mU/mVoU6P/Xu70way6/Z/q4Z9tpVM9AcLhY3LnQQHUlPIz3nd8fDg P5nyCwXssz5ij0dZk27n2B562NMfsrw8fDmzWi6QDo3qPgh79HhE/dw7dze9pb5W2Blc e3yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721679346; x=1722284146; 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=ZGP+Aa745F7ypJ+Dkyr+61df7ZjE3gfM1rIDKtPIxDc=; b=QsN/u24lwLoyDTI153+LoGPXnYHWhLcaKt2wmgGnSH4ccQ6Pzn2fpAPK1i0OT2hD2E 1KmexdGpAAznjB3xK0/RtI2XRD1ig9jAOtPkaobfPFNd0p/QOj0o20QQdP9dvo4JNr95 bGdkLpmHkPNfjUGSJXKgOjYRIwyUUr49pYAg13LeN5ekFKRZrDLXpfL7CLrEs9BAzN2t 598Jjglv/6BbVhOd0fgNbN7BPQfw9tRRJQ1WvSVrzaJZsG610qr3lltlCP4zttVgIw3C TyySwLH6frzqAQw9w+8FDHO/edIeHn8zf1cMmrJJ7PLufqP9o6kn3/P6xVePGqrwekwz 0T4Q== X-Gm-Message-State: AOJu0Yyg5Pm5rlh0Q3GwfmHpZ/NZQ8/B3jBXQ94TRvHZg20utGqXzVnO orf/IgxUiukS9sD+S/wwNepmOX82Cz2bfumcvbD0xk9qwCUVQFIG6YQqcLrNobEETGihhAH8la7 pYaQ= X-Google-Smtp-Source: AGHT+IHmiqXtSmRVozaY+jEBJdPMNN2TrhZeHluEv4dDTAeFJicCXynVRc8tzwtyc2yE7jzSjOkx5Q== X-Received: by 2002:a17:90b:1a8b:b0:2c9:5c7c:815d with SMTP id 98e67ed59e1d1-2cd1605dd39mr5425726a91.22.1721679345708; Mon, 22 Jul 2024 13:15:45 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cb772c1acesm8723378a91.2.2024.07.22.13.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 13:15:45 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov , David Hunt , Sivaprasad Tummala , Tadhg Kearney Subject: [PATCH v3] power: fix number of uncore freqs Date: Mon, 22 Jul 2024 13:15:22 -0700 Message-ID: <20240722201535.12522-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 --- 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(-) 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..4eb9c5900a 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 */ @@ -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; -- 2.43.0