Skip to contentSkip to conversation

igt: Remove incorrect get_aperture IOCTL arg

PATCH In review Antonio Argenziano 3 participants 4 messages Dec 6, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igt: Remove incorrect get_aperture IOCTL arg

The local implementation of struct drm_i915_gem_get_aperture is inconsistent with what is defined in the driver and now made its way into IGT's include folder. The correct structure also doesn't contain fields that were being used is some require functions about stolen size. Removed those functions and all tests that used the require, they have been skipping for a while and if none complained they must not be needed.

Cc Imre Deak <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Chris Wilson <[email protected]>
---
 lib/ioctl_wrappers.c    |  65 ------
 lib/ioctl_wrappers.h    |  13 --
 tests/i915/gem_create.c |  24 ---
 tests/i915/gem_pread.c  |  85 --------
 tests/i915/gem_pwrite.c |  38 ----
 tests/i915/gem_stolen.c | 455 ----------------------------------------
 tests/meson.build       |   1 -
 7 files changed, 681 deletions(-)
 delete mode 100644 tests/i915/gem_stolen.c
lib/ioctl_wrappers.c +0 -65
index 9f255508..f9f13830 100644
@@ -468,26 +468,6 @@ void gem_sync(int fd, uint32_t handle)
 	errno = 0;
 }
 
-
-bool gem_create__has_stolen_support(int fd)
-{
-	static int has_stolen_support = -1;
-	struct drm_i915_getparam gp;
-	int val = -1;
-
-	if (has_stolen_support < 0) {
-		memset(&gp, 0, sizeof(gp));
-		gp.param = 38; /* CREATE_VERSION */
-		gp.value = &val;
-
-		/* Do we have the extended gem_create_ioctl? */
-		ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-		has_stolen_support = val >= 2;
-	}
-
-	return has_stolen_support;
-}
-
 struct local_i915_gem_create_v2 {
 	uint64_t size;
 	uint32_t handle;
@@ -1191,51 +1171,6 @@ bool gem_has_bsd2(int fd)
 	return has_bsd2;
 }
 
-struct local_i915_gem_get_aperture {
-	__u64 aper_size;
-	__u64 aper_available_size;
-	__u64 version;
-	__u64 map_total_size;
-	__u64 stolen_total_size;
-};
-#define DRM_I915_GEM_GET_APERTURE	0x23
-#define LOCAL_IOCTL_I915_GEM_GET_APERTURE DRM_IOR  (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct local_i915_gem_get_aperture)
-/**
- * gem_total_mappable_size:
- * @fd: open i915 drm file descriptor
- *
- * Feature test macro to query the kernel for the total mappable size.
- *
- * Returns: Total mappable address space size.
- */
-uint64_t gem_total_mappable_size(int fd)
-{
-	struct local_i915_gem_get_aperture aperture;
-
-	memset(&aperture, 0, sizeof(aperture));
-	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture);
-
-	return aperture.map_total_size;
-}
-
-/**
- * gem_total_stolen_size:
- * @fd: open i915 drm file descriptor
- *
- * Feature test macro to query the kernel for the total stolen size.
- *
- * Returns: Total stolen memory.
- */
-uint64_t gem_total_stolen_size(int fd)
-{
-	struct local_i915_gem_get_aperture aperture;
-
-	memset(&aperture, 0, sizeof(aperture));
-	do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture);
-
-	return aperture.stolen_total_size;
-}
-
 /**
  * gem_available_aperture_size:
  * @fd: open i915 drm file descriptor
lib/ioctl_wrappers.h +0 -13
index b22b36b0..80198ce2 100644
@@ -100,17 +100,6 @@ void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, un
 
 int gem_munmap(void *ptr, uint64_t size);
 
-/**
- * gem_require_stolen_support:
- * @fd: open i915 drm file descriptor
- *
- * Test macro to query whether support for allocating objects from stolen
- * memory is available. Automatically skips through igt_require() if not.
- */
-#define gem_require_stolen_support(fd) \
-			igt_require(gem_create__has_stolen_support(fd) && \
-				    (gem_total_stolen_size(fd) > 0))
-
 /**
  * gem_require_mmap_wc:
  * @fd: open i915 drm file descriptor
@@ -153,8 +142,6 @@ int gem_gpu_reset_type(int fd);
 bool gem_gpu_reset_enabled(int fd);
 bool gem_engine_reset_enabled(int fd);
 int gem_available_fences(int fd);
-uint64_t gem_total_mappable_size(int fd);
-uint64_t gem_total_stolen_size(int fd);
 uint64_t gem_available_aperture_size(int fd);
 uint64_t gem_aperture_size(int fd);
 uint64_t gem_global_aperture_size(int fd);
tests/i915/gem_create.c +0 -24
index 25c5e808..9b150635 100644
@@ -72,27 +72,6 @@ struct local_i915_gem_create_v2 {
 	uint32_t flags;
 } create;
 
-#define LOCAL_IOCTL_I915_GEM_CREATE       DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct local_i915_gem_create_v2)
-
-static void invalid_flag_test(int fd)
-{
-	int ret;
-
-	gem_require_stolen_support(fd);
-
-	create.handle = 0;
-	create.size = PAGE_SIZE;
-	create.flags = ~I915_CREATE_PLACEMENT_STOLEN;
-	ret = drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create);
-
-	igt_assert(ret <= 0);
-
-	create.flags = ~0;
-	ret = drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create);
-
-	igt_assert(ret <= 0);
-}
-
 static void invalid_size_test(int fd)
 {
 	uint32_t handle;
@@ -151,9 +130,6 @@ igt_main
 		fd = drm_open_driver(DRIVER_INTEL);
 	}
 
-	igt_subtest("stolen-invalid-flag")
-		invalid_flag_test(fd);
-
 	igt_subtest("create-invalid-size")
 		invalid_size_test(fd);
 
tests/i915/gem_pread.c +0 -85

91 lines not on this page · raw message

tests/i915/gem_pwrite.c +0 -38
index 696bd316..a99642c5 100644
@@ -277,44 +277,6 @@ int main(int argc, char **argv)
 		}
 	}
 
-	igt_subtest("stolen-normal") {
-		gem_require_stolen_support(fd);
-		for (count = 1; count <= 1<<17; count <<= 1) {
-			struct timeval start, end;
-
-			gettimeofday(&start, NULL);
-			do_gem_write(fd, dst_stolen, src_user,
-				     object_size, count);
-			gettimeofday(&end, NULL);
-			usecs = elapsed(&start, &end, count);
-			bps = bytes_per_sec(buf, object_size/usecs*1e6);
-			igt_info("Time to pwrite %d bytes x %6d:        %7.3fµs, %s\n",
-				 object_size, count, usecs, bps);
-			fflush(stdout);
-		}
-	}
-
-	for (c = cache; c->level != -1; c++) {
-		igt_subtest_f("stolen-%s", c->name) {
-			gem_require_stolen_support(fd);
-			gem_set_caching(fd, dst, c->level);
-			for (count = 1; count <= 1<<17; count <<= 1) {
-				struct timeval start, end;
-
-				gettimeofday(&start, NULL);
-				do_gem_write(fd, dst_stolen, src_user,
-					     object_size, count);
-				gettimeofday(&end, NULL);
-				bps = bytes_per_sec(buf,
-						    object_size/usecs*1e6);
-				igt_info("Time to stolen-%s pwrite %d bytes x %6d:     %7.3fµs, %s\n",
-					 c->name, object_size, count,
-					 usecs, bps);
-				fflush(stdout);
-			}
-		}
-	}
-
 	igt_fixture {
 		free(src);
 		gem_close(fd, dst);
tests/i915/gem_stolen.c deleted +0 -455

455 lines not on this page · raw message

tests/meson.build +0 -1
index b8a6e61b..33c773ce 100644
@@ -199,7 +199,6 @@ gem_progs = [
 	'gem_shrink',
 	'gem_softpin',
 	'gem_spin_batch',
-	'gem_stolen',
 	'gem_storedw_batches_loop',
 	'gem_storedw_loop',
 	'gem_streaming_writes',
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

Quoting Antonio Argenziano (2018-12-06 21:17:04)

Quoted 7 lines

The local implementation of struct drm_i915_gem_get_aperture is inconsistent with what is defined in the driver and now made its way into IGT's include folder. The correct structure also doesn't contain fields that were being used is some require functions about stolen size. Removed those functions and all tests that used the require, they have been skipping for a while and if none complained they must not be needed.

Or they are for future implementations...
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw
Quoted 10 lines · Chris Wilson

Quoting Antonio Argenziano (2018-12-06 21:17:04)

Quoted 7 lines

The local implementation of struct drm_i915_gem_get_aperture is inconsistent with what is defined in the driver and now made its way into IGT's include folder. The correct structure also doesn't contain fields that were being used is some require functions about stolen size. Removed those functions and all tests that used the require, they have been skipping for a while and if none complained they must not be needed.

Or they are for future implementations...

I assumed they were for a proposed implementation that didn't land since gem_stolen has been there ~3yrs :)

Do you want to keep them? I'm OK with it but maybe we should add a comment saying there is a plan for extending the IOCTL.

Antonio

Quoted 2 lines

-Chris

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for igt: Remove incorrect get_aperture IOCTL arg

In reply to Antonio Argenziano
== Series Details ==

== Series Details ==

Series: igt: Remove incorrect get_aperture IOCTL arg
URL : https://patchwork.freedesktop.org/series/53697/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5278 -> IGTPW_2130
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_2130 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_2130, 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/53697/revisions/1/mbox/

Possible new issues
-------------------

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

### IGT changes ###

#### Possible regressions ####

* igt@amdgpu/amd_basic@userptr:
- fi-kbl-8809g: PASS -> DMESG-WARN

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_frontbuffer_tracking@basic:
- {fi-icl-u3}: PASS -> FAIL [fdo#103167]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: INCOMPLETE [fdo#107718] -> PASS

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

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718

Participating hosts (47 -> 42)
------------------------------

Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y

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

* IGT: IGT_4743 -> IGTPW_2130

CI_DRM_5278: 9055053e0f1a599ddfde1ff9699cdb35bcc1dd2f @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2130: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2130/
IGT_4743: edb2db2cf2b6665d7ba3fa9117263302f6307a4f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

-igt@gem_create@stolen-invalid-flag
-igt@gem_pread@pagefault-pread
-igt@gem_pread@stolen-display
-igt@gem_pread@stolen-normal
-igt@gem_pread@stolen-snoop
-igt@gem_pread@stolen-uncached
-igt@gem_pwrite@stolen-display
-igt@gem_pwrite@stolen-normal
-igt@gem_pwrite@stolen-snoop
-igt@gem_pwrite@stolen-uncached
-igt@gem_stolen@large-object-alloc
-igt@gem_stolen@stolen-clear
-igt@gem_stolen@stolen-copy
-igt@gem_stolen@stolen-fill-purge
-igt@gem_stolen@stolen-hibernate
-igt@gem_stolen@stolen-no-mmap
-igt@gem_stolen@stolen-pread
-igt@gem_stolen@stolen-pwrite

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2130/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev