From: Matthew Auld <matthew.auld@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Ramalingam C <ramalingam.c@intel.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
intel-gfx <intel-gfx@lists.freedesktop.org>,
CQ Tang <cq.tang@intel.com>,
Hellstrom Thomas <thomas.hellstrom@intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [Intel-gfx] [PATCH 03/14] drm/i915/xehpsdv: enforce min GTT alignment
Date: Thu, 14 Oct 2021 15:21:13 +0100 [thread overview]
Message-ID: <ff05dba2-9626-4afe-93f2-eb0151fec363@intel.com> (raw)
In-Reply-To: <YWgxqGYS8Ps3JtqD@phenom.ffwll.local>
On 14/10/2021 14:33, Daniel Vetter wrote:
> On Wed, Oct 13, 2021 at 03:13:33PM +0100, Matthew Auld wrote:
>> On 13/10/2021 14:38, Daniel Vetter wrote:
>>> On Mon, Oct 11, 2021 at 09:41:44PM +0530, Ramalingam C wrote:
>>>> From: Matthew Auld <matthew.auld@intel.com>
>>>>
>>>> For local-memory objects we need to align the GTT addresses to 64K, both
>>>> for the ppgtt and ggtt.
>>>>
>>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>>> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
>>>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>>
>>> Do we still need this with relocations removed? Userspace is picking all
>>> the addresses for us, so all we have to check is whether userspace got it
>>> right.
>>
>> Yeah, for OFFSET_FIXED this just validates that the provided address is
>> correctly aligned to 64K, while for the in-kernel insertion stuff we still
>> need to allocate an address that is aligned to 64K. Setting the alignment
>> here handles both cases.
>
> Can't we just teach any in-kernel allocators to align to 2M and call it a
> day? Ofc the code can still validate we don't have bugs (always good to
> check your work). Ofc if the benefits is "no code can be removed anyway
> since we still need to check" then ofc no point :-)
Yeah, if we want to make it 2M, then we still need to add that here,
like with 64K.
>
> Just want to make sure we're not carrying complexity around for nothing,
> since this predates the relocation removal.
If we were to just make everything 2M then we can in theory ditch all
the colouring stuff. Assuming userspace is happy with 2M or nothing,
then it just means potentially terrible utilisation of the ppGTT for the
kernel, but maybe that doesn't matter much really? For userspace maybe
they will have some kind of sub-allocation scheme?
Well actually I guess it would be 2M alignment + 2M vma padding for
anything that can be placed in I915_MEMORY_CLASS_DEVICE, including mixed
objects. And then the usual 4K alignment for I915_MEMORY_CLASS_SYSTEM
only objects.
> -Daniel
>
>>
>>> -Daniel
>>>
>>>
>>>> ---
>>>> drivers/gpu/drm/i915/i915_vma.c | 9 +++++++--
>>>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
>>>> index 4b7fc4647e46..1ea1fa08efdf 100644
>>>> --- a/drivers/gpu/drm/i915/i915_vma.c
>>>> +++ b/drivers/gpu/drm/i915/i915_vma.c
>>>> @@ -670,8 +670,13 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
>>>> }
>>>> color = 0;
>>>> - if (vma->obj && i915_vm_has_cache_coloring(vma->vm))
>>>> - color = vma->obj->cache_level;
>>>> + if (vma->obj) {
>>>> + if (HAS_64K_PAGES(vma->vm->i915) && i915_gem_object_is_lmem(vma->obj))
>>>> + alignment = max(alignment, I915_GTT_PAGE_SIZE_64K);
>>>> +
>>>> + if (i915_vm_has_cache_coloring(vma->vm))
>>>> + color = vma->obj->cache_level;
>>>> + }
>>>> if (flags & PIN_OFFSET_FIXED) {
>>>> u64 offset = flags & PIN_OFFSET_MASK;
>>>> --
>>>> 2.20.1
>>>>
>>>
>
next prev parent reply other threads:[~2021-10-14 14:21 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 16:11 [Intel-gfx] [PATCH 00/14] drm/i915/dg2: Enabling 64k page size and flat ccs Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 01/14] drm/i915: Add has_64k_pages flag Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 02/14] drm/i915/xehpsdv: set min page-size to 64K Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 03/14] drm/i915/xehpsdv: enforce min GTT alignment Ramalingam C
2021-10-13 13:38 ` Daniel Vetter
2021-10-13 14:13 ` Matthew Auld
2021-10-14 13:33 ` Daniel Vetter
2021-10-14 14:21 ` Matthew Auld [this message]
2021-10-11 16:11 ` [Intel-gfx] [PATCH 04/14] drm/i915: enforce min page size for scratch Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 05/14] drm/i915/gtt/xehpsdv: move scratch page to system memory Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 06/14] drm/i915/xehpsdv: support 64K GTT pages Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 07/14] drm/i915: Add vm min alignment support Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 08/14] drm/i915/selftests: account for min_alignment in GTT selftests Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 09/14] drm/i915/xehpsdv: implement memory coloring Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 10/14] drm/i915/xehpsdv: Add has_flat_ccs to device info Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 11/14] drm/i915/lmem: Enable lmem for platforms with Flat CCS Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 12/14] drm/i915/gt: Clear compress metadata for Gen12.5 >= platforms Ramalingam C
2021-10-11 16:11 ` [Intel-gfx] [PATCH 13/14] drm/i915/uapi: document behaviour for DG2 64K support Ramalingam C
2021-10-13 13:46 ` Daniel Vetter
2021-10-11 16:11 ` [Intel-gfx] [PATCH 14/14] Doc/gpu/rfc/i915: i915 DG2 uAPI Ramalingam C
2021-10-11 17:08 ` Tang, CQ
2021-10-12 5:23 ` Lucas De Marchi
2021-10-13 13:50 ` Daniel Vetter
2021-10-11 18:05 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dg2: Enabling 64k page size and flat ccs Patchwork
2021-10-11 18:06 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-10-11 18:34 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-10-13 13:51 ` [Intel-gfx] [PATCH 00/14] " Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff05dba2-9626-4afe-93f2-eb0151fec363@intel.com \
--to=matthew.auld@intel.com \
--cc=cq.tang@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=ramalingam.c@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=thomas.hellstrom@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox