All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib: Move trash_bos to their only user
@ 2018-07-18 10:56 ` Chris Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-07-18 10:56 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
from the lib and in the process convert it over from the legacy
libdrm_intel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiarski@intel.com>
---
 lib/igt_aux.c  | 57 --------------------------------------------------
 lib/igt_aux.h  | 10 +--------
 tests/pm_rpm.c | 31 ++++++++++++++++++---------
 3 files changed, 22 insertions(+), 76 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index d9dbf7ced..1250d5c5f 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -682,63 +682,6 @@ void igt_print_activity(void)
 	igt_interactive_info(".");
 }
 
-/* mappable aperture trasher helper */
-drm_intel_bo **trash_bos;
-int num_trash_bos;
-
-/**
- * igt_init_aperture_trashers:
- * @bufmgr: libdrm buffer manager
- *
- * Initialize the aperture trasher using @bufmgr, which can then be run with
- * igt_trash_aperture().
- */
-void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr)
-{
-	int i;
-
-	num_trash_bos = gem_mappable_aperture_size() / (1024*1024);
-
-	trash_bos = malloc(num_trash_bos * sizeof(drm_intel_bo *));
-	igt_assert(trash_bos);
-
-	for (i = 0; i < num_trash_bos; i++)
-		trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096);
-}
-
-/**
- * igt_trash_aperture:
- *
- * Trash the aperture by walking a set of GTT memory mapped objects.
- */
-void igt_trash_aperture(void)
-{
-	int i;
-	uint8_t *gtt_ptr;
-
-	for (i = 0; i < num_trash_bos; i++) {
-		drm_intel_gem_bo_map_gtt(trash_bos[i]);
-		gtt_ptr = trash_bos[i]->virtual;
-		*gtt_ptr = 0;
-		drm_intel_gem_bo_unmap_gtt(trash_bos[i]);
-	}
-}
-
-/**
- * igt_cleanup_aperture_trashers:
- *
- * Clean up all aperture trasher state set up with igt_init_aperture_trashers().
- */
-void igt_cleanup_aperture_trashers(void)
-{
-	int i;
-
-	for (i = 0; i < num_trash_bos; i++)
-		drm_intel_bo_unreference(trash_bos[i]);
-
-	free(trash_bos);
-}
-
 static int autoresume_delay;
 
 static const char *suspend_state_name[] = {
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 639a90778..ef89faa9b 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -28,16 +28,13 @@
 #ifndef IGT_AUX_H
 #define IGT_AUX_H
 
-#include <intel_bufmgr.h>
 #include <inttypes.h>
 #include <stdbool.h>
+#include <stddef.h>
 #include <sys/time.h>
 
 #include <i915/gem_submission.h>
 
-extern drm_intel_bo **trash_bos;
-extern int num_trash_bos;
-
 /* signal interrupt helpers */
 #define gettid() syscall(__NR_gettid)
 #define sigev_notify_thread_id _sigev_un._tid
@@ -122,11 +119,6 @@ bool igt_check_boolean_env_var(const char *env_var, bool default_value);
 
 bool igt_aub_dump_enabled(void);
 
-/* helpers based upon the libdrm buffer manager */
-void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
-void igt_trash_aperture(void);
-void igt_cleanup_aperture_trashers(void);
-
 /* suspend/hibernate and auto-resume system */
 
 /**
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 1f2647be1..4268bb19a 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -1295,25 +1295,36 @@ static void gem_idle_subtest(void)
 
 static void gem_evict_pwrite_subtest(void)
 {
-	static drm_intel_bufmgr *bufmgr;
+	struct {
+		uint32_t handle;
+		uint32_t *ptr;
+	} *trash_bos;
+	unsigned int num_trash_bos, n;
 	uint32_t buf;
-	int i;
 
-	bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
-	igt_assert(bufmgr);
-	igt_init_aperture_trashers(bufmgr);
+	num_trash_bos = gem_mappable_aperture_size() / (1024*1024) + 1;
+	trash_bos = malloc(num_trash_bos * sizeof(*trash_bos));
+	igt_assert(trash_bos);
 
-	igt_trash_aperture();
+	for (n = 0; n < num_trash_bos; n++) {
+		trash_bos[n].handle = gem_create(drm_fd, 1024*1024);
+		trash_bos[n].ptr = gem_mmap__gtt(drm_fd, trash_bos[n].handle,
+						 1024*1024, PROT_WRITE);
+		*trash_bos[n].ptr = 0;
+	}
 
 	disable_or_dpms_all_screens_and_wait(&ms_data, true);
 	igt_assert(wait_for_suspended());
 
 	buf = 0;
-	for (i = 0; i < num_trash_bos; i++)
-		gem_write(drm_fd, trash_bos[i]->handle, 0, &buf, sizeof(buf));
+	for (n = 0; n < num_trash_bos; n++)
+		gem_write(drm_fd, trash_bos[n].handle, 0, &buf, sizeof(buf));
 
-	igt_cleanup_aperture_trashers();
-	drm_intel_bufmgr_destroy(bufmgr);
+	for (n = 0; n < num_trash_bos; n++) {
+		munmap(trash_bos[n].ptr, 1024*1024);
+		gem_close(drm_fd, trash_bos[n].handle);
+	}
+	free(trash_bos);
 }
 
 /* This also triggered WARNs on dmesg at some point. */
-- 
2.18.0

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

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

* [Intel-gfx] [PATCH i-g-t] lib: Move trash_bos to their only user
@ 2018-07-18 10:56 ` Chris Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-07-18 10:56 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
from the lib and in the process convert it over from the legacy
libdrm_intel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiarski@intel.com>
---
 lib/igt_aux.c  | 57 --------------------------------------------------
 lib/igt_aux.h  | 10 +--------
 tests/pm_rpm.c | 31 ++++++++++++++++++---------
 3 files changed, 22 insertions(+), 76 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index d9dbf7ced..1250d5c5f 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -682,63 +682,6 @@ void igt_print_activity(void)
 	igt_interactive_info(".");
 }
 
