[Intel-gfx] [PATCH] Merge two subtests for pm_rc6_residency IGT case

2014-08-26 Thread Wendy Wang
Combine two subtests(rc6_residency_check and rc6_residency_counter)
 into one subtest(residency_accuracy)

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 8cf7be3..3f3363a 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -87,13 +87,22 @@ static void read_rc6_residency( int value[], const char 
*name_of_rc6_residency[]
free(path);
 }
 
-static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[])
+static void residency_accuracy(int value[],const char *name_of_rc6_residency[])
 {
int flag;
unsigned int flag_counter,flag_support;
double counter_result = 0;
+   unsigned int diff;
flag_counter = 0;
flag_support = 0;
+   diff = (value[3] - value[0]) +
+   (value[4] - value[1]) +
+   (value[5] - value[2]);
+
+   igt_assert_f(diff = (SLEEP_DURATION + RC6_FUDGE),Diff was too high. 
That is unpossible\n);
+   igt_assert_f(diff = (SLEEP_DURATION - RC6_FUDGE),GPU was not in RC6 
long enough. Check that 
+   the GPU is as idle as 
possible(ie. no X, 
+   running and running no 
other tests)\n);
 
for(flag = NUMBER_OF_RC6_RESIDENCY-1; flag = 0; flag --)
{
@@ -123,26 +132,11 @@ static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[
}
 
igt_info(The residency counter: %f \n, counter_result);
-
igt_skip_on_f(flag_support == 0 , This machine didn't entry any RC6 
state.\n);
igt_assert_f((flag_counter != 0)  (counter_result =1) , Sysfs RC6 
residency counter is inaccurate.\n);
-
igt_info(This machine entry %s state.\n, 
name_of_rc6_residency[(flag_counter / 2) - 1]);
 }
 
-static void rc6_residency_check(int value[])
-{
-   unsigned int diff;
-   diff = (value[3] - value[0]) +
-   (value[4] - value[1]) +
-   (value[5] - value[2]);
-
-   igt_assert_f(diff = (SLEEP_DURATION + RC6_FUDGE),Diff was too high. 
That is unpossible\n);
-   igt_assert_f(diff = (SLEEP_DURATION - RC6_FUDGE),GPU was not in RC6 
long enough. Check that 
-   the GPU is as idle as 
possible(ie. no X, 
-   running and running no 
other tests)\n);
-}
-
 igt_main
 {
int fd;
@@ -159,9 +153,6 @@ igt_main
read_rc6_residency(value, name_of_rc6_residency);
}
 
-   igt_subtest(rc6-residency-check)
-   rc6_residency_check(value);
-
-   igt_subtest(rc6-residency-counter)
-   rc6_residency_counter(value, name_of_rc6_residency);
+   igt_subtest(residency-accuracy)
+   residency_accuracy(value, name_of_rc6_residency);
 }
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] Fix the comments for igt case: pm_rc6_residency

2014-06-18 Thread Wendy Wang
1. Replace abort() with igt_exit()
2. Combine two subtests(rc6_residency_check and rc6_residency_counter)
 into one subtest(residency_accuracy)
3. Replace printf with igt_info(f...)

Test result on multi platforms:
[root@x-bdw01 power]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_b438e8_20140615+ x86_64)
This machine doesn't support rc6pp
This machine doesn't support rc6p
This machine entry into rc6 state
The residency counter: 0.994333
Subtest residency-accuracy: SUCCESS

[root@x-byt06: power]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-next-queued_27b6c1_20140618+ x86_64)
This machine doesn't support rc6pp
This machine doesn't support rc6p
This machine entry into rc6 state
The residency counter: 1.144333
Test assertion failure function residency_accuracy, file pm_rc6_residency.c:141:
Last errno: 0, Success
Failed assertion: (flag_counter != 0)  (counter_result =1)
Sysfs RC6 residency counter is inaccurate
Subtest residency-accuracy: FAIL

[root@x-hswu32 home]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_e9ce9f_20140617+ x86_64)
This machine doesn't support rc6pp
This machine doesn't support rc6p
This machine entry into rc6 state
The residency counter: 1.004333
Test assertion failure function residency_accuracy, file pm_rc6_residency.c:141:
Last errno: 0, Success
Failed assertion: (flag_counter != 0)  (counter_result =1)
Sysfs RC6 residency counter is inaccurate
Subtest residency-accuracy: FAIL

[root@x-ivb16 power]# ./pm_rc6_residency
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_fff6c5_20140618+ x86_64)
This machine doesn't support rc6pp
This machine entry into rc6p state
The residency counter: 0.99
Subtest residency-accuracy: SUCCESS

[root@x-ivb16 power]# ./pm_rc6_residency --list
residency-accuracy

