dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.
Date: Tue, 18 May 2021 20:11:38 +0200	[thread overview]
Message-ID: <bfa959dc-7a75-ff96-98f6-d6d27dfed846@amd.com> (raw)
In-Reply-To: <c0e9957b-1da7-e195-e65c-ee4ad22ca10a@linux.intel.com>

Am 18.05.21 um 19:32 schrieb Thomas Hellström:
> [SNIP]
>>>> PTE handling is the domain of TTM, drivers should never mess with 
>>>> that directly.
>>>
>>> Hmm. May I humbly suggest a different view on this:
>>>
>>> I agree fully for ttm_bo_type_device bos but for ttm_bo_type_kernel, 
>>> TTM has no business whatsoever with user-space PTEs. That's really 
>>> why that bo type exists in the first place. But otoh one can of 
>>> course argue that then i915 has no business calling the TTM fault 
>>> helper for these bos.
>>
>> Well the real question is why does i915 wants to expose kernel BOs to 
>> userspace? As the name says only the kernel should be able to access 
>> them.
>
> I'd say "kernel" of course refers to how TTM handles them.

Fair enough.

>>
>>>
>>> So for discrete we can probably do the right thing with 
>>> ttm_bo_type_device. What worries me a bit is when we get to older 
>>> hardware support because whatever we do is by definition going to be 
>>> ugly. At best we might be able to split the address space between 
>>> i915's mmos, and hand the rest to TTM, modifying offsets as you 
>>> suggest. That way a TTM call to unmap_mapping_range() would do the 
>>> right thing, I think.
>>
>> Well we do all kind of nasty stuff with the offset in DMA-buf, KFD, 
>> overlayfs etc. So adjusting the offset inside the kernel is already 
>> well supported and used.
>>
>> What I don't fully understand is your use case here? Can you briefly 
>> describe that?
>>
>> Do you use different bits of the offset to signal what caching 
>> behavior you have? And then based on this adjust the pgprot_t in the 
>> vma?
>>
>> Thanks,
>> Christian.
>
> TBH I'm not completely sure about the history of this. I think the 
> basic idea is that you want to support different vmas with different 
> caching modes, so you never change the vma pgprot after mmap time, 
> like TTM does. Needless to say this only works with Intel processors 
> on integrated and the more I write about this the more I'm convinced 
> that we should perhaps not concern TTM with that at all.

Yeah, that might be a possibility.

But KFD does something very similar IIRC. They stuff the routing 
information into the upper bits of the offset and adjust it then to 
match what TTM wants in the mmap() callback.

Adjusting the caching behavior on the fly is really tricky and I'm 
pretty sure you should not do that outside of the integrated Intel 
processor anyway :)

Cheers,
Christian.

>
> /Thomas
>
>
>>
>>>
>>> /Thomas
>>>
>>>>
>>>> Christian.
>>>>
>>>>>
>>>>> While we're in the process of killing that offset flexibility for 
>>>>> discrete, we can't do so for older hardware unfortunately.
>>>>>
>>>>> /Thomas
>>>>>
>>>>>
>>>>>>
>>>>>> Christian.
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>>
>>>>>>> /Thomas
>>>>>>>
>>>>>>
>>>>
>>


  reply	other threads:[~2021-05-18 18:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210518145543.1042429-1-thomas.hellstrom@linux.intel.com>
2021-05-18 15:07 ` [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers Christian König
2021-05-18 15:11   ` Thomas Hellström
2021-05-18 15:17     ` Christian König
2021-05-18 15:25       ` Thomas Hellström
2021-05-18 15:29         ` Christian König
2021-05-18 17:10           ` Thomas Hellström
2021-05-18 17:17             ` Christian König
2021-05-18 17:32               ` Thomas Hellström
2021-05-18 18:11                 ` Christian König [this message]
2021-05-18 16:49   ` Maarten Lankhorst
2021-05-18 17:06     ` Christian König
2021-05-18  8:26 [PATCH v2 00/15] drm/i915: Move LMEM (VRAM) management over to TTM Thomas Hellström
2021-05-18  8:26 ` [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers Thomas Hellström

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=bfa959dc-7a75-ff96-98f6-d6d27dfed846@amd.com \
    --to=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.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