[PATCH v5 00/13] Support DEVICE_GENERIC memory in migrate_vma_*

2021-08-11 Thread Alex Sierra
1-2 Rebased Ralph Campbell's ZONE_DEVICE page refcounting patches. Patches 4-5 are for context to show how we are looking up the SPM memory and registering it with devmap. Patches 3,6-8 are the changes we are trying to upstream or rework to make them acceptable upstream. Patches 9-13 add ZON

[PATCH v5 01/13] ext4/xfs: add page refcount helper

2021-08-11 Thread Alex Sierra
ref count functionality was missing on fuse/dax.c. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- fs/dax.c| 4 ++-- fs/ext4/inode.c | 5 + fs/fuse/dax.c | 4 +--- fs/xfs/xfs_file.c | 4 +--- include/linux/dax.h | 10 ++ 5 files changed, 15

[PATCH v5 06/13] include/linux/mm.h: helpers to check zone device generic type

2021-08-11 Thread Alex Sierra
Two helpers added. One checks if zone device page is generic type. The other if page is either private or generic type. Signed-off-by: Alex Sierra --- include/linux/mm.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index c0fcb47d7641

[PATCH v5 03/13] kernel: resource: lookup_resource as exported symbol

2021-08-11 Thread Alex Sierra
claim it as MEMORY_DEVICE_GENERIC using devm_memremap_pages. Signed-off-by: Alex Sierra --- kernel/resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/resource.c b/kernel/resource.c index 627e61b0c124..2d4abd395c73 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -783,6

[PATCH v5 08/13] mm: call pgmap->ops->page_free for DEVICE_GENERIC pages

2021-08-11 Thread Alex Sierra
Add MEMORY_DEVICE_GENERIC case to free_zone_device_page callback. Device generic type memory case is now able to free its pages properly. Signed-off-by: Alex Sierra --- mm/memremap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memremap.c b/mm/memremap.c index

[PATCH v5 05/13] drm/amdkfd: generic type as sys mem on migration to ram

2021-08-11 Thread Alex Sierra
Generic 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 Generic type case, should be set as SYSTEM. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd

[PATCH v5 12/13] tools: update hmm-test to support device generic type

2021-08-11 Thread Alex Sierra
migrate_ping_pong test case added to test explicit migration from device to sys memory for both private and generic zone types. Helpers to migrate from device to sys memory and vicerversa were also added. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/hmm-tests.c | 142

[PATCH v5 02/13] mm: remove extra ZONE_DEVICE struct page refcount

2021-08-11 Thread Alex Sierra
ed to zero. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- fs/dax.c | 4 +- include/linux/dax.h| 2 +- include/linux/memre

[PATCH v5 04/13] drm/amdkfd: add SPM support for SVM

2021-08-11 Thread Alex Sierra
. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index 21b86c35a4f2

[PATCH v5 07/13] mm: add generic type support to migrate_vma helpers

2021-08-11 Thread Alex Sierra
Device generic type case added for migrate_vma_pages and migrate_vma_check_page helpers. Both, generic and private device types have the same conditions to decide to migrate pages from/to device memory. Signed-off-by: Alex Sierra --- mm/migrate.c | 20 +--- 1 file changed, 9

[PATCH v5 09/13] lib: test_hmm add ioctl to get zone device type

2021-08-11 Thread Alex Sierra
new ioctl cmd added to query zone device type. This will be used once the test_hmm adds zone device generic type. Signed-off-by: Alex Sierra --- lib/test_hmm.c | 15 ++- lib/test_hmm_uapi.h | 7 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib

[PATCH v5 10/13] lib: test_hmm add module param for zone device type

2021-08-11 Thread Alex Sierra
ap.type = MEMORY_DEVICE_PRIVATE at dmirror_allocate_chunk that was forcing to configure pagemap.type to MEMORY_DEVICE_PRIVATE Signed-off-by: Alex Sierra --- lib/test_hmm.c | 46 - lib/test_hmm_uapi.h | 1 + 2 files changed, 34 insertions(+), 13 deletions(-) diff --gi

