From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 1/5] drm/i915: Round up object allocations Date: Sun, 26 Jan 2014 11:01:50 +0100 Message-ID: <20140126100150.GQ9772@phenom.ffwll.local> References: <1390533674-18402-1-git-send-email-benjamin.widawsky@intel.com> <1390533674-18402-2-git-send-email-benjamin.widawsky@intel.com> <20140125202824.GM9772@phenom.ffwll.local> <20140126054957.GA1926@bwidawsk.net> <20140126095708.GB23557@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ea0-f170.google.com (mail-ea0-f170.google.com [209.85.215.170]) by gabe.freedesktop.org (Postfix) with ESMTP id 39692FA432 for ; Sun, 26 Jan 2014 02:01:55 -0800 (PST) Received: by mail-ea0-f170.google.com with SMTP id k10so1769640eaj.1 for ; Sun, 26 Jan 2014 02:01:54 -0800 (PST) Content-Disposition: inline In-Reply-To: <20140126095708.GB23557@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson , Daniel Vetter , Ben Widawsky , Intel GFX , Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org On Sun, Jan 26, 2014 at 09:57:08AM +0000, Chris Wilson wrote: > On Sun, Jan 26, 2014 at 10:17:57AM +0100, Daniel Vetter wrote: > > On Sun, Jan 26, 2014 at 6:49 AM, Ben Widawsky wrote: > > > On Sat, Jan 25, 2014 at 09:28:24PM +0100, Daniel Vetter wrote: > > >> On Thu, Jan 23, 2014 at 07:21:10PM -0800, Ben Widawsky wrote: > > >> > DRM gets very mad when you request an object which occupies a partial > > >> > page. As a DRM driver, i915 never really wants to anger DRM, and would > > >> > always just want the rounding done for us. > > >> > > > >> > Signed-off-by: Ben Widawsky > > >> > --- > > >> > drivers/gpu/drm/i915/i915_gem.c | 2 ++ > > >> > 1 file changed, 2 insertions(+) > > >> > > > >> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > > >> > index 024e454..8cd1134 100644 > > >> > --- a/drivers/gpu/drm/i915/i915_gem.c > > >> > +++ b/drivers/gpu/drm/i915/i915_gem.c > > >> > @@ -4168,6 +4168,8 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev, > > >> > struct address_space *mapping; > > >> > gfp_t mask; > > >> > > > >> > + size = round_up(size, PAGE_SIZE); > > >> > + > > >> > > >> Nope, if there's some code that doesn't do page-aligend bo allocations it > > >> needs to be fixed there. If you want throw a WARN_ON and early return in > > >> here. > > >> -Daniel > > > > > > Why? > > > > Because allocating a non-page aligned gem bo is a bug. All current > > in-kernel allocations are already aligned. I've thought that we also > > reject unaligned request from userspace but apparently we help out > > since forever (i.e. gem was merged). Might be worth a shot to turn > > that into an -EINVAL if libdrm does the right rounding ... > > We already have an -EINVAL guard on our create ioctl(s). Only for size == 0, not for non-aligned size, at least afaics (no coffee yet ...). -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch