[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] 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/amdkfd: remap unaligned svm ranges that have split

2023-10-19 Thread Alex Sierra
Split SVM ranges that have been mapped into 2MB page table entries, require to be remap in case the split has happened in a non-aligned VA. [WHY]: This condition causes the 2MB page table entries be split into 4KB PTEs. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 43

[PATCH] drm/amdkfd: remap unaligned svm ranges that have split

2023-10-18 Thread Alex Sierra
Split SVM ranges that have been mapped into 2MB page table entries, require to be remap in case the split has happened in a non-aligned VA. [WHY]: This condition causes the 2MB page table entries be split into 4KB PTEs. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 45

[PATCH] drm/amdkfd: use mask to get v9 interrupt sq data bits correctly

2023-08-28 Thread Alex Sierra
Interrupt sq data bits were not taken properly from contextid0 and contextid1. Use macro KFD_CONTEXT_ID_GET_SQ_INT_DATA instead. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd

[PATCH] drm/amdkfd: retry after EBUSY is returned from hmm_ranges_get_pages

2023-08-16 Thread Alex Sierra
if hmm_range_get_pages returns EBUSY error during svm_range_validate_and_map, within the context of a page fault interrupt. This should retry through svm_range_restore_pages callback. Therefore we treat this as EAGAIN error instead, and defer it to restore pages fallback. Signed-off-by: Alex

[PATCH] drm/amdkfd: wrap dynamic debug call with CONFIG_DYNAMIC_DEBUG_CORE

2023-08-04 Thread Alex Sierra
This causes error compilation if CONFIG_DYNAMIC_DEBUG_CORE is not defined. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index a69994ff1c2f

[PATCH] drm/amdkfd: avoid unmap dma address when svm_ranges are split

2023-07-28 Thread Alex Sierra
DMA address reference within svm_ranges should be unmapped only after the memory has been released from the system. In case of range splitting, the DMA address information should be copied to the corresponding range after this has split. But leaving dma mapping intact. Signed-off-by: Alex Sierra

[PATCH] drm/amdkfd: avoid unmap dma address when svm_ranges are split

2023-07-27 Thread Alex Sierra
DMA address reference within svm_ranges should be unmapped only after the memory has been released from the system. In case of range splitting, the DMA address information should be copied to the corresponding range after this has split. But leaving dma mapping intact. Signed-off-by: Alex Sierra

[PATCH] drm/amdkfd: avoid svm dump when dynamic debug disabled

2023-07-19 Thread Alex Sierra
to print svm_range_debug_dump debug traces. Signed-off-by: Alex Sierra Tested-by: Alex Sierra Signed-off-by: Philip Yang Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd

[PATCH] drm/amdkfd: avoid svm dump when dynamic debug disabled

2023-07-19 Thread Alex Sierra
to print svm_range_debug_dump debug traces. Signed-off-by: Alex Sierra Tested-by: Alex Sierra Signed-off-by: Philip Yang Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion

[PATCH] drm/amdkfd: avoid svm dump when dynamic debug disabled

2023-07-08 Thread Alex Sierra
svm_range_debug_dump should not be called at all when dynamic debug is disabled to avoid iterating over SVM lists. This could drop performance, specially with big number of SVM ranges. Signed-off-by: Alex Sierra Signed-off-by: Philip Yang --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 -- 1

[PATCH] drm/amdkfd: set coherent host access capability flag

2023-06-15 Thread Alex Sierra
This flag determines whether the host possesses coherent access to the memory of the device. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd

[PATCH] drm/amdkfd: set coherent host access capability flag

2023-06-15 Thread Alex Sierra
This flag determines whether the host possesses coherent access to the memory of the device. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd

[PATCH] drm/amdkfd: flag added to handle errors from svm validate and map

2023-05-29 Thread Alex Sierra
during the retry. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_svm.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index fcfde9140bce

[PATCH] drm/amd: SVM flag error added at svm_range flags

2023-05-29 Thread Alex Sierra
during the retry. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 12 +++- include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index

[PATCH] drm/amdgpu: improve wait logic at fence polling

2023-04-26 Thread Alex Sierra
Accomplish this by reading the seq number right away instead of sleep for 5us. There are certain cases where the fence is ready almost immediately. Sleep number granularity was also reduced as the majority of the kiq tlb flush takes between 2us to 6us. Signed-off-by: Alex Sierra --- drivers/gpu

[PATCH] drm/amdgpu: ensure no PCIe peer access for CPU XGMI iolinks

2022-08-29 Thread Alex Sierra
[Why] Devices with CPU XGMI iolink do not support PCIe peer access. Signed-off-by: Alex Sierra Acked-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu

[PATCH] drm/amdgpu: ensure no PCIe peer access for CPU XGMI iolinks

2022-08-26 Thread Alex Sierra
[Why] Devices with CPU XGMI iolink do not support PCIe peer access. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu

[PATCH v9 00/14] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping

2022-07-16 Thread Alex Sierra
uot;mm/gup: migrate device coherent pages when pinning instead of failing" with changes based on David Hildenbrand comments. - Replace moving page zone helpers into new header-specific file. Instead, those were moved to mmzone.h. Patch "mm: move page zone helpers from mm.h to mmzone.h"

[PATCH v9 08/14] lib: test_hmm add ioctl to get zone device type

2022-07-16 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 11 +-- lib/test_hmm_uapi.h

[PATCH] drm/amdkfd: track unified memory reservation with xnack off

2022-07-16 Thread Alex Sierra
: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 4 ++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 23 --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 60 +-- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

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

2022-07-16 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 Acked-by: Felix Kuehling Reviewed-by: Alis

[PATCH v9 07/14] drm/amdkfd: add SPM support for SVM

2022-07-16 Thread Alex Sierra
. Also, MIGRATE_VMA_SELECT_DEVICE_COHERENT flag is selected for coherent type case during migration to device. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 34 +++- 1 file changed, 21

[PATCH v9 04/14] mm: handling Non-LRU pages returned by vm_normal_pages

2022-07-16 Thread Alex Sierra
ently don't expect ZONE_DEVICE pages, however, with DEVICE_COHERENT we might now return ZONE_DEVICE. Check for ZONE_DEVICE pages in applicable users of follow_page() as well. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling (v2) Reviewed-by: Alistair Popple (v6) --- fs/proc/task_mmu.c |

[PATCH v9 14/14] tools: add selftests to hmm for COW in device memory

2022-07-16 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 v9 06/14] mm/gup: migrate device coherent pages when pinning instead of failing

2022-07-16 Thread Alex Sierra
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 pages.

[PATCH v9 13/14] tools: add hmm gup tests for device coherent type

2022-07-16 Thread Alex Sierra
The intention is to test hmm device coherent type under different get user pages paths. Also, test gup with FOLL_LONGTERM flag set in device coherent pages. These pages should get migrated back to system memory. Signed-off-by: Alex Sierra Reviewed-by: Alistair Popple --- tools/testing

[PATCH v9 09/14] lib: test_hmm add module param for zone device type

2022-07-16 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 Acked-by: F

[PATCH v9 10/14] lib: add support for device coherent type in test_hmm

2022-07-16 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 Acked-by: Felix Kuehling Reviewed-by:

[PATCH v9 03/14] mm: add zone device coherent type memory support

2022-07-16 Thread Alex Sierra
. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Popple [hch: rebased ontop of the refcount changes, removed is_dev_private_or_coherent_page] Signed-off-by: Christoph Hellwig Acked-by: David Hildenbrand --- include/linux/memremap.h | 19 +++ include

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

2022-07-16 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Popple Signed-off-by

[PATCH v9 01/14] mm: rename is_pinnable_pages to is_longterm_pinnable_pages

2022-07-16 Thread Alex Sierra
is_pinnable_page() and folio_is_pinnable() were renamed to is_longterm_pinnable_page() and folio_is_longterm_pinnable() respectively. These functions are used in the FOLL_LONGTERM flag context. Signed-off-by: Alex Sierra Reviewed-by: David Hildenbrand --- include/linux/mm.h | 8 mm

[PATCH v9 02/14] mm: move page zone helpers from mm.h to mmzone.h

2022-07-16 Thread Alex Sierra
[WHY] It makes more sense to have these helpers in zone specific header file, rather than the generic mm.h Signed-off-by: Alex Sierra --- include/linux/memremap.h | 2 +- include/linux/mm.h | 78 --- include/linux/mmzone.h | 80

[PATCH v9 05/14] mm: add device coherent vma selection for memory migration

2022-07-16 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig Reviewed-by: David

[PATCH] mm: move page zone helpers from mm.h to mmzone.h

2022-07-14 Thread Alex Sierra
[WHY] It makes more sense to have these helpers in zone specific header file, rather than the generic mm.h Signed-off-by: Alex Sierra --- include/linux/memremap.h | 2 +- include/linux/mm.h | 78 --- include/linux/mmzone.h | 80

[PATCH 3/3] drm/amdgpu: add debugfs for kfd system and ttm mem used

