Re: [Nouveau] [PATCH v9 03/10] mm/rmap: Split try_to_munlock from try_to_unmap

2021-05-25 Thread Shakeel Butt
On Tue, May 25, 2021 at 11:40 AM Liam Howlett wrote: > [...] > > > > +/* > > + * Walks the vma's mapping a page and mlocks the page if any locked vma's > > are > > + * found. Once one is found the page is locked and the scan can be > > terminated. > > + */ > > Can you please add that this

Re: [Nouveau] [PATCH v9 03/10] mm/rmap: Split try_to_munlock from try_to_unmap

2021-05-25 Thread Liam Howlett
* Alistair Popple [210524 09:29]: > The behaviour of try_to_unmap_one() is difficult to follow because it > performs different operations based on a fairly large set of flags used > in different combinations. > > TTU_MUNLOCK is one such flag. However it is exclusively used by > try_to_munlock()

Re: [Nouveau] [PATCH v9 07/10] mm: Device exclusive memory access

2021-05-25 Thread Balbir Singh
On Mon, May 24, 2021 at 03:11:57PM -0700, Andrew Morton wrote: > On Mon, 24 May 2021 23:27:22 +1000 Alistair Popple wrote: > > > Some devices require exclusive write access to shared virtual > > memory (SVM) ranges to perform atomic operations on that memory. This > > requires CPU page tables to

[Nouveau] [PATCH -next] drm/nouveau: Remove set but not used variable 'dev'

2021-05-25 Thread Baokun Li
Fixes gcc '-Wunused-but-set-variable' warning: drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_populate': drivers/gpu/drm/nouveau/nouveau_bo.c:1258:17: warning: variable ‘dev’ set but not used [-Wunused-but-set-variable] drivers/gpu/drm/nouveau/nouveau_bo.c: In function

Re: [Nouveau] [PATCH v4 0/7] drm: Clean up mmap for TTM-based GEM drivers

2021-05-25 Thread Thomas Zimmermann
Something I forgot to add is that patches 1 to 4 already have a Reviewed-by: Christian König Am 25.05.21 um 17:10 schrieb Thomas Zimmermann: Implement mmap via struct drm_gem_object_functions.mmap in amdgpu, radeon and nouveau. This allows for using common DRM helpers for the mmap-related

[Nouveau] [PATCH v4 6/7] drm/vmwgfx: Inline vmw_verify_access()

2021-05-25 Thread Thomas Zimmermann
Vmwgfx is the only user of the TTM's verify_access callback. Inline the call and avoid the indirection through the function pointer. Signed-off-by: Thomas Zimmermann Reviewed-by: Zack Rusin --- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 9 - drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c

[Nouveau] [PATCH v4 7/7] drm/ttm: Remove ttm_bo_mmap() and friends

2021-05-25 Thread Thomas Zimmermann
The function ttm_bo_mmap is unused. Remove it and it's helpers; including the verify_access callback in struct ttm_device_funcs. Signed-off-by: Thomas Zimmermann Reviewed-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 53 -

[Nouveau] [PATCH v4 5/7] drm/vmwgfx: Inline ttm_bo_mmap() into vmwgfx driver

2021-05-25 Thread Thomas Zimmermann
The vmwgfx driver is the only remaining user of ttm_bo_mmap(). Inline the code. The internal helper ttm_bo_vm_lookup() is now also part of vmwgfx as vmw_bo_vm_lookup(). v2: * replace pr_err() with drm_err() (Zack) Signed-off-by: Thomas Zimmermann Reviewed-by: Zack Rusin ---

[Nouveau] [PATCH v4 4/7] drm/nouveau: Implement mmap as GEM object function

2021-05-25 Thread Thomas Zimmermann
Moving the driver-specific mmap code into a GEM object function allows for using DRM helpers for various mmap callbacks. The GEM object function is provided by GEM TTM helpers. Nouveau's implementation of verify_access is unused and has been removed. Access permissions are validated by the DRM

[Nouveau] [PATCH v4 2/7] drm/amdgpu: Implement mmap as GEM object function

2021-05-25 Thread Thomas Zimmermann
Moving the driver-specific mmap code into a GEM object function allows for using DRM helpers for various mmap callbacks. This change resolves several inconsistencies between regular mmap and prime-based mmap. The vm_ops field in vma is now set for all mmap'ed areas. Previously it way only set for

[Nouveau] [PATCH v4 3/7] drm/radeon: Implement mmap as GEM object function

2021-05-25 Thread Thomas Zimmermann
Moving the driver-specific mmap code into a GEM object function allows for using DRM helpers for various mmap callbacks. This change also allows to support prime-based mmap via DRM's helper drm_gem_prime_mmap(). Permission checks are implemented by drm_gem_mmap(), with an additional check for

[Nouveau] [PATCH v4 0/7] drm: Clean up mmap for TTM-based GEM drivers

2021-05-25 Thread Thomas Zimmermann
Implement mmap via struct drm_gem_object_functions.mmap in amdgpu, radeon and nouveau. This allows for using common DRM helpers for the mmap-related callbacks in struct file_operations and struct drm_driver. The drivers have their own vm_ops, which are now set automatically by the DRM core

[Nouveau] [PATCH v4 1/7] drm/ttm: Don't override vm_ops callbacks, if set

2021-05-25 Thread Thomas Zimmermann
Drivers may want to set their own callbacks for a VM area. Only set TTM's callbacks if the vm_ops field is clear. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c

Re: [Nouveau] [PATCH v9 07/10] mm: Device exclusive memory access

2021-05-25 Thread Alistair Popple
On Tuesday, 25 May 2021 11:31:17 AM AEST John Hubbard wrote: > On 5/24/21 3:11 PM, Andrew Morton wrote: > >> ... > >> > >> Documentation/vm/hmm.rst | 17 > >> include/linux/mmu_notifier.h | 6 ++ > >> include/linux/rmap.h | 4 + > >> include/linux/swap.h | 7