public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear
       [not found] <20190214132916.3550-1-chris@chris-wilson.co.uk>
@ 2019-02-14 18:32 ` Chris Wilson
  2019-02-17 18:35   ` Matthew Auld
  2019-02-14 19:14 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_create: Verify that all new objects are clear (rev2) Patchwork
  2019-02-15  2:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2019-02-14 18:32 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Matthew Auld

The kernel must not return stale information back to userspace when they
create a new object. For that purpose, we always clear objects on
creation, so verify that this is so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 tests/i915/gem_create.c | 71 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index 25c5e8088..9de2263d5 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -44,6 +44,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <getopt.h>
+#include <pthread.h>
 
 #include <drm.h>
 
@@ -141,6 +142,73 @@ static void invalid_nonaligned_size(int fd)
 	gem_close(fd, handle);
 }
 
+static uint64_t get_npages(uint64_t *global, uint64_t npages)
+{
+	uint64_t try, old, max;
+
+	max = *global;
+	do {
+		old = max;
+		try = npages % (max / 2);
+		max -= try;
+	} while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
+
+	return try;
+}
+
+struct thread_clear {
+	uint64_t max;
+	int timeout;
+	int i915;
+};
+
+static void *thread_clear(void *data)
+{
+	struct thread_clear *arg = data;
+	int i915 = arg->i915;
+
+	igt_until_timeout(arg->timeout) {
+		uint32_t handle;
+		uint64_t npages;
+
+		npages = random();
+		npages <<= 32;
+		npages |= random();
+		npages = get_npages(&arg->max, npages);
+
+		handle = gem_create(i915, npages << 12);
+		for (uint64_t page = 0; page < npages; page++) {
+			uint64_t x;
+
+			gem_read(i915, handle,
+					page % (4096 - sizeof(x)),
+					&x, sizeof(x));
+			igt_assert_eq_u64(x, 0);
+		}
+		gem_close(i915, handle);
+
+		__sync_add_and_fetch(&arg->max, npages);
+	}
+
+	return NULL;
+}
+
+static void always_clear(int i915, int timeout)
+{
+	struct thread_clear arg = {
+		.i915 = i915,
+		.timeout = timeout,
+		.max = intel_get_avail_ram_mb() << (20 - 12), /* in pages */
+	};
+	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+	pthread_t thread[ncpus];
+
+	for (int i = 0; i < ncpus; i++)
+		pthread_create(&thread[i], NULL, thread_clear, &arg);
+	for (int i = 0; i < ncpus; i++)
+		pthread_join(thread[i], NULL);
+}
+
 igt_main
 {
 	int fd = -1;
@@ -162,4 +230,7 @@ igt_main
 
 	igt_subtest("create-invalid-nonaligned")
 		invalid_nonaligned_size(fd);
+
+	igt_subtest("create-clear")
+		always_clear(fd, 30);
 }
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_create: Verify that all new objects are clear (rev2)
       [not found] <20190214132916.3550-1-chris@chris-wilson.co.uk>
  2019-02-14 18:32 ` [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear Chris Wilson
@ 2019-02-14 19:14 ` Patchwork
  2019-02-15  2:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-02-14 19:14 UTC (permalink / raw)
  To: igt-dev

== Series Details ==

