From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 397D8A0543; Tue, 14 Jul 2020 12:30:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 083311D5D3; Tue, 14 Jul 2020 12:30:08 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6ACBE1D5B6 for ; Tue, 14 Jul 2020 12:30:05 +0200 (CEST) IronPort-SDR: 3znqufBzkBKAKsIjXc9i6EUvEmebFigf6YpgQpXZMt5GT6mnax2f49Z92+UGbQqzCb3gzwopkU 9EpQ2zV+Z0tQ== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="146342811" X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="146342811" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 03:30:02 -0700 IronPort-SDR: dDnE1CW/7hwv0gfL/FZeED2Z78W04Mz1qlRDt8A77o5C4jXOWOjIWWbNEgxVa9qiTRAI3RJpQB TXQ+hMkVVaPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="324506213" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.52]) by FMSMGA003.fm.intel.com with ESMTP; 14 Jul 2020 03:30:03 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: David Hunt , reshma.pattan@intel.com, bruce.richardson@intel.com Date: Tue, 14 Jul 2020 11:30:02 +0100 Message-Id: <7774ac413dcbe1e13c0029dd77ab7b467eb2c005.1594722597.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <7fcd224245cddd24d5457f1d6ba29c563006c4d6.1594722597.git.anatoly.burakov@intel.com> References: <7fcd224245cddd24d5457f1d6ba29c563006c4d6.1594722597.git.anatoly.burakov@intel.com> In-Reply-To: <42bebf7cebd2b635a60b626faf605df6d8a277c1.1594652063.git.anatoly.burakov@intel.com> References: <42bebf7cebd2b635a60b626faf605df6d8a277c1.1594652063.git.anatoly.burakov@intel.com> Subject: [dpdk-dev] [PATCH v3 2/2] l3fwd-power: fix updating performance lcore parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When perf-config option is specified, we are calling into the power library even though it may not necessarily be enabled. It is questionable whether perf-config option is even applicable to non-power library modes, but for now, fix it just by avoiding calling into the power library if it wasn't initialized, and assume that every lcore is high performance core. Fixes: e0194feb322c ("examples/l3fwd-power: add interrupt-only mode") Signed-off-by: Anatoly Burakov Acked-by: David Hunt --- examples/l3fwd-power/perf_core.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/examples/l3fwd-power/perf_core.c b/examples/l3fwd-power/perf_core.c index 0a294dfcc8..4705967ea2 100644 --- a/examples/l3fwd-power/perf_core.c +++ b/examples/l3fwd-power/perf_core.c @@ -28,12 +28,27 @@ struct perf_lcore_params { static struct perf_lcore_params prf_lc_prms[MAX_LCORE_PARAMS]; static uint16_t nb_prf_lc_prms; +static int +is_hp_core(unsigned int lcore) +{ + struct rte_power_core_capabilities caps; + int ret; + + /* do we have power management enabled? */ + if (rte_power_get_env() == PM_ENV_NOT_SET) { + /* there's no power management, so just mark it as high perf */ + return 1; + } + ret = rte_power_get_capabilities(lcore, &caps); + return ret == 0 && caps.turbo; +} + int update_lcore_params(void) { uint8_t non_perf_lcores[RTE_MAX_LCORE]; uint16_t nb_non_perf_lcores = 0; - int i, j, ret; + int i, j; /* if perf-config option was not used do nothing */ if (nb_prf_lc_prms == 0) @@ -42,13 +57,9 @@ update_lcore_params(void) /* if high-perf-cores option was not used query every available core */ if (nb_hp_lcores == 0) { for (i = 0; i < RTE_MAX_LCORE; i++) { - if (rte_lcore_is_enabled(i)) { - struct rte_power_core_capabilities caps; - ret = rte_power_get_capabilities(i, &caps); - if (ret == 0 && caps.turbo) { - hp_lcores[nb_hp_lcores] = i; - nb_hp_lcores++; - } + if (rte_lcore_is_enabled(i) && is_hp_core(i)) { + hp_lcores[nb_hp_lcores] = i; + nb_hp_lcores++; } } } -- 2.17.1