Re: [Intel-gfx] [PATCH i-g-t 1/1] igt/dapc: Test Driver Assisted Performance Capture (DAPC)

2017-08-30 Thread Daniel Vetter
On Wed, Aug 30, 2017 at 10:43:47AM +0100, Lionel Landwerlin wrote:
> On 30/08/17 10:39, Daniel Vetter wrote:
> > Also dapc is not a good testcase name, needs some proper prefixing.
> 
> 
> Reminds me perf.c should probably be renamed too.
> What would be an appropriate name? intel_perf.c?

I think at least a common prefix for all the perf related stuff would be
good. Atm we don't have a consistent rule for prefixing intel-specific
tests, so perf and perf_dapc sound ok to me. If you want, add an intel_
prefix for fun.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t 1/1] igt/dapc: Test Driver Assisted Performance Capture (DAPC)

2017-08-30 Thread Kamble, Sagar A

Thanks Lionel for the review. Will revamp the testcase.


Thanks

Sagar

On 8/29/2017 2:21 PM, Lionel Landwerlin wrote:

Hi Sagar,

Thanks for writing this test. It looks promising but there are a few 
issues that needs to be addressed for this to run in CI.

Please have a look at the comments below.

Thanks!

On 28/08/17 10:53, Sagar Arun Kamble wrote:

This test verifies different i915 perf sampling options for fields like
PID, CTX ID, Timestamp, OA Report, TAG, MMIO.

Cc: Lionel Landwerlin 
Signed-off-by: Sourab Gupta 
Signed-off-by: Sagar Arun Kamble 
---
  tests/Makefile.sources |1 +
  tests/dapc.c   | 1017 


  2 files changed, 1018 insertions(+)
  create mode 100644 tests/dapc.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index bb013c7..61feb0d 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -26,6 +26,7 @@ TESTS_progs = \
  core_getversion \
  core_prop_blob \
  core_setmaster_vs_auth \
+dapc \
  debugfs_test \
  drm_import_export \
  drm_mm \
diff --git a/tests/dapc.c b/tests/dapc.c
new file mode 100644
index 000..f49b1cd
--- /dev/null
+++ b/tests/dapc.c
@@ -0,0 +1,1017 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person 
obtaining a
+ * copy of this software and associated documentation files (the 
"Software"),
+ * to deal in the Software without restriction, including without 
limitation
+ * the rights to use, copy, modify, merge, publish, distribute, 
sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom 
the

+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including 
the next
+ * paragraph) shall be included in all copies or substantial 
portions of the

+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO 
EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 
OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
OTHER DEALINGS

+ * IN THE SOFTWARE.
+ *
+ * dapc: Driver Assisted Performance Capture
+ * This tests the i915 perf functionality to sample various 
metrics by
+ * associating with the CS stream or just standalone periodic OA 
samples.
+ * Verifies fields like PID, CTX ID, Timestamp, OA Report, MMIO, 
Tags are

+ * generated properly for each sample.
+ *
+ * Authors:
+ *   Sourab Gupta 
+ *   Sagar Arun Kamble 
+ *
+ */
+#define _GNU_SOURCE
+#include "xf86drm.h"
+#include "i915_drm.h"
+#include "igt_core.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+


To be able to run this test in the continuous integration system, we 
need it to be autonomous.
The following macro requires user interaction. Unfortunately that 
won't work.
Please look at the other tests to create subtests and make sure we can 
run this in the CI.

Thanks!

Yes. Will update this.



+#define COLLECT_DATA { \
+printf("(%s) Collecting data. ", __func__); \
+printf("Press enter to continue...\n"); \
+getc(stdin); \
+}
+


It would be good to test stream configurations with different sizes.
For example only Pid, or Tag & Pid or SourceInfo & ctx ID & Tag, etc...
And verify that we get reports with appropriate sizes.

Sure. Will try to add testcases for those combinations too.


+#define OA_SAMPLE_SIZE_MAX(8 +/* drm_i915_perf_record_header 
*/ \

+ 8 +/* source info */ \
+ 8 +/* ctx ID */ \
+ 8 +/* Pid */ \
+ 8 +/* Tag */ \
+ 256) /* raw OA counter snapshot */
+
+#define TS_SAMPLE_SIZE_MAX(8 +/* drm_i915_perf_record_header 
*/ \

+ 8 +/* ctx ID */ \
+ 8 +/* Pid */ \
+ 8 +/* Tag */ \
+ 8)/* Timestamp */ \
+
+#define TS_MMIO_SAMPLE_SIZE_MAX(8 +   /* 
drm_i915_perf_record_header */ \

