All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] drm/i915: Handle E2BIG error in i915_gem_fault
@ 2015-09-09 10:29 Michel Thierry
  2015-09-09 10:33 ` Chris Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Thierry @ 2015-09-09 10:29 UTC (permalink / raw)
  To: intel-gfx

i915_gem_object_bind_to_vm returns -E2BIG when the user tries to bind an
object larger than the aperture, but i915_gem_fault does not handle this
return code:

[501906.530985] gem_mmap_gtt: starting subtest big-bo-tiledX
[501906.541992] gem_mmap_gtt (22362): drop_caches: 3
[501906.610774] WARNING: CPU: 2 PID: 22362 at
drivers/gpu/drm/i915/i915_gem.c:1880 i915_gem_fault+0x24f/0x470 [i915]()
[501906.623568] unhandled error in i915_gem_fault: -7
[501906.825115] Call Trace:
[501906.830322]  [<ffffffff8178ffcc>] dump_stack+0x45/0x57
[501906.838589]  [<ffffffff810759aa>] warn_slowpath_common+0x8a/0xc0
[501906.847846]  [<ffffffff81075a26>] warn_slowpath_fmt+0x46/0x50
[501906.856776]  [<ffffffffc079591f>] i915_gem_fault+0x24f/0x470 [i915]
[501906.866276]  [<ffffffff8119e11d>] __do_fault+0x3d/0xa0
[501906.874464]  [<ffffffff81068cc0>] ? pte_alloc_one+0x30/0x50
[501906.883169]  [<ffffffff811a26a7>] handle_mm_fault+0xe27/0x1810
[501906.892202]  [<ffffffff81306e8a>] ? security_mmap_file+0xca/0xe0
[501906.900389]  [<ffffffff811fb6ad>] ? do_vfs_ioctl+0x2cd/0x4b0
[501906.908143]  [<ffffffff81063ada>] __do_page_fault+0x19a/0x430
[501906.916024]  [<ffffffff81063d92>] do_page_fault+0x22/0x30
[501906.923532]  [<ffffffff81799248>] page_fault+0x28/0x30

RFC about the error code that should be returned by i915_gem_fault.

Testcase: igt/gem_mmap_gtt/big-bo-tiledXY
Reported-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Michel Thierry <michel.thierry@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 352ccd5..3e00f72 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1869,6 +1869,7 @@ out:
 		 */
 		ret = VM_FAULT_NOPAGE;
 		break;
+	case -E2BIG:
 	case -ENOMEM:
 		ret = VM_FAULT_OOM;
 		break;
-- 
2.5.1

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

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

* Re: [RFC] drm/i915: Handle E2BIG error in i915_gem_fault
  2015-09-09 10:29 [RFC] drm/i915: Handle E2BIG error in i915_gem_fault Michel Thierry
@ 2015-09-09 10:33 ` Chris Wilson
  2015-09-09 16:53   ` Michel Thierry
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2015-09-09 10:33 UTC (permalink / raw)
  To: Michel Thierry; +Cc: intel-gfx

On Wed, Sep 09, 2015 at 11:29:52AM +0100, Michel Thierry wrote:
> i915_gem_object_bind_to_vm returns -E2BIG when the user tries to bind an
> object larger than the aperture, but i915_gem_fault does not handle this
> return code:
> 
> [501906.530985] gem_mmap_gtt: starting subtest big-bo-tiledX
> [501906.541992] gem_mmap_gtt (22362): drop_caches: 3
> [501906.610774] WARNING: CPU: 2 PID: 22362 at
> drivers/gpu/drm/i915/i915_gem.c:1880 i915_gem_fault+0x24f/0x470 [i915]()
> [501906.623568] unhandled error in i915_gem_fault: -7
> [501906.825115] Call Trace:
> [501906.830322]  [<ffffffff8178ffcc>] dump_stack+0x45/0x57
> [501906.838589]  [<ffffffff810759aa>] warn_slowpath_common+0x8a/0xc0
> [501906.847846]  [<ffffffff81075a26>] warn_slowpath_fmt+0x46/0x50
> [501906.856776]  [<ffffffffc079591f>] i915_gem_fault+0x24f/0x470 [i915]
> [501906.866276]  [<ffffffff8119e11d>] __do_fault+0x3d/0xa0
> [501906.874464]  [<ffffffff81068cc0>] ? pte_alloc_one+0x30/0x50
> [501906.883169]  [<ffffffff811a26a7>] handle_mm_fault+0xe27/0x1810
> [501906.892202]  [<ffffffff81306e8a>] ? security_mmap_file+0xca/0xe0
> [501906.900389]  [<ffffffff811fb6ad>] ? do_vfs_ioctl+0x2cd/0x4b0
> [501906.908143]  [<ffffffff81063ada>] __do_page_fault+0x19a/0x430
> [501906.916024]  [<ffffffff81063d92>] do_page_fault+0x22/0x30
> [501906.923532]  [<ffffffff81799248>] page_fault+0x28/0x30
> 
> RFC about the error code that should be returned by i915_gem_fault.

There are two fixes here, change E2BIG to ENOSPC. The differentiate is
painful to all consumers (and missing in userspace).

The second is that gem_fault was supposed to be fixed to handle it and
sigbus is the legimate error for that case (not enomem/sigsegv).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [RFC] drm/i915: Handle E2BIG error in i915_gem_fault
  2015-09-09 10:33 ` Chris Wilson
@ 2015-09-09 16:53   ` Michel Thierry
  2015-09-09 17:44     ` Chris Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Thierry @ 2015-09-09 16:53 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On 9/9/2015 11:33 AM, Chris Wilson wrote:
> On Wed, Sep 09, 2015 at 11:29:52AM +0100, Michel Thierry wrote:
>> i915_gem_object_bind_to_vm returns -E2BIG when the user tries to bind an
>> object larger than the aperture, but i915_gem_fault does not handle this
>> return code:
>>
>> [501906.530985] gem_mmap_gtt: starting subtest big-bo-tiledX
>> [501906.541992] gem_mmap_gtt (22362): drop_caches: 3
>> [501906.610774] WARNING: CPU: 2 PID: 22362 at
>> drivers/gpu/drm/i915/i915_gem.c:1880 i915_gem_fault+0x24f/0x470 [i915]()
>> [501906.623568] unhandled error in i915_gem_fault: -7
>> [501906.825115] Call Trace:
>> [501906.830322]  [<ffffffff8178ffcc>] dump_stack+0x45/0x57
>> [501906.838589]  [<ffffffff810759aa>] warn_slowpath_common+0x8a/0xc0
>> [501906.847846]  [<ffffffff81075a26>] warn_slowpath_fmt+0x46/0x50
>> [501906.856776]  [<ffffffffc079591f>] i915_gem_fault+0x24f/0x470 [i915]
>> [501906.866276]  [<ffffffff8119e11d>] __do_fault+0x3d/0xa0
>> [501906.874464]  [<ffffffff81068cc0>] ? pte_alloc_one+0x30/0x50
>> [501906.883169]  [<ffffffff811a26a7>] handle_mm_fault+0xe27/0x1810
>> [501906.892202]  [<ffffffff81306e8a>] ? security_mmap_file+0xca/0xe0
>> [501906.900389]  [<ffffffff811fb6ad>] ? do_vfs_ioctl+0x2cd/0x4b0
>> [501906.908143]  [<ffffffff81063ada>] __do_page_fault+0x19a/0x430
>> [501906.916024]  [<ffffffff81063d92>] do_page_fault+0x22/0x30
>> [501906.923532]  [<ffffffff81799248>] page_fault+0x28/0x30
>>
>> RFC about the error code that should be returned by i915_gem_fault.
>
> There are two fixes here, change E2BIG to ENOSPC. The differentiate is
> painful to all consumers (and missing in userspace).

I'll change the return code in gem_object_bind_to_vm instead.

>
> The second is that gem_fault was supposed to be fixed to handle it and
> sigbus is the legimate error for that case (not enomem/sigsegv).

These subtests use objs tiling x/y, so the driver won't use partial views.

Should it be better if i915_gem_mmap_gtt checks for this (obj size 
bigger than apperture and some tiling mode), and return an error at that 
point? Instead of waiting for the sigbus error in gem_fault.

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

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

* Re: [RFC] drm/i915: Handle E2BIG error in i915_gem_fault
  2015-09-09 16:53   ` Michel Thierry
@ 2015-09-09 17:44     ` Chris Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2015-09-09 17:44 UTC (permalink / raw)
  To: Michel Thierry; +Cc: intel-gfx

On Wed, Sep 09, 2015 at 05:53:57PM +0100, Michel Thierry wrote:
> On 9/9/2015 11:33 AM, Chris Wilson wrote:
> >On Wed, Sep 09, 2015 at 11:29:52AM +0100, Michel Thierry wrote:
> >>i915_gem_object_bind_to_vm returns -E2BIG when the user tries to bind an
> >>object larger than the aperture, but i915_gem_fault does not handle this
> >>return code:
> >>
> >>[501906.530985] gem_mmap_gtt: starting subtest big-bo-tiledX
> >>[501906.541992] gem_mmap_gtt (22362): drop_caches: 3
> >>[501906.610774] WARNING: CPU: 2 PID: 22362 at
> >>drivers/gpu/drm/i915/i915_gem.c:1880 i915_gem_fault+0x24f/0x470 [i915]()
> >>[501906.623568] unhandled error in i915_gem_fault: -7
> >>[501906.825115] Call Trace:
> >>[501906.830322]  [<ffffffff8178ffcc>] dump_stack+0x45/0x57
> >>[501906.838589]  [<ffffffff810759aa>] warn_slowpath_common+0x8a/0xc0
> >>[501906.847846]  [<ffffffff81075a26>] warn_slowpath_fmt+0x46/0x50
> >>[501906.856776]  [<ffffffffc079591f>] i915_gem_fault+0x24f/0x470 [i915]
> >>[501906.866276]  [<ffffffff8119e11d>] __do_fault+0x3d/0xa0
> >>[501906.874464]  [<ffffffff81068cc0>] ? pte_alloc_one+0x30/0x50
> >>[501906.883169]  [<ffffffff811a26a7>] handle_mm_fault+0xe27/0x1810
> >>[501906.892202]  [<ffffffff81306e8a>] ? security_mmap_file+0xca/0xe0
> >>[501906.900389]  [<ffffffff811fb6ad>] ? do_vfs_ioctl+0x2cd/0x4b0
> >>[501906.908143]  [<ffffffff81063ada>] __do_page_fault+0x19a/0x430
> >>[501906.916024]  [<ffffffff81063d92>] do_page_fault+0x22/0x30
> >>[501906.923532]  [<ffffffff81799248>] page_fault+0x28/0x30
> >>
> >>RFC about the error code that should be returned by i915_gem_fault.
> >
> >There are two fixes here, change E2BIG to ENOSPC. The differentiate is
> >painful to all consumers (and missing in userspace).
> 
> I'll change the return code in gem_object_bind_to_vm instead.
> 
> >
> >The second is that gem_fault was supposed to be fixed to handle it and
> >sigbus is the legimate error for that case (not enomem/sigsegv).
> 
> These subtests use objs tiling x/y, so the driver won't use partial views.
> 
> Should it be better if i915_gem_mmap_gtt checks for this (obj size
> bigger than apperture and some tiling mode), and return an error at
> that point? Instead of waiting for the sigbus error in gem_fault.

No, the driver is meant to use a partial fenced view in this case. The
feature was merged very early and is still very, very incomplete.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2015-09-09 17:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-09 10:29 [RFC] drm/i915: Handle E2BIG error in i915_gem_fault Michel Thierry
2015-09-09 10:33 ` Chris Wilson
2015-09-09 16:53   ` Michel Thierry
2015-09-09 17:44     ` 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.