Patchwork [Quantal,SRU,1/1] drm/i915: EBUSY status handling added to i915_gem_fault().

login
register
mail settings
Submitter Leann Ogasawara
Date Dec. 6, 2012, 6:21 p.m.
Message ID <cede42806327d133adff6543c8b63922216c8add.1354816398.git.leann.ogasawara@canonical.com>
Download mbox | patch
Permalink /patch/204298/
State New
Headers show

Comments

Leann Ogasawara - Dec. 6, 2012, 6:21 p.m.
From: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>

BugLink: http://bugs.launchpad.net/bugs/1087302

Subsequent threads returning EBUSY from vm_insert_pfn() was not handled
correctly. As a result concurrent access from new threads to
mmapped data caused SIGBUS.

Note that this fixes i-g-t/tests/gem_threaded_tiled_access.

Tested-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit e79e0fe380847493266fba557217e2773c61bd1b)

Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem.c |    5 +++++
 1 file changed, 5 insertions(+)
Brad Figg - Dec. 6, 2012, 6:29 p.m.
On 12/06/2012 10:21 AM, leann.ogasawara@canonical.com wrote:
> From: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1087302
> 
> Subsequent threads returning EBUSY from vm_insert_pfn() was not handled
> correctly. As a result concurrent access from new threads to
> mmapped data caused SIGBUS.
> 
> Note that this fixes i-g-t/tests/gem_threaded_tiled_access.
> 
> Tested-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> (cherry picked from commit e79e0fe380847493266fba557217e2773c61bd1b)
> 
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index e4d0187..4406603 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1144,6 +1144,11 @@ out:
>  	case 0:
>  	case -ERESTARTSYS:
>  	case -EINTR:
> +	case -EBUSY:
> +		/*
> +		 * EBUSY is ok: this just means that another thread
> +		 * already did the job.
> +		 */
>  		return VM_FAULT_NOPAGE;
>  	case -ENOMEM:
>  		return VM_FAULT_OOM;
>

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e4d0187..4406603 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1144,6 +1144,11 @@  out:
 	case 0:
 	case -ERESTARTSYS:
 	case -EINTR:
+	case -EBUSY:
+		/*
+		 * EBUSY is ok: this just means that another thread
+		 * already did the job.
+		 */
 		return VM_FAULT_NOPAGE;
 	case -ENOMEM:
 		return VM_FAULT_OOM;