+ 8 +   /* ctx ID */ \
+ 8 +   /* Pid */ \
+ 8 +   /* Tag */ \
+ 8 +   /* Timestamp */ \
+ 4*I915_PERF_MMIO_NUM_MAX)/* MMIO reg */
+
+#define OA_TS_MMIO_SAMPLE_SIZE_MAX (8 +   /* 
drm_i915_perf_record_header */ \

+8 +   /* source info */ \
+8 +   /* ctx ID */ \
+8 +   /* Pid */ \
+  

Re: [Intel-gfx] [PATCH i-g-t 1/1] igt/dapc: Test Driver Assisted Performance Capture (DAPC)

2017-08-30 Thread Kamble, Sagar A



On 8/30/2017 3:09 PM, Daniel Vetter wrote:

One more on top of Lionel's coments.

On Mon, Aug 28, 2017 at 03:23:03PM +0530, Sagar Arun Kamble wrote:

+int main(int argc, char **argv)
+{
+   bool ret;
+   int option;
+   int platform;
+
+   if (argc != 3) {
+   printf("Usage: \n./dapc  \
+   \nPlatform: 0-HSW, 1-BDW, 2-SKL\n\
+   \nTest_mode:\n\
+   \t0 - RCS OA mode\n\
+   \t1 - RCS TS mode\n\
+   \t2 - RCS TS+MMIO mode\n\
+   \t3 - RCS OA+TS+MMIO mode\n\
+   \t4 - Periodic OA mode\n");
+   return 0;
+   }
+
+   ret = initialize();
+   if (!ret)
+   return -1;
+
+   platform = atoi(argv[1]);
+   switch (platform) {
+   case 0:
+   arch = ARCH_HSW;
+   break;
+   case 1:
+   arch = ARCH_BDW;
+   break;
+   case 2:
+   arch = ARCH_SKL;
+   break;
+   default:
+   fprintf(stderr, "Invalid platform:%d\n", platform);
+   return -1;
+   }
+
+   option = atoi(argv[2]);

Please convert this into a proper igt testcase that enumrates subtests
like all the others. Otherwise CI won't pick it up, which makes this
wasted effort. This means using igt_main, igt_subtest, igt_fixture and all
the various igt_assert/require macros we have to check results.

Also dapc is not a good testcase name, needs some proper prefixing.
-Daniel

Yes. Will update the testcase. Thank you Daniel.



+   switch (option) {
+   case 0:
+   test_perf_dapc_rcs_oa();
+   break;
+   case 1:
+   test_perf_dapc_rcs_ts();
+   break;
+   case 2:
+   test_perf_dapc_rcs_ts_mmio();
+   break;
+   case 3:
+   test_perf_dapc_rcs_oa_ts_mmio();
+   break;
+   case 4:
+   test_perf_dapc_periodic_oa();
+   break;
+   default:
+   fprintf(stderr, "Invalid Option:%d\n", option);
+   return -1;
+   }
+
+   return 0;
+}
--
1.9.1

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




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


Re: [Intel-gfx] [PATCH i-g-t 1/1] igt/dapc: Test Driver Assisted Performance Capture (DAPC)

2017-08-30 Thread Lionel Landwerlin

On 30/08/17 10:39, Daniel Vetter wrote:

Also dapc is not a good testcase name, needs some proper prefixing.



Reminds me perf.c should probably be renamed too.
What would be an appropriate name? intel_perf.c?
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t 1/1] igt/dapc: Test Driver Assisted Performance Capture (DAPC)

2017-08-30 Thread Daniel Vetter
One more on top of Lionel's coments.

On Mon, Aug 28, 2017 at 03:23:03PM +0530, Sagar Arun Kamble wrote:
> +int main(int argc, char **argv)
> +{
> + bool ret;
> + int option;
> + int platform;
> +
> + if (argc != 3) {
> + printf("Usage: \n./dapc  \
> + \nPlatform: 0-HSW, 1-BDW, 2-SKL\n\
> + \nTest_mode:\n\
> + \t0 - RCS OA mode\n\
> + \t1 - RCS TS mode\n\
> + \t2 - RCS TS+MMIO mode\n\
> + \t3 - RCS OA+TS+MMIO mode\n\
> + \t4 - Periodic OA mode\n");
> + return 0;
> + }
> +
> + ret = initialize();
> + if (!ret)
> + return -1;
> +
> + platform = atoi(argv[1]);
> + switch (platform) {
> + case 0:
> + arch = ARCH_HSW;
> + break;
> + case 1:
> + arch = ARCH_BDW;
> + break;
> + case 2:
> + arch = ARCH_SKL;
> + break;
> + default:
> + fprintf(stderr, "Invalid platform:%d\n", platform);
> + return -1;
> + }
> +
> + option = atoi(argv[2]);

Please convert this into a proper igt testcase that enumrates subtests
like all the others. Otherwise CI won't pick it up, which makes this
wasted effort. This means using igt_main, igt_subtest, igt_fixture and all
the various igt_assert/require macros we have to check results.

Also dapc is not a good testcase name, needs some proper prefixing.
-Daniel

> + switch (option) {
> + case 0:
> + test_perf_dapc_rcs_oa();
> + break;
> + case 1:
> + test_perf_dapc_rcs_ts();
> + break;
> + case 2:
> + test_perf_dapc_rcs_ts_mmio();
> + break;
> + case 3:
> + test_perf_dapc_rcs_oa_ts_mmio();
> + break;
> + case 4:
> + test_perf_dapc_periodic_oa();
> + break;
> + default:
> + fprintf(stderr, "Invalid Option:%d\n", option);
> + return -1;
> + }
> +
> + return 0;
> +}
> -- 
> 1.9.1
> 

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


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t 1/1] igt/dapc: Test Driver Assisted Performance Capture (DAPC)

2017-08-29 Thread Lionel Landwerlin

Hi Sagar,

Thanks for writing this test. It looks promising but there are a few 
issues that needs to be addressed for this to run in CI.

Please have a look at the comments below.

Thanks!

On 28/08/17 10:53, Sagar Arun Kamble wrote:

This test verifies different i915 perf sampling options for fields like
PID, CTX ID, Timestamp, OA Report, TAG, MMIO.

Cc: Lionel Landwerlin 
Signed-off-by: Sourab Gupta 
Signed-off-by: Sagar Arun Kamble 
---
  tests/Makefile.sources |1 +
  tests/dapc.c   | 1017 
  2 files changed, 1018 insertions(+)
  create mode 100644 tests/dapc.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index bb013c7..61feb0d 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -26,6 +26,7 @@ TESTS_progs = \
core_getversion \
core_prop_blob \
core_setmaster_vs_auth \
+   dapc \
debugfs_test \
drm_import_export \
drm_mm \
diff --git a/tests/dapc.c b/tests/dapc.c
new file mode 100644
index 000..f49b1cd
--- /dev/null
+++ b/tests/dapc.c
@@ -0,0 +1,1017 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * dapc: Driver Assisted Performance Capture
+ *  This tests the i915 perf functionality to sample various metrics by
+ *  associating with the CS stream or just standalone periodic OA samples.
+ *  Verifies fields like PID, CTX ID, Timestamp, OA Report, MMIO, Tags are
+ *  generated properly for each sample.
+ *
+ * Authors:
+ *   Sourab Gupta 
+ *   Sagar Arun Kamble 
+ *
+ */
+#define _GNU_SOURCE
+#include "xf86drm.h"
+#include "i915_drm.h"
+#include "igt_core.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+


To be able to run this test in the continuous integration system, we 
need it to be autonomous.
The following macro requires user interaction. Unfortunately that won't 
work.
Please look at the other tests to create subtests and make sure we can 
run this in the CI.

Thanks!


+#define COLLECT_DATA { \
+   printf("(%s) Collecting data. ", __func__); \
+   printf("Press enter to continue...\n"); \
+   getc(stdin); \
+}
+


It would be good to test stream configurations with different sizes.
For example only Pid, or Tag & Pid or SourceInfo & ctx ID & Tag, etc...
And verify that we get reports with appropriate sizes.


+#define OA_SAMPLE_SIZE_MAX (8 +/* drm_i915_perf_record_header */ \
+8 +/* source info */ \
+8 +/* ctx ID */ \
+8 +/* Pid */ \
+8 +/* Tag */ \
+256) /* raw OA counter snapshot */
+
+#define TS_SAMPLE_SIZE_MAX (8 +/* drm_i915_perf_record_header */ \
+8 +/* ctx ID */ \
+8 +/* Pid */ \
+8 +/* Tag */ \
+8) /* Timestamp */ \
+
+#define TS_MMIO_SAMPLE_SIZE_MAX(8 +   /* drm_i915_perf_record_header 
*/ \
+8 +   /* ctx ID */ \
+8 +   /* Pid */ \
+8 +   /* Tag */ \
+8 +   /* Timestamp */ \
+4*I915_PERF_MMIO_NUM_MAX)  /* MMIO reg */
+
+#define OA_TS_MMIO_SAMPLE_SIZE_MAX (8 +   /* drm_i915_perf_record_header */ \
+   8 +   /* source info */ \
+   8 +   /* ctx ID */ \
+