[PATCH v5 11/13] lib: add support for device generic type in test_hmm

2021-08-11 Thread Alex Sierra
supports two different SP ranges of at least 256MB size. This could be specified in the kernel parameter variable efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x1 & 0x14000 physical address. efi_fake_mem=1G@0x1:0x4,1G@0x14000:0x4 Signed-off-by: Alex Si

[PATCH v5 13/13] tools: update test_hmm script to support SP config

2021-08-11 Thread 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 generic. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/test_hmm.sh

[PATCH v6 02/13] mm: remove extra ZONE_DEVICE struct page refcount

2021-08-12 Thread Alex Sierra
ed to zero. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- fs/dax.c | 4 +- include/linux/dax.h| 2 +- include/linux/memre

[PATCH v6 00/13] Support DEVICE_GENERIC memory in migrate_vma_*

2021-08-12 Thread Alex Sierra
g directories: $sudo mkdir /mnt/ram0 $sudo mkdir /mnt/ram1 Everytime you boot, you need to create ext4 file system for the emulated persistent memory partitions. $sudo mkfs.ext4 /dev/pmem0 $sudo mkfs.ext4 /dev/pmem1 To run the tests: $sudo ./check -g quick Alex Sierra (11): kernel: resource: lo

[PATCH v6 01/13] ext4/xfs: add page refcount helper

2021-08-12 Thread Alex Sierra
ref count functionality was missing on fuse/dax.c. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- fs/dax.c| 4 ++-- fs/ext4/inode.c | 5 + fs/fuse/dax.c | 4 +--- fs/xfs/xfs_file.c | 4 +--- include/linux/dax.h | 10 ++ 5 files changed, 15

[PATCH v6 04/13] drm/amdkfd: add SPM support for SVM

2021-08-12 Thread Alex Sierra
. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index dab290a4d19d

[PATCH v6 05/13] drm/amdkfd: generic type as sys mem on migration to ram

2021-08-12 Thread Alex Sierra
Generic 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 Generic type case, should be set as SYSTEM. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd

[PATCH v6 08/13] mm: call pgmap->ops->page_free for DEVICE_GENERIC pages

2021-08-12 Thread Alex Sierra
Add MEMORY_DEVICE_GENERIC case to free_zone_device_page callback. Device generic type memory case is now able to free its pages properly. Signed-off-by: Alex Sierra --- mm/memremap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memremap.c b/mm/memremap.c index

[PATCH v6 09/13] lib: test_hmm add ioctl to get zone device type

2021-08-12 Thread Alex Sierra
new ioctl cmd added to query zone device type. This will be used once the test_hmm adds zone device generic type. Signed-off-by: Alex Sierra --- lib/test_hmm.c | 15 ++- lib/test_hmm_uapi.h | 7 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib

[PATCH v6 03/13] kernel: resource: lookup_resource as exported symbol

2021-08-12 Thread Alex Sierra
claim it as MEMORY_DEVICE_GENERIC using devm_memremap_pages. Signed-off-by: Alex Sierra --- kernel/resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/resource.c b/kernel/resource.c index ca9f5198a01f..227fc9fab573 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -772,6

[PATCH v6 07/13] mm: add generic type support to migrate_vma helpers

2021-08-12 Thread Alex Sierra
Device generic type case added for migrate_vma_pages and migrate_vma_check_page helpers. Both, generic and private device types have the same conditions to decide to migrate pages from/to device memory. Signed-off-by: Alex Sierra --- mm/migrate.c | 18 +++--- 1 file changed, 11

[PATCH v6 06/13] include/linux/mm.h: helpers to check zone device generic type

2021-08-12 Thread Alex Sierra
Two helpers added. One checks if zone device page is generic type. The other if page is either private or generic type. Signed-off-by: Alex Sierra --- include/linux/mm.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index d48a1f0889d1

