From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id BB4296EC21 for ; Thu, 14 Oct 2021 07:41:44 +0000 (UTC) Date: Thu, 14 Oct 2021 00:22:28 -0700 Message-ID: <87y26wgjez.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20211014071446.GA3617@zkempczy-mobl2> References: <20211008065432.15482-1-zbigniew.kempczynski@intel.com> <20211008065432.15482-2-zbigniew.kempczynski@intel.com> <87k0ihpm3t.wl-ashutosh.dixit@intel.com> <20211013052745.GA3586@zkempczy-mobl2> <87bl3sibor.wl-ashutosh.dixit@intel.com> <20211014071446.GA3617@zkempczy-mobl2> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable Subject: Re: [igt-dev] [PATCH i-g-t 1/7] lib/gem_submission: Add kernel exec object alignment capability List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Zbigniew =?ISO-8859-2?Q?Kempczy=F1ski?= Cc: igt-dev@lists.freedesktop.org List-ID: On Thu, 14 Oct 2021 00:14:46 -0700, Zbigniew Kempczy=F1ski wrote: > > On Wed, Oct 13, 2021 at 07:26:28PM -0700, Dixit, Ashutosh wrote: > > On Tue, 12 Oct 2021 22:27:45 -0700, Zbigniew Kempczy=F1ski wrote: > > > > > > On Tue, Oct 12, 2021 at 09:47:18PM -0700, Dixit, Ashutosh wrote: > > > > On Thu, 07 Oct 2021 23:54:26 -0700, Zbigniew Kempczy=F1ski wrote: > > > > > > > > > > +bool gem_allows_passing_alignment(int fd) > > > > > +{ > > > > > + struct drm_i915_gem_exec_object2 obj =3D { > > > > > + .handle =3D gem_create(fd, 4096), > > > > > + }; > > > > > + struct drm_i915_gem_execbuffer2 execbuf =3D { > > > > > + .buffers_ptr =3D to_user_pointer(&obj), > > > > > + .buffer_count =3D 1, > > > > > + }; > > > > > + bool ret; > > > > > + const uint32_t bbe =3D MI_BATCH_BUFFER_END; > > > > > + > > > > > + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe)); > > > > > + gem_execbuf(fd, &execbuf); > > > > > + > > > > > + obj.alignment =3D 0x2000; > > > > > > > > 8K? Shouldn't this be less than 4K? > > > > > > I'm not sure how kernel check will look like so positive value larger > > > than 4K is sane for me. For example if in the kernel we will have: > > > > > > if (entry->alignment !=3D 0 && entry->alignment !=3D 0x1000) > > > return -EINVAL; > > > > Sorry I am still not following why the alignment has to be > 4K. Since = for > > alignment we generally consider aligned to a 4K page, so an alignment v= alue > > which is multiple of 4K might not even be a correct test. I would just = use > > an alignment value of 64 here (kernel requires it to be a power of > > 2). Wouldn't that work? Thanks. > > Agree, on input any value which is power of two is correct. I just choosen > 8K because it is a) page aligned b) power of two so definitely this value > can be used within kernel. > > alignment =3D 64 is a little bit tricky - it is correct but will be chang= ed > to minimum alignment before pinning so I would like to avoid such values. > I've spent some time to go over the pinning path according what has happen > with that 64 and I was surprised it is not used at all anywhere. > > Resume: any value which is power of two is correct here, I just took 8K. Yes I saw gem_exec_alignment later and it is using similar alignment values. So I need to look some more to understand what this alignment is. So please change the name to either gem_allows_obj_alignment or gem_has_obj_alignment whichever you prefer. No need to resend the series, please go ahead and merge the R-b patches. This one is also: Reviewed-by: Ashutosh Dixit