[Nouveau] [PATCH 27/27] tools: add hmm gup test for long term pinned device pages

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra The intention is to test device coherent type pages that have been called through get user pages with PIN_LONGTERM flag set. These pages should get migrated back to normal system memory. Signed-off-by: Alex Sierra Signed-off-by: Alistair Popple Reviewed-by: Felix Kuehling

[Nouveau] [PATCH 26/27] mm/gup: migrate device coherent pages when pinning instead of failing

2022-02-09 Thread Christoph Hellwig
From: Alistair Popple Currently any attempts to pin a device coherent page will fail. This is because device coherent pages need to be managed by a device driver, and pinning them would prevent a driver from migrating them off the device. However this is no reason to fail pinning of these

[Nouveau] [PATCH 23/27] tools: update hmm-test to support device coherent type

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra Test cases such as migrate_fault and migrate_multiple, were modified to explicit migrate from device to sys memory without the need of page faults, when using device coherent type. Snapshot test case updated to read memory device type first and based on that, get the proper

[Nouveau] [PATCH 25/27] mm: remove the vma check in migrate_vma_setup()

2022-02-09 Thread Christoph Hellwig
From: Alistair Popple migrate_vma_setup() checks that a valid vma is passed so that the page tables can be walked to find the pfns associated with a given address range. However in some cases the pfns are already known, such as when migrating device coherent pages during pin_user_pages() meaning

[Nouveau] [PATCH 24/27] tools: update test_hmm script to support SP config

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra Add two more parameters to set spm_addr_dev0 & spm_addr_dev1 addresses. These two parameters configure the start SP addresses for each device in test_hmm driver. Consequently, this configures zone device type as coherent. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling

[Nouveau] [PATCH 22/27] lib: add support for device coherent type in test_hmm

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra Device Coherent type uses device memory that is coherently accesible by the CPU. This could be shown as SP (special purpose) memory range at the BIOS-e820 memory enumeration. If no SP memory is supported in system, this could be faked by setting CONFIG_EFI_FAKE_MEMMAP.

[Nouveau] [PATCH 21/27] lib: test_hmm add module param for zone device type

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra In order to configure device coherent in test_hmm, two module parameters should be passed, which correspond to the SP start address of each device (2) spm_addr_dev0 & spm_addr_dev1. If no parameters are passed, private device type is configured. Signed-off-by: Alex Sierra

[Nouveau] [PATCH 20/27] lib: test_hmm add ioctl to get zone device type

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra new ioctl cmd added to query zone device type. This will be used once the test_hmm adds zone device coherent type. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 23

[Nouveau] [PATCH 19/27] drm/amdkfd: coherent type as sys mem on migration to ram

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra Coherent device type memory on VRAM to RAM migration, has similar access as System RAM from the CPU. This flag sets the source from the sender. Which in Coherent type case, should be set as MIGRATE_VMA_SELECT_DEVICE_COHERENT. Signed-off-by: Alex Sierra Reviewed-by: Felix

[Nouveau] [PATCH 18/27] drm/amdkfd: add SPM support for SVM

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra When CPU is connected throug XGMI, it has coherent access to VRAM resource. In this case that resource is taken from a table in the device gmc aperture base. This resource is used along with the device type, which could be DEVICE_PRIVATE or DEVICE_COHERENT to create the device

[Nouveau] [PATCH 16/27] mm: add device coherent vma selection for memory migration

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra This case is used to migrate pages from device memory, back to system memory. Device coherent type memory is cache coherent from device and CPU point of view. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig

[Nouveau] [PATCH 17/27] mm/gup: fail get_user_pages for LONGTERM dev coherent type

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra Avoid long term pinning for Coherent device type pages. This could interfere with their own device memory manager. For now, we are just returning error for PIN_LONGTERM Coherent device type pages. Eventually, these type of pages will get migrated to system memory, once the

[Nouveau] [PATCH 13/27] mm: move the migrate_vma_* device migration code into it's own file

2022-02-09 Thread Christoph Hellwig
Split the code used to migrate to and from ZONE_DEVICE memory from migrate.c into a new file. Signed-off-by: Christoph Hellwig --- mm/Kconfig | 3 + mm/Makefile | 1 + mm/migrate.c| 753 --- mm/migrate_device.c | 765

[Nouveau] [PATCH 14/27] mm: build migrate_vma_* for all configs with ZONE_DEVICE support

2022-02-09 Thread Christoph Hellwig
This code will be used for device coherent memory as well in a bit, so relax the ifdef a bit. Signed-off-by: Christoph Hellwig --- mm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index 6391d8d3a616f3..95d4aa3acaefe0 100644 --- a/mm/Kconfig

[Nouveau] [PATCH 15/27] mm: add zone device coherent type memory support

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra Device memory that is cache coherent from device and CPU point of view. This is used on platforms that have an advanced system bus (like CAPI or CXL). Any page of a process can be migrated to such memory. However, no one should be allowed to pin such memory so that it can

[Nouveau] [PATCH 12/27] mm: refactor the ZONE_DEVICE handling in migrate_vma_pages

2022-02-09 Thread Christoph Hellwig
Make the flow a little more clear and prepare for adding a new ZONE_DEVICE memory type. Signed-off-by: Christoph Hellwig --- mm/migrate.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index

[Nouveau] [PATCH 11/27] mm: refactor the ZONE_DEVICE handling in migrate_vma_insert_page

2022-02-09 Thread Christoph Hellwig
Make the flow a little more clear and prepare for adding a new ZONE_DEVICE memory type. Signed-off-by: Christoph Hellwig --- mm/migrate.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index

[Nouveau] [PATCH 10/27] mm: refactor check_and_migrate_movable_pages

2022-02-09 Thread Christoph Hellwig
Remove up to two levels of indentation by using continue statements and move variables to local scope where possible. Signed-off-by: Christoph Hellwig --- mm/gup.c | 81 ++-- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git

[Nouveau] [PATCH 09/27] mm: generalize the pgmap based page_free infrastructure

2022-02-09 Thread Christoph Hellwig
Key off on the existence of ->page_free to prepare for adding support for more pgmap types that are device managed and thus need the free callback. Signed-off-by: Christoph Hellwig --- mm/memremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memremap.c

[Nouveau] [PATCH 08/27] fsdax: depend on ZONE_DEVICE || FS_DAX_LIMITED

2022-02-09 Thread Christoph Hellwig
Add a depends on ZONE_DEVICE support or the s390-specific limited DAX support, as one of the two is required at runtime for fsdax code to actually work. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- fs/Kconfig | 1 + 1 file changed, 1

[Nouveau] [PATCH 07/27] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-09 Thread Christoph Hellwig
ZONE_DEVICE struct pages have an extra reference count that complicates the code for put_page() and several places in the kernel that need to check the reference count to see that a page is not being used (gup, compaction, migration, etc.). Clean up the code so the reference count doesn't need to

[Nouveau] [PATCH 06/27] mm: don't include in

2022-02-09 Thread Christoph Hellwig
Move the check for the actual pgmap types that need the free at refcount one behavior into the out of line helper, and thus avoid the need to pull memremap.h into mm.h. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Dan Williams

[Nouveau] [PATCH 05/27] mm: simplify freeing of devmap managed pages

2022-02-09 Thread Christoph Hellwig
Make put_devmap_managed_page return if it took charge of the page or not and remove the separate page_is_devmap_managed helper. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Dan Williams ---

[Nouveau] [PATCH 04/27] mm: move free_devmap_managed_page to memremap.c

2022-02-09 Thread Christoph Hellwig
free_devmap_managed_page has nothing to do with the code in swap.c, move it to live with the rest of the code for devmap handling. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Muchun Song Reviewed-by:

[Nouveau] [PATCH 02/27] mm: remove the __KERNEL__ guard from

2022-02-09 Thread Christoph Hellwig
__KERNEL__ ifdefs don't make sense outside of include/uapi/. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Muchun Song Reviewed-by: Dan Williams --- include/linux/mm.h | 4 1 file changed, 4

[Nouveau] [PATCH 03/27] mm: remove pointless includes from

2022-02-09 Thread Christoph Hellwig
hmm.h pulls in the world for no good reason at all. Remove the includes and push a few ones into the users instead. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 1 +

[Nouveau] [PATCH 01/27] mm: remove a pointless CONFIG_ZONE_DEVICE check in memremap_pages

2022-02-09 Thread Christoph Hellwig
memremap.c is only built when CONFIG_ZONE_DEVICE is set, so remove the superflous extra check. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Muchun Song Reviewed-by: Dan Williams --- mm/memremap.c | 3

[Nouveau] start sorting out the ZONE_DEVICE refcount mess v2

2022-02-09 Thread Christoph Hellwig
Hi all, this series removes the offset by one refcount for ZONE_DEVICE pages that are freed back to the driver owning them, which is just device private ones for now, but also the planned device coherent pages and the ehanced p2p ones pending. It does not address the fsdax pages yet, which will

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-09 Thread Christoph Hellwig
On Thu, Feb 10, 2022 at 01:10:47PM +1100, Alistair Popple wrote: > diff --git a/mm/gup.c b/mm/gup.c > index cbb49abb7992..8e85c9fb8df4 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -2007,7 +2007,6 @@ static long check_and_migrate_movable_pages(unsigned > long nr_pages, > if (!ret &&

Re: [Nouveau] [PATCH v3] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Lucas De Marchi
On Thu, Feb 03, 2022 at 12:56:14AM -0800, Lucas De Marchi wrote: Rename struct dma_buf_map to struct iosys_map and corresponding APIs. Over time dma-buf-map grew up to more functionality than the one used by dma-buf: in fact it's just a shim layer to abstract system memory, that can be accessed

Re: [Nouveau] [PATCH v2] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Sumit Semwal
Hello Lucas, On Wed, 2 Feb 2022 at 15:08, Lucas De Marchi wrote: > > On Wed, Feb 02, 2022 at 10:25:28AM +0100, Christian König wrote: > >Am 02.02.22 um 10:11 schrieb Lucas De Marchi: > >>[SNIP] > >>diff --git a/MAINTAINERS b/MAINTAINERS > >>index d03ad8da1f36..112676f11792 100644 > >>---

Re: [Nouveau] [PATCH v2] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Lucas De Marchi
On Wed, Feb 02, 2022 at 11:20:16AM +0100, Thomas Zimmermann wrote: Hi Am 02.02.22 um 10:11 schrieb Lucas De Marchi: diff --git a/Documentation/driver-api/dma-buf.rst b/Documentation/driver-api/dma-buf.rst index 2cd7db82d9fe..ea1e81894d7c 100644 --- a/Documentation/driver-api/dma-buf.rst +++

[Nouveau] [PATCH] drm/nouveau: Remove the unused header file nvif/list.h

2022-02-09 Thread Cai Huoqing
The nouveau driver depends on include/linux/list.h instead of nvif/list.h, so remove the obstacle-nvif/list.h. Signed-off-by: Cai Huoqing --- drivers/gpu/drm/nouveau/include/nvif/list.h | 353 1 file changed, 353 deletions(-) delete mode 100644

Re: [Nouveau] [PATCH v2] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Lucas De Marchi
On Wed, Feb 02, 2022 at 10:25:28AM +0100, Christian König wrote: Am 02.02.22 um 10:11 schrieb Lucas De Marchi: [SNIP] diff --git a/MAINTAINERS b/MAINTAINERS index d03ad8da1f36..112676f11792 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5675,7 +5675,6 @@ T:git

[Nouveau] [PATCH 13/23] drm/nouveau/kms: Remove redundant zpos initialisation

2022-02-09 Thread Maxime Ripard
The nouveau KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane purpose. Since the initial value wasn't carried over in the state, the driver had to set it again in nv50_wndw_reset(). However, the helpers have been adjusted to set it properly at reset,

[Nouveau] [PATCH v2] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Lucas De Marchi
Rename struct dma_buf_map to struct iosys_map and corresponding APIs. Over time dma-buf-map grew up to more functionality than the one used by dma-buf: in fact it's just a shim layer to abstract system memory, that can be accessed via regular load and store, from IO memory, that needs to be

[Nouveau] [PATCH v4] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Lucas De Marchi
Rename struct dma_buf_map to struct iosys_map and corresponding APIs. Over time dma-buf-map grew up to more functionality than the one used by dma-buf: in fact it's just a shim layer to abstract system memory, that can be accessed via regular load and store, from IO memory that needs to be acessed

Re: [Nouveau] [PATCH 2/8] mm: remove the __KERNEL__ guard from

2022-02-09 Thread Muchun Song
On Mon, Feb 7, 2022 at 2:42 PM Christoph Hellwig wrote: > > __KERNEL__ ifdefs don't make sense outside of include/uapi/. > > Signed-off-by: Christoph Hellwig Reviewed-by: Muchun Song Thanks.

[Nouveau] [PATCH v3] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Lucas De Marchi
Rename struct dma_buf_map to struct iosys_map and corresponding APIs. Over time dma-buf-map grew up to more functionality than the one used by dma-buf: in fact it's just a shim layer to abstract system memory, that can be accessed via regular load and store, from IO memory that needs to be acessed

Re: [Nouveau] [PATCH 00/14] Rename dma-buf-map

2022-02-09 Thread Lucas De Marchi
On Tue, Feb 01, 2022 at 08:46:15AM +0100, Christian König wrote: Am 01.02.22 um 01:36 schrieb Lucas De Marchi: On Fri, Jan 28, 2022 at 10:48:42AM +0100, Christian König wrote: Am 28.01.22 um 10:40 schrieb Lucas De Marchi: On Fri, Jan 28, 2022 at 10:22:00AM +0100, Christian König wrote: Am

Re: [Nouveau] [PATCH 4/8] mm: move free_devmap_managed_page to memremap.c

2022-02-09 Thread Muchun Song
On Mon, Feb 7, 2022 at 2:42 PM Christoph Hellwig wrote: > > free_devmap_managed_page has nothing to do with the code in swap.c, > move it to live with the rest of the code for devmap handling. > > Signed-off-by: Christoph Hellwig Reviewed-by: Muchun Song Thanks.

Re: [Nouveau] [PATCH v3] dma-buf-map: Rename to iosys-map

2022-02-09 Thread Daniel Vetter
On Thu, Feb 03, 2022 at 12:56:14AM -0800, Lucas De Marchi wrote: > Rename struct dma_buf_map to struct iosys_map and corresponding APIs. > Over time dma-buf-map grew up to more functionality than the one used by > dma-buf: in fact it's just a shim layer to abstract system memory, that > can be

Re: [Nouveau] [PATCH 1/8] mm: remove a pointless CONFIG_ZONE_DEVICE check in memremap_pages

2022-02-09 Thread Muchun Song
On Mon, Feb 7, 2022 at 2:36 PM Christoph Hellwig wrote: > > memremap.c is only built when CONFIG_ZONE_DEVICE is set, so remove > the superflous extra check. > > Signed-off-by: Christoph Hellwig Reviewed-by: Muchun Song Thanks.

Re: [Nouveau] [PATCH 00/14] Rename dma-buf-map

2022-02-09 Thread Lucas De Marchi
On Fri, Jan 28, 2022 at 10:48:42AM +0100, Christian König wrote: Am 28.01.22 um 10:40 schrieb Lucas De Marchi: On Fri, Jan 28, 2022 at 10:22:00AM +0100, Christian König wrote: Am 28.01.22 um 10:12 schrieb Lucas De Marchi: On Fri, Jan 28, 2022 at 09:41:14AM +0100, Christian König wrote: Rule

Re: [Nouveau] [Intel-gfx] [PATCH v2 04/11] drm/i915: Use str_enable_disable()

2022-02-09 Thread Matt Roper
On Wed, Jan 26, 2022 at 01:39:44AM -0800, Lucas De Marchi wrote: > Remove the local enabledisable() implementation and adopt the > str_enable_disable() from linux/string_helpers.h. > > Signed-off-by: Lucas De Marchi > Acked-by: Daniel Vetter > Acked-by: Jani Nikula There's an open-coded

Re: [Nouveau] [Intel-gfx] [PATCH v2 03/11] drm/i915: Use str_yes_no()

2022-02-09 Thread Matt Roper
On Wed, Jan 26, 2022 at 01:39:43AM -0800, Lucas De Marchi wrote: > Remove the local yesno() implementation and adopt the str_yes_no() from > linux/string_helpers.h. > > Signed-off-by: Lucas De Marchi > Acked-by: Daniel Vetter > Acked-by: Jani Nikula Reviewed-by: Matt Roper > --- >

Re: [Nouveau] [Intel-gfx] [PATCH v2 06/11] drm/i915: Use str_on_off()

2022-02-09 Thread Matt Roper
On Wed, Jan 26, 2022 at 01:39:46AM -0800, Lucas De Marchi wrote: > Remove the local onoff() implementation and adopt the > str_on_off() from linux/string_helpers.h. > > Signed-off-by: Lucas De Marchi > Acked-by: Daniel Vetter > Acked-by: Jani Nikula Reviewed-by: Matt Roper > --- >

Re: [Nouveau] [Intel-gfx] [PATCH v2 05/11] drm/i915: Use str_enabled_disabled()

2022-02-09 Thread Matt Roper
On Wed, Jan 26, 2022 at 01:39:45AM -0800, Lucas De Marchi wrote: > Remove the local enableddisabled() implementation and adopt the > str_enabled_disabled() from linux/string_helpers.h. > > Signed-off-by: Lucas De Marchi > Acked-by: Daniel Vetter > Acked-by: Jani Nikula There's two open-coded

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-09 Thread Christoph Hellwig
On Mon, Feb 07, 2022 at 04:19:29PM -0500, Felix Kuehling wrote: > > Am 2022-02-07 um 01:32 schrieb Christoph Hellwig: >> Move the check for the actual pgmap types that need the free at refcount >> one behavior into the out of line helper, and thus avoid the need to >> pull memremap.h into mm.h. >>

Re: [Nouveau] [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-09 Thread Jason Gunthorpe
On Wed, Feb 09, 2022 at 02:53:51PM +0100, Christoph Hellwig wrote: > On Wed, Feb 09, 2022 at 08:29:56AM -0400, Jason Gunthorpe wrote: > > It is nice, but the other series are still impacted by the fsdax mess > > - they still stuff pages into ptes without proper refcounts and have > > to carry

Re: [Nouveau] [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-09 Thread Christoph Hellwig
On Wed, Feb 09, 2022 at 08:29:56AM -0400, Jason Gunthorpe wrote: > It is nice, but the other series are still impacted by the fsdax mess > - they still stuff pages into ptes without proper refcounts and have > to carry nonsense to dance around this problem. > > I certainly would be unhappy if the

Re: [Nouveau] [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-09 Thread Jason Gunthorpe
On Wed, Feb 09, 2022 at 07:23:45AM +0100, Christoph Hellwig wrote: > On Tue, Feb 08, 2022 at 07:30:11PM -0800, Dan Williams wrote: > > Interesting. I had expected that to really fix the refcount problem > > that fs/dax.c would need to start taking real page references as pages > > were added to a