Re: [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition

2021-07-27 Thread Felix Kuehling
Hi Huoqing, Your patch is technically correct. However, I don't think it fixes any actual bug, and it changes a code path that has no performance implications. Therefore I would just leave it as it is. Regards,   Felix Am 2021-07-20 um 2:34 a.m. schrieb Cai Huoqing: > no need to get error code

Re: [PATCH v3 0/8] Support DEVICE_GENERIC memory in migrate_vma_*

2021-07-30 Thread Felix Kuehling
Am 2021-07-23 um 6:46 p.m. schrieb Sierra Guiza, Alejandro (Alex): > > On 7/17/2021 2:54 PM, Sierra Guiza, Alejandro (Alex) wrote: >> >> On 7/16/2021 5:14 PM, Felix Kuehling wrote: >>> Am 2021-07-16 um 11:07 a.m. schrieb Theodore Y. Ts'o: >>>> On

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

2021-07-30 Thread Felix Kuehling
Am 2021-07-28 um 7:45 p.m. schrieb Sierra Guiza, Alejandro (Alex): > > On 7/22/2021 12:26 PM, Jason Gunthorpe wrote: >> On Thu, Jul 22, 2021 at 11:59:17AM -0500, Sierra Guiza, Alejandro >> (Alex) wrote: >>> On 7/22/2021 7:23 AM, Jason Gunthorpe wrote: On Sat, Jul 17, 2021 at 02:21:32PM -0500,

Re: [PATCH 3/8] drm/amdgpu: Implement mmap as GEM object function

2021-04-07 Thread Felix Kuehling
On 2021-04-07 7:25 a.m., Christian König wrote: +    /* + * Don't verify access for KFD BOs. They don't have a GEM + * object associated with them. + */ +    if (bo->kfd_bo) +    goto out; Who does the access verification now? This is somewhat confusing. I took this check as-is

Re: [PATCH 3/8] drm/amdgpu: Implement mmap as GEM object function

2021-04-07 Thread Felix Kuehling
On 2021-04-07 3:34 p.m., Felix Kuehling wrote: On 2021-04-07 7:25 a.m., Christian König wrote: +    /* + * Don't verify access for KFD BOs. They don't have a GEM + * object associated with them. + */ +    if (bo->kfd_bo) +    goto out; Who does the access ver

[PATCH 1/4] drm/amdkfd: Remove legacy code not acquiring VMs

2021-04-07 Thread Felix Kuehling
ROCm user mode has acquired VMs from DRM file descriptors for as long as it supported the upstream KFD. Legacy code to support older versions of ROCm is not needed any more. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 4 -- .../gpu/drm/amd/amdgpu

[PATCH 3/4] drm/amdkfd: Allow access for mmapping KFD BOs

2021-04-07 Thread Felix Kuehling
DRM allows access automatically when it creates a GEM handle for a BO. KFD BOs don't have GEM handles, so KFD needs to manage access manually. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 3 ++- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

[PATCH 2/4] drm/amdkfd: Use drm_priv to pass VM from KFD to amdgpu

2021-04-07 Thread Felix Kuehling
amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu needs the drm_priv to allow mmap to access the BO through the corresponding file descriptor. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 14 ++-- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 69

[PATCH 4/4] drm/amdgpu: Remove verify_access shortcut for KFD BOs

2021-04-07 Thread Felix Kuehling
This shortcut is no longer needed with access managed progerly by KFD. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index

Re: [PATCH 00/34] Add HMM-based SVM memory manager to KFD v4

2021-04-08 Thread Felix Kuehling
Am 2021-04-08 um 11:02 a.m. schrieb Jason Gunthorpe: > On Mon, Apr 05, 2021 at 09:45:55PM -0400, Felix Kuehling wrote: >> Rebased on upstream. Dropped already upstream patch >> "drm/amdgpu: reserve fence slot to update page table". >> >> Added more fixes:

Re: Linux Kernel build bug with AMD_IOMMU_V2=M and HSA_AMD=Y

2021-04-08 Thread Felix Kuehling
This should have been fixed by this commit in amd-staging-drm-next: https://lore.kernel.org/patchwork/patch/1392368/ commit b8aff1f3a0b3d8434f8ccf5d3017137c29aca77b Author: Felix Kuehling Date: Mon Mar 8 22:15:42 2021 -0500 drm/amdkfd: fix build error with AMD_IOMMU_V2=m Using

[PATCH 1/9] drm/amdgpu: Rename kfd_bo_va_list to kfd_mem_attachment

2021-04-13 Thread Felix Kuehling
This name is more fitting, especially for the changes coming next to support multi-GPU systems with proper DMA mappings. Cleaned up the code and renamed some related functions and variables to improve readability. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

[PATCH 2/9] drm/amdgpu: Keep a bo-reference per-attachment

2021-04-13 Thread Felix Kuehling
For now they all reference the same BO. For correct DMA mappings they will refer to different BOs per-GPU. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 22 ++- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd

[PATCH 0/9] Implement multi-GPU DMA mappings for KFD

2021-04-13 Thread Felix Kuehling
comments in this patch series where I'm hoping for some expert advice. Patches 8 and 9 are some related fixes in TTM and amdgpu_ttm. I'm pretty sure patch 9 is not the right way to do this. Felix Kuehling (9): drm/amdgpu: Rename kfd_bo_va_list to kfd_mem_attachment drm/amdgpu:

[PATCH 3/9] drm/amdgpu: Simplify AQL queue mapping

2021-04-13 Thread Felix Kuehling
amdgpu_amdkfd_gpuvm_free_memory_of_gpu. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 103 -- 1 file changed, 48 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu

[PATCH 5/9] drm/amdgpu: DMA map/unmap when updating GPU mappings

2021-04-13 Thread Felix Kuehling
DMA map kfd_mem_attachments in update_gpuvm_pte. This function is called with the BO and page tables reserved, so we can safely update the DMA mapping. DMA unmap when a BO is unmapped from a GPU and before updating mappings in restore workers. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd

[PATCH 4/9] drm/amdgpu: Add multi-GPU DMA mapping helpers

2021-04-13 Thread Felix Kuehling
Add BO-type specific helpers functions to DMA-map and unmap kfd_mem_attachments. Implement this functionality for userptrs by creating one SG BO per GPU and filling it with a DMA mapping of the pages from the original mem->bo. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amd

[PATCH 6/9] drm/amdgpu: Move kfd_mem_attach outside reservation

2021-04-13 Thread Felix Kuehling
This is needed to avoid deadlocks with DMA buf import in the next patch. Also move PT/PD validation out of kfd_mem_attach, that way the caller can bo this unconditionally. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 72 +++ 1 file changed

[PATCH 8/9] drm/ttm: Don't count pages in SG BOs against pages_limit

2021-04-13 Thread Felix Kuehling
Pages in SG BOs were not allocated by TTM. So don't count them against TTM's pages limit. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/ttm/ttm_tt.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/d

[PATCH 7/9] drm/amdgpu: Add DMA mapping of GTT BOs

2021-04-13 Thread Felix Kuehling
Use DMABufs with dynamic attachment to DMA-map GTT BOs on other GPUs. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 2 + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 74 ++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a

[PATCH 9/9] drm/amdgpu: Lock the attached dmabuf in unpopulate

2021-04-13 Thread Felix Kuehling
ind instead? Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 936b3cfdde55..257750921eed 100644 --- a/drivers/gpu/

[PATCH 0/9] Implement multi-GPU DMA mappings for KFD

2021-04-13 Thread Felix Kuehling
comments in this patch series where I'm hoping for some expert advice. Patches 8 and 9 are some related fixes in TTM and amdgpu_ttm. I'm pretty sure patch 9 is not the right way to do this. Felix Kuehling (9): drm/amdgpu: Rename kfd_bo_va_list to kfd_mem_attachment drm/amdgpu:

[PATCH 2/9] drm/amdgpu: Keep a bo-reference per-attachment

2021-04-13 Thread Felix Kuehling
For now they all reference the same BO. For correct DMA mappings they will refer to different BOs per-GPU. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 22 ++- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd

[PATCH 1/9] drm/amdgpu: Rename kfd_bo_va_list to kfd_mem_attachment

2021-04-13 Thread Felix Kuehling
This name is more fitting, especially for the changes coming next to support multi-GPU systems with proper DMA mappings. Cleaned up the code and renamed some related functions and variables to improve readability. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

[PATCH 3/9] drm/amdgpu: Simplify AQL queue mapping

2021-04-13 Thread Felix Kuehling
amdgpu_amdkfd_gpuvm_free_memory_of_gpu. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 103 -- 1 file changed, 48 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu

[PATCH 8/9] drm/ttm: Don't count pages in SG BOs against pages_limit

2021-04-13 Thread Felix Kuehling
Pages in SG BOs were not allocated by TTM. So don't count them against TTM's pages limit. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/ttm/ttm_tt.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/d

[PATCH 9/9] drm/amdgpu: Lock the attached dmabuf in unpopulate

2021-04-13 Thread Felix Kuehling
ind instead? Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 936b3cfdde55..257750921eed 100644 --- a/drivers/gpu/

[PATCH 4/9] drm/amdgpu: Add multi-GPU DMA mapping helpers

2021-04-13 Thread Felix Kuehling
Add BO-type specific helpers functions to DMA-map and unmap kfd_mem_attachments. Implement this functionality for userptrs by creating one SG BO per GPU and filling it with a DMA mapping of the pages from the original mem->bo. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amd

[PATCH 7/9] drm/amdgpu: Add DMA mapping of GTT BOs

2021-04-13 Thread Felix Kuehling
Use DMABufs with dynamic attachment to DMA-map GTT BOs on other GPUs. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 2 + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 74 ++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a

[PATCH 6/9] drm/amdgpu: Move kfd_mem_attach outside reservation

2021-04-13 Thread Felix Kuehling
This is needed to avoid deadlocks with DMA buf import in the next patch. Also move PT/PD validation out of kfd_mem_attach, that way the caller can bo this unconditionally. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 72 +++ 1 file changed

[PATCH 5/9] drm/amdgpu: DMA map/unmap when updating GPU mappings

2021-04-13 Thread Felix Kuehling
DMA map kfd_mem_attachments in update_gpuvm_pte. This function is called with the BO and page tables reserved, so we can safely update the DMA mapping. DMA unmap when a BO is unmapped from a GPU and before updating mappings in restore workers. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd

Re: [PATCH 0/9] Implement multi-GPU DMA mappings for KFD

2021-04-13 Thread Felix Kuehling
Sorry for the spam. I mis-spelled the amd-gfx list on the To: line of this patch series. Please ignore this and see the patch series I sent a minute later. Regards,   Felix On 2021-04-14 2:46 a.m., Felix Kuehling wrote: This patch series fixes DMA-mappings of system memory (GTT and userptr

Re: [PATCH 3/8] drm/amdgpu: Implement mmap as GEM object function

2021-04-14 Thread Felix Kuehling
Am 2021-04-14 um 3:44 a.m. schrieb Thomas Zimmermann: > Hi > > Am 07.04.21 um 21:49 schrieb Felix Kuehling: >> On 2021-04-07 3:34 p.m., Felix Kuehling wrote: >>> On 2021-04-07 7:25 a.m., Christian König wrote: >>>>>>>> +    /* >>>>>&g

Re: [PATCH 8/9] drm/ttm: Don't count pages in SG BOs against pages_limit

2021-04-14 Thread Felix Kuehling
Am 2021-04-14 um 8:25 a.m. schrieb Daniel Vetter: >> Sorry I though that this would be obvious :) >> >> I've already pushed the patch in the morning, but going to keep that in >> mind for the next time. > I'll keep reminding you to pls elaborate more in commit messages, it's > coming up every once

Re: [PATCH 9/9] drm/amdgpu: Lock the attached dmabuf in unpopulate

2021-04-14 Thread Felix Kuehling
Am 2021-04-14 um 3:33 a.m. schrieb Christian König: > Am 14.04.21 um 08:46 schrieb Felix Kuehling: >> amdgpu_ttm_tt_unpopulate can be called during bo_destroy. The >> dmabuf->resv >> must not be held by the caller or dma_buf_detach will deadlock. This is >> proba

Re: [PATCH 3/4] drm/amdkfd: Allow access for mmapping KFD BOs

2021-04-14 Thread Felix Kuehling
Am 2021-04-14 um 11:37 a.m. schrieb philip yang: > > > On 2021-04-07 7:12 p.m., Felix Kuehling wrote: >> DRM allows access automatically when it creates a GEM handle for a BO. >> KFD BOs don't have GEM handles, so KFD needs to manage access manually. > > After readi

Re: [PATCH 2/4] drm/amdkfd: Use drm_priv to pass VM from KFD to amdgpu

2021-04-14 Thread Felix Kuehling
Am 2021-04-14 um 11:21 a.m. schrieb philip yang: > > > On 2021-04-07 7:12 p.m., Felix Kuehling wrote: >> amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu needs the drm_priv to allow mmap >> to access the BO through the corresponding file descriptor. >> >> Signed-off-by: F

[PATCH 00/34] Add HMM-based SVM memory manager to KFD v5

2021-04-14 Thread Felix Kuehling
fence drm/amdgpu: add param bit flag to create SVM BOs drm/amdgpu: svm bo enable_signal call condition drm/amdgpu: add svm_bo eviction to enable_signal cb Felix Kuehling (13): drm/amdkfd: map svm range to GPUs drm/amdkfd: svm range eviction and restore drm/amdgpu: Enable retry f

[PATCH 01/34] drm/amdkfd: helper to convert gpu id and idx

2021-04-14 Thread Felix Kuehling
: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_priv.h| 11 +++ drivers/gpu/drm/amd/amdkfd/kfd_process.c | 10 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h

[PATCH 07/34] drm/amdkfd: validate svm range system memory

2021-04-14 Thread Felix Kuehling
From: Philip Yang Use HMM to get system memory pages address, which will be used to map to GPUs or migrate to vram. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 116 ++- drivers/gpu

[PATCH 03/34] drm/amdkfd: register svm range

2021-04-14 Thread Felix Kuehling
index into bitmap. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/Makefile | 3 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 17 + drivers/gpu/drm/amd/amdkfd/kfd_priv.h| 8 + drivers

[PATCH 04/34] drm/amdkfd: add svm ioctl GET_ATTR op

2021-04-14 Thread Felix Kuehling
From: Philip Yang Get the intersection of attributes over all memory in the given range Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 164 +++ 1 file changed

[PATCH 05/34] drm/amdgpu: add common HMM get pages function

2021-04-14 Thread Felix Kuehling
From: Philip Yang Move the HMM get pages function from amdgpu_ttm and to amdgpu_mn. This common function will be used by new svm APIs. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 83

[PATCH 08/34] drm/amdkfd: deregister svm range

2021-04-14 Thread Felix Kuehling
s the mmap_write_lock to guarantee that it has an up-to-date svm_range_list. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 + drivers/gpu/drm/amd/amdkfd/kfd_svm.c

[PATCH 06/34] drm/amdkfd: support larger svm range allocation

2021-04-14 Thread Felix Kuehling
From: Philip Yang For larger range allocation, if hmm_range_fault return -EBUSY, set retry timeout based on 1 second for every 512MB, this is safe timeout value. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c

[PATCH 14/34] drm/amdkfd: add ioctl to configure and query xnack retries

2021-04-14 Thread Felix Kuehling
retries per KFD process. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 28 +++ include/uapi/linux/kfd_ioctl.h | 43 +++- 2 files changed, 70 insertions(+), 1 deletion

[PATCH 11/34] drm/amdkfd: svm range eviction and restore

2021-04-14 Thread Felix Kuehling
flushes any deferred work to make sure it restores an up-to-date svm_range_list. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_priv.h| 2 + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 1 + drivers/gpu/drm/amd/amdkfd

[PATCH 15/34] drm/amdkfd: register HMM device private zone

2021-04-14 Thread Felix Kuehling
From: Philip Yang Register vram memory as MEMORY_DEVICE_PRIVATE type resource, to allocate vram backing pages for page migration. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/Kconfig | 2 + drivers/gpu/drm/amd

[PATCH 13/34] drm/amdkfd: add xnack enabled flag to kfd_process

2021-04-14 Thread Felix Kuehling
RETRY_DISABLE setting. However, processes not relying on recoverable page faults can work with RETRY enabled. This means XNACK off is always available as a fallback so we can use the same mode on all GPUs in a process. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling

[PATCH 09/34] drm/amdgpu: export vm update mapping interface

2021-04-14 Thread Felix Kuehling
From: Philip Yang It will be used by kfd to map svm range to GPU, because svm range does not have amdgpu_bo and bo_va, cannot use amdgpu_bo_update interface, use amdgpu vm update interface directly. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling

[PATCH 19/34] drm/amdkfd: HMM migrate ram to vram

2021-04-14 Thread Felix Kuehling
. Restore work wait for migration is finished, then update GPUs page table mapping to new vram pages, resume process queues If migrate_vma_setup failed to collect all ram pages of range, retry 3 times until success to start migration. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off

[PATCH 16/34] drm/amdkfd: validate vram svm range from TTM

2021-04-14 Thread Felix Kuehling
mapping exist, then process exit will not have unmap callback for this prange to free prange and svm bo. Free outstanding pranges from svms list before process is freed in svm_range_list_fini. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix

[PATCH 18/34] drm/amdkfd: copy memory through gart table

2021-04-14 Thread Felix Kuehling
same kernel buffer function to fill in gart table mapping, so this is serialized with memory copy by sdma job submit. We only need wait for the last memory copy sdma fence for larger buffer migration. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling

[PATCH 17/34] drm/amdkfd: support xgmi same hive mapping

2021-04-14 Thread Felix Kuehling
Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 94 ++-- 1 file changed, 75 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index b12eb0

[PATCH 24/34] drm/amdkfd: SVM API call to restore page tables

2021-04-14 Thread Felix Kuehling
From: Alex Sierra Use SVM API to restore page tables when retry fault and compute context are enabled. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 +++- 1 file changed, 15 insertions

[PATCH 23/34] drm/amdkfd: page table restore through svm API

2021-04-14 Thread Felix Kuehling
Page table restore implementation in SVM API. This is called from the fault handler at amdgpu_vm. To update page tables through the page fault retry IH. Signed-off-by: Alex Sierra Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd

[PATCH 02/34] drm/amdkfd: add svm ioctl API

2021-04-14 Thread Felix Kuehling
attributes that can be used to set or get one or multiple attributes. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 12 ++ drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c | 4

[PATCH 10/34] drm/amdkfd: map svm range to GPUs

2021-04-14 Thread Felix Kuehling
Use amdgpu_vm_bo_update_mapping to update GPU page table to map or unmap svm range system memory pages address to GPUs. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 473

[PATCH 21/34] drm/amdkfd: invalidate tables on page retry fault

2021-04-14 Thread Felix Kuehling
GPUVM faults. Signed-off-by: Alex Sierra Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 6 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 77 +++- drivers/gpu/drm/amd/amdkfd/kfd_svm.h

[PATCH 28/34] drm/amdgpu: svm bo enable_signal call condition

2021-04-14 Thread Felix Kuehling
do an eviction. Instead it will discard the memory held by the BO. This is needed for HMM migration to user mode system memory pages. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 14 ++ 1 file change

[PATCH 12/34] drm/amdgpu: Enable retry faults unconditionally on Aldebaran

2021-04-14 Thread Felix Kuehling
This is needed to allow per-process XNACK mode selection in the SQ when booting with XNACK off by default. Signed-off-by: Felix Kuehling Reviewed-by: Philip Yang Tested-by: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 8

[PATCH 20/34] drm/amdkfd: HMM migrate vram to ram

2021-04-14 Thread Felix Kuehling
finished, then update GPU page table mapping to system memory, and resume process queues Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 302 ++- drivers/gpu/drm/amd/amdkfd/kfd_migrate.h

[PATCH 27/34] drm/amdkfd: add svm_bo eviction mechanism support

2021-04-14 Thread Felix Kuehling
VRAM space is available. Here, all the ttm_evict calls are synchronous, this guarantees that each eviction has completed and the fence has signaled before it returns. Signed-off-by: Alex Sierra Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu

[PATCH 22/34] drm/amdgpu: enable 48-bit IH timestamp counter

2021-04-14 Thread Felix Kuehling
From: Alex Sierra By default this timestamp is 32 bit counter. It gets overflowed in around 10 minutes. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Philip Yang --- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers

[PATCH 26/34] drm/amdgpu: add param bit flag to create SVM BOs

2021-04-14 Thread Felix Kuehling
From: Alex Sierra Add CREATE_SVM_BO define bit for SVM BOs. Another define flag was moved to concentrate these KFD type flags in one include file. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 7

[PATCH 25/34] drm/amdkfd: add svm_bo reference for eviction fence

2021-04-14 Thread Felix Kuehling
regular BO evictions. This also include modifications to set the reference at the fence creation call. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 4 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c

[PATCH 31/34] drm/amdkfd: add svm range validate timestamp

2021-04-14 Thread Felix Kuehling
than AMDGPU_SVM_RANGE_RETRY_FAULT_PENDING, that means the retry fault is from another GPU, then continue to handle retry fault recover. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 17 + drivers

[PATCH 29/34] drm/amdgpu: add svm_bo eviction to enable_signal cb

2021-04-14 Thread Felix Kuehling
From: Alex Sierra Add to amdgpu_amdkfd_fence.enable_signal callback, support for svm_bo fence eviction. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 11 --- 1 file changed, 8 insertions

[PATCH 34/34] drm/amdkfd: Add CONFIG_HSA_AMD_SVM

2021-04-14 Thread Felix Kuehling
for visible options. Reviewed-by: Philip Yang Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/Kconfig | 15 ++-- drivers/gpu/drm/amd/amdkfd/Makefile | 9 --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 ++ drivers/gpu/drm/amd/amdkfd/kfd_migrate.h | 17 +++

[PATCH 30/34] drm/amdkfd: refine migration policy with xnack on

2021-04-14 Thread Felix Kuehling
With xnack on, GPU vm fault handler decide the best restore location, then migrate range to the best restore location and update GPU mapping to recover the GPU vm fault. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling

[PATCH 32/34] drm/amdkfd: multiple gpu migrate vram to vram

2021-04-14 Thread Felix Kuehling
gpu to migrate to system memory, then use sdma of destination gpu to migrate from system memory to gpu. Print out gpuid or gpuidx in debug messages. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 47

[PATCH 33/34] drm/amdkfd: Add SVM API support capability bits

2021-04-14 Thread Felix Kuehling
esses. CoherentHostAccess property added to HSA_MEMORYPROPERTY, the value match HSA_MEMORYPROPERTY defined in Thunk spec: CoherentHostAccess: whether or not device memory can be coherently accessed by the host CPU. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kue

[PATCH v2 1/3] drm/amdkfd: Use drm_priv to pass VM from KFD to amdgpu

2021-04-14 Thread Felix Kuehling
amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu needs the drm_priv to allow mmap to access the BO through the corresponding file descriptor. The VM can also be extracted from drm_priv, so drm_priv can replace the vm parameter in the kfd2kgd interface. Signed-off-by: Felix Kuehling --- drivers/gpu/drm

[PATCH v2 3/3] drm/amdgpu: Remove verify_access shortcut for KFD BOs

2021-04-14 Thread Felix Kuehling
This shortcut is no longer needed with access managed properly by KFD. Signed-off-by: Felix Kuehling Reviewed-by: Philip Yang --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd

[PATCH v2 2/3] drm/amdkfd: Allow access for mmapping KFD BOs

2021-04-14 Thread Felix Kuehling
ccess manually. Use drm_vma_node_allow to allow user mode to mmap BOs allocated with kfd_ioctl_alloc_memory_of_gpu through the DRM render node that was used in the kfd_ioctl_acquire_vm call for the same GPU. Signed-off-by: Felix Kuehling Acked-by: Christian König --- drivers/gpu/drm/amd/a

Re: [PATCH 9/9] drm/amdgpu: Lock the attached dmabuf in unpopulate

2021-04-15 Thread Felix Kuehling
Am 2021-04-15 um 3:41 a.m. schrieb Christian König: > > > Am 14.04.21 um 17:15 schrieb Felix Kuehling: >> Am 2021-04-14 um 3:33 a.m. schrieb Christian König: >>> Am 14.04.21 um 08:46 schrieb Felix Kuehling: >>>> amdgpu_ttm_tt_unpopulate can be called duri

Re: [PATCH v3 5/7] drm/vmwgfx: Inline ttm_bo_mmap() into vmwgfx driver

2021-04-20 Thread Felix Kuehling
Am 2021-04-20 um 4:51 a.m. schrieb Daniel Vetter: >>> Whole series is Reviewed-by: Christian König >> Thanks a lot. If I'm not mistaken, the patches at [1] need to go in first. >> So it could take a a bit until this lands. >> >> Otherwise, this series could go through the same tree as [1] if nouv

[PATCH v2 10/10] drm/amdgpu: Move dmabuf attach/detach to backend_(un)bind

2021-04-21 Thread Felix Kuehling
The dmabuf attachment should be updated by moving the SG BO to DOMAIN_CPU and back to DOMAIN_GTT. This does not necessarily invoke the populate/unpopulate callbacks. Do this in backend_bind/unbind instead. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3

[PATCH v2 03/10] drm/amdgpu: Keep a bo-reference per-attachment

2021-04-21 Thread Felix Kuehling
For now they all reference the same BO. For correct DMA mappings they will refer to different BOs per-GPU. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 22 ++- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd

[PATCH v2 05/10] drm/amdgpu: Add multi-GPU DMA mapping helpers

2021-04-21 Thread Felix Kuehling
Add BO-type specific helpers functions to DMA-map and unmap kfd_mem_attachments. Implement this functionality for userptrs by creating one SG BO per GPU and filling it with a DMA mapping of the pages from the original mem->bo. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amd

[PATCH v2 01/10] rock-dbg_defconfig: Enable Intel IOMMU

2021-04-21 Thread Felix Kuehling
Enable the Intel IOMMU driver in the rock-dbg_defconfig. This enables testing of DMA mappings on systems with an Intel IOMMU. Signed-off-by: Felix Kuehling --- arch/x86/configs/rock-dbg_defconfig | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/configs

[PATCH v2 06/10] drm/amdgpu: DMA map/unmap when updating GPU mappings

2021-04-21 Thread Felix Kuehling
DMA map kfd_mem_attachments in update_gpuvm_pte. This function is called with the BO and page tables reserved, so we can safely update the DMA mapping. DMA unmap when a BO is unmapped from a GPU and before updating mappings in restore workers. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd

[PATCH v2 00/10] Implement multi-GPU DMA mappings for KFD

2021-04-21 Thread Felix Kuehling
created for DMA mappings cause many tests fail because TTM incorrectly thinks it's out of memory. Felix Kuehling (10): rock-dbg_defconfig: Enable Intel IOMMU drm/amdgpu: Rename kfd_bo_va_list to kfd_mem_attachment drm/amdgpu: Keep a bo-reference per-attachment drm/amdgpu: Simplify

[PATCH v2 04/10] drm/amdgpu: Simplify AQL queue mapping

2021-04-21 Thread Felix Kuehling
amdgpu_amdkfd_gpuvm_free_memory_of_gpu. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 103 -- 1 file changed, 48 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu

[PATCH v2 08/10] drm/amdgpu: Add DMA mapping of GTT BOs

2021-04-21 Thread Felix Kuehling
Use DMABufs with dynamic attachment to DMA-map GTT BOs on other GPUs. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h| 2 + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 76 ++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a

[PATCH v2 09/10] drm/ttm: Don't count pages in SG BOs against pages_limit

2021-04-21 Thread Felix Kuehling
Pages in SG BOs were not allocated by TTM. So don't count them against TTM's pages limit. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/ttm/ttm_tt.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/d

[PATCH v2 02/10] drm/amdgpu: Rename kfd_bo_va_list to kfd_mem_attachment

2021-04-21 Thread Felix Kuehling
This name is more fitting, especially for the changes coming next to support multi-GPU systems with proper DMA mappings. Cleaned up the code and renamed some related functions and variables to improve readability. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

[PATCH v2 07/10] drm/amdgpu: Move kfd_mem_attach outside reservation

2021-04-21 Thread Felix Kuehling
This is needed to avoid deadlocks with DMA buf import in the next patch. Also move PT/PD validation out of kfd_mem_attach, that way the caller can bo this unconditionally. Signed-off-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 75 +++ 1 file changed

Re: [PATCH][next] drm/amdkfd: fix uint32 variable compared to less than zero

2021-04-22 Thread Felix Kuehling
Am 2021-04-22 um 8:31 a.m. schrieb Colin King: > From: Colin Ian King > > Currently the call to kfd_process_gpuidx_from_gpuid is returning an > int value and this is being assigned to a uint32_t variable gpuidx > and this is being checked for a negative error return which is always > going to be f

Re: [PATCH][next] drm/amdkfd: remove redundant initialization to variable r

2021-04-22 Thread Felix Kuehling
Am 2021-04-22 um 8:44 a.m. schrieb Colin King: > From: Colin Ian King > > The variable r is being initialized with a value that is never read > and it is being updated later with a new value. The initialization is > redundant and can be removed. > > Addresses-Coverity: ("Unused value") > Signed-of

Re: [PATCH v2 04/10] drm/amdgpu: Simplify AQL queue mapping

2021-04-23 Thread Felix Kuehling
Am 2021-04-22 um 9:33 p.m. schrieb Zeng, Oak: > Regards, > Oak > > > > On 2021-04-21, 9:31 PM, "amd-gfx on behalf of Felix Kuehling" > > wrote: > > Do AQL queue double-mapping with a single attach call. That will make it > easier to create

Re: [PATCH] drm/amdgpu: Added missing prototype

2021-04-23 Thread Felix Kuehling
Am 2021-04-23 um 5:39 p.m. schrieb Souptick Joarder: > Kernel test robot throws below warning -> > >>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c:125:5: warning: >>> no previous prototype for 'kgd_arcturus_hqd_sdma_load' >>> [-Wmissing-prototypes] > 125 | int kgd_arcturus_hqd_sdma_loa

Re: [PATCH] drm/amd/amdkfd/kfd_process.c: Fix kernel-doc syntax error

2021-04-24 Thread Felix Kuehling
Am 2021-04-24 um 12:50 p.m. schrieb Fabio M. De Francesco: > Fixed a kernel-doc error in the documentation of a function. > > Signed-off-by: Fabio M. De Francesco I fixed the headline prefix to match our usual convention (drm/amdkfd: ...) and applied the patch to amd-staging-drm-next. Thanks,  

Re: [PATCH v2] drm/amdgpu: Added missing prototype

2021-04-24 Thread Felix Kuehling
Am 2021-04-24 um 5:40 a.m. schrieb Souptick Joarder: > Kernel test robot throws below warning -> > >>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c:125:5: warning: >>> no previous prototype for 'kgd_arcturus_hqd_sdma_load' >>> [-Wmissing-prototypes] > 125 | int kgd_arcturus_hqd_sdma_loa

Re: [PATCH][next] drm/amdkfd: Fix spelling mistake "unregisterd" -> "unregistered"

2021-04-26 Thread Felix Kuehling
On 2021-04-26 8:15, Nirmoy wrote: > Reviewed-by: Nirmoy Das > > On 4/26/21 2:13 PM, Colin King wrote: >> From: Colin Ian King >> >> There is a spelling mistake in a pr_debug message. Fix it. >> >> Signed-off-by: Colin Ian King Applied to amd-staging-drm-next. Thanks,   Felix >> --- >>   driv

Re: [PATCH v2 05/10] drm/amdgpu: Add multi-GPU DMA mapping helpers

2021-04-26 Thread Felix Kuehling
ptr in iommu. Maybe you map them in iommu not during > memory attachment time? > > Also see a nit-pick inline > > Regards, > Oak > > > > On 2021-04-21, 9:31 PM, "dri-devel on behalf of Felix Kuehling" > > wrote: > > Add BO-type speci

Re: [PATCH v2 06/10] drm/amdgpu: DMA map/unmap when updating GPU mappings

2021-04-26 Thread Felix Kuehling
Am 2021-04-26 um 8:23 p.m. schrieb Zeng, Oak: > Regards, > Oak > > > > On 2021-04-21, 9:31 PM, "dri-devel on behalf of Felix Kuehling" > > wrote: > > DMA map kfd_mem_attachments in update_gpuvm_pte. This function is called > with the BO

Re: [PATCH v2 08/10] drm/amdgpu: Add DMA mapping of GTT BOs

2021-04-26 Thread Felix Kuehling
Am 2021-04-26 um 8:35 p.m. schrieb Zeng, Oak: > Regards, > Oak > > > > On 2021-04-21, 9:31 PM, "amd-gfx on behalf of Felix Kuehling" > > wrote: > > Use DMABufs with dynamic attachment to DMA-map GTT BOs on other GPUs. > > Signed-off-by

Re: [PATCH v2 08/10] drm/amdgpu: Add DMA mapping of GTT BOs

2021-04-27 Thread Felix Kuehling
> > > On 2021-04-21, 9:31 PM, "amd-gfx on behalf of Felix Kuehling" > > wrote: > > > > Use DMABufs with dynamic attachment to DMA-map GTT BOs on other > GPUs. > > > > Signed-off-by: Felix Kuehling >

[PATCH 2/2] drm/ttm: Fix swapout in ttm_tt_populate

2021-04-27 Thread Felix Kuehling
ttm_bo_swapout returns a non-0 value on success. Don't treat that as an error in ttm_tt_populate. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c

  1   2   3   4   5   6   7   8   9   10   >