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 2188FA0C41; Wed, 12 May 2021 18:33:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D1E841103; Wed, 12 May 2021 18:33:19 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 105D14003E; Wed, 12 May 2021 18:33:16 +0200 (CEST) IronPort-SDR: ETgnjyEGqqH6R/V97ryHtfuRrbTblXVFN6U9NEyyB5US0xopRY/vgtr2WtiE+vf4AYbiPSluvX CRSlDdaIF6qQ== X-IronPort-AV: E=McAfee;i="6200,9189,9982"; a="180014977" X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="180014977" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2021 09:33:05 -0700 IronPort-SDR: DSNGqAwT7w365B5xNBI0i3PTH1+fETI0PY8B6U0KTrOanO6r74++/JJKpu7BpE8AkEgHTjIAXZ hvrauCpJDodw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="430816390" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.222.38]) by orsmga007.jf.intel.com with ESMTP; 12 May 2021 09:33:03 -0700 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com, stable@dpdk.org Date: Wed, 12 May 2021 17:32:52 +0100 Message-Id: <20210512163254.9945-2-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210512163254.9945-1-david.hunt@intel.com> References: <20210422144030.16746-1-david.hunt@intel.com> <20210512163254.9945-1-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v2 2/4] test/power: add turbo mode to freq check function 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 Sender: "dev" With the intel_pstate driver and turbo enabled, the top frequency in the frequency array is the P1+1, i.e. 2300001, whereas the frequency shown in scaling_cur_freq could be a lot higher. This patch adds a flag to the check_cur_freq function so that we can specify if a frequency is greater than expected (turbo mode), in which case the check should be successful. Fixes: aeaeaf5f2d62 ("test/power: add cases for turbo feature") Cc: stable@dpdk.org Signed-off-by: David Hunt --- changes in v2 changed check_cur_freq() to take a bool instead of an int, as suggested by Anatoly, and changed all the calls to use true/false. --- app/test/test_power_cpufreq.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c index 52f58ef8b2..2b4728d2e1 100644 --- a/app/test/test_power_cpufreq.c +++ b/app/test/test_power_cpufreq.c @@ -48,7 +48,7 @@ static uint32_t total_freq_num; static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX]; static int -check_cur_freq(unsigned lcore_id, uint32_t idx) +check_cur_freq(unsigned int lcore_id, uint32_t idx, bool turbo) { #define TEST_POWER_CONVERT_TO_DECIMAL 10 #define MAX_LOOP 100 @@ -90,7 +90,10 @@ check_cur_freq(unsigned lcore_id, uint32_t idx) / TEST_ROUND_FREQ_TO_N_100000; freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000; - ret = (freqs[idx] == freq_conv ? 0 : -1); + if (turbo) + ret = (freqs[idx] <= freq_conv ? 0 : -1); + else + ret = (freqs[idx] == freq_conv ? 0 : -1); if (ret == 0) break; @@ -183,7 +186,7 @@ check_power_get_freq(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, count); + ret = check_cur_freq(TEST_POWER_LCORE_ID, count, false); if (ret < 0) return -1; @@ -233,7 +236,7 @@ check_power_set_freq(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1); + ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, false); if (ret < 0) return -1; @@ -269,7 +272,7 @@ check_power_freq_down(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1); + ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, false); if (ret < 0) return -1; @@ -288,7 +291,7 @@ check_power_freq_down(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, 1); + ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, false); if (ret < 0) return -1; @@ -324,7 +327,7 @@ check_power_freq_up(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 2); + ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 2, false); if (ret < 0) return -1; @@ -343,7 +346,7 @@ check_power_freq_up(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, 0); + ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, true); if (ret < 0) return -1; @@ -371,7 +374,7 @@ check_power_freq_max(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, 0); + ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, true); if (ret < 0) return -1; @@ -399,7 +402,7 @@ check_power_freq_min(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1); + ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, false); if (ret < 0) return -1; @@ -433,7 +436,7 @@ check_power_turbo(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, 0); + ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, true); if (ret < 0) return -1; @@ -452,7 +455,7 @@ check_power_turbo(void) } /* Check the current frequency */ - ret = check_cur_freq(TEST_POWER_LCORE_ID, 1); + ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, false); if (ret < 0) return -1; -- 2.17.1