[PATCH] drm/amdgpu: Force order between a read and write to the same address

2023-11-18 Thread Alex Sierra
Setting register to force ordering to prevent read/write or write/read hazards for un-cached modes. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c| 22 +-- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c| 8 +++ .../include/asic_reg/gc

[PATCH] drm/amdgpu: Force order between a read and write to the same address

2023-11-20 Thread Alex Sierra
Setting register to force ordering to prevent read/write or write/read hazards for un-cached modes. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c| 8 .../gpu/drm/amd/include/asic_reg/gc/gc_11_0_0_offset.h| 2 ++ 2 files changed, 10

[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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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] drm/amdkfd: drop process ref count when xnack disable

2021-08-31 Thread Alex Sierra
During svm restore pages interrupt handler, kfd_process ref count was never dropped when xnack was disabled. Therefore, the object was never released. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a

[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 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 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 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 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 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 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 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 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] amd/amdkfd: remove svms declaration to avoid werror

2021-09-30 Thread Alex Sierra
svm_range_list svms declaration removed to avoid werror when CONFIG_HSA_AMD_SVM is not enabled. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b

[PATCH] drm/amdkfd: rm BO resv on validation to avoid deadlock

2021-10-07 Thread Alex Sierra
x27;t need to hold the BO reservation anymore during validation and mapping. Now the physical addresses are taken from hmm_range_fault. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm

[PATCH] drm/amdkfd: rm BO resv on validation to avoid deadlock

2021-10-07 Thread Alex Sierra
x27;t need to hold the BO reservation anymore during validation and mapping. Now the physical addresses are taken from hmm_range_fault. We also take migrate_mutex to prevent range migration while validate_and_map update GPU page table. Signed-off-by: Alex Sierra Signed-off-by: Felix Kue

[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 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 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 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 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 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 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 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 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 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 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] drm/amdkfd: avoid recursive lock in migrations back to RAM

2021-11-01 Thread Alex Sierra
ction. If equal, the migration will be ignored. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 drivers/gpu/drm/amd/amdkfd/kfd_priv.h| 1 + drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/amd/

[PATCH] drm/amdkfd: avoid recursive lock in migrations back to RAM

2021-11-01 Thread Alex Sierra
mber is checked against "current" reference at svm_migrate_to_ram callback function. If equal, the migration will be ignored. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 drivers/gpu/drm/amd/amdkfd/kfd_priv.h| 1 + drivers/gpu/drm/amd/amdkfd/kfd_

[PATCH] drm/amdkfd: lower the VAs base offset to 8KB

2021-11-05 Thread Alex Sierra
space to map memory at this low region. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c b/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c index 2e86692def19

[PATCH v1 1/9] mm: add zone device coherent type memory support

2021-11-15 Thread Alex Sierra
. Signed-off-by: Alex Sierra --- include/linux/memremap.h | 8 include/linux/mm.h | 9 + mm/memcontrol.c | 6 +++--- mm/memory-failure.c | 6 +- mm/memremap.c| 5 - mm/migrate.c | 21 + 6 files changed, 42

[PATCH v1 3/9] drm/amdkfd: add SPM support for SVM

2021-11-15 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 5/9] lib: test_hmm add ioctl to get zone device type

2021-11-15 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 4/9] drm/amdkfd: coherent type as sys mem on migration to ram

2021-11-15 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 9/9] tools: update test_hmm script to support SP config

2021-11-15 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 2/9] mm: add device coherent vma selection for memory migration

2021-11-15 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 6/9] lib: test_hmm add module param for zone device type

2021-11-15 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 7/9] lib: add support for device coherent type in test_hmm

2021-11-15 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 0/9] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping

2021-11-15 Thread Alex Sierra
and our SVM memory manager already merged in 5.15. Alex Sierra (9): mm: add zone device coherent type memory support mm: add device coherent vma selection for memory migration drm/amdkfd: add SPM support for SVM drm/amdkfd: coherent type as sys mem on migration to ram lib: test_hmm add

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

2021-11-15 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 | 156

[PATCH v1 0/2] Remove extra ZONE_DEVICE page refcount

2021-11-15 Thread Alex Sierra
This patch includes Ralph Campbell’s ZONE_DEVICE refcount cleanup and additionally the changes necessary to avoid breaking the separately submitted MEMORY_DEVICE_COHERENT page migration code. Ralph’s original description: ZONE_DEVICE struct pages have an extra reference count that complicates the c

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

2021-11-15 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 --- arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 +- drivers/gpu/drm/nouveau/nouveau_d

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

2021-11-15 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 02/11] mm: add device coherent vma selection for memory migration

2021-12-06 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 v2 00/11] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping

2021-12-06 Thread Alex Sierra
new hmm_gup_test has been added to the hmm-test to test this functionality. It makes use of the gup_test module to long term pin user pages that have been migrate to device memory first. - Other patch corrections made by Felix, Alistair and Christoph. Alex Sierra (11): mm: add zone device cohe

[PATCH v2 03/11] mm/gup: migrate PIN_LONGTERM dev coherent pages to system

2021-12-06 Thread Alex Sierra
Avoid long term pinning for Coherent device type pages. This could interfere with their own device memory manager. If caller tries to get user device coherent pages with PIN_LONGTERM flag set, those pages will be migrated back to system memory. Signed-off-by: Alex Sierra --- mm/gup.c | 32

[PATCH v2 04/11] drm/amdkfd: add SPM support for SVM

2021-12-06 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 v2 07/11] lib: test_hmm add module param for zone device type

2021-12-06 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 v2 01/11] mm: add zone device coherent type memory support

2021-12-06 Thread Alex Sierra
. Signed-off-by: Alex Sierra --- include/linux/memremap.h | 8 include/linux/mm.h | 16 mm/memcontrol.c | 6 +++--- mm/memory-failure.c | 8 ++-- mm/memremap.c| 5 - mm/migrate.c | 21 + 6 files changed

  1   2   3   4   5   >