patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo_cur_freq value in cpufreq autotest
       [not found] <20210407063822.35858-1-richael.zhuang@arm.com>
@ 2021-04-07  6:38 ` Richael Zhuang
  2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 2/3] test/power: fix a bug " Richael Zhuang
  2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 3/3] test/power: sleep 1s before check cpuinfo_cur_freq Richael Zhuang
  2 siblings, 0 replies; 5+ messages in thread
From: Richael Zhuang @ 2021-04-07  6:38 UTC (permalink / raw)
  To: richael.zhuang; +Cc: alan.carew, stable

The value in "/sys/.../cpuinfo_cur_freq" may not be exactly the
same as what we set. For example, we write "2400000" to
"/sys/.../cpufreq/scaling_setspeed" to set the frequency, then the
value in "/sys/.../cpuinfo_cur_freq" may be "2401222". So need to
round the value.

Fixes: ed7c51a6a680 ("app/test: vm power management")
Cc: alan.carew@intel.com
Cc: stable@dpdk.org

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
---
 app/test/test_power_cpufreq.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
index 731c6b4dc..1f4d8bb05 100644
--- a/app/test/test_power_cpufreq.c
+++ b/app/test/test_power_cpufreq.c
@@ -34,6 +34,10 @@ test_power_caps(void)
 #define TEST_POWER_LCORE_INVALID ((unsigned)RTE_MAX_LCORE)
 #define TEST_POWER_FREQS_NUM_MAX ((unsigned)RTE_MAX_LCORE_FREQS)
 
+/* macros used for rounding frequency to nearest 100000 */
+#define TEST_FREQ_ROUNDING_DELTA 50000
+#define TEST_ROUND_FREQ_TO_N_100000 100000
+
 #define TEST_POWER_SYSFILE_CUR_FREQ \
 	"/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_cur_freq"
 
@@ -62,7 +66,17 @@ check_cur_freq(unsigned lcore_id, uint32_t idx)
 		goto fail_get_cur_freq;
 	}
 	cur_freq = strtoul(buf, NULL, TEST_POWER_CONVERT_TO_DECIMAL);
-	ret = (freqs[idx] == cur_freq ? 0 : -1);
+
+	/* convert the frequency to nearest 100000 value
+	 * Ex: if cur_freq=1396789 then freq_conv=1400000
+	 * Ex: if cur_freq=800030 then freq_conv=800000
+	 */
+	unsigned int freq_conv = 0;
+	freq_conv = (cur_freq + TEST_FREQ_ROUNDING_DELTA)
+				/ TEST_ROUND_FREQ_TO_N_100000;
+	freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000;
+
+	ret = (freqs[idx] == freq_conv ? 0 : -1);
 
 fail_get_cur_freq:
 	fclose(f);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v3 2/3] test/power: fix a bug in cpufreq autotest
       [not found] <20210407063822.35858-1-richael.zhuang@arm.com>
  2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo_cur_freq value in cpufreq autotest Richael Zhuang
@ 2021-04-07  6:38 ` Richael Zhuang
  2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 3/3] test/power: sleep 1s before check cpuinfo_cur_freq Richael Zhuang
  2 siblings, 0 replies; 5+ messages in thread
From: Richael Zhuang @ 2021-04-07  6:38 UTC (permalink / raw)
  To: richael.zhuang; +Cc: lukaszx.krakowiak, stable

For platforms that don't support turbo boost,rte_power_turbo_status()
returns "-ENOTSUP" (like power_kvm_vm_turbo_status()). So don't allow
check_power_turbo() to continue if rte_power_turbo_status(TEST_POWER_LCORE_ID)!=1

Fixes: aeaeaf5f2d62 ("test/power: add cases for turbo feature")
Cc: lukaszx.krakowiak@intel.com
Cc: stable@dpdk.org

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
---
 app/test/test_power_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
