Skip to contentSkip to conversation

gem_pin: Be explicit about GGTT needs

PATCH In review Ben Widawsky 4 participants 9 messages Nov 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gem_pin: Be explicit about GGTT needs

This test assumes that using gem_pin will pin in the same address space used by execbuf. Since pin is for the global GTT only, use the existing flag to notify i915.ko that the exec object is special.

---
 tests/gem_pin.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/gem_pin.c +3 -1
index 273315f..ca48a04 100644
@@ -45,6 +45,8 @@
 #define BLT_WRITE_ALPHA         (1<<21)
 #define BLT_WRITE_RGB           (1<<20)
 
+#define LOCAL__EXEC_OBJ_NEEDS_GTT (1<<1)
+
 static void exec(int fd, uint32_t handle, uint32_t offset)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
 	gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
 	gem_exec[0].alignment = 0;
 	gem_exec[0].offset = 0;
-	gem_exec[0].flags = 0;
+	gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;
 	gem_exec[0].rsvd1 = 0;
 	gem_exec[0].rsvd2 = 0;
 
Signature · 1 line
1.8.4.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Ben Widawsky

This test assumes that using gem_pin will pin in the same address space used by execbuf. Since pin is for the global GTT only, use the existing flag to notify i915.ko that the exec object is special.

Interesting. Yes, I think you are right, the flag is required for the test to be correct with full-ppgtt.

Quoted 2 lines

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
In reply to Ben Widawsky
Quoted 24 lines · Ben Widawsky

This test assumes that using gem_pin will pin in the same address space used by execbuf. Since pin is for the global GTT only, use the existing flag to notify i915.ko that the exec object is special.

---
 tests/gem_pin.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/gem_pin.c +2 -0
index 273315f..ca48a04 100644
@@ -45,6 +45,8 @@
 #define BLT_WRITE_ALPHA         (1<<21)
 #define BLT_WRITE_RGB           (1<<20)
 
+#define LOCAL__EXEC_OBJ_NEEDS_GTT (1<<1)
+
 static void exec(int fd, uint32_t handle, uint32_t offset)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;

tests/gem_pin.c static void exec(int fd, uint32_t handle, uint32_t offset) · line 68

Quoted 5 lines
tests/gem_pin.c +1 -1
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
 	gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
 	gem_exec[0].alignment = 0;
 	gem_exec[0].offset = 0;
-	gem_exec[0].flags = 0;
+	gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;

This only really works with the aliasing ppgtt stuff on gen6, I'd just skip the test -it's not really useful with real ppgtt. -Daniel

Quoted 10 lines
tests/gem_pin.c +0 -0
 	gem_exec[0].rsvd1 = 0;
 	gem_exec[0].rsvd2 = 0;
 
Signature · 6 lines
1.8.4.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#3 lore raw
Quoted 19 lines · Daniel Vetter
Quoted 18 lines · Ben Widawsky

This test assumes that using gem_pin will pin in the same address space used by execbuf. Since pin is for the global GTT only, use the existing flag to notify i915.ko that the exec object is special.

---
 tests/gem_pin.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/gem_pin.c +0 -0
index 273315f..ca48a04 100644
@@ -45,6 +45,8 @@
 #define BLT_WRITE_ALPHA         (1<<21)
 #define BLT_WRITE_RGB           (1<<20)
 
Quoted 15 lines

tests/gem_pin.c static void exec(int fd, uint32_t handle, uint32_t offset) · line 68

Quoted 11 lines
tests/gem_pin.c +3 -1
+#define LOCAL__EXEC_OBJ_NEEDS_GTT (1<<1)
+
 static void exec(int fd, uint32_t handle, uint32_t offset)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
 	gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
 	gem_exec[0].alignment = 0;
 	gem_exec[0].offset = 0;
-	gem_exec[0].flags = 0;
+	gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;

This only really works with the aliasing ppgtt stuff on gen6, I'd just skip the test -it's not really useful with real ppgtt. -Daniel

It is really useful with real ppgtt. Please rethink your assertion.

Quoted 16 lines
Quoted 11 lines
tests/gem_pin.c +0 -0
 	gem_exec[0].rsvd1 = 0;
 	gem_exec[0].rsvd2 = 0;
 
Signature · 6 lines
1.8.4.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#4 lore raw
Quoted 11 lines · Ben Widawsky
Quoted 10 lines

tests/gem_pin.c static void exec(int fd, uint32_t handle, uint32_t offset) · line 68

Quoted 6 lines
tests/gem_pin.c +1 -1
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
    gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
    gem_exec[0].alignment = 0;
    gem_exec[0].offset = 0;
-   gem_exec[0].flags = 0;
+   gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;

This only really works with the aliasing ppgtt stuff on gen6, I'd just skip the test -it's not really useful with real ppgtt. -Daniel

Quoted 1 line

It is really useful with real ppgtt. Please rethink your assertion.

The test links up the global gtt used by the current pin ioctl with the ppgtt. That's not useful, except when they alias. If we want soft-pinning, then we need a new ioctl mode to return the right address from the right address space. Which means a new (sub)test. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Ben Widawsky
Quoted 10 lines

tests/gem_pin.c static void exec(int fd, uint32_t handle, uint32_t offset) · line 68

Quoted 6 lines
tests/gem_pin.c +1 -1
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
    gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
    gem_exec[0].alignment = 0;
    gem_exec[0].offset = 0;
-   gem_exec[0].flags = 0;
+   gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;

This only really works with the aliasing ppgtt stuff on gen6, I'd just skip the test -it's not really useful with real ppgtt. -Daniel