2022-07-11 Thread Alex Sierra
This keeps track of kfd system mem used and kfd ttm mem used. Signed-off-by: Alex Sierra Reviewed-by: Philip Yang --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 3 +++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 19 +++ drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c

[PATCH 2/3] drm/amdkfd: track unified memory reservation with xnack off

2022-07-11 Thread Alex Sierra
: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 4 ++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 25 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 60 +-- 3 files changed, 60 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH 1/3] drm/amdgpu: remove acc_size from reserve/unreserve mem

2022-07-11 Thread Alex Sierra
need to track it any more. Signed-off-by: Alex Sierra Reviewed-by: Philip Yang Reviewed-by: Felix Kuehling Acked-by: Christian König --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 60 ++- 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH v8 15/15] tools: add selftests to hmm for COW in device memory

2022-07-07 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 v8 12/15] tools: update hmm-test to support device coherent type

2022-07-07 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Popple Signed-off-by

[PATCH v8 14/15] tools: add hmm gup tests for device coherent type

2022-07-07 Thread Alex Sierra
The intention is to test hmm device coherent type under different get user pages paths. Also, test gup with FOLL_LONGTERM flag set in device coherent pages. These pages should get migrated back to system memory. Signed-off-by: Alex Sierra Reviewed-by: Alistair Popple --- tools/testing

[PATCH v8 10/15] lib: test_hmm add module param for zone device type

2022-07-07 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 Acked-by: F

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

2022-07-07 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 Acked-by: Felix Kuehling Reviewed-by: Alis

[PATCH v8 11/15] lib: add support for device coherent type in test_hmm

2022-07-07 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 Acked-by: Felix Kuehling Reviewed-by:

[PATCH v8 09/15] lib: test_hmm add ioctl to get zone device type

2022-07-07 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 11 +-- lib/test_hmm_uapi.h

[PATCH v8 07/15] mm/gup: migrate device coherent pages when pinning instead of failing

2022-07-07 Thread Alex Sierra
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 pages.

[PATCH v8 08/15] drm/amdkfd: add SPM support for SVM

2022-07-07 Thread Alex Sierra
. Also, MIGRATE_VMA_SELECT_DEVICE_COHERENT flag is selected for coherent type case during migration to device. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 34 +++- 1 file changed, 21

[PATCH v8 06/15] mm: remove the vma check in migrate_vma_setup()

2022-07-07 Thread Alex Sierra
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

[PATCH v8 01/15] mm: rename is_pinnable_pages to is_longterm_pinnable_pages

2022-07-07 Thread Alex Sierra
is_pinnable_page() and folio_is_pinnable() were renamed to is_longterm_pinnable_page() and folio_is_longterm_pinnable() respectively. These functions are used in the FOLL_LONGTERM flag context. Signed-off-by: Alex Sierra --- include/linux/mm.h | 8 mm/gup.c | 4 ++-- mm

[PATCH v8 04/15] mm: handling Non-LRU pages returned by vm_normal_pages

2022-07-07 Thread Alex Sierra
ently don't expect ZONE_DEVICE pages, however, with DEVICE_COHERENT we might now return ZONE_DEVICE. Check for ZONE_DEVICE pages in applicable users of follow_page() as well. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling (v2) Reviewed-by: Alistair Popple (v6) --- fs/proc/task_mmu.c |

[PATCH v8 05/15] mm: add device coherent vma selection for memory migration

2022-07-07 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig Reviewed-by: David

[PATCH v8 02/15] mm: move page zone helpers into new header-specific file

2022-07-07 Thread Alex Sierra
[WHY] Have a cleaner way to expose all page zone helpers in one header file, rather than split them between mm.h and memremap.h files. Signed-off-by: Alex Sierra --- drivers/infiniband/core/rw.c | 1 - drivers/nvme/target/io-cmd-bdev.c | 1 - include/linux/memremap.h | 113

[PATCH v8 03/15] mm: add zone device coherent type memory support

2022-07-07 Thread Alex Sierra
. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Popple [hch: rebased ontop of the refcount changes, removed is_dev_private_or_coherent_page] Signed-off-by: Christoph Hellwig Acked-by: David Hildenbrand --- include/linux/mm.h| 4 +++- include/linux

[PATCH v8 00/15] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping

2022-07-07 Thread Alex Sierra
er for LRU pages handling instead. v8: - Add "mm: move page zone helpers into new header-specific file" patch. The intention is to centralize all page zone helpers and keep them independent from mm.h and memremap.h. Alex Sierra (13): mm: rename is_pinnable_pages to is_longterm_pinn

[PATCH v7 14/14] tools: add selftests to hmm for COW in device memory

2022-06-28 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 v7 13/14] tools: add hmm gup tests for device coherent type

2022-06-28 Thread Alex Sierra
The intention is to test hmm device coherent type under different get user pages paths. Also, test gup with FOLL_LONGTERM flag set in device coherent pages. These pages should get migrated back to system memory. Signed-off-by: Alex Sierra Reviewed-by: Alistair Popple --- tools/testing

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

2022-06-28 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Popple Signed-off-by

[PATCH v7 05/14] mm: remove the vma check in migrate_vma_setup()

2022-06-28 Thread Alex Sierra
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

[PATCH v7 09/14] lib: test_hmm add module param for zone device type

2022-06-28 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 Acked-by: F

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

2022-06-28 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 Acked-by: Felix Kuehling Reviewed-by: Alis

[PATCH v7 08/14] lib: test_hmm add ioctl to get zone device type

2022-06-28 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 11 +-- lib/test_hmm_uapi.h

[PATCH v7 07/14] drm/amdkfd: add SPM support for SVM

2022-06-28 Thread Alex Sierra
. Also, MIGRATE_VMA_SELECT_DEVICE_COHERENT flag is selected for coherent type case during migration to device. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 34 +++- 1 file changed, 21

[PATCH v7 06/14] mm/gup: migrate device coherent pages when pinning instead of failing

2022-06-28 Thread Alex Sierra
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 pages.

[PATCH v7 10/14] lib: add support for device coherent type in test_hmm

2022-06-28 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 Acked-by: Felix Kuehling Reviewed-by:

[PATCH v7 03/14] mm: handling Non-LRU pages returned by vm_normal_pages

2022-06-28 Thread Alex Sierra
xpect LRU pages, are also checked for device zone pages due to DEVICE_COHERENT type. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling (v2) Reviewed-by: Alistair Popple (v6) --- fs/proc/task_mmu.c | 2 +- mm/huge_memory.c | 2 +- mm/khugepaged.c| 9 ++--- mm/ksm.c | 6 +++--

[PATCH v7 04/14] mm: add device coherent vma selection for memory migration

2022-06-28 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- include/linux

[PATCH v7 01/14] mm: rename is_pinnable_pages to is_pinnable_longterm_pages

2022-06-28 Thread Alex Sierra
is_pinnable_page() and folio_is_pinnable() were renamed to is_longterm_pinnable_page() and folio_is_longterm_pinnable() respectively. These functions are used in the FOLL_LONGTERM flag context. Signed-off-by: Alex Sierra --- include/linux/memremap.h | 24 include/linux

[PATCH v7 02/14] mm: add zone device coherent type memory support

2022-06-28 Thread Alex Sierra
. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Popple [hch: rebased ontop of the refcount changes, removed is_dev_private_or_coherent_page] Signed-off-by: Christoph Hellwig --- include/linux/memremap.h | 22 +- mm/memcontrol.c | 7

[PATCH v7 00/14] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping

2022-06-28 Thread Alex Sierra
hmm and selftest/vm/hmm-test.c. v6: - Rebase to 5.19.0-rc4 - Rename is_pinnable_page to is_longterm_pinnable_page and add a coherent device checker. - Add a new gup test to hmm-test to cover fast pinnable case with FOLL_LONGTERM. v7: - Reorder patch series. - Remove FOLL_LRU and check on each

[PATCH 3/3] drm/amdgpu: add debugfs for kfd system and ttm mem used

2022-06-27 Thread Alex Sierra
This keeps track of kfd system mem used and kfd ttm mem used. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 3 +++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 19 +++ drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c | 2 ++ 3 files changed, 24

[PATCH 2/3] drm/amdkfd: track unified memory reservation with xnack off

2022-06-27 Thread Alex Sierra
: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 4 ++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 25 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 58 +-- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH 1/3] drm/amdgpu: remove acc_size from reserve/unreserve mem

2022-06-27 Thread Alex Sierra
need to track it any more. Signed-off-by: Alex Sierra Reviewed-by: Philip Yang Reviewed-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 60 ++- 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/d

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

2022-06-27 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 Acked-by: Felix Kuehling Reviewed-by: Alis

[PATCH v6 10/14] lib: add support for device coherent type in test_hmm

2022-06-27 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 Acked-by: Felix Kuehling Reviewed-by:

[PATCH v6 13/14] tools: add hmm gup tests for device coherent type

2022-06-27 Thread Alex Sierra
The intention is to test hmm device coherent type under different get user pages paths. Also, test gup with FOLL_LONGTERM flag set in device coherent pages. These pages should get migrated back to system memory. Signed-off-by: Alex Sierra Reviewed-by: Alistair Popple --- tools/testing

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

2022-06-27 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Popple Signed-off-by

[PATCH v6 14/14] tools: add selftests to hmm for COW in device memory

2022-06-27 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 v6 08/14] lib: test_hmm add ioctl to get zone device type

2022-06-27 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 11 +-- lib/test_hmm_uapi.h

[PATCH v6 07/14] drm/amdkfd: add SPM support for SVM

2022-06-27 Thread Alex Sierra
. Also, MIGRATE_VMA_SELECT_DEVICE_COHERENT flag is selected for coherent type case during migration to device. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 34 +++- 1 file changed, 21

[PATCH v6 06/14] mm: add device coherent checker to is_pinnable_page

2022-06-27 Thread Alex Sierra
is_device_coherent checker was added to is_pinnable_page and renamed to is_longterm_pinnable_page. The reason is that device coherent pages are not supported for longterm pinning. Signed-off-by: Alex Sierra --- include/linux/memremap.h | 25 + include/linux/mm.h

[PATCH v6 09/14] lib: test_hmm add module param for zone device type

2022-06-27 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 Acked-by: F

[PATCH v6 03/14] mm: add device coherent vma selection for memory migration

2022-06-27 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- include/linux

[PATCH v6 04/14] mm: remove the vma check in migrate_vma_setup()

2022-06-27 Thread Alex Sierra
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

[PATCH v6 05/14] mm/gup: migrate device coherent pages when pinning instead of failing

2022-06-27 Thread Alex Sierra
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 pages.

[PATCH v6 02/14] mm: handling Non-LRU pages returned by vm_normal_pages

2022-06-27 Thread Alex Sierra
flag that adds the same behaviour to follow_page and related APIs, to allow callers to specify that they expect to put pages on an LRU list. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Popple --- fs/proc/task_mmu.c | 2 +- include/linux/mm.h | 3 ++- mm/

[PATCH v6 01/14] mm: add zone device coherent type memory support

2022-06-27 Thread Alex Sierra
. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Popple [hch: rebased ontop of the refcount changes, removed is_dev_private_or_coherent_page] Signed-off-by: Christoph Hellwig --- include/linux/memremap.h | 19 +++ mm/memcontrol.c | 7

[PATCH v6 00/14] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping

2022-06-27 Thread Alex Sierra
hmm and selftest/vm/hmm-test.c. v6: - Rebase to 5.19.0-rc4 - Rename is_pinnable_page to is_longterm_pinnable_page and add a coherent device checker. - Add a new gup test to hmm-test to cover fast pinnable case with FOLL_LONGTERM Alex Sierra (12): mm: add zone device coherent type memory sup

[PATCH 2/2] drm/amdkfd: track unified memory reservation with xnack off

2022-06-07 Thread Alex Sierra
: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 4 ++ .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 27 ++- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 47 +-- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH 1/2] drm/amdgpu: remove acc_size from reserve/unreserve mem

2022-06-07 Thread Alex Sierra
need to track it any more. Signed-off-by: Alex Sierra Reviewed-by: Philip Yang Reviewed-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 59 ++- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/d

[PATCH v5 12/13] tools: add hmm gup tests for device coherent type

2022-05-31 Thread Alex Sierra
The intention is to test hmm device coherent type under different get user pages paths. Also, test gup with FOLL_LONGTERM flag set in device coherent pages. These pages should get migrated back to system memory. Signed-off-by: Alex Sierra Reviewed-by: Alistair Popple --- tools/testing

[PATCH v5 13/13] tools: add selftests to hmm for COW in device memory

2022-05-31 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 v5 11/13] tools: update test_hmm script to support SP config

2022-05-31 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 Acked-by: Felix Kuehling Reviewed-by: Alis

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

2022-05-31 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Popple Signed-off-by

[PATCH v5 09/13] lib: add support for device coherent type in test_hmm

2022-05-31 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 Acked-by: Felix Kuehling Reviewed-by:

[PATCH v5 03/13] mm: add device coherent vma selection for memory migration

2022-05-31 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- include/linux

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

2022-05-31 Thread Alex Sierra
. Also, MIGRATE_VMA_SELECT_DEVICE_COHERENT flag is selected for coherent type case during migration to device. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 34 +++- 1 file changed, 21

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

2022-05-31 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 Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 11 +-- lib/test_hmm_uapi.h

[PATCH v5 04/13] mm: remove the vma check in migrate_vma_setup()

2022-05-31 Thread Alex Sierra
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

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

2022-05-31 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 Acked-by: F

  1   2   3   4   5   >