index 1f4d8bb05..cda74bd8a 100644
--- a/app/test/test_power_cpufreq.c
+++ b/app/test/test_power_cpufreq.c
@@ -386,7 +386,7 @@ check_power_turbo(void)
 {
 	int ret;
 
-	if (rte_power_turbo_status(TEST_POWER_LCORE_ID) == 0) {
+	if (rte_power_turbo_status(TEST_POWER_LCORE_ID) != 1) {
 		printf("Turbo not available on lcore %u, skipping test\n",
 				TEST_POWER_LCORE_ID);
 		return 0;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v3 3/3] test/power: sleep 1s before check cpuinfo_cur_freq
       [not found] <20210407063822.35858-1-richael.zhuang@arm.com>
  2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo_cur_freq value in cpufreq autotest Richael Zhuang
  2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 2/3] test/power: fix a bug " Richael Zhuang
@ 2021-04-07  6:38 ` Richael Zhuang
  2 siblings, 0 replies; 5+ messages in thread
From: Richael Zhuang @ 2021-04-07  6:38 UTC (permalink / raw)
  To: richael.zhuang; +Cc: alan.carew, stable

Sleep for 1s before checking the newly updated value from
"/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_cur_freq", because
for some systems it may not be effective immediately.

Fixes: ed7c51a6a680 ("app/test: vm power management")
Cc: alan.carew@intel.com
Cc: stable@dpdk.org

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
---
 app/test/test_power_cpufreq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
index cda74bd8a..7a93bc90a 100644
--- a/app/test/test_power_cpufreq.c
+++ b/app/test/test_power_cpufreq.c
@@ -47,6 +47,9 @@ static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX];
 static int
 check_cur_freq(unsigned lcore_id, uint32_t idx)
 {
+	/* wait for the value to be updated */
+	sleep(1);
+
 #define TEST_POWER_CONVERT_TO_DECIMAL 10
 	FILE *f;
 	char fullpath[PATH_MAX];
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo cur freq value in cpufreq autotest
       [not found] ` <20210407074636.26891-1-richael.zhuang@arm.com>
@ 2021-04-07  7:46   ` Richael Zhuang
  0 siblings, 0 replies; 5+ messages in thread
From: Richael Zhuang @ 2021-04-07  7:46 UTC (permalink / raw)
  To: dev; +Cc: alan.carew, stable, David Hunt, Pablo de Lara

The value in "/sys/.../cpuinfo_cur_freq" may not be exactly the
same as what was set. For example, if "2400000" is written to
"/sys/.../cpufreq/scaling_setspeed" to set the frequency, then the
value in "/sys/.../cpuinfo_cur_freq" may be "2401222". So need to
round the value.

Fixes: ed7c51a6a680 ("app/test: vm power management")
Cc: alan.carew@intel.com
Cc: stable@dpdk.org

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
---
 app/test/test_power_cpufreq.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
index 731c6b4dc..1f4d8bb05 100644
--- a/app/test/test_power_cpufreq.c
+++ b/app/test/test_power_cpufreq.c
@@ -34,6 +34,10 @@ test_power_caps(void)
 #define TEST_POWER_LCORE_INVALID ((unsigned)RTE_MAX_LCORE)
 #define TEST_POWER_FREQS_NUM_MAX ((unsigned)RTE_MAX_LCORE_FREQS)
 
+/* macros used for rounding frequency to nearest 100000 */
+#define TEST_FREQ_ROUNDING_DELTA 50000
+#define TEST_ROUND_FREQ_TO_N_100000 100000
+
 #define TEST_POWER_SYSFILE_CUR_FREQ \
 	"/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_cur_freq"
 
@@ -62,7 +66,17 @@ check_cur_freq(unsigned lcore_id, uint32_t idx)
 		goto fail_get_cur_freq;
 	}
 	cur_freq = strtoul(buf, NULL, TEST_POWER_CONVERT_TO_DECIMAL);
-	ret = (freqs[idx] == cur_freq ? 0 : -1);
+
+	/* convert the frequency to nearest 100000 value
+	 * Ex: if cur_freq=1396789 then freq_conv=1400000
+	 * Ex: if cur_freq=800030 then freq_conv=800000
+	 */
+	unsigned int freq_conv = 0;
+	freq_conv = (cur_freq + TEST_FREQ_ROUNDING_DELTA)
+				/ TEST_ROUND_FREQ_TO_N_100000;
+	freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000;
+
+	ret = (freqs[idx] == freq_conv ? 0 : -1);
 
 fail_get_cur_freq:
 	fclose(f);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo_cur_freq value in cpufreq autotest
       [not found] <20210407064111.51832-1-richael.zhuang@arm.com>
@ 2021-04-07  6:41 ` Richael Zhuang
  0 siblings, 0 replies; 5+ messages in thread
From: Richael Zhuang @ 2021-04-07  6:41 UTC (permalink / raw)
  To: ruifeng.wang; +Cc: alan.carew, stable

The value in "/sys/.../cpuinfo_cur_freq" may not be exactly the
same as what we set. For example, we write "2400000" to
"/sys/.../cpufreq/scaling_setspeed" to set the frequency, then the
value in "/sys/.../cpuinfo_cur_freq" may be "2401222". So need to
round the value.

Fixes: ed7c51a6a680 ("app/test: vm power management")
Cc: alan.carew@intel.com
Cc: stable@dpdk.org

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
---
 app/test/test_power_cpufreq.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
index 731c6b4dc..1f4d8bb05 100644
--- a/app/test/test_power_cpufreq.c
+++ b/app/test/test_power_cpufreq.c
@@ -34,6 +34,10 @@ test_power_caps(void)
 #define TEST_POWER_LCORE_INVALID ((unsigned)RTE_MAX_LCORE)
 #define TEST_POWER_FREQS_NUM_MAX ((unsigned)RTE_MAX_LCORE_FREQS)
 
+/* macros used for rounding frequency to nearest 100000 */
+#define TEST_FREQ_ROUNDING_DELTA 50000
+#define TEST_ROUND_FREQ_TO_N_100000 100000
+
 #define TEST_POWER_SYSFILE_CUR_FREQ \
 	"/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_cur_freq"
 
@@ -62,7 +66,17 @@ check_cur_freq(unsigned lcore_id, uint32_t idx)
 		goto fail_get_cur_freq;
 	}
 	cur_freq = strtoul(buf, NULL, TEST_POWER_CONVERT_TO_DECIMAL);