Quoted 7 lines
Quoted 1 line

It is really useful with real ppgtt. Please rethink your assertion.

The test links up the global gtt used by the current pin ioctl with the ppgtt. That's not useful, except when they alias. If we want soft-pinning, then we need a new ioctl mode to return the right address from the right address space. Which means a new (sub)test. -Daniel

This is only indirectly related to soft pinning. No context will ever have the global GTT address space. If you want to support the pin IOCTL, (which Chris has before said he requires - the original patch series disabled it) you must do this. We already have a flag that does what we want, and, demonstrably, a test which exercises it.

I do not think a new ioctl, nor a new subtest is the solution for this.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#6 lore raw
Quoted 21 lines · Ben Widawsky
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Ben Widawsky
Quoted 10 lines

tests/gem_pin.c static void exec(int fd, uint32_t handle, uint32_t offset) · line 68

Quoted 6 lines
tests/gem_pin.c +1 -1
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
    gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
    gem_exec[0].alignment = 0;
    gem_exec[0].offset = 0;
-   gem_exec[0].flags = 0;
+   gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;

This only really works with the aliasing ppgtt stuff on gen6, I'd just skip the test -it's not really useful with real ppgtt. -Daniel

Quoted 7 lines
Quoted 1 line

It is really useful with real ppgtt. Please rethink your assertion.

The test links up the global gtt used by the current pin ioctl with the ppgtt. That's not useful, except when they alias. If we want soft-pinning, then we need a new ioctl mode to return the right address from the right address space. Which means a new (sub)test. -Daniel

Quoted 7 lines

This is only indirectly related to soft pinning. No context will ever have the global GTT address space. If you want to support the pin IOCTL, (which Chris has before said he requires - the original patch series disabled it) you must do this. We already have a flag that does what we want, and, demonstrably, a test which exercises it.

I do not think a new ioctl, nor a new subtest is the solution for this.

Ok, I'll wait until I see the code that implements this on top of ppgtt. But until we have that I don't think we need to change the test at all.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw
Quoted 28 lines · Daniel Vetter
Quoted 27 lines · Ben Widawsky
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Ben Widawsky
Quoted 10 lines

tests/gem_pin.c static void exec(int fd, uint32_t handle, uint32_t offset) · line 68

Quoted 6 lines
tests/gem_pin.c +1 -1
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
    gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
    gem_exec[0].alignment = 0;
    gem_exec[0].offset = 0;
-   gem_exec[0].flags = 0;
+   gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;

This only really works with the aliasing ppgtt stuff on gen6, I'd just skip the test -it's not really useful with real ppgtt. -Daniel

Quoted 7 lines
Quoted 1 line

It is really useful with real ppgtt. Please rethink your assertion.

The test links up the global gtt used by the current pin ioctl with the ppgtt. That's not useful, except when they alias. If we want soft-pinning, then we need a new ioctl mode to return the right address from the right address space. Which means a new (sub)test. -Daniel

This is only indirectly related to soft pinning. No context will ever have the global GTT address space. If you want to support the pin IOCTL, (which Chris has before said he requires - the original patch series disabled it) you must do this. We already have a flag that does what we want, and, demonstrably, a test which exercises it.

Quoted 6 lines
Quoted 1 line

I do not think a new ioctl, nor a new subtest is the solution for this.

Ok, I'll wait until I see the code that implements this on top of ppgtt. But until we have that I don't think we need to change the test at all.
-Daniel

This is a question for Chris. If DDX only depends on the behavior with aliasing PPGTT, then I agree - no test change needed.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#8 lore raw
Quoted 31 lines · Ben Widawsky
Quoted 30 lines · Daniel Vetter
Quoted 28 lines · Ben Widawsky
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Ben Widawsky
Quoted 10 lines

Review static void exec(int fd, uint32_t handle, uint32_t offset) · line 68

Quoted 6 lines
(quoted diff) +1 -1
@@ -63,7 +65,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset)
    gem_exec[0].relocs_ptr = (uintptr_t) gem_reloc;
    gem_exec[0].alignment = 0;
    gem_exec[0].offset = 0;
-   gem_exec[0].flags = 0;
+   gem_exec[0].flags = LOCAL__EXEC_OBJ_NEEDS_GTT;

This only really works with the aliasing ppgtt stuff on gen6, I'd just skip the test -it's not really useful with real ppgtt. -Daniel

Quoted 7 lines
Quoted 1 line

It is really useful with real ppgtt. Please rethink your assertion.

The test links up the global gtt used by the current pin ioctl with the ppgtt. That's not useful, except when they alias. If we want soft-pinning, then we need a new ioctl mode to return the right address from the right address space. Which means a new (sub)test. -Daniel

This is only indirectly related to soft pinning. No context will ever have the global GTT address space. If you want to support the pin IOCTL, (which Chris has before said he requires - the original patch series disabled it) you must do this. We already have a flag that does what we want, and, demonstrably, a test which exercises it.

I do not think a new ioctl, nor a new subtest is the solution for this.

Quoted 7 lines
Quoted 4 lines

Ok, I'll wait until I see the code that implements this on top of ppgtt. But until we have that I don't think we need to change the test at all.
-Daniel

This is a question for Chris. If DDX only depends on the behavior with aliasing PPGTT, then I agree - no test change needed.

Where pin has come in handy has been to w/a hw bugs, so predicting when and why we might need it again is difficult. As such I'd rather we maintained its existing semantics of pinning an object in the ggtt into the full-ppgtt future. As such it is should be trivial to implement the ioctl with very little impact.
-chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre