diff mbox

drm/i915: Reject huge tiled objects

Message ID 1431085059.3551.0.camel@jlahtine-mobl1 (mailing list archive)
State New, archived
Headers show

Commit Message

Joonas Lahtinen May 8, 2015, 11:37 a.m. UTC
We do not yet support tiled objects bigger than the mappable
aperture size so reject them.

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Chris Wilson May 8, 2015, 11:46 a.m. UTC | #1
On Fri, May 08, 2015 at 02:37:39PM +0300, Joonas Lahtinen wrote:
> We do not yet support tiled objects bigger than the mappable
> aperture size so reject them.
> 
> Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

This still turns the EINVAL into a SIGBUS. There is only one client that
I know of that is prepared to handle SIGBUS here...
-Chris
Joonas Lahtinen May 8, 2015, 12:10 p.m. UTC | #2
On pe, 2015-05-08 at 12:46 +0100, Chris Wilson wrote:
> On Fri, May 08, 2015 at 02:37:39PM +0300, Joonas Lahtinen wrote:
> > We do not yet support tiled objects bigger than the mappable
> > aperture size so reject them.
> > 
> > Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> This still turns the EINVAL into a SIGBUS. There is only one client that
> I know of that is prepared to handle SIGBUS here...

Whatever BO passed the mmap early rejection and ended up failing due to
low aperture space, produced this same result previously (that would be
any object that was of size mappable_aperture_size - framebuffer_size).
So it should not be unseen in the clients?

I was very much disturbed by the error handling method when I first
discovered it while making the huge BO testcases (I-G-T doesn't handle
SIGBUS gracefully either, the process terminates), but didn't want to
change it either without knowing the bigger context.

Regards, Joonas

> -Chris
>
Shuang He May 8, 2015, 9:41 p.m. UTC | #3
Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6355
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  276/276              276/276
ILK                                  302/302              302/302
SNB                                  316/316              316/316
IVB                                  342/342              342/342
BYT                                  286/286              286/286
BDW                                  321/321              321/321
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
Note: You need to pay more attention to line start with '*'
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b45f93b..6b09eff 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1670,6 +1670,11 @@  int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 
 	/* Use a partial view if the object is bigger than the aperture. */
 	if (obj->base.size >= dev_priv->gtt.mappable_end) {
+		if (obj->tiling_mode != I915_TILING_NONE) {
+			ret = -ENOSPC;
+			goto unlock;
+		}
+
 		static const unsigned int chunk_size = 256; // 1 MiB
 		memset(&view, 0, sizeof(view));
 		view.type = I915_GGTT_VIEW_PARTIAL;