-	ret = (freqs[idx] == cur_freq ? 0 : -1);
+
+	/* convert the frequency to nearest 100000 value
+	 * Ex: if cur_freq=1396789 then freq_conv=1400000
+	 * Ex: if cur_freq=800030 then freq_conv=800000
+	 */
+	unsigned int freq_conv = 0;
+	freq_conv = (cur_freq + TEST_FREQ_ROUNDING_DELTA)
+				/ TEST_ROUND_FREQ_TO_N_100000;
+	freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000;
+
+	ret = (freqs[idx] == freq_conv ? 0 : -1);
 
 fail_get_cur_freq:
 	fclose(f);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-07  7:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210407063822.35858-1-richael.zhuang@arm.com>
2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo_cur_freq value in cpufreq autotest Richael Zhuang
2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 2/3] test/power: fix a bug " Richael Zhuang
2021-04-07  6:38 ` [dpdk-stable] [PATCH v3 3/3] test/power: sleep 1s before check cpuinfo_cur_freq Richael Zhuang
     [not found] <20210407064111.51832-1-richael.zhuang@arm.com>
2021-04-07  6:41 ` [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo_cur_freq value in cpufreq autotest Richael Zhuang
2021-04-07  2:39 [dpdk-stable] [PATCH v2 2/2] test/power: fix a bug " Richael Zhuang
     [not found] ` <20210407074636.26891-1-richael.zhuang@arm.com>
2021-04-07  7:46   ` [dpdk-stable] [PATCH v3 1/3] test/power: round cpuinfo cur freq value " Richael Zhuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).