[root@x-ivb16 power]# ./pm_rc6_residency --run-subtest residency-accuracy
IGT-Version: 1.7-gf2fcec6 (x86_64)
(Linux: 3.15.0-rc8_drm-intel-nightly_fff6c5_20140618+ x86_64)
This machine doesn't support rc6pp
This machine entry into rc6p state
The residency counter: 0.993667
Subtest residency-accuracy: SUCCESS

Signed-off-by: Wendy Wang wendy.w...@intel.com

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index d364369..0945364 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -47,7 +47,7 @@ static unsigned int readit(const char *path)
file = fopen(path, r);
if (file == NULL) {
fprintf(stderr, Couldn't open %s (%d)\n, path, errno);
-   abort();
+   igt_exit();
}
scanned = fscanf(file, %u, ret);
igt_assert(scanned == 1);
@@ -90,14 +90,24 @@ static void read_rc6_residency( int value[], const char 
*name_of_rc6_residency[]
free(path);
 }
 
-static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[])
+static void residency_accuracy(int value[],const char *name_of_rc6_residency[])
 {
int flag;
unsigned int flag_counter,flag_support;
double counter_result = 0;
+   unsigned int diff;
flag_counter = 0;
flag_support = 0;
 
+   diff = (value[3] - value[0]) +
+   (value[4] - value[1]) +
+   (value[5] - value[2]);
+
+   igt_assert_f(diff = (SLEEP_DURATION + RC6_FUDGE),Diff was too high. 
That is unpossible\n);
+   igt_assert_f(diff = (SLEEP_DURATION - RC6_FUDGE),GPU was not in RC6 
long enough. Check that 
+   the GPU is as idle as 
possible(ie. no X, 
+   running and running no 
other tests)\n);
+
for(flag = NUMBER_OF_RC6_RESIDENCY-1; flag = 0; flag --)
{
unsigned int  tmp_counter, tmp_support;
@@ -113,7 +123,7 @@ static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[
 
if( value [flag + 3] == 0){
tmp_support = 0;
-   printf(This machine doesn't support 
%s\n,name_of_rc6_residency[flag]);
+   igt_info(This machine doesn't support 
%s\n,name_of_rc6_residency[flag]);
}
else
tmp_support = 1;
@@ -124,26 +134,11 @@ static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[
flag_support = flag_support + tmp_support;
flag_support = flag_support  1;
}
+   igt_info(This machine entry into %s state\n, 
name_of_rc6_residency[(flag_counter / 2) - 1]);
+   igt_info(The residency counter: %f \n, counter_result);
 
-   printf(The residency counter: %f \n, counter_result);
-
-   igt_skip_on_f(flag_support == 0 , This machine didn't entry any RC6 
state.\n);
-   igt_assert_f((flag_counter != 0)  (counter_result =1) , Sysfs RC6 
residency counter

[Intel-gfx] [PATCH] Fixed the review issues for pm_rc6_residency IGT case

2014-06-09 Thread Wendy Wang
Why need add rc6_residency_counter subtest case:
RC6 feature support residency counter,from power consumption aspect,
the counter closer to 1,the better.If the counter is  0.9, the residency
is not good and will impact power consumption value, if the counter is   1,
sysfs file is inaccurate.

Attach the test result message:
root@x-bdw05:/GFX/Test/Intel_gpu_tools/intel-gpu-tools/tests# ./pm_rc6_residency
IGT-Version: 1.6-g9a70e29 (x86_64) (Linux: 
3.15.0-rc7_drm-intel-nightly_0a37b5_20140604+ x86_64)
Subtest rc6-residency-check: SUCCESS
This machine doesn't support rc6pp
This machine doesn't support rc6p
The residency counter : 0.987000
This machine entry rc6 state.
Subtest rc6-residency-counter: SUCCESS

root@x-bdw05:/GFX/Test/Intel_gpu_tools/intel-gpu-tools/tests# 
./pm_rc6_residency --run-subtest rc6-residency-counter
IGT-Version: 1.6-g9a70e29 (x86_64) (Linux: 
3.15.0-rc7_drm-intel-nightly_0a37b5_20140604+ x86_64)
This machine doesn't support rc6pp
This machine doesn't support rc6p
The residency counter : 0.987000
This machine entry rc6 state.
Subtest rc6-residency-counter: SUCCESS

root@x-bdw05:/GFX/Test/Intel_gpu_tools/intel-gpu-tools/tests# 
./pm_rc6_residency --run-subtest rc6-residency-check
IGT-Version: 1.6-g9a70e29 (x86_64) (Linux: 
3.15.0-rc7_drm-intel-nightly_0a37b5_20140604+ x86_64)
Subtest rc6-residency-check: SUCCESS

root@x-bdw05:/GFX/Test/Intel_gpu_tools/intel-gpu-tools/tests# 
./pm_rc6_residency --list
rc6-residency-check
rc6-residency-counter

Run as non-root
[haha@x-pk home]$ ./pm_rc6_residency
IGT-Version: 1.6-g18d2130 (x86_64) (Linux: 
3.13.0-rc3_drm-intel-nightly_639e4d_20131210+ x86_64)
No intel gpu found
Subtest rc6-residency-check: SKIP
Subtest rc6-residency-counter: SKIP

Run on non-intel platform
[root@x-pk5 home]# ./pm_rc6_residency
IGT-Version: 1.6-g18d2130 (x86_64) (Linux: 
3.13.0-rc3_drm-intel-nightly_639e4d_20131210+ x86_64)
Test requirement not met in function read_rc6_residency, file 
pm_rc6_residency.c:77:
Last errno: 2, No such file or directory
Test requirement: (!(file))
Subtest rc6-residency-check: SKIP
Subtest rc6-residency-counter: SKIP

Signed-off-by: Wendy Wang wendy.w...@intel.com

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index e4c23b3..214c055 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -72,6 +72,7 @@ TESTS_progs_M = \
pm_lpsp \
pm_rpm \
pm_rps \
+   pm_rc6_residency \
prime_self_import \
template \
$(NULL)
@@ -138,7 +139,6 @@ TESTS_progs = \
kms_sink_crc_basic \
kms_fence_pin_leak \
pm_psr \
-   pm_rc6_residency \
prime_udl \
$(NULL)
 
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 550e3ad..d364369 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -38,7 +38,6 @@
 #define SLEEP_DURATION 3000 // in milliseconds
 #define RC6_FUDGE 900 // in milliseconds
 
-
 static unsigned int readit(const char *path)
 {
unsigned int ret;
@@ -60,6 +59,7 @@ static unsigned int readit(const char *path)
 
 static void read_rc6_residency( int value[], const char 
*name_of_rc6_residency[])
 {
+   unsigned int i;
const int device = drm_get_card();
char *path ;
int  ret;
@@ -72,32 +72,33 @@ static void read_rc6_residency( int value[], const char 
*name_of_rc6_residency[]
ret = asprintf(path, /sys/class/drm/card%d/power/rc6_enable, device);
igt_assert(ret != -1);
 
-   file = fopen(path, r);//open
+   file = fopen(path, r);
igt_require(file);
 
/* claim success if no rc6 enabled. */
if (readit(path) == 0)
igt_success();
 
-   for(unsigned int i = 0; i  6; i++)
+   for(i = 0; i  6; i++)
{
if(i == 3)
sleep(SLEEP_DURATION / 1000);
-   ret = asprintf(path, 
/sys/class/drm/card%d/power/%s_residency_ms,device,name_of_rc6_residency[i % 
3] );
+   ret = asprintf(path, 
/sys/class/drm/card%d/power/%s_residency_ms,device,name_of_rc6_residency[i % 
3]);
igt_assert(ret != -1);
value[i] = readit(path);
}
free(path);
 }
 
-static void rc6_residency_counter(int value[],const char * 
name_of_rc6_residency[])
+static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[])
 {
+   int flag;
unsigned int flag_counter,flag_support;
-   double  counter_result = 0;
+   double counter_result = 0;
flag_counter = 0;
flag_support = 0;
 
-   for(int flag = NUMBER_OF_RC6_RESIDENCY-1; flag = 0 ; flag --)
+   for(flag = NUMBER_OF_RC6_RESIDENCY-1; flag = 0; flag --)
{
unsigned int  tmp_counter, tmp_support;
double counter;
@@ -124,11 +125,10 @@ static void rc6_residency_counter(int value[],const char 
* name_of_rc6_residency
flag_support = flag_support  1;
}
 
-   printf

[Intel-gfx] [PATCH] [I-G-T]Add rc6_residency_counter subtest

2014-06-04 Thread Wendy Wang
Move rc6_residency_check to subtest, add new rc6_residency_counter subtest
for pm_rc6_residency IGT case.

Test results run on platforms show as below:
On HSW
---
[root@x-hswu opt]# ./pm_rc6_residency
IGT-Version: 1.6-g35b31df (x86_64) (Linux: 
3.15.0-rc3_drm-intel-nightly_0791a3_20140520+ x86_64)
Subtest rc6-residency-check: SUCCESS
This machine doesn't support rc6pp
This machine doesn't support rc6p
This machine entry  rc6 status.
The residency counter : 0.999667
Subtest rc6-residency-counter: SUCCESS

On IVB

[root@IVB tests]# ./pm_rc6_residency
IGT-Version: 1.6-g35b31df (x86_64) (Linux: 3.13.6_20140318+ x86_64)
Subtest rc6-residency-check: SUCCESS
This machine entry  rc6p status.
The residency counter : 0.997000
Subtest rc6-residency-counter: SUCCESS

On BYT

root@x-byt:/opt# ./pm_rc6_residency
IGT-Version: 1.6-g0d39021 (x86_64) (Linux: 3.14.0_kcloud_ceabbb_20140521+ 
x86_64)
Subtest rc6-residency-check: SUCCESS
This machine doesn't support rc6pp
This machine doesn't support rc6p
The residency counter : 1.144333
Test assertion failure function rc6_residency_counter, file 
pm_rc6_residency.c:131:
Last errno: 0, Success
Failed assertion: counter_result =1
Debug files must be wrong,
Subtest rc6-residency-counter: FAIL

On BDW
---
[root@x-bdw01 opt]# ./pm_rc6_residency
IGT-Version: 1.6-g0d39021 (x86_64) (Linux: 
3.15.0-rc5_drm-intel-nightly_367653_20140521+ x86_64)
Subtest rc6-residency-check: SUCCESS
This machine doesn't support rc6pp
This machine doesn't support rc6p
The residency counter : 0.994333
This machine entry rc6 state.
Subtest rc6-residency-counter: SUCCESS

Signed-off-by: Liu, Lei A lei.a@intel.com, Wendy Wang 
wendy.w...@intel.com
Signed-off-by: Wendy Wang wendy.w...@intel.com

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 197ab00..550e3ad 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -34,9 +34,11 @@
 
 #include drmtest.h
 
+#define NUMBER_OF_RC6_RESIDENCY 3
 #define SLEEP_DURATION 3000 // in milliseconds
 #define RC6_FUDGE 900 // in milliseconds
 
+
 static unsigned int readit(const char *path)
 {
unsigned int ret;
@@ -44,8 +46,10 @@ static unsigned int readit(const char *path)
 
FILE *file;
file = fopen(path, r);
-   igt_assert_f(file,
-Couldn't open %s (%d)\n, path, errno);
+   if (file == NULL) {
+   fprintf(stderr, Couldn't open %s (%d)\n, path, errno);
+   abort();
+   }
scanned = fscanf(file, %u, ret);
igt_assert(scanned == 1);
 
@@ -54,62 +58,112 @@ static unsigned int readit(const char *path)
return ret;
 }
 
-igt_simple_main
+static void read_rc6_residency( int value[], const char 
*name_of_rc6_residency[])
 {
const int device = drm_get_card();
-   char *path, *pathp, *pathpp;
-   int fd, ret;
-   unsigned int value1, value1p, value1pp, value2, value2p, value2pp;
+   char *path ;
+   int  ret;
FILE *file;
-   int diff;
-
-   igt_skip_on_simulation();
-
-   /* Use drm_open_any to verify device existence */
-   fd = drm_open_any();
-   close(fd);
-
-   ret = asprintf(path, /sys/class/drm/card%d/power/rc6_enable, device);
-   igt_assert(ret != -1);
 
/* For some reason my ivb isn't idle even after syncing up with the gpu.
 * Let's add a sleept just to make it happy. */
sleep(5);
 
-   file = fopen(path, r);
+   ret = asprintf(path, /sys/class/drm/card%d/power/rc6_enable, device);
+   igt_assert(ret != -1);
+
+   file = fopen(path, r);//open
igt_require(file);
 
/* claim success if no rc6 enabled. */
if (readit(path) == 0)
igt_success();
 
-   ret = asprintf(path, /sys/class/drm/card%d/power/rc6_residency_ms, 
device);
-   igt_assert(ret != -1);
-   ret = asprintf(pathp, /sys/class/drm/card%d/power/rc6p_residency_ms, 
device);
-   igt_assert(ret != -1);
-   ret = asprintf(pathpp, 
/sys/class/drm/card%d/power/rc6pp_residency_ms, device);
-   igt_assert(ret != -1);
+   for(unsigned int i = 0; i  6; i++)
+   {
+   if(i == 3)
+   sleep(SLEEP_DURATION / 1000);
+   ret = asprintf(path, 
/sys/class/drm/card%d/power/%s_residency_ms,device,name_of_rc6_residency[i % 
3] );
+   igt_assert(ret != -1);
+   value[i] = readit(path);
+   }
+   free(path);
+}
 
-   value1 = readit(path);
-   value1p = readit(pathp);
-   value1pp = readit(pathpp);
-   sleep(SLEEP_DURATION / 1000);
-   value2 = readit(path);
-   value2p = readit(pathp);
-   value2pp = readit(pathpp);
+static void rc6_residency_counter(int value[],const char * 
name_of_rc6_residency[])
+{
+   unsigned int flag_counter,flag_support;
+   double