All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Nirmoy Das" <nirmoy.das@intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>
Cc: intel-xe@lists.freedesktop.org, "Zhang, Carl" <carl.zhang@intel.com>
Subject: Re: [Intel-xe] [RFC PATCH 0/2] Implement vma madvise ioctl
Date: Tue, 30 May 2023 17:18:24 +0200	[thread overview]
Message-ID: <dbab9407-a358-eccb-fc4e-641f7f815a5f@linux.intel.com> (raw)
In-Reply-To: <f8e86b42-0cbd-f2a2-23e5-01d3672e13e1@linux.intel.com>

On 5/30/2023 3:19 PM, Thomas Hellström wrote:

>
> On 5/24/23 22:12, Nirmoy Das wrote:
>>
>> On 5/24/2023 8:30 PM, Matthew Brost wrote:
>>> On Wed, May 24, 2023 at 02:36:46PM +0200, Nirmoy Das wrote:
>>>> Sending this initial RFC patch series for vma madvise ioctl
>>>> to gether feedback if this the correct way to do that.
>>>>
>>>> I am adding two expected options for userspace to pass
>>>>
>>>> DRM_XE_VMA_MADVISE_WILLNEED:
>>>>     * Set ttm priority to normal/high(if cap permits)
>>>>     * Make sure VMAs are in allowed placement and bound.
>>>>
>>>> DRM_XE_VMA_MADVISE_DONTNEED:
>>>>     * Set ttm priority to low so the BO belong to the vma
>>>>     become early target for eviction.
>>>>     * Make sure VMAs are not bound.
>>>>
>>>> Questions:
>>>> Should this be part of DRM_IOCTL_XE_VM_MADVISE rather than creating 
>>>> new ioctl?
>>>>
>>> Def not a new IOCTL. Let's take a step back, what are you trying to
>>> implement that the current DRM_IOCTL_XE_VM_MADVISE IOCTL / VM bind 
>>> IOCTL
>>> does not support?
>>
>> AFAIU at this moment:
>>
>> MADVISE_WILLNEED  ==  XE_VM_BIND_OP_PREFETCH + 
>> DRM_XE_VM_MADVISE_PRIORITY
>> MADVISE_DONTNEED  ==  XE_VM_BIND_OP_UNMAP + DRM_XE_VM_MADVISE_PRIORITY
>>
>> So unless we need explicit madvise ioctl or vm_madvise ioctl options 
>> for UMD,
>> I think we can have madvise equivalent with above vm bind and vm 
>> madvise ioctl.
>>
>> Hi Thomas, Joonas,
>>
>> What do you think ?
>
> Hi, Nirmoy,
>
> the functionality we need for DONTNEED and WILLNEED would, based on 
> i915 and the move to vma-based would IMO be something along the lines of:
>
> DONTNEED
> 1) if userptr, unbind (or perhaps -EINVAL)
> 2) If bo, mark the vma as dontneed. If all other vmas of the bo are 
> marked dontneed, mark the bo as dontneed and adjust its priority.
> 3) If a dontneed bo is marked for eviction, unbind its vmas, kill its 
> storage and mark it as purged. Don't put on rebind list.
>
> WILLNEED
> 1) If userptr, bind (or perhaps -EINVAL)
> 2) If bo, remove dontneed marker. If bo was purged, notify user-space. 
> (Need feedback from UMD whether they want an error message or just a 
> fresh backing store). Adjust its priority, put vma on rebind list.
>
>  So in particular, if no eviction / shrinking happens between DONTNEED 
> and WILLNEED they will essentially be NOOPs.
>
> It sounds like this is a bit different than what can be achieved with 
> prefetch/unmap/priority.

HI Thomas,

Thanks for your detailed response. This is indeed not completely doable 
currently.

Should we have a separate ioctl for this or two new options in 
DRM_IOCTL_XE_VM_MADVISE ?

>
> /Thomas
>
>>
>>
>> Regards,
>>
>> Nirmoy
>>
>>>
>>> Matt
>>>
>>>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>>> Cc: Matthew Brost <matthew.brost@intel.com>
>>>>
>>>> Nirmoy Das (2):
>>>>    drm/xe: Expose vma bind-unbind functions
>>>>    drm/xe: Implement madvise ioctl for vma
>>>>
>>>>   drivers/gpu/drm/xe/Makefile         |   1 +
>>>>   drivers/gpu/drm/xe/xe_device.c      |   2 +
>>>>   drivers/gpu/drm/xe/xe_vm.c          |  52 +++----
>>>>   drivers/gpu/drm/xe/xe_vm.h          |   3 +
>>>>   drivers/gpu/drm/xe/xe_vma_madvise.c | 223 
>>>> ++++++++++++++++++++++++++++
>>>>   drivers/gpu/drm/xe/xe_vma_madvise.h |  15 ++
>>>>   include/uapi/drm/xe_drm.h           |  28 ++++
>>>>   7 files changed, 296 insertions(+), 28 deletions(-)
>>>>   create mode 100644 drivers/gpu/drm/xe/xe_vma_madvise.c
>>>>   create mode 100644 drivers/gpu/drm/xe/xe_vma_madvise.h
>>>>
>>>> -- 
>>>> 2.39.0
>>>>

  parent reply	other threads:[~2023-05-30 15:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 12:36 [Intel-xe] [RFC PATCH 0/2] Implement vma madvise ioctl Nirmoy Das
2023-05-24 12:36 ` [Intel-xe] [RFC PATCH 1/2] drm/xe: Expose vma bind-unbind functions Nirmoy Das
2023-05-24 12:36 ` [Intel-xe] [RFC PATCH 2/2] drm/xe: Implement madvise ioctl for vma Nirmoy Das
2023-05-24 12:39 ` [Intel-xe] ✓ CI.Patch_applied: success for Implement vma madvise ioctl Patchwork
2023-05-24 12:41 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-05-24 12:45 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-05-24 18:30 ` [Intel-xe] [RFC PATCH 0/2] " Matthew Brost
2023-05-24 20:12   ` Nirmoy Das
2023-05-30 13:19     ` Thomas Hellström
2023-05-30 15:12       ` Thomas Hellström
2023-05-30 15:18       ` Nirmoy Das [this message]
2023-05-30 15:37         ` Thomas Hellström
2023-05-30 15:42           ` Nirmoy Das

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=dbab9407-a358-eccb-fc4e-641f7f815a5f@linux.intel.com \
    --to=nirmoy.das@linux.intel.com \
    --cc=carl.zhang@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=nirmoy.das@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.