-/* mappable aperture trasher helper */
-drm_intel_bo **trash_bos;
-int num_trash_bos;
-
-/**
- * igt_init_aperture_trashers:
- * @bufmgr: libdrm buffer manager
- *
- * Initialize the aperture trasher using @bufmgr, which can then be run with
- * igt_trash_aperture().
- */
-void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr)
-{
-	int i;
-
-	num_trash_bos = gem_mappable_aperture_size() / (1024*1024);
-
-	trash_bos = malloc(num_trash_bos * sizeof(drm_intel_bo *));
-	igt_assert(trash_bos);
-
-	for (i = 0; i < num_trash_bos; i++)
-		trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096);
-}
-
-/**
- * igt_trash_aperture:
- *
- * Trash the aperture by walking a set of GTT memory mapped objects.
- */
-void igt_trash_aperture(void)
-{
-	int i;
-	uint8_t *gtt_ptr;
-
-	for (i = 0; i < num_trash_bos; i++) {
-		drm_intel_gem_bo_map_gtt(trash_bos[i]);
-		gtt_ptr = trash_bos[i]->virtual;
-		*gtt_ptr = 0;
-		drm_intel_gem_bo_unmap_gtt(trash_bos[i]);
-	}
-}
-
-/**
- * igt_cleanup_aperture_trashers:
- *
- * Clean up all aperture trasher state set up with igt_init_aperture_trashers().
- */
-void igt_cleanup_aperture_trashers(void)
-{
-	int i;
-
-	for (i = 0; i < num_trash_bos; i++)
-		drm_intel_bo_unreference(trash_bos[i]);
-
-	free(trash_bos);
-}
-
 static int autoresume_delay;
 
 static const char *suspend_state_name[] = {
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 639a90778..ef89faa9b 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -28,16 +28,13 @@
 #ifndef IGT_AUX_H
 #define IGT_AUX_H
 
-#include <intel_bufmgr.h>
 #include <inttypes.h>
 #include <stdbool.h>
+#include <stddef.h>
 #include <sys/time.h>
 
 #include <i915/gem_submission.h>
 
-extern drm_intel_bo **trash_bos;
-extern int num_trash_bos;
-
 /* signal interrupt helpers */
 #define gettid() syscall(__NR_gettid)
 #define sigev_notify_thread_id _sigev_un._tid
@@ -122,11 +119,6 @@ bool igt_check_boolean_env_var(const char *env_var, bool default_value);
 
 bool igt_aub_dump_enabled(void);
 
-/* helpers based upon the libdrm buffer manager */
-void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
-void igt_trash_aperture(void);
-void igt_cleanup_aperture_trashers(void);
-
 /* suspend/hibernate and auto-resume system */
 
 /**
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 1f2647be1..4268bb19a 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -1295,25 +1295,36 @@ static void gem_idle_subtest(void)
 
 static void gem_evict_pwrite_subtest(void)
 {
-	static drm_intel_bufmgr *bufmgr;
+	struct {
+		uint32_t handle;
+		uint32_t *ptr;
+	} *trash_bos;
+	unsigned int num_trash_bos, n;
 	uint32_t buf;
-	int i;
 
-	bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
-	igt_assert(bufmgr);
-	igt_init_aperture_trashers(bufmgr);
+	num_trash_bos = gem_mappable_aperture_size() / (1024*1024) + 1;
+	trash_bos = malloc(num_trash_bos * sizeof(*trash_bos));
+	igt_assert(trash_bos);
 
-	igt_trash_aperture();
+	for (n = 0; n < num_trash_bos; n++) {
+		trash_bos[n].handle = gem_create(drm_fd, 1024*1024);
+		trash_bos[n].ptr = gem_mmap__gtt(drm_fd, trash_bos[n].handle,
+						 1024*1024, PROT_WRITE);
+		*trash_bos[n].ptr = 0;
+	}
 
 	disable_or_dpms_all_screens_and_wait(&ms_data, true);
 	igt_assert(wait_for_suspended());
 
 	buf = 0;
-	for (i = 0; i < num_trash_bos; i++)
-		gem_write(drm_fd, trash_bos[i]->handle, 0, &buf, sizeof(buf));
+	for (n = 0; n < num_trash_bos; n++)
+		gem_write(drm_fd, trash_bos[n].handle, 0, &buf, sizeof(buf));
 
-	igt_cleanup_aperture_trashers();
-	drm_intel_bufmgr_destroy(bufmgr);
+	for (n = 0; n < num_trash_bos; n++) {
+		munmap(trash_bos[n].ptr, 1024*1024);
+		gem_close(drm_fd, trash_bos[n].handle);
+	}
+	free(trash_bos);
 }
 
 /* This also triggered WARNs on dmesg at some point. */
-- 
2.18.0

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

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

* [igt-dev] ✓ Fi.CI.BAT: success for lib: Move trash_bos to their only user
  2018-07-18 10:56 ` [Intel-gfx] " Chris Wilson
  (?)
@ 2018-07-18 12:48 ` Patchwork
  -1 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-07-18 12:48 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: lib: Move trash_bos to their only user
URL   : https://patchwork.freedesktop.org/series/46780/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4503 -> IGTPW_1603 =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1603 need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1603, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46780/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1603:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        PASS -> SKIP

    igt@gem_render_linear_blits@basic:
      fi-bwr-2160:        SKIP -> PASS +1

    igt@gem_render_tiled_blits@basic:
      fi-elk-e7500:       SKIP -> PASS +1
      fi-ilk-650:         SKIP -> PASS +2

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s4-devices:
      {fi-kbl-8809g}:     NOTRUN -> INCOMPLETE (fdo#103665, fdo#107139)

    
    ==== Possible fixes ====

    igt@kms_chamelium@dp-crc-fast:
      fi-kbl-7500u:       FAIL (fdo#103841) -> PASS +1

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

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

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

  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
  fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
  fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139


== Participating hosts (46 -> 41) ==

  Additional (1): fi-kbl-8809g 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-bdw-gvtdvm fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 


== Build changes ==

    * IGT: IGT_4562 -> IGTPW_1603

  CI_DRM_4503: 4aa6797dfafaf527949bf55d3c8513c6902dfec2 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1603: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1603/
  IGT_4562: 8781fd89a63eabed9359d02b50583cca67ff3673 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

* [igt-dev] ✓ Fi.CI.IGT: success for lib: Move trash_bos to their only user
  2018-07-18 10:56 ` [Intel-gfx] " Chris Wilson
  (?)
  (?)
@ 2018-07-18 15:18 ` Patchwork
  -1 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-07-18 15:18 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: lib: Move trash_bos to their only user
URL   : https://patchwork.freedesktop.org/series/46780/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4562_full -> IGTPW_1603_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1603_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1603_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46780/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1603_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-bsd2:
      shard-kbl:          SKIP -> PASS +1

    igt@gem_mocs_settings@mocs-rc6-render:
      shard-kbl:          PASS -> SKIP

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-cpu:
      shard-snb:          PASS -> SKIP

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665, fdo#106023)

    igt@gem_wait@wait-bsd:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-snb:          PASS -> FAIL (fdo#106641)

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          PASS -> FAIL (fdo#103166)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)
      shard-kbl:          PASS -> FAIL (fdo#99912)

    igt@testdisplay:
      shard-glk:          PASS -> INCOMPLETE (k.org#198133, fdo#103359)

    
    ==== Possible fixes ====

    igt@kms_flip@2x-modeset-vs-vblank-race-interruptible:
      shard-glk:          FAIL (fdo#103060) -> PASS

    igt@kms_flip@2x-plain-flip-fb-recreate:
      shard-hsw:          FAIL (fdo#100368) -> PASS

    igt@kms_flip@plain-flip-fb-recreate:
      shard-glk:          FAIL (fdo#100368) -> PASS +1

    igt@kms_plane_lowres@pipe-a-tiling-y:
      shard-glk:          FAIL (fdo#103166) -> PASS

    igt@kms_setmode@basic:
      shard-snb:          FAIL (fdo#99912) -> PASS

    igt@kms_universal_plane@cursor-fb-leak-pipe-b:
      shard-glk:          FAIL (fdo#107241) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#107241 https://bugs.freedesktop.org/show_bug.cgi?id=107241
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4562 -> IGTPW_1603
    * Linux: CI_DRM_4501 -> CI_DRM_4503

  CI_DRM_4501: 692d13f7b75baf0bb8c58b9784569c52d68f01e2 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4503: 4aa6797dfafaf527949bf55d3c8513c6902dfec2 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1603: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1603/
  IGT_4562: 8781fd89a63eabed9359d02b50583cca67ff3673 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

* Re: [PATCH i-g-t] lib: Move trash_bos to their only user
  2018-07-18 10:56 ` [Intel-gfx] " Chris Wilson
@ 2018-07-19  9:18   ` Chris Wilson
  -1 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-07-19  9:18 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Quoting Chris Wilson (2018-07-18 11:56:27)
> Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
> from the lib and in the process convert it over from the legacy
> libdrm_intel.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michał Winiarski <michal.winiarski@intel.com>

Hi Michał, will you be my victim for today?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t] lib: Move trash_bos to their only user
@ 2018-07-19  9:18   ` Chris Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-07-19  9:18 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Quoting Chris Wilson (2018-07-18 11:56:27)
> Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
> from the lib and in the process convert it over from the legacy
> libdrm_intel.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michał Winiarski <michal.winiarski@intel.com>

Hi Michał, will you be my victim for today?
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t] lib: Move trash_bos to their only user
  2018-07-18 10:56 ` [Intel-gfx] " Chris Wilson
@ 2018-07-19 10:24   ` Michał Winiarski
  -1 siblings, 0 replies; 10+ messages in thread
From: Michał Winiarski @ 2018-07-19 10:24 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

On Wed, Jul 18, 2018 at 11:56:27AM +0100, Chris Wilson wrote:
> Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
> from the lib and in the process convert it over from the legacy
> libdrm_intel.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michał Winiarski <michal.winiarski@intel.com>

I'm not sure what the test is testing exactly, but since it's a straight forward
conversion from libdrm_intel with no functional changes:

Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>

-Michał

> ---
>  lib/igt_aux.c  | 57 --------------------------------------------------
>  lib/igt_aux.h  | 10 +--------
>  tests/pm_rpm.c | 31 ++++++++++++++++++---------
>  3 files changed, 22 insertions(+), 76 deletions(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index d9dbf7ced..1250d5c5f 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -682,63 +682,6 @@ void igt_print_activity(void)
>  	igt_interactive_info(".");
>  }
>  
> -/* mappable aperture trasher helper */
> -drm_intel_bo **trash_bos;
> -int num_trash_bos;
> -
> -/**
> - * igt_init_aperture_trashers:
> - * @bufmgr: libdrm buffer manager
> - *
> - * Initialize the aperture trasher using @bufmgr, which can then be run with
> - * igt_trash_aperture().
> - */
> -void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr)
> -{
> -	int i;
> -
> -	num_trash_bos = gem_mappable_aperture_size() / (1024*1024);
> -
> -	trash_bos = malloc(num_trash_bos * sizeof(drm_intel_bo *));
> -	igt_assert(trash_bos);
> -
> -	for (i = 0; i < num_trash_bos; i++)
> -		trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096);
> -}
> -
> -/**
> - * igt_trash_aperture:
> - *
> - * Trash the aperture by walking a set of GTT memory mapped objects.
> - */
> -void igt_trash_aperture(void)
> -{
> -	int i;
> -	uint8_t *gtt_ptr;
> -
> -	for (i = 0; i < num_trash_bos; i++) {
> -		drm_intel_gem_bo_map_gtt(trash_bos[i]);
> -		gtt_ptr = trash_bos[i]->virtual;
> -		*gtt_ptr = 0;
> -		drm_intel_gem_bo_unmap_gtt(trash_bos[i]);
> -	}
> -}
> -
> -/**
> - * igt_cleanup_aperture_trashers:
> - *
> - * Clean up all aperture trasher state set up with igt_init_aperture_trashers().
> - */
> -void igt_cleanup_aperture_trashers(void)
> -{
> -	int i;
> -
> -	for (i = 0; i < num_trash_bos; i++)
> -		drm_intel_bo_unreference(trash_bos[i]);
> -
> -	free(trash_bos);
> -}
> -
>  static int autoresume_delay;
>  
>  static const char *suspend_state_name[] = {
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index 639a90778..ef89faa9b 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -28,16 +28,13 @@
>  #ifndef IGT_AUX_H
>  #define IGT_AUX_H
>  
> -#include <intel_bufmgr.h>
>  #include <inttypes.h>
>  #include <stdbool.h>
> +#include <stddef.h>
>  #include <sys/time.h>
>  
>  #include <i915/gem_submission.h>
>  
> -extern drm_intel_bo **trash_bos;
> -extern int num_trash_bos;
> -
>  /* signal interrupt helpers */
>  #define gettid() syscall(__NR_gettid)
>  #define sigev_notify_thread_id _sigev_un._tid
> @@ -122,11 +119,6 @@ bool igt_check_boolean_env_var(const char *env_var, bool default_value);
>  
>  bool igt_aub_dump_enabled(void);
>  
> -/* helpers based upon the libdrm buffer manager */
> -void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
> -void igt_trash_aperture(void);
> -void igt_cleanup_aperture_trashers(void);
> -
>  /* suspend/hibernate and auto-resume system */
>  
>  /**
> diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
> index 1f2647be1..4268bb19a 100644
> --- a/tests/pm_rpm.c
> +++ b/tests/pm_rpm.c
> @@ -1295,25 +1295,36 @@ static void gem_idle_subtest(void)
>  
>  static void gem_evict_pwrite_subtest(void)
>  {
> -	static drm_intel_bufmgr *bufmgr;
> +	struct {
> +		uint32_t handle;
> +		uint32_t *ptr;
> +	} *trash_bos;
> +	unsigned int num_trash_bos, n;
>  	uint32_t buf;
> -	int i;
>  
> -	bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
> -	igt_assert(bufmgr);
> -	igt_init_aperture_trashers(bufmgr);
> +	num_trash_bos = gem_mappable_aperture_size() / (1024*1024) + 1;
> +	trash_bos = malloc(num_trash_bos * sizeof(*trash_bos));
> +	igt_assert(trash_bos);
>  
> -	igt_trash_aperture();
> +	for (n = 0; n < num_trash_bos; n++) {
> +		trash_bos[n].handle = gem_create(drm_fd, 1024*1024);
> +		trash_bos[n].ptr = gem_mmap__gtt(drm_fd, trash_bos[n].handle,
> +						 1024*1024, PROT_WRITE);
> +		*trash_bos[n].ptr = 0;
> +	}
>  
>  	disable_or_dpms_all_screens_and_wait(&ms_data, true);
>  	igt_assert(wait_for_suspended());
>  
>  	buf = 0;
> -	for (i = 0; i < num_trash_bos; i++)
> -		gem_write(drm_fd, trash_bos[i]->handle, 0, &buf, sizeof(buf));
> +	for (n = 0; n < num_trash_bos; n++)
> +		gem_write(drm_fd, trash_bos[n].handle, 0, &buf, sizeof(buf));
>  
> -	igt_cleanup_aperture_trashers();
> -	drm_intel_bufmgr_destroy(bufmgr);
> +	for (n = 0; n < num_trash_bos; n++) {
> +		munmap(trash_bos[n].ptr, 1024*1024);
> +		gem_close(drm_fd, trash_bos[n].handle);
> +	}
> +	free(trash_bos);
>  }
>  
>  /* This also triggered WARNs on dmesg at some point. */
> -- 
> 2.18.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t] lib: Move trash_bos to their only user
@ 2018-07-19 10:24   ` Michał Winiarski
  0 siblings, 0 replies; 10+ messages in thread
From: Michał Winiarski @ 2018-07-19 10:24 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

On Wed, Jul 18, 2018 at 11:56:27AM +0100, Chris Wilson wrote:
> Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
> from the lib and in the process convert it over from the legacy
> libdrm_intel.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michał Winiarski <michal.winiarski@intel.com>

I'm not sure what the test is testing exactly, but since it's a straight forward
conversion from libdrm_intel with no functional changes:

Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>

-Michał

> ---
>  lib/igt_aux.c  | 57 --------------------------------------------------
>  lib/igt_aux.h  | 10 +--------
>  tests/pm_rpm.c | 31 ++++++++++++++++++---------
>  3 files changed, 22 insertions(+), 76 deletions(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index d9dbf7ced..1250d5c5f 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -682,63 +682,6 @@ void igt_print_activity(void)
>  	igt_interactive_info(".");
>  }
>  
> -/* mappable aperture trasher helper */
> -drm_intel_bo **trash_bos;
> -int num_trash_bos;
> -
> -/**
> - * igt_init_aperture_trashers:
> - * @bufmgr: libdrm buffer manager
> - *
> - * Initialize the aperture trasher using @bufmgr, which can then be run with
> - * igt_trash_aperture().
> - */
> -void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr)
> -{
> -	int i;
> -
> -	num_trash_bos = gem_mappable_aperture_size() / (1024*1024);
> -
> -	trash_bos = malloc(num_trash_bos * sizeof(drm_intel_bo *));
> -	igt_assert(trash_bos);
> -
> -	for (i = 0; i < num_trash_bos; i++)
> -		trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096);
> -}
> -
> -/**
> - * igt_trash_aperture:
> - *
> - * Trash the aperture by walking a set of GTT memory mapped objects.
> - */
> -void igt_trash_aperture(void)
> -{
> -	int i;
> -	uint8_t *gtt_ptr;
> -
> -	for (i = 0; i < num_trash_bos; i++) {
> -		drm_intel_gem_bo_map_gtt(trash_bos[i]);
> -		gtt_ptr = trash_bos[i]->virtual;
> -		*gtt_ptr = 0;
> -		drm_intel_gem_bo_unmap_gtt(trash_bos[i]);
> -	}
> -}
> -
> -/**
> - * igt_cleanup_aperture_trashers:
> - *
> - * Clean up all aperture trasher state set up with igt_init_aperture_trashers().
> - */
> -void igt_cleanup_aperture_trashers(void)
> -{
> -	int i;
> -
> -	for (i = 0; i < num_trash_bos; i++)
> -		drm_intel_bo_unreference(trash_bos[i]);
> -
> -	free(trash_bos);
> -}
> -
>  static int autoresume_delay;
>  
>  static const char *suspend_state_name[] = {
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index 639a90778..ef89faa9b 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -28,16 +28,13 @@
>  #ifndef IGT_AUX_H
>  #define IGT_AUX_H
>  
> -#include <intel_bufmgr.h>
>  #include <inttypes.h>
>  #include <stdbool.h>
> +#include <stddef.h>
>  #include <sys/time.h>
>  
>  #include <i915/gem_submission.h>
>  
> -extern drm_intel_bo **trash_bos;
> -extern int num_trash_bos;
> -
>  /* signal interrupt helpers */
>  #define gettid() syscall(__NR_gettid)
>  #define sigev_notify_thread_id _sigev_un._tid
> @@ -122,11 +119,6 @@ bool igt_check_boolean_env_var(const char *env_var, bool default_value);
>  
>  bool igt_aub_dump_enabled(void);
>  
> -/* helpers based upon the libdrm buffer manager */
> -void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
> -void igt_trash_aperture(void);
> -void igt_cleanup_aperture_trashers(void);
> -
>  /* suspend/hibernate and auto-resume system */
>  
>  /**
> diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
> index 1f2647be1..4268bb19a 100644
> --- a/tests/pm_rpm.c
> +++ b/tests/pm_rpm.c
> @@ -1295,25 +1295,36 @@ static void gem_idle_subtest(void)
>  
>  static void gem_evict_pwrite_subtest(void)
>  {
> -	static drm_intel_bufmgr *bufmgr;
> +	struct {
> +		uint32_t handle;
> +		uint32_t *ptr;
> +	} *trash_bos;
> +	unsigned int num_trash_bos, n;
>  	uint32_t buf;
> -	int i;
>  
> -	bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
> -	igt_assert(bufmgr);
> -	igt_init_aperture_trashers(bufmgr);
> +	num_trash_bos = gem_mappable_aperture_size() / (1024*1024) + 1;
> +	trash_bos = malloc(num_trash_bos * sizeof(*trash_bos));
> +	igt_assert(trash_bos);
>  
> -	igt_trash_aperture();
> +	for (n = 0; n < num_trash_bos; n++) {
> +		trash_bos[n].handle = gem_create(drm_fd, 1024*1024);
> +		trash_bos[n].ptr = gem_mmap__gtt(drm_fd, trash_bos[n].handle,
> +						 1024*1024, PROT_WRITE);
> +		*trash_bos[n].ptr = 0;
> +	}
>  
>  	disable_or_dpms_all_screens_and_wait(&ms_data, true);
>  	igt_assert(wait_for_suspended());
>  
>  	buf = 0;
> -	for (i = 0; i < num_trash_bos; i++)
> -		gem_write(drm_fd, trash_bos[i]->handle, 0, &buf, sizeof(buf));
> +	for (n = 0; n < num_trash_bos; n++)
> +		gem_write(drm_fd, trash_bos[n].handle, 0, &buf, sizeof(buf));
>  
> -	igt_cleanup_aperture_trashers();
> -	drm_intel_bufmgr_destroy(bufmgr);
> +	for (n = 0; n < num_trash_bos; n++) {
> +		munmap(trash_bos[n].ptr, 1024*1024);
> +		gem_close(drm_fd, trash_bos[n].handle);
> +	}
> +	free(trash_bos);
>  }
>  
>  /* This also triggered WARNs on dmesg at some point. */
> -- 
> 2.18.0
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t] lib: Move trash_bos to their only user
  2018-07-19 10:24   ` [igt-dev] " Michał Winiarski
@ 2018-07-19 10:32     ` Chris Wilson
  -1 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-07-19 10:32 UTC (permalink / raw)
  To: Michał Winiarski; +Cc: igt-dev, intel-gfx

Quoting Michał Winiarski (2018-07-19 11:24:05)
> On Wed, Jul 18, 2018 at 11:56:27AM +0100, Chris Wilson wrote:
> > Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
> > from the lib and in the process convert it over from the legacy
> > libdrm_intel.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Michał Winiarski <michal.winiarski@intel.com>
> 
> I'm not sure what the test is testing exactly, but since it's a straight forward
> conversion from libdrm_intel with no functional changes:

Yeah, I guess it's trying to cover paths through pwrite+rpm. I don't
really see it as a tractable problem without using say kprobe+bpf to
steer us?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH i-g-t] lib: Move trash_bos to their only user
@ 2018-07-19 10:32     ` Chris Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-07-19 10:32 UTC (permalink / raw)
  To: Michał Winiarski; +Cc: igt-dev, intel-gfx

Quoting Michał Winiarski (2018-07-19 11:24:05)
> On Wed, Jul 18, 2018 at 11:56:27AM +0100, Chris Wilson wrote:
> > Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
> > from the lib and in the process convert it over from the legacy
> > libdrm_intel.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Michał Winiarski <michal.winiarski@intel.com>
> 
> I'm not sure what the test is testing exactly, but since it's a straight forward
> conversion from libdrm_intel with no functional changes:

Yeah, I guess it's trying to cover paths through pwrite+rpm. I don't
really see it as a tractable problem without using say kprobe+bpf to
steer us?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2018-07-19 10:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18 10:56 [PATCH i-g-t] lib: Move trash_bos to their only user Chris Wilson
2018-07-18 10:56 ` [Intel-gfx] " Chris Wilson
2018-07-18 12:48 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-07-18 15:18 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-07-19  9:18 ` [PATCH i-g-t] " Chris Wilson
2018-07-19  9:18   ` [igt-dev] " Chris Wilson
2018-07-19 10:24 ` Michał Winiarski
2018-07-19 10:24   ` [igt-dev] " Michał Winiarski
2018-07-19 10:32   ` Chris Wilson
2018-07-19 10:32     ` [Intel-gfx] " Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.