drm/i915: Fix EIO/wedged handling in gem fault handler

In

commit 1f83fee08d
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Nov 15 17:17:22 2012 +0100

    drm/i915: clear up wedged transitions

I've accidentally inverted the EIO/wedged handling in the fault
handler: We want to return the EIO as a SIGBUS only if it's not
because of the gpu having died, to prevent userspace from unduly
dying.

In my defence the comment right above is completely misleading, so fix
both.

v2: Drop the WARN_ON, it's not actually a bug to e.g. receive an -EIO
when swap-in fails.

v3: Don't remove too much ... oops.

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Daniel Vetter 2014-09-04 09:36:18 +02:00 committed by Jani Nikula
parent ad46cb533d
commit 2232f0315c
1 changed files with 7 additions and 4 deletions

View File

@ -1590,10 +1590,13 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
out: out:
switch (ret) { switch (ret) {
case -EIO: case -EIO:
/* If this -EIO is due to a gpu hang, give the reset code a /*
* chance to clean up the mess. Otherwise return the proper * We eat errors when the gpu is terminally wedged to avoid
* SIGBUS. */ * userspace unduly crashing (gl has no provisions for mmaps to
if (i915_terminally_wedged(&dev_priv->gpu_error)) { * fail). But any other -EIO isn't ours (e.g. swap in failure)
* and so needs to be reported.
*/
if (!i915_terminally_wedged(&dev_priv->gpu_error)) {
ret = VM_FAULT_SIGBUS; ret = VM_FAULT_SIGBUS;
break; break;
} }