[Intel-gfx] [PATCH i-g-t 1/1] igt/dapc: Test Driver Assisted Performance Capture (DAPC)

2017-08-28 Thread Sagar Arun Kamble
This test verifies different i915 perf sampling options for fields like
PID, CTX ID, Timestamp, OA Report, TAG, MMIO.

Cc: Lionel Landwerlin 
Signed-off-by: Sourab Gupta 
Signed-off-by: Sagar Arun Kamble 
---
 tests/Makefile.sources |1 +
 tests/dapc.c   | 1017 
 2 files changed, 1018 insertions(+)
 create mode 100644 tests/dapc.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index bb013c7..61feb0d 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -26,6 +26,7 @@ TESTS_progs = \
core_getversion \
core_prop_blob \
core_setmaster_vs_auth \
+   dapc \
debugfs_test \
drm_import_export \
drm_mm \
diff --git a/tests/dapc.c b/tests/dapc.c
new file mode 100644
index 000..f49b1cd
--- /dev/null
+++ b/tests/dapc.c
@@ -0,0 +1,1017 @@
+/*
+ * Copyright ?? 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * dapc: Driver Assisted Performance Capture
+ *  This tests the i915 perf functionality to sample various metrics by
+ *  associating with the CS stream or just standalone periodic OA samples.
+ *  Verifies fields like PID, CTX ID, Timestamp, OA Report, MMIO, Tags are
+ *  generated properly for each sample.
+ *
+ * Authors:
+ *   Sourab Gupta 
+ *   Sagar Arun Kamble 
+ *
+ */
+#define _GNU_SOURCE
+#include "xf86drm.h"
+#include "i915_drm.h"
+#include "igt_core.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define COLLECT_DATA { \
+   printf("(%s) Collecting data. ", __func__); \
+   printf("Press enter to continue...\n"); \
+   getc(stdin); \
+}
+
+#define OA_SAMPLE_SIZE_MAX (8 +/* drm_i915_perf_record_header */ \
+8 +/* source info */ \
+8 +/* ctx ID */ \
+8 +/* Pid */ \
+8 +/* Tag */ \
+256) /* raw OA counter snapshot */
+
+#define TS_SAMPLE_SIZE_MAX (8 +/* drm_i915_perf_record_header */ \
+8 +/* ctx ID */ \
+8 +/* Pid */ \
+8 +/* Tag */ \
+8) /* Timestamp */ \
+
+#define TS_MMIO_SAMPLE_SIZE_MAX(8 +   /* drm_i915_perf_record_header 
*/ \
+8 +   /* ctx ID */ \
+8 +   /* Pid */ \
+8 +   /* Tag */ \
+8 +   /* Timestamp */ \
+4*I915_PERF_MMIO_NUM_MAX)  /* MMIO reg */
+
+#define OA_TS_MMIO_SAMPLE_SIZE_MAX (8 +   /* drm_i915_perf_record_header */ \
+   8 +   /* source info */ \
+   8 +   /* ctx ID */ \
+   8 +   /* Pid */ \
+   8 +   /* Tag */ \
+   8 +   /* Timestamp */ \
+   (4*I915_PERF_MMIO_NUM_MAX) + /* MMIO reg*/ \
+   256) /* raw OA counter snapshot */
+
+#define READ_OA_BUF_SIZE_MAX   (100*OA_SAMPLE_SIZE_MAX)
+#define READ_TS_BUF_SIZE_MAX   (100*TS_SAMPLE_SIZE_MAX)
+#define READ_TS_MMIO_BUF_SIZE_MAX  (100*TS_MMIO_SAMPLE_SIZE_MAX)
+#define READ_OA_TS_MMIO_BUF_SIZE_MAX   (100*OA_TS_MMIO_SAMPLE_SIZE_MAX)
+
+#define SAMPLE_OA  (1<<0)
+#define SAMPLE_TS  (1<<1)
+#define SAMPLE_MMIO(1<<2)
+
+struct intel_device {
+