Series: i915/gem_create: Verify that all new objects are clear (rev2)
URL   : https://patchwork.freedesktop.org/series/56686/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5601 -> IGTPW_2409
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/56686/revisions/2/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2409 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@cs-compute:
    - fi-kbl-8809g:       NOTRUN -> FAIL [fdo#108094]

  * igt@gem_exec_suspend@basic-s4-devices:
    - fi-kbl-7500u:       PASS -> DMESG-WARN [fdo#105128] / [fdo#107139]
    - fi-blb-e6850:       PASS -> INCOMPLETE [fdo#107718]

  * igt@i915_selftest@live_evict:
    - fi-bsw-kefka:       PASS -> DMESG-WARN [fdo#107709]

  
#### Possible fixes ####

  * igt@amdgpu/amd_basic@userptr:
    - fi-kbl-8809g:       DMESG-WARN [fdo#108965] -> PASS

  * igt@gem_exec_suspend@basic-s3:
    - {fi-icl-u3}:        FAIL [fdo#103375] -> PASS

  * igt@gem_mmap_gtt@basic-small-bo:
    - {fi-icl-u3}:        DMESG-WARN [fdo#107724] -> PASS

  * igt@i915_selftest@live_workarounds:
    - {fi-icl-u2}:        INCOMPLETE [fdo#109626] -> PASS

  * igt@kms_flip@basic-flip-vs-dpms:
    - fi-skl-6700hq:      DMESG-WARN [fdo#105998] -> PASS

  * igt@kms_pipe_crc_basic@nonblocking-crc-pipe-c:
    - fi-kbl-7567u:       {SKIP} [fdo#109271] -> PASS +27

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - fi-ivb-3520m:       FAIL [fdo#103375] -> PASS

  * igt@pm_rpm@basic-pci-d3-state:
    - fi-bsw-kefka:       {SKIP} [fdo#109271] -> PASS

  * igt@pm_rpm@basic-rte:
    - fi-bsw-kefka:       FAIL [fdo#108800] -> PASS

  
#### Warnings ####

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - fi-kbl-7567u:       {SKIP} [fdo#109271] -> DMESG-FAIL [fdo#105079]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#105079]: https://bugs.freedesktop.org/show_bug.cgi?id=105079
  [fdo#105128]: https://bugs.freedesktop.org/show_bug.cgi?id=105128
  [fdo#105998]: https://bugs.freedesktop.org/show_bug.cgi?id=105998
  [fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
  [fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#108094]: https://bugs.freedesktop.org/show_bug.cgi?id=108094
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
  [fdo#108800]: https://bugs.freedesktop.org/show_bug.cgi?id=108800
  [fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
  [fdo#109226]: https://bugs.freedesktop.org/show_bug.cgi?id=109226
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109567]: https://bugs.freedesktop.org/show_bug.cgi?id=109567
  [fdo#109626]: https://bugs.freedesktop.org/show_bug.cgi?id=109626


Participating hosts (50 -> 44)
------------------------------

  Missing    (6): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-gdg-551 fi-bdw-samus 


Build changes
-------------

    * IGT: IGT_4827 -> IGTPW_2409

  CI_DRM_5601: 7977cc73f17770b9b1ed8baff66a8c9fd681d6a8 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2409: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2409/
  IGT_4827: 395eaffd7e1390c9d6043c2980dc14ce3e08b154 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@gem_create@create-clear

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2409/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.IGT: success for i915/gem_create: Verify that all new objects are clear (rev2)
       [not found] <20190214132916.3550-1-chris@chris-wilson.co.uk>
  2019-02-14 18:32 ` [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear Chris Wilson
  2019-02-14 19:14 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_create: Verify that all new objects are clear (rev2) Patchwork
@ 2019-02-15  2:10 ` Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-02-15  2:10 UTC (permalink / raw)
  To: igt-dev

== Series Details ==

Series: i915/gem_create: Verify that all new objects are clear (rev2)
URL   : https://patchwork.freedesktop.org/series/56686/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5601_full -> IGTPW_2409_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/56686/revisions/2/mbox/

New tests
---------

  New tests have been introduced between CI_DRM_5601_full and IGTPW_2409_full:

### New IGT tests (1) ###

  * igt@gem_create@create-clear:
    - Statuses : 5 pass(s)
    - Exec time: [33.08, 39.45] s

  

Known issues
------------

  Here are the changes found in IGTPW_2409_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_eio@reset-stress:
    - shard-snb:          PASS -> FAIL [fdo#107799]

  * igt@kms_atomic_transition@plane-all-modeset-transition-fencing:
    - shard-apl:          PASS -> INCOMPLETE [fdo#103927] / [fdo#109225]

  * igt@kms_busy@extended-modeset-hang-newfb-render-b:
    - shard-kbl:          NOTRUN -> DMESG-WARN [fdo#107956]
    - shard-snb:          NOTRUN -> DMESG-WARN [fdo#107956]

  * igt@kms_cursor_crc@cursor-128x128-suspend:
    - shard-apl:          PASS -> FAIL [fdo#103191] / [fdo#103232]

  * igt@kms_cursor_crc@cursor-64x21-sliding:
    - shard-apl:          PASS -> FAIL [fdo#103232] +1

  * igt@kms_flip@flip-vs-modeset-vs-hang-interruptible:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#103313] / [fdo#103558] / [fdo#105602] +2

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
    - shard-apl:          PASS -> FAIL [fdo#103167] +1

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
    - shard-glk:          PASS -> FAIL [fdo#103167] +1

  * igt@kms_plane@pixel-format-pipe-c-planes-source-clamping:
    - shard-glk:          PASS -> FAIL [fdo#108948] +1

  * igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
    - shard-kbl:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
    - shard-kbl:          NOTRUN -> FAIL [fdo#108145] / [fdo#108590]

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-yf:
    - shard-kbl:          PASS -> FAIL [fdo#103166] +1

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-none:
    - shard-glk:          PASS -> FAIL [fdo#103166] +4

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
    - shard-apl:          PASS -> FAIL [fdo#103166] +6

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-kbl:          PASS -> FAIL [fdo#109016]

  * igt@kms_sysfs_edid_timing:
    - shard-kbl:          NOTRUN -> FAIL [fdo#100047]

  * igt@kms_universal_plane@cursor-fb-leak-pipe-b:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#103558] / [fdo#105602] +45

  * igt@kms_vblank@pipe-c-accuracy-idle:
    - shard-kbl:          NOTRUN -> DMESG-WARN [fdo#103558] / [fdo#105602] +2

  * igt@pm_rpm@i2c:
    - shard-kbl:          PASS -> DMESG-FAIL [fdo#103313] / [fdo#103558] / [fdo#105602]

  * igt@pm_rps@reset:
    - shard-apl:          PASS -> FAIL [fdo#102250]

  
#### Possible fixes ####

  * igt@gem_eio@in-flight-suspend:
    - shard-kbl:          INCOMPLETE [fdo#103665] / [fdo#106702] -> PASS

  * igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
    - shard-glk:          FAIL [fdo#108145] -> PASS +1

  * igt@kms_color@pipe-c-legacy-gamma:
    - shard-glk:          FAIL [fdo#104782] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-suspend:
    - shard-kbl:          DMESG-WARN [fdo#108566] -> PASS

  * igt@kms_cursor_crc@cursor-128x42-sliding:
    - shard-kbl:          FAIL [fdo#103232] -> PASS +1
    - shard-apl:          FAIL [fdo#103232] -> PASS +4

  * igt@kms_cursor_crc@cursor-64x64-suspend:
    - shard-apl:          FAIL [fdo#103191] / [fdo#103232] -> PASS

  * igt@kms_flip@2x-flip-vs-expired-vblank:
    - shard-glk:          FAIL [fdo#102887] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
    - shard-apl:          FAIL [fdo#103167] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
    - shard-glk:          FAIL [fdo#103167] -> PASS +6

  * igt@kms_plane@plane-position-covered-pipe-c-planes:
    - shard-glk:          FAIL [fdo#103166] -> PASS
    - shard-kbl:          FAIL [fdo#103166] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-b-tiling-none:
    - shard-apl:          FAIL [fdo#103166] -> PASS +4

  * igt@kms_setmode@basic:
    - shard-kbl:          FAIL [fdo#99912] -> PASS

  * igt@kms_vblank@pipe-a-ts-continuation-modeset-rpm:
    - shard-apl:          FAIL -> PASS +1
    - shard-kbl:          FAIL -> PASS

  
#### Warnings ####

  * igt@kms_cursor_crc@cursor-128x128-onscreen:
    - shard-kbl:          FAIL [fdo#103232] -> DMESG-WARN [fdo#103558] / [fdo#105602]

  * igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
    - shard-kbl:          FAIL [fdo#108145] -> DMESG-FAIL [fdo#103558] / [fdo#105602] / [fdo#108145]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
  [fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250
  [fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103313]: https://bugs.freedesktop.org/show_bug.cgi?id=103313
  [fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
  [fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
  [fdo#106702]: https://bugs.freedesktop.org/show_bug.cgi?id=106702
  [fdo#107799]: https://bugs.freedesktop.org/show_bug.cgi?id=107799
  [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
  [fdo#108597]: https://bugs.freedesktop.org/show_bug.cgi?id=108597
  [fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
  [fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
  [fdo#109225]: https://bugs.freedesktop.org/show_bug.cgi?id=109225
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 5)
------------------------------

  Missing    (2): shard-skl shard-iclb 


Build changes
-------------

    * IGT: IGT_4827 -> IGTPW_2409
    * Piglit: piglit_4509 -> None

  CI_DRM_5601: 7977cc73f17770b9b1ed8baff66a8c9fd681d6a8 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2409: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2409/
  IGT_4827: 395eaffd7e1390c9d6043c2980dc14ce3e08b154 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2409/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear
  2019-02-14 18:32 ` [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear Chris Wilson
@ 2019-02-17 18:35   ` Matthew Auld
  2019-02-17 20:26     ` [Intel-gfx] " Chris Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Auld @ 2019-02-17 18:35 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, Intel Graphics Development, Matthew Auld

On Thu, 14 Feb 2019 at 18:32, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> The kernel must not return stale information back to userspace when they
> create a new object. For that purpose, we always clear objects on
> creation, so verify that this is so.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld@intel.com>
> ---
>  tests/i915/gem_create.c | 71 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 71 insertions(+)
>
> diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
> index 25c5e8088..9de2263d5 100644
> --- a/tests/i915/gem_create.c
> +++ b/tests/i915/gem_create.c
> @@ -44,6 +44,7 @@
>  #include <sys/stat.h>
>  #include <sys/time.h>
>  #include <getopt.h>
> +#include <pthread.h>
>
>  #include <drm.h>
>
> @@ -141,6 +142,73 @@ static void invalid_nonaligned_size(int fd)
>         gem_close(fd, handle);
>  }
>
> +static uint64_t get_npages(uint64_t *global, uint64_t npages)
> +{
> +       uint64_t try, old, max;
> +
> +       max = *global;
> +       do {
> +               old = max;
> +               try = npages % (max / 2);
> +               max -= try;
> +       } while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
> +
> +       return try;
> +}
> +
> +struct thread_clear {
> +       uint64_t max;
> +       int timeout;
> +       int i915;
> +};
> +
> +static void *thread_clear(void *data)
> +{
> +       struct thread_clear *arg = data;
> +       int i915 = arg->i915;
> +
> +       igt_until_timeout(arg->timeout) {
> +               uint32_t handle;
> +               uint64_t npages;
> +
> +               npages = random();
> +               npages <<= 32;
> +               npages |= random();
> +               npages = get_npages(&arg->max, npages);
> +
> +               handle = gem_create(i915, npages << 12);
> +               for (uint64_t page = 0; page < npages; page++) {
> +                       uint64_t x;
> +
> +                       gem_read(i915, handle,
> +                                       page % (4096 - sizeof(x)),
> +                                       &x, sizeof(x));

Don't we also want to read some values outside of the first page, or
am I missing something?

> +                       igt_assert_eq_u64(x, 0);
> +               }
> +               gem_close(i915, handle);
> +
> +               __sync_add_and_fetch(&arg->max, npages);
> +       }
> +
> +       return NULL;
> +}
> +
> +static void always_clear(int i915, int timeout)
> +{
> +       struct thread_clear arg = {
> +               .i915 = i915,
> +               .timeout = timeout,
> +               .max = intel_get_avail_ram_mb() << (20 - 12), /* in pages */
> +       };
> +       const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
> +       pthread_t thread[ncpus];
> +
> +       for (int i = 0; i < ncpus; i++)
> +               pthread_create(&thread[i], NULL, thread_clear, &arg);
> +       for (int i = 0; i < ncpus; i++)
> +               pthread_join(thread[i], NULL);
> +}
> +
>  igt_main
>  {
>         int fd = -1;
> @@ -162,4 +230,7 @@ igt_main
>
>         igt_subtest("create-invalid-nonaligned")
>                 invalid_nonaligned_size(fd);
> +
> +       igt_subtest("create-clear")
> +               always_clear(fd, 30);
>  }
> --
> 2.20.1
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear
  2019-02-17 18:35   ` Matthew Auld
@ 2019-02-17 20:26     ` Chris Wilson
  2019-02-17 20:48       ` Matthew Auld
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2019-02-17 20:26 UTC (permalink / raw)
  To: Matthew Auld; +Cc: igt-dev, Intel Graphics Development, Matthew Auld

Quoting Matthew Auld (2019-02-17 18:35:05)
> On Thu, 14 Feb 2019 at 18:32, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > The kernel must not return stale information back to userspace when they
> > create a new object. For that purpose, we always clear objects on
> > creation, so verify that this is so.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> > ---
> >  tests/i915/gem_create.c | 71 +++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 71 insertions(+)
> >
> > diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
> > index 25c5e8088..9de2263d5 100644
> > --- a/tests/i915/gem_create.c
> > +++ b/tests/i915/gem_create.c
> > @@ -44,6 +44,7 @@
> >  #include <sys/stat.h>
> >  #include <sys/time.h>
> >  #include <getopt.h>
> > +#include <pthread.h>
> >
> >  #include <drm.h>
> >
> > @@ -141,6 +142,73 @@ static void invalid_nonaligned_size(int fd)
> >         gem_close(fd, handle);
> >  }
> >
> > +static uint64_t get_npages(uint64_t *global, uint64_t npages)
> > +{
> > +       uint64_t try, old, max;
> > +
> > +       max = *global;
> > +       do {
> > +               old = max;
> > +               try = npages % (max / 2);
> > +               max -= try;
> > +       } while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
> > +
> > +       return try;
> > +}
> > +
> > +struct thread_clear {
> > +       uint64_t max;
> > +       int timeout;
> > +       int i915;
> > +};
> > +
> > +static void *thread_clear(void *data)
> > +{
> > +       struct thread_clear *arg = data;
> > +       int i915 = arg->i915;
> > +
> > +       igt_until_timeout(arg->timeout) {
> > +               uint32_t handle;
> > +               uint64_t npages;
> > +
> > +               npages = random();
> > +               npages <<= 32;
> > +               npages |= random();
> > +               npages = get_npages(&arg->max, npages);
> > +
> > +               handle = gem_create(i915, npages << 12);
> > +               for (uint64_t page = 0; page < npages; page++) {
> > +                       uint64_t x;
> > +
> > +                       gem_read(i915, handle,
> > +                                       page % (4096 - sizeof(x)),
> > +                                       &x, sizeof(x));
> 
> Don't we also want to read some values outside of the first page, or
> am I missing something?

No it was meant to be advancing each page, and then byte within page.

With the trivial page * 4096 + ...?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear
  2019-02-17 20:26     ` [Intel-gfx] " Chris Wilson
@ 2019-02-17 20:48       ` Matthew Auld
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Auld @ 2019-02-17 20:48 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, Intel Graphics Development, Matthew Auld

On Sun, 17 Feb 2019 at 20:27, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> Quoting Matthew Auld (2019-02-17 18:35:05)
> > On Thu, 14 Feb 2019 at 18:32, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > >
> > > The kernel must not return stale information back to userspace when they
> > > create a new object. For that purpose, we always clear objects on
> > > creation, so verify that this is so.
> > >
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Matthew Auld <matthew.auld@intel.com>
> > > ---
> > >  tests/i915/gem_create.c | 71 +++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 71 insertions(+)
> > >
> > > diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
> > > index 25c5e8088..9de2263d5 100644
> > > --- a/tests/i915/gem_create.c
> > > +++ b/tests/i915/gem_create.c
> > > @@ -44,6 +44,7 @@
> > >  #include <sys/stat.h>
> > >  #include <sys/time.h>
> > >  #include <getopt.h>
> > > +#include <pthread.h>
> > >
> > >  #include <drm.h>
> > >
> > > @@ -141,6 +142,73 @@ static void invalid_nonaligned_size(int fd)
> > >         gem_close(fd, handle);
> > >  }
> > >
> > > +static uint64_t get_npages(uint64_t *global, uint64_t npages)
> > > +{
> > > +       uint64_t try, old, max;
> > > +
> > > +       max = *global;
> > > +       do {
> > > +               old = max;
> > > +               try = npages % (max / 2);
> > > +               max -= try;
> > > +       } while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
> > > +
> > > +       return try;
> > > +}
> > > +
> > > +struct thread_clear {
> > > +       uint64_t max;
> > > +       int timeout;
> > > +       int i915;
> > > +};
> > > +
> > > +static void *thread_clear(void *data)
> > > +{
> > > +       struct thread_clear *arg = data;
> > > +       int i915 = arg->i915;
> > > +
> > > +       igt_until_timeout(arg->timeout) {
> > > +               uint32_t handle;
> > > +               uint64_t npages;
> > > +
> > > +               npages = random();
> > > +               npages <<= 32;
> > > +               npages |= random();
> > > +               npages = get_npages(&arg->max, npages);
> > > +
> > > +               handle = gem_create(i915, npages << 12);
> > > +               for (uint64_t page = 0; page < npages; page++) {
> > > +                       uint64_t x;
> > > +
> > > +                       gem_read(i915, handle,
> > > +                                       page % (4096 - sizeof(x)),
> > > +                                       &x, sizeof(x));
> >
> > Don't we also want to read some values outside of the first page, or
> > am I missing something?
>
> No it was meant to be advancing each page, and then byte within page.
>
> With the trivial page * 4096 + ...?

Yup, r-b.

> -Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-02-17 20:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190214132916.3550-1-chris@chris-wilson.co.uk>
2019-02-14 18:32 ` [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear Chris Wilson
2019-02-17 18:35   ` Matthew Auld
2019-02-17 20:26     ` [Intel-gfx] " Chris Wilson
2019-02-17 20:48       ` Matthew Auld
2019-02-14 19:14 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_create: Verify that all new objects are clear (rev2) Patchwork
2019-02-15  2:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox