All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
Cc: intel-xe@lists.freedesktop.org,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Boris Brezillon" <bbrezillon@kernel.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 04/26] drm/gpuvm: Introduce DRM_GPUVM_SM_MAP_OPS_FLAG_SPLIT_MADVISE flag
Date: Tue, 12 Aug 2025 18:06:26 +0200	[thread overview]
Message-ID: <DC0KTIPCIM2X.YRWQ3K2RLHIG@kernel.org> (raw)
In-Reply-To: <f5d6e986-abc7-476c-b27b-ba22e5d114a2@intel.com>

On Mon Aug 11, 2025 at 8:52 AM CEST, Himal Prasad Ghimiray wrote:
> On 09-08-2025 18:53, Danilo Krummrich wrote:
> Possible scenarios for ops functionality based on input start and end 
> address from user:
>
> a) User-provided range is a subset of an existing drm_gpuva
> Expected Result: Same behavior as the default sm_map logic.
> Reference: Case 1 from [1].
>
> b) Either start or end (but not both) is not aligned with a drm_gpuva 
> boundary
> Expected Result: One REMAP and one MAP operation.
> Reference: Case 3 from [1].
>
> Existing GPUVMAs:
>
>           drm_gpuva1                        drm_gpuva2
> 	[a----------------------------b-1][b-------------------c-1]
>
> User Input to ops:
>    start = inside drm_gpuva1
>    end   = exactly at c-1 (end of drm_gpuva2)
>
> Resulting Mapping:
> 	drm_gpuva1:pre       drm_gpuva:New map     drm_gpuva2
> 	[a---------start-1][start------- b-1] [b------------c-1]
>
> Ops Created:
>    REMAP:UNMAP drm_gpuva1 a to b
>    REMAP:PREV a to start - 1
>    MAP: start to b-1
>
> Note: No unmap of drm_gpuvma2 and no merging of New map and drm_gpuva2.
>
> c) Both start and end are not aligned with drm_gpuva boundaries, and 
> they fall within different drm_gpuva regions
> Expected Result: Two REMAP operations and two MAP operations.
> Reference: Case 2 from [1].
>
>
> d) User-provided range does not overlap with any existing drm_gpuva
> Expected Result: No operations.
> start and end exactly match the boundaries of one or more existing 
> drm_gpuva regions
>
> e) This includes cases where start is at the beginning of drm_gpuva1 and 
> end is at the end of drm_gpuva2 (drm_gpuva1 and drm_gpuva2 can be same 
> or different).
> Expected Result: No operations
>
> [1] 
> https://lore.kernel.org/intel-xe/4203f450-4b49-401d-81a8-cdcca02035f9@intel.com/ 

<snip>

> I’ve tried to explain the behavior/usecase with madvise and expected 
> outcomes of the ops logic in detail in [1]. Could you please take a 
> moment to review that and let me know if the explanation is sufficient 
> or if any part needs further clarification?

Thanks a lot for writing this up!

I think this clarifies everything, the examples from [1] are good (sorry that
your reply from the RFC got lost somehow on my end).

>> Please add a separate section about madvise operations to the documentation at
>> the beginning of the drivers/gpu/drm/drm_gpuvm.c file.
>
> Sure will do that.

Great, this will help users (as well as reviewers) a lot. Please also add your
examples from [1] to this entry, similar to the existing examples for sm_map.

>>> v2
>>> - use drm_gpuvm_sm_map_ops_create with flags instead of defining new
>>>    ops_create (Danilo)
>> 
>> If this turns out not to be what I thought semantically and we still agree it's
>> the correct approach, I think I have to take this back and it should indeed be
>> an entirely separate code path. But let's wait for your answers above.

Having the correct understanding of how this is supposed to work (and seeing how
the code turns out) I think it's still OK to integrate it into sm_map().

However, it probably makes sense to factor out the code into a common function
and then build the madvise() and sm_map() functions on top of it.

Please also find some more comments on the patch itself.

>> Again, I really think this needs some proper documentation like in the
>> "DOC: Split and Merge" documentation section.
>
> Sure

Thanks!

  reply	other threads:[~2025-08-12 16:06 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 16:43 [PATCH v6 00/26] MADVISE FOR XE Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 01/26] drm/gpuvm: Pass map arguments through a struct Himal Prasad Ghimiray
2025-08-08  5:03   ` Matthew Brost
2025-08-09 12:43   ` Danilo Krummrich
2025-08-11  6:54     ` Ghimiray, Himal Prasad
2025-08-12 16:51   ` Danilo Krummrich
2025-08-12 17:55     ` Ghimiray, Himal Prasad
2025-08-07 16:43 ` [PATCH v6 02/26] drm/gpuvm: Kill drm_gpuva_init() Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 03/26] drm/gpuvm: Support flags in drm_gpuvm_map_req Himal Prasad Ghimiray
2025-08-08  5:04   ` Matthew Brost
2025-08-09 12:46   ` Danilo Krummrich
2025-08-11  6:56     ` Ghimiray, Himal Prasad
2025-08-07 16:43 ` [PATCH v6 04/26] drm/gpuvm: Introduce DRM_GPUVM_SM_MAP_OPS_FLAG_SPLIT_MADVISE flag Himal Prasad Ghimiray
2025-08-08  5:20   ` Matthew Brost
2025-08-09 13:23   ` Danilo Krummrich
2025-08-11  6:52     ` Ghimiray, Himal Prasad
2025-08-12 16:06       ` Danilo Krummrich [this message]
2025-08-12 17:52         ` Ghimiray, Himal Prasad
2025-08-12 16:58   ` Danilo Krummrich
2025-08-12 17:54     ` Ghimiray, Himal Prasad
2025-08-07 16:43 ` [PATCH v6 05/26] drm/xe/uapi: Add madvise interface Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 06/26] drm/xe/vm: Add attributes struct as member of vma Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 07/26] drm/xe/vma: Move pat_index to vma attributes Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 08/26] drm/xe/vma: Modify new_vma to accept struct xe_vma_mem_attr as parameter Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 09/26] drm/gpusvm: Make drm_gpusvm_for_each_* macros public Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 10/26] drm/xe/svm: Split system allocator vma incase of madvise call Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 11/26] drm/xe: Allow CPU address mirror VMA unbind with gpu bindings for madvise Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 12/26] drm/xe/svm: Add xe_svm_ranges_zap_ptes_in_range() for PTE zapping Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 13/26] drm/xe: Implement madvise ioctl for xe Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 14/26] drm/xe/svm : Add svm ranges migration policy on atomic access Himal Prasad Ghimiray
2025-08-08  5:42   ` Matthew Brost
2025-08-07 16:43 ` [PATCH v6 15/26] drm/xe/madvise: Update migration policy based on preferred location Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 16/26] drm/xe/pat: Add helper for compression mode of pat index Himal Prasad Ghimiray
2025-08-08  5:47   ` Matthew Brost
2025-08-07 16:43 ` [PATCH v6 17/26] drm/xe/svm: Support DRM_XE_SVM_MEM_RANGE_ATTR_PAT memory attribute Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 18/26] drm/xe/uapi: Add flag for consulting madvise hints on svm prefetch Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 19/26] drm/xe/svm: Consult madvise preferred location in prefetch Himal Prasad Ghimiray
2025-08-08  0:30   ` Matthew Brost
2025-08-07 16:43 ` [PATCH v6 20/26] drm/xe/bo: Add attributes field to xe_bo Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 21/26] drm/xe/bo: Update atomic_access attribute on madvise Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 22/26] drm/xe/madvise: Skip vma invalidation if mem attr are unchanged Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 23/26] drm/xe/vm: Add helper to check for default VMA memory attributes Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 24/26] drm/xe: Reset VMA attributes to default in SVM garbage collector Himal Prasad Ghimiray
2025-08-07 17:13   ` Matthew Brost
2025-08-07 16:43 ` [PATCH v6 25/26] drm/xe: Enable madvise ioctl for xe Himal Prasad Ghimiray
2025-08-07 16:43 ` [PATCH v6 26/26] drm/xe/uapi: Add UAPI for querying VMA count and memory attributes Himal Prasad Ghimiray
2025-08-07 18:02 ` ✗ CI.checkpatch: warning for MADVISE FOR XE (rev6) Patchwork
2025-08-07 18:03 ` ✓ CI.KUnit: success " Patchwork
2025-08-07 18:18 ` ✗ CI.checksparse: warning " Patchwork
2025-08-07 19:11 ` ✓ Xe.CI.BAT: success " Patchwork
2025-08-07 21:16 ` ✓ Xe.CI.Full: " Patchwork

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=DC0KTIPCIM2X.YRWQ3K2RLHIG@kernel.org \
    --to=dakr@kernel.org \
    --cc=bbrezillon@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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.