[PATCH v6 12/13] tools: update hmm-test to support device generic type

2021-08-12 Thread Alex Sierra
migrate_ping_pong test case added to test explicit migration from device to sys memory for both private and generic zone types. Helpers to migrate from device to sys memory and vicerversa were also added. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/hmm-tests.c | 142

[PATCH v6 13/13] tools: update test_hmm script to support SP config

2021-08-12 Thread 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 generic. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/test_hmm.sh

[PATCH v6 10/13] lib: test_hmm add module param for zone device type

2021-08-12 Thread Alex Sierra
ap.type = MEMORY_DEVICE_PRIVATE at dmirror_allocate_chunk that was forcing to configure pagemap.type to MEMORY_DEVICE_PRIVATE v6: Check for null pointers for resource and memremap references at dmirror_allocate_chunk Signed-off-by: Alex Sierra --- lib/test_hmm.c | 56 ---

[PATCH v6 11/13] lib: add support for device generic type in test_hmm

2021-08-12 Thread Alex Sierra
supports two different SP ranges of at least 256MB size. This could be specified in the kernel parameter variable efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x1 & 0x14000 physical address. efi_fake_mem=1G@0x1:0x4,1G@0x14000:0x4 Signed-off-by: Alex Si

[PATCH v1 07/14] drm/amdkfd: public type as sys mem on migration to ram

2021-08-24 Thread Alex Sierra
Public 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 Public type case, should be set as IOMEM. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c

[PATCH v1 05/14] drm/amdkfd: ref count init for device pages

2021-08-24 Thread Alex Sierra
Ref counter from device pages is init to zero during memmap init zone. The first time a new device page is allocated to migrate data into it, its ref counter needs to be initialized to one. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 2 +- 1 file changed, 1

[PATCH v1 12/14] lib: add support for device public type in test_hmm

2021-08-24 Thread Alex Sierra
supports two different SP ranges of at least 256MB size. This could be specified in the kernel parameter variable efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x1 & 0x14000 physical address. Ex. efi_fake_mem=1G@0x1:0x4,1G@0x14000:0x4 Signed-off-by: Alex Si

[PATCH v1 11/14] lib: test_hmm add module param for zone device type

2021-08-24 Thread Alex Sierra
In order to configure device public 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 --- v5: Remove de

[PATCH v1 03/14] mm: add iomem vma selection for memory migration

2021-08-24 Thread Alex Sierra
In this case, this is used to migrate pages from device memory, back to system memory. This particular device memory type should be accessible by the CPU, through IOMEM access. Typically, zone device public type memory falls into this category. Signed-off-by: Alex Sierra --- include/linux

[PATCH v1 08/14] mm: add public type support to migrate_vma helpers

2021-08-24 Thread Alex Sierra
Add device public type case to migrate_vma_insert_page, migrate_vma_pages and migrate_vma_check_page helpers. Signed-off-by: Alex Sierra --- mm/migrate.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index d4ae2da99607

[PATCH v1 13/14] tools: update hmm-test to support device public type

2021-08-24 Thread Alex Sierra
migrate_ping_pong test case added to test explicit migration from device to sys memory for both private and public zone types. Helpers to migrate from device to sys memory and vicerversa were also added. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/hmm-tests.c | 142

[PATCH v1 01/14] ext4/xfs: add page refcount helper

2021-08-24 Thread Alex Sierra
From: Ralph Campbell There are several places where ZONE_DEVICE struct pages assume a reference count == 1 means the page is idle and free. Instead of open coding this, add a helper function to hide this detail. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Reviewed-by: Christoph

[PATCH v1 06/14] drm/amdkfd: add SPM support for SVM

2021-08-24 Thread Alex Sierra
. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- v7: Remove lookup_resource call, so export symbol for this function is not longer required. Patch dropped "kernel: resource: lookup_resource as exported symbol" --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 29 +++--

[PATCH v1 02/14] mm: remove extra ZONE_DEVICE struct page refcount

2021-08-24 Thread Alex Sierra
count doesn't need to be treated specially for ZONE_DEVICE. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- v2: AS: merged this patch in linux 5.11 version v5: AS: add condition at try_grab_page to check for the zone device type, while page ref counter is checked less/equal to

[PATCH v1 04/14] mm: add zone device public type memory support

2021-08-24 Thread Alex Sierra
-off-by: Alex Sierra --- include/linux/memremap.h | 8 include/linux/mm.h | 8 mm/memcontrol.c | 6 +++--- mm/memory-failure.c | 6 +- mm/memremap.c| 1 + 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/include/linux/memremap.h b

[PATCH v1 10/14] lib: test_hmm add ioctl to get zone device type

2021-08-24 Thread Alex Sierra
new ioctl cmd added to query zone device type. This will be used once the test_hmm adds zone device public type. Signed-off-by: Alex Sierra --- lib/test_hmm.c | 15 ++- lib/test_hmm_uapi.h | 7 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib

[PATCH v1 00/14] Add MEMORY_DEVICE_PUBLIC for CPU-accessible coherent device memory

2021-08-24 Thread Alex Sierra
previous reviews of this patch series (see https://patchwork.freedesktop.org/series/90706/). Finally, we extended hmm_test to cover migration of MEMORY_DEVICE_PUBLIC. This work is based on HMM and our SVM memory manager, which has landed in Linux 5.14 recently. Alex Sierra (12): mm: add iomem

[PATCH v1 09/14] mm: call pgmap->ops->page_free for DEVICE_PUBLIC pages

2021-08-24 Thread Alex Sierra
Add MEMORY_DEVICE_PUBLIC case to free_zone_device_page callback. Device public type memory case is now able to free its pages properly. Signed-off-by: Alex Sierra --- mm/memremap.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/memremap.c b/mm/memremap.c index

[PATCH v1 14/14] tools: update test_hmm script to support SP config

2021-08-24 Thread 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 public. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/test_hmm.sh

[PATCH v4 03/13] kernel: resource: lookup_resource as exported symbol

2021-07-17 Thread Alex Sierra
claim it as MEMORY_DEVICE_GENERIC using devm_memremap_pages. Signed-off-by: Alex Sierra --- kernel/resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/resource.c b/kernel/resource.c index 627e61b0c124..269489bb7097 100644 --- a/kernel/resource.c +++ b/kernel

[PATCH v4 00/13] Support DEVICE_GENERIC memory in migrate_vma_*

2021-07-17 Thread Alex Sierra
ZONE_DEVICE page refcounting patches. Patches 4-5 are for context to show how we are looking up the SPM memory and registering it with devmap. Patches 3,6-8 are the changes we are trying to upstream or rework to make them acceptable upstream. Patches 9-13 add ZONE_DEVICE Generic type supp

[PATCH v4 07/13] mm: add generic type support to migrate_vma helpers

2021-07-17 Thread Alex Sierra
Device generic type case added for migrate_vma_pages and migrate_vma_check_page helpers. Both, generic and private device types have the same conditions to decide to migrate pages from/to device memory. Signed-off-by: Alex Sierra --- mm/migrate.c | 20 +--- 1 file changed, 9

[PATCH v4 02/13] mm: remove extra ZONE_DEVICE struct page refcount

2021-07-17 Thread Alex Sierra
count doesn't need to be treated specially for ZONE_DEVICE. v2: AS: merged this patch in linux 5.11 version Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- fs/

[PATCH v4 01/13] ext4/xfs: add page refcount helper

2021-07-17 Thread Alex Sierra
ref count functionality was missing on fuse/dax.c. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- fs/dax.c| 4 ++-- fs/ext4/inode.c | 5 + fs/fuse/dax.c | 4 +--- fs/xfs/xfs_file.c | 4 +--- include/linux/dax.h | 10 ++ 5 files changed, 15

[PATCH v4 09/13] lib: test_hmm add ioctl to get zone device type

2021-07-17 Thread Alex Sierra
new ioctl cmd added to query zone device type. This will be used once the test_hmm adds zone device generic type. Signed-off-by: Alex Sierra --- lib/test_hmm.c | 15 ++- lib/test_hmm_uapi.h | 7 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib

[PATCH v4 04/13] drm/amdkfd: add SPM support for SVM

2021-07-17 Thread Alex Sierra
. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index 21b86c35a4f2

[PATCH v4 05/13] drm/amdkfd: generic type as sys mem on migration to ram

2021-07-17 Thread Alex Sierra
Generic 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 Generic type case, should be set as SYSTEM. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd

[PATCH v4 08/13] mm: call pgmap->ops->page_free for DEVICE_GENERIC pages

2021-07-17 Thread Alex Sierra
Add MEMORY_DEVICE_GENERIC case to free_zone_device_page callback. Device generic type memory case is now able to free its pages properly. Signed-off-by: Alex Sierra --- mm/memremap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memremap.c b/mm/memremap.c index

[PATCH v4 10/13] lib: test_hmm add module param for zone device type

2021-07-17 Thread Alex Sierra
In order to configure device generic in test_hmm, two module parameters should be passed, which correspon 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 --- lib/test_h

[PATCH v4 06/13] include/linux/mm.h: helpers to check zone device generic type

2021-07-17 Thread Alex Sierra
Two helpers added. One checks if zone device page is generic type. The other if page is either private or generic type. Signed-off-by: Alex Sierra --- include/linux/mm.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index d8d79bb94be8

[PATCH v4 12/13] tools: update hmm-test to support device generic type

2021-07-17 Thread Alex Sierra
migrate_ping_pong test case added to test explicit migration from device to sys memory for both private and generic zone types. Helpers to migrate from device to sys memory and vicerversa were also added. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/hmm-tests.c | 142

[PATCH v4 11/13] lib: add support for device generic type in test_hmm

2021-07-17 Thread Alex Sierra
supports two different SP ranges of at least 256MB size. This could be specified in the kernel parameter variable efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x1 & 0x14000 physical address. efi_fake_mem=1G@0x1:0x4,1G@0x14000:0x4 Signed-off-by: Alex Si

[PATCH v4 13/13] tools: update test_hmm script to support SP config

2021-07-17 Thread 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 generic. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/test_hmm.sh

[PATCH v1 0/3] split vm_normal_pages for LRU and non-LRU handling

2022-03-10 Thread Alex Sierra
est called hmm_cow_in_device, will test pages marked as COW, allocated in device zone. Also, more configurations were added into hmm_gup_test to test basic get user pages and get user pages fast paths in device zone pages. Alex Sierra (3): mm: split vm_normal_pages for LRU and non-LRU handling tools: ad

[PATCH v1 2/3] tools: add more gup configs to hmm_gup selftests

2022-03-10 Thread Alex Sierra
Test device pages with get_user_pages and get_user_pages_fast. The motivation is to test device coherent type pages in the gup and gup fast paths, after vm_normal_pages was split into LRU and non-LRU handled. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling --- tools/testing/selftests/vm

[PATCH v1 3/3] tools: add selftests to hmm for COW in device memory

2022-03-10 Thread Alex Sierra
are duplicated directly from device memory. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling --- tools/testing/selftests/vm/hmm-tests.c | 80 ++ 1 file changed, 80 insertions(+) diff --git a/tools/testing/selftests/vm/hmm-tests.c b/tools/testing/selftests/vm/hmm

[PATCH v1 1/3] mm: split vm_normal_pages for LRU and non-LRU handling

2022-03-10 Thread Alex Sierra
, to allow callers to specify that they expect to put pages on an LRU list. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling --- fs/proc/task_mmu.c | 12 ++-- include/linux/mm.h | 11 +++ mm/gup.c| 10 ++ mm/hmm.c| 2 +- mm/huge_memory.c|

[PATCH] mm: split vm_normal_pages for LRU and non-LRU handling

2022-02-28 Thread Alex Sierra
callers to specify that they expect to put pages on an LRU list. Signed-off-by: Alex Sierra --- fs/proc/task_mmu.c | 12 +- include/linux/mm.h | 53 - mm/gup.c| 10 + mm/hmm.c| 2 +- mm/huge_memory.c|

[PATCH v2 01/12] ext4/xfs: add page refcount helper

2021-09-13 Thread Alex Sierra
From: Ralph Campbell There are several places where ZONE_DEVICE struct pages assume a reference count == 1 means the page is idle and free. Instead of open coding this, add a helper function to hide this detail. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Reviewed-by: Christoph

[PATCH v2 00/12] MEMORY_DEVICE_PUBLIC for CPU-accessible coherent device memory

2021-09-13 Thread Alex Sierra
Minor changes: Swap patch order 03 and 04. Addings Add VM_BUG_ON_PAGE(page_ref_count(page), page) to patch 'drm/amdkfd: ref count init for device pages', to make sure page hasn't been used Alex Sierra (10): mm: add zone device public type memory support mm: add device public vma

[PATCH v2 03/12] mm: add zone device public type memory support

2021-09-13 Thread Alex Sierra
-off-by: Alex Sierra --- include/linux/memremap.h | 8 include/linux/mm.h | 8 mm/memcontrol.c | 6 +++--- mm/memory-failure.c | 6 +- mm/memremap.c| 2 ++ mm/migrate.c | 19 --- 6 files changed, 38 insertions

[PATCH v2 04/12] mm: add device public vma selection for memory migration

2021-09-13 Thread Alex Sierra
This case is used to migrate pages from device memory, back to system memory. Device public type memory is cache coherent from device and CPU point of view. Signed-off-by: Alex Sierra --- v2: condition added when migrations from device public pages. --- include/linux/migrate.h | 1 + mm

[PATCH v2 06/12] drm/amdkfd: add SPM support for SVM

2021-09-13 Thread Alex Sierra
. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- v7: Remove lookup_resource call, so export symbol for this function is not longer required. Patch dropped "kernel: resource: lookup_resource as exported symbol" --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 32 +++--

[PATCH v2 05/12] drm/amdkfd: ref count init for device pages

2021-09-13 Thread Alex Sierra
Ref counter from device pages is init to zero during memmap init zone. The first time a new device page is allocated to migrate data into it, its ref counter needs to be initialized to one. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 1 file changed, 2

[PATCH v2 07/12] drm/amdkfd: public type as sys mem on migration to ram

2021-09-13 Thread Alex Sierra
Public 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 Public type case, should be set as MIGRATE_VMA_SELECT_DEVICE_PUBLIC. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm

[PATCH v2 02/12] mm: remove extra ZONE_DEVICE struct page refcount

2021-09-13 Thread Alex Sierra
count doesn't need to be treated specially for ZONE_DEVICE. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Reviewed-by: Christoph Hellwig --- v2: AS: merged this patch in linux 5.11 version v5: AS: add condition at try_grab_page to check for the zone device type, while pag

[PATCH v2 11/12] tools: update hmm-test to support device public type

2021-09-13 Thread Alex Sierra
migrate_ping_pong test case added to test explicit migration from device to sys memory for both private and public zone types. Helpers to migrate from device to sys memory and vicerversa were also added. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/hmm-tests.c | 142

[PATCH v2 08/12] lib: test_hmm add ioctl to get zone device type

2021-09-13 Thread Alex Sierra
new ioctl cmd added to query zone device type. This will be used once the test_hmm adds zone device public type. Signed-off-by: Alex Sierra --- lib/test_hmm.c | 15 ++- lib/test_hmm_uapi.h | 7 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib

[PATCH v2 09/12] lib: test_hmm add module param for zone device type

2021-09-13 Thread Alex Sierra
In order to configure device public 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 --- v5: Remove de

[PATCH v2 12/12] tools: update test_hmm script to support SP config

2021-09-13 Thread 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 public. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/test_hmm.sh

[PATCH v2 10/12] lib: add support for device public type in test_hmm

2021-09-13 Thread Alex Sierra
supports two different SP ranges of at least 256MB size. This could be specified in the kernel parameter variable efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x1 & 0x14000 physical address. Ex. efi_fake_mem=1G@0x1:0x4,1G@0x14000:0x4 Signed-off-by: Alex Si

[PATCH v1 00/12] MEMORY_DEVICE_COHERENT for CPU-accessible coherent device memory

2021-10-12 Thread Alex Sierra
builds on HMM and our SVM memory manager already merged in 5.14. We would like to complete review and merge this migration patchset for 5.16. Alex Sierra (10): mm: add zone device coherent type memory support mm: add device coherent vma selection for memory migration drm/amdkfd: ref count init

[PATCH v1 01/12] ext4/xfs: add page refcount helper

2021-10-12 Thread Alex Sierra
From: Ralph Campbell There are several places where ZONE_DEVICE struct pages assume a reference count == 1 means the page is idle and free. Instead of open coding this, add a helper function to hide this detail. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Reviewed-by: Christoph

[PATCH v1 02/12] mm: remove extra ZONE_DEVICE struct page refcount

2021-10-12 Thread Alex Sierra
count doesn't need to be treated specially for ZONE_DEVICE. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Reviewed-by: Christoph Hellwig --- v2: AS: merged this patch in linux 5.11 version v5: AS: add condition at try_grab_page to check for the zone device type, while pag

[PATCH v1 04/12] mm: add device coherent vma selection for memory migration

2021-10-12 Thread 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 --- v2: condition added when migrations from device coherent pages. --- include/linux/migrate.h | 1 + mm

[PATCH v1 06/12] drm/amdkfd: add SPM support for SVM

2021-10-12 Thread Alex Sierra
. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- v7: Remove lookup_resource call, so export symbol for this function is not longer required. Patch dropped "kernel: resource: lookup_resource as exported symbol" --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 32 +++--

[PATCH v1 03/12] mm: add zone device coherent type memory support

2021-10-12 Thread Alex Sierra
-off-by: Alex Sierra --- include/linux/memremap.h | 8 include/linux/mm.h | 8 mm/memcontrol.c | 6 +++--- mm/memory-failure.c | 6 +- mm/memremap.c| 2 ++ mm/migrate.c | 19 --- 6 files changed, 38 insertions

[PATCH v1 07/12] drm/amdkfd: coherent type as sys mem on migration to ram

2021-10-12 Thread 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 Kuehling --- drivers

[PATCH v1 08/12] lib: test_hmm add ioctl to get zone device type

2021-10-12 Thread 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 --- lib/test_hmm.c | 15 ++- lib/test_hmm_uapi.h | 7 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib

[PATCH v1 09/12] lib: test_hmm add module param for zone device type

2021-10-12 Thread 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 --- lib/test_h

[PATCH v1 05/12] drm/amdkfd: ref count init for device pages

2021-10-12 Thread Alex Sierra
Ref counter from device pages is init to zero during memmap init zone. The first time a new device page is allocated to migrate data into it, its ref counter needs to be initialized to one. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 1 file changed, 2

[PATCH v1 10/12] lib: add support for device coherent type in test_hmm

2021-10-12 Thread Alex Sierra
supports two different SP ranges of at least 256MB size. This could be specified in the kernel parameter variable efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x1 & 0x14000 physical address. Ex. efi_fake_mem=1G@0x1:0x4,1G@0x14000:0x4 Signed-off-by: Alex Si

[PATCH v1 12/12] tools: update test_hmm script to support SP config

2021-10-12 Thread 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 --- tools/testing/selftests/vm/test_hm

[PATCH v1 11/12] tools: update hmm-test to support device coherent type

2021-10-12 Thread Alex Sierra
migrate_ping_pong test case added to test explicit migration from device to sys memory for both private and coherent zone types. Helpers to migrate from device to sys memory and vicerversa were also added. Signed-off-by: Alex Sierra --- tools/testing/selftests/vm/hmm-tests.c | 137

[PATCH v1 2/2] mm: remove extra ZONE_DEVICE struct page refcount

2021-10-14 Thread Alex Sierra
count doesn't need to be treated specially for ZONE_DEVICE. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Reviewed-by: Christoph Hellwig --- v2: AS: merged this patch in linux 5.11 version v5: AS: add condition at try_grab_page to check for the zone device type, while pag

[PATCH v1 0/2] mm: remove extra ZONE_DEVICE struct page refcount

2021-10-14 Thread Alex Sierra
This patch cleans up ZONE_DEVICE page refcounting. Quoting Matthew Wilcox, "it removes a ton of cruft from every call to put_page()" This work was originally done by Ralph Campbell and submitted as RFC. As of today, it has been ack by Theodore Ts'o / Darrick J. Wong, and reviewed by Christoph Hellw

[PATCH v1 1/2] ext4/xfs: add page refcount helper

2021-10-14 Thread Alex Sierra
From: Ralph Campbell There are several places where ZONE_DEVICE struct pages assume a reference count == 1 means the page is idle and free. Instead of open coding this, add a helper function to hide this detail. Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Reviewed-by: Christoph

[PATCH v4 01/10] mm: add zone device coherent type memory support

2022-01-26 Thread Alex Sierra
. Signed-off-by: Alex Sierra --- v4: - use the same system entry path for coherent device pages at migrate_vma_insert_page. - Add coherent device type support for try_to_migrate / try_to_migrate_one. --- include/linux/memremap.h | 8 +++ include/linux/mm.h | 16 ++ mm/memcontrol.c

[PATCH v4 00/10] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping

2022-01-26 Thread Alex Sierra
_migrate_one. - Include number of coherent device pages successfully migrated back to system at test_hmm. Made the proper changes to hmm-test to read/check this number. Alex Sierra (10): mm: add zone device coherent type memory support mm: add device coherent vma selection for memory

[PATCH v4 02/10] mm: add device coherent vma selection for memory migration

2022-01-26 Thread 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 --- v2: condition added when migrations from device coherent pages. --- include/linux/migrate.h | 1 + mm

[PATCH v4 06/10] lib: test_hmm add ioctl to get zone device type

2022-01-26 Thread 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 --- lib/test_hmm.c | 23 +-- lib/test_hmm_uapi.h | 8 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a

[PATCH v4 08/10] lib: add support for device coherent type in test_hmm

2022-01-26 Thread Alex Sierra
e easily accessed from user space through /dev/hmm_mirror. Usually num_device 0 and 1 are for private, and 2 and 3 for coherent types. If no module parameters are passed, two instances of private type device_mirror will be created only. Signed-off-by: Alex Sierra --- v4: Return number of coherent devi

[PATCH v4 04/10] drm/amdkfd: add SPM support for SVM

2022-01-26 Thread Alex Sierra
. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- v7: Remove lookup_resource call, so export symbol for this function is not longer required. Patch dropped "kernel: resource: lookup_resource as exported symbol" --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 29 +++--

[PATCH v4 07/10] lib: test_hmm add module param for zone device type

2022-01-26 Thread 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 --- lib/test_h

[PATCH v4 09/10] tools: update hmm-test to support device coherent type

2022-01-26 Thread Alex Sierra
migrate_ping_pong test case added to test explicit migration from device to sys memory for both private and coherent zone types. Helpers to migrate from device to sys memory and vicerversa were also added. Signed-off-by: Alex Sierra --- v2: Set FIXTURE_VARIANT to add multiple device types to the

[PATCH v4 05/10] drm/amdkfd: coherent type as sys mem on migration to ram

2022-01-26 Thread 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 Kuehling --- drivers

  1   2   3   4   >