* [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
@ 2024-05-31 14:18 Alex Deucher
2024-06-01 5:24 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Alex Deucher @ 2024-05-31 14:18 UTC (permalink / raw)
To: stable, gregkh, sashal
Cc: Lang Yu, Tomáš Trnka, Felix Kuehling, Alex Deucher
From: Lang Yu <Lang.Yu@amd.com>
Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
Two attachments use the same VM, root PD would be locked twice.
[ 57.910418] Call Trace:
[ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
[ 57.793820] amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
[ 57.793923] ? idr_get_next_ul+0xbe/0x100
[ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
[ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
[ 57.794141] ? process_scheduled_works+0x29c/0x580
[ 57.794147] process_scheduled_works+0x303/0x580
[ 57.794157] ? __pfx_worker_thread+0x10/0x10
[ 57.794160] worker_thread+0x1a2/0x370
[ 57.794165] ? __pfx_worker_thread+0x10/0x10
[ 57.794167] kthread+0x11b/0x150
[ 57.794172] ? __pfx_kthread+0x10/0x10
[ 57.794177] ret_from_fork+0x3d/0x60
[ 57.794181] ? __pfx_kthread+0x10/0x10
[ 57.794184] ret_from_fork_asm+0x1b/0x30
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
Tested-by: Tomáš Trnka <trnka@scm.com>
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
(cherry picked from commit 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index e4d4e55c08ad..0535b07987d9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1188,7 +1188,8 @@ static int reserve_bo_and_cond_vms(struct kgd_mem *mem,
int ret;
ctx->sync = &mem->sync;
- drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
+ drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT |
+ DRM_EXEC_IGNORE_DUPLICATES, 0);
drm_exec_until_all_locked(&ctx->exec) {
ctx->n_vms = 0;
list_for_each_entry(entry, &mem->attachments, list) {
--
2.45.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
2024-05-31 14:18 [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms Alex Deucher
@ 2024-06-01 5:24 ` Greg KH
2024-06-03 14:31 ` Deucher, Alexander
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2024-06-01 5:24 UTC (permalink / raw)
To: Alex Deucher
Cc: stable, sashal, Lang Yu, Tomáš Trnka, Felix Kuehling
On Fri, May 31, 2024 at 10:18:07AM -0400, Alex Deucher wrote:
> From: Lang Yu <Lang.Yu@amd.com>
>
> Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
> Two attachments use the same VM, root PD would be locked twice.
>
> [ 57.910418] Call Trace:
> [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
> [ 57.793820] amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
> [ 57.793923] ? idr_get_next_ul+0xbe/0x100
> [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
> [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
> [ 57.794141] ? process_scheduled_works+0x29c/0x580
> [ 57.794147] process_scheduled_works+0x303/0x580
> [ 57.794157] ? __pfx_worker_thread+0x10/0x10
> [ 57.794160] worker_thread+0x1a2/0x370
> [ 57.794165] ? __pfx_worker_thread+0x10/0x10
> [ 57.794167] kthread+0x11b/0x150
> [ 57.794172] ? __pfx_kthread+0x10/0x10
> [ 57.794177] ret_from_fork+0x3d/0x60
> [ 57.794181] ? __pfx_kthread+0x10/0x10
> [ 57.794184] ret_from_fork_asm+0x1b/0x30
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
> Tested-by: Tomáš Trnka <trnka@scm.com>
> Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org
> (cherry picked from commit 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
What kernel release(s) is this backport for?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
2024-06-01 5:24 ` Greg KH
@ 2024-06-03 14:31 ` Deucher, Alexander
2024-06-12 12:06 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Deucher, Alexander @ 2024-06-03 14:31 UTC (permalink / raw)
To: Greg KH
Cc: stable@vger.kernel.org, sashal@kernel.org, Yu, Lang,
Tomáš Trnka, Kuehling, Felix
[Public]
> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Saturday, June 1, 2024 1:24 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>
> Cc: stable@vger.kernel.org; sashal@kernel.org; Yu, Lang <Lang.Yu@amd.com>;
> Tomáš Trnka <trnka@scm.com>; Kuehling, Felix <Felix.Kuehling@amd.com>
> Subject: Re: [PATCH] drm/amdkfd: handle duplicate BOs in
> reserve_bo_and_cond_vms
>
> On Fri, May 31, 2024 at 10:18:07AM -0400, Alex Deucher wrote:
> > From: Lang Yu <Lang.Yu@amd.com>
> >
> > Observed on gfx8 ASIC where
> KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
> > Two attachments use the same VM, root PD would be locked twice.
> >
> > [ 57.910418] Call Trace:
> > [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
> > [ 57.793820]
> amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
> > [ 57.793923] ? idr_get_next_ul+0xbe/0x100
> > [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
> > [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
> > [ 57.794141] ? process_scheduled_works+0x29c/0x580
> > [ 57.794147] process_scheduled_works+0x303/0x580
> > [ 57.794157] ? __pfx_worker_thread+0x10/0x10
> > [ 57.794160] worker_thread+0x1a2/0x370
> > [ 57.794165] ? __pfx_worker_thread+0x10/0x10
> > [ 57.794167] kthread+0x11b/0x150
> > [ 57.794172] ? __pfx_kthread+0x10/0x10
> > [ 57.794177] ret_from_fork+0x3d/0x60
> > [ 57.794181] ? __pfx_kthread+0x10/0x10
> > [ 57.794184] ret_from_fork_asm+0x1b/0x30
> >
> > Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
> > Tested-by: Tomáš Trnka <trnka@scm.com>
> > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > Cc: stable@vger.kernel.org
> > (cherry picked from commit
> 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
> > ---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
>
> What kernel release(s) is this backport for?
6.6.x and newer.
Thanks!
Alex
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
2024-06-03 14:31 ` Deucher, Alexander
@ 2024-06-12 12:06 ` Greg KH
2024-06-13 8:04 ` Tomáš Trnka
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2024-06-12 12:06 UTC (permalink / raw)
To: Deucher, Alexander
Cc: stable@vger.kernel.org, sashal@kernel.org, Yu, Lang,
Tomáš Trnka, Kuehling, Felix
On Mon, Jun 03, 2024 at 02:31:27PM +0000, Deucher, Alexander wrote:
> [Public]
>
> > -----Original Message-----
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Saturday, June 1, 2024 1:24 AM
> > To: Deucher, Alexander <Alexander.Deucher@amd.com>
> > Cc: stable@vger.kernel.org; sashal@kernel.org; Yu, Lang <Lang.Yu@amd.com>;
> > Tomáš Trnka <trnka@scm.com>; Kuehling, Felix <Felix.Kuehling@amd.com>
> > Subject: Re: [PATCH] drm/amdkfd: handle duplicate BOs in
> > reserve_bo_and_cond_vms
> >
> > On Fri, May 31, 2024 at 10:18:07AM -0400, Alex Deucher wrote:
> > > From: Lang Yu <Lang.Yu@amd.com>
> > >
> > > Observed on gfx8 ASIC where
> > KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
> > > Two attachments use the same VM, root PD would be locked twice.
> > >
> > > [ 57.910418] Call Trace:
> > > [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
> > > [ 57.793820]
> > amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
> > > [ 57.793923] ? idr_get_next_ul+0xbe/0x100
> > > [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
> > > [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
> > > [ 57.794141] ? process_scheduled_works+0x29c/0x580
> > > [ 57.794147] process_scheduled_works+0x303/0x580
> > > [ 57.794157] ? __pfx_worker_thread+0x10/0x10
> > > [ 57.794160] worker_thread+0x1a2/0x370
> > > [ 57.794165] ? __pfx_worker_thread+0x10/0x10
> > > [ 57.794167] kthread+0x11b/0x150
> > > [ 57.794172] ? __pfx_kthread+0x10/0x10
> > > [ 57.794177] ret_from_fork+0x3d/0x60
> > > [ 57.794181] ? __pfx_kthread+0x10/0x10
> > > [ 57.794184] ret_from_fork_asm+0x1b/0x30
> > >
> > > Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
> > > Tested-by: Tomáš Trnka <trnka@scm.com>
> > > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > > Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: stable@vger.kernel.org
> > > (cherry picked from commit
> > 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
> > > ---
> > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > What kernel release(s) is this backport for?
>
> 6.6.x and newer.
Does not apply to 6.6.y, sorry, how was this tested? Can you submit a
patch that does work?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
2024-06-12 12:06 ` Greg KH
@ 2024-06-13 8:04 ` Tomáš Trnka
2024-06-13 8:14 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Tomáš Trnka @ 2024-06-13 8:04 UTC (permalink / raw)
To: Deucher, Alexander, Greg KH
Cc: stable@vger.kernel.org, sashal@kernel.org, Yu, Lang,
Kuehling, Felix
On Wednesday, June 12, 2024 2:06:37 PM CEST, Greg KH wrote:
> On Mon, Jun 03, 2024 at 02:31:27PM +0000, Deucher, Alexander wrote:
> > [Public]
> >
> > > -----Original Message-----
> > > From: Greg KH <gregkh@linuxfoundation.org>
> > > Sent: Saturday, June 1, 2024 1:24 AM
> > > To: Deucher, Alexander <Alexander.Deucher@amd.com>
> > > Cc: stable@vger.kernel.org; sashal@kernel.org; Yu, Lang
> > > <Lang.Yu@amd.com>;
> > > Tomáš Trnka <trnka@scm.com>; Kuehling, Felix <Felix.Kuehling@amd.com>
> > > Subject: Re: [PATCH] drm/amdkfd: handle duplicate BOs in
> > > reserve_bo_and_cond_vms
> > >
> > > On Fri, May 31, 2024 at 10:18:07AM -0400, Alex Deucher wrote:
> > > > From: Lang Yu <Lang.Yu@amd.com>
> > > >
> > > > Observed on gfx8 ASIC where
> > >
> > > KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
> > >
> > > > Two attachments use the same VM, root PD would be locked twice.
> > > >
> > > > [ 57.910418] Call Trace:
> > > > [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
> > > > [ 57.793820]
> > >
> > > amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
> > >
> > > > [ 57.793923] ? idr_get_next_ul+0xbe/0x100
> > > > [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
> > > > [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
> > > > [ 57.794141] ? process_scheduled_works+0x29c/0x580
> > > > [ 57.794147] process_scheduled_works+0x303/0x580
> > > > [ 57.794157] ? __pfx_worker_thread+0x10/0x10
> > > > [ 57.794160] worker_thread+0x1a2/0x370
> > > > [ 57.794165] ? __pfx_worker_thread+0x10/0x10
> > > > [ 57.794167] kthread+0x11b/0x150
> > > > [ 57.794172] ? __pfx_kthread+0x10/0x10
> > > > [ 57.794177] ret_from_fork+0x3d/0x60
> > > > [ 57.794181] ? __pfx_kthread+0x10/0x10
> > > > [ 57.794184] ret_from_fork_asm+0x1b/0x30
> > > >
> > > > Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
> > > > Tested-by: Tomáš Trnka <trnka@scm.com>
> > > > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > > > Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> > > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > > > Cc: stable@vger.kernel.org
> > > > (cherry picked from commit
> > >
> > > 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
> > >
> > > > ---
> > > >
> > > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
> > > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > What kernel release(s) is this backport for?
> >
> > 6.6.x and newer.
>
> Does not apply to 6.6.y, sorry, how was this tested? Can you submit a
> patch that does work?
>
> thanks,
>
> greg k-h
Sorry about that. 6.6 does not have commit
05d249352f1ae909230c230767ca8f4e9fdf8e7b "drm/exec: Pass in initial # of
objects" which adds the trailing 0 argument. Just removing that zero makes the
patch apply and work. Such a modified version is attached below.
Tested on 6.6.32 (version below), 6.8.12 and 6.9.3 (version sent by Alex
above).
2T
From: Lang Yu <Lang.Yu@amd.com>
Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
Two attachments use the same VM, root PD would be locked twice.
[ 57.910418] Call Trace:
[ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
[ 57.793820] amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
[ 57.793923] ? idr_get_next_ul+0xbe/0x100
[ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
[ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
[ 57.794141] ? process_scheduled_works+0x29c/0x580
[ 57.794147] process_scheduled_works+0x303/0x580
[ 57.794157] ? __pfx_worker_thread+0x10/0x10
[ 57.794160] worker_thread+0x1a2/0x370
[ 57.794165] ? __pfx_worker_thread+0x10/0x10
[ 57.794167] kthread+0x11b/0x150
[ 57.794172] ? __pfx_kthread+0x10/0x10
[ 57.794177] ret_from_fork+0x3d/0x60
[ 57.794181] ? __pfx_kthread+0x10/0x10
[ 57.794184] ret_from_fork_asm+0x1b/0x30
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
Tested-by: Tomáš Trnka <trnka@scm.com>
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
(cherry picked from commit 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/
drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 15c5a2533ba6..9115fc8c96ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1135,7 +1135,8 @@ static int reserve_bo_and_cond_vms(struct kgd_mem *mem,
int ret;
ctx->sync = &mem->sync;
- drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT);
+ drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT |
+ DRM_EXEC_IGNORE_DUPLICATES);
drm_exec_until_all_locked(&ctx->exec) {
ctx->n_vms = 0;
list_for_each_entry(entry, &mem->attachments, list) {
--
2.45.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
2024-06-13 8:04 ` Tomáš Trnka
@ 2024-06-13 8:14 ` Greg KH
2024-06-13 8:36 ` Tomáš Trnka
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2024-06-13 8:14 UTC (permalink / raw)
To: Tomáš Trnka
Cc: Deucher, Alexander, stable@vger.kernel.org, sashal@kernel.org,
Yu, Lang, Kuehling, Felix
On Thu, Jun 13, 2024 at 10:04:51AM +0200, Tomáš Trnka wrote:
> On Wednesday, June 12, 2024 2:06:37 PM CEST, Greg KH wrote:
> > On Mon, Jun 03, 2024 at 02:31:27PM +0000, Deucher, Alexander wrote:
> > > [Public]
> > >
> > > > -----Original Message-----
> > > > From: Greg KH <gregkh@linuxfoundation.org>
> > > > Sent: Saturday, June 1, 2024 1:24 AM
> > > > To: Deucher, Alexander <Alexander.Deucher@amd.com>
> > > > Cc: stable@vger.kernel.org; sashal@kernel.org; Yu, Lang
> > > > <Lang.Yu@amd.com>;
> > > > Tomáš Trnka <trnka@scm.com>; Kuehling, Felix <Felix.Kuehling@amd.com>
> > > > Subject: Re: [PATCH] drm/amdkfd: handle duplicate BOs in
> > > > reserve_bo_and_cond_vms
> > > >
> > > > On Fri, May 31, 2024 at 10:18:07AM -0400, Alex Deucher wrote:
> > > > > From: Lang Yu <Lang.Yu@amd.com>
> > > > >
> > > > > Observed on gfx8 ASIC where
> > > >
> > > > KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
> > > >
> > > > > Two attachments use the same VM, root PD would be locked twice.
> > > > >
> > > > > [ 57.910418] Call Trace:
> > > > > [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
> > > > > [ 57.793820]
> > > >
> > > > amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
> > > >
> > > > > [ 57.793923] ? idr_get_next_ul+0xbe/0x100
> > > > > [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
> > > > > [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
> > > > > [ 57.794141] ? process_scheduled_works+0x29c/0x580
> > > > > [ 57.794147] process_scheduled_works+0x303/0x580
> > > > > [ 57.794157] ? __pfx_worker_thread+0x10/0x10
> > > > > [ 57.794160] worker_thread+0x1a2/0x370
> > > > > [ 57.794165] ? __pfx_worker_thread+0x10/0x10
> > > > > [ 57.794167] kthread+0x11b/0x150
> > > > > [ 57.794172] ? __pfx_kthread+0x10/0x10
> > > > > [ 57.794177] ret_from_fork+0x3d/0x60
> > > > > [ 57.794181] ? __pfx_kthread+0x10/0x10
> > > > > [ 57.794184] ret_from_fork_asm+0x1b/0x30
> > > > >
> > > > > Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
> > > > > Tested-by: Tomáš Trnka <trnka@scm.com>
> > > > > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > > > > Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> > > > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > > > > Cc: stable@vger.kernel.org
> > > > > (cherry picked from commit
> > > >
> > > > 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
> > > >
> > > > > ---
> > > > >
> > > > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
> > > > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > What kernel release(s) is this backport for?
> > >
> > > 6.6.x and newer.
> >
> > Does not apply to 6.6.y, sorry, how was this tested? Can you submit a
> > patch that does work?
> >
> > thanks,
> >
> > greg k-h
>
> Sorry about that. 6.6 does not have commit
> 05d249352f1ae909230c230767ca8f4e9fdf8e7b "drm/exec: Pass in initial # of
> objects" which adds the trailing 0 argument. Just removing that zero makes the
> patch apply and work. Such a modified version is attached below.
>
> Tested on 6.6.32 (version below), 6.8.12 and 6.9.3 (version sent by Alex
> above).
>
> 2T
>
> From: Lang Yu <Lang.Yu@amd.com>
>
> Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
> Two attachments use the same VM, root PD would be locked twice.
>
> [ 57.910418] Call Trace:
> [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
> [ 57.793820] amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
> [ 57.793923] ? idr_get_next_ul+0xbe/0x100
> [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
> [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
> [ 57.794141] ? process_scheduled_works+0x29c/0x580
> [ 57.794147] process_scheduled_works+0x303/0x580
> [ 57.794157] ? __pfx_worker_thread+0x10/0x10
> [ 57.794160] worker_thread+0x1a2/0x370
> [ 57.794165] ? __pfx_worker_thread+0x10/0x10
> [ 57.794167] kthread+0x11b/0x150
> [ 57.794172] ? __pfx_kthread+0x10/0x10
> [ 57.794177] ret_from_fork+0x3d/0x60
> [ 57.794181] ? __pfx_kthread+0x10/0x10
> [ 57.794184] ret_from_fork_asm+0x1b/0x30
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
> Tested-by: Tomáš Trnka <trnka@scm.com>
> Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org
> (cherry picked from commit 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0)
As you are modifying, and passing on, a patch, you need to also sign off
on this.
Please submit this in a format that I can apply it in, not as something
I need to hand-edit out of an email.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
2024-06-13 8:14 ` Greg KH
@ 2024-06-13 8:36 ` Tomáš Trnka
2024-06-13 8:50 ` Greg KH
0 siblings, 1 reply; 8+ messages in thread
From: Tomáš Trnka @ 2024-06-13 8:36 UTC (permalink / raw)
To: Greg KH
Cc: Deucher, Alexander, stable@vger.kernel.org, sashal@kernel.org,
Yu, Lang, Kuehling, Felix
From: Lang Yu <Lang.Yu@amd.com>
[ Upstream commit 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0 ]
Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
Two attachments use the same VM, root PD would be locked twice.
[ 57.910418] Call Trace:
[ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
[ 57.793820] amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
[ 57.793923] ? idr_get_next_ul+0xbe/0x100
[ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
[ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
[ 57.794141] ? process_scheduled_works+0x29c/0x580
[ 57.794147] process_scheduled_works+0x303/0x580
[ 57.794157] ? __pfx_worker_thread+0x10/0x10
[ 57.794160] worker_thread+0x1a2/0x370
[ 57.794165] ? __pfx_worker_thread+0x10/0x10
[ 57.794167] kthread+0x11b/0x150
[ 57.794172] ? __pfx_kthread+0x10/0x10
[ 57.794177] ret_from_fork+0x3d/0x60
[ 57.794181] ? __pfx_kthread+0x10/0x10
[ 57.794184] ret_from_fork_asm+0x1b/0x30
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
Tested-by: Tomáš Trnka <trnka@scm.com>
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.6.x only
Signed-off-by: Tomáš Trnka <trnka@scm.com>
[TT: trivially adjusted for 6.6 which does not have commit 05d249352f
(third argument to drm_exec_init removed)]
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/
drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 15c5a2533ba6..9115fc8c96ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1135,7 +1135,8 @@ static int reserve_bo_and_cond_vms(struct kgd_mem *mem,
int ret;
ctx->sync = &mem->sync;
- drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT);
+ drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT |
+ DRM_EXEC_IGNORE_DUPLICATES);
drm_exec_until_all_locked(&ctx->exec) {
ctx->n_vms = 0;
list_for_each_entry(entry, &mem->attachments, list) {
--
2.45.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
2024-06-13 8:36 ` Tomáš Trnka
@ 2024-06-13 8:50 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2024-06-13 8:50 UTC (permalink / raw)
To: Tomáš Trnka
Cc: Deucher, Alexander, stable@vger.kernel.org, sashal@kernel.org,
Yu, Lang, Kuehling, Felix
On Thu, Jun 13, 2024 at 10:36:28AM +0200, Tomáš Trnka wrote:
> From: Lang Yu <Lang.Yu@amd.com>
>
> [ Upstream commit 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0 ]
>
> Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
> Two attachments use the same VM, root PD would be locked twice.
>
> [ 57.910418] Call Trace:
> [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
> [ 57.793820] amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
> [ 57.793923] ? idr_get_next_ul+0xbe/0x100
> [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
> [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
> [ 57.794141] ? process_scheduled_works+0x29c/0x580
> [ 57.794147] process_scheduled_works+0x303/0x580
> [ 57.794157] ? __pfx_worker_thread+0x10/0x10
> [ 57.794160] worker_thread+0x1a2/0x370
> [ 57.794165] ? __pfx_worker_thread+0x10/0x10
> [ 57.794167] kthread+0x11b/0x150
> [ 57.794172] ? __pfx_kthread+0x10/0x10
> [ 57.794177] ret_from_fork+0x3d/0x60
> [ 57.794181] ? __pfx_kthread+0x10/0x10
> [ 57.794184] ret_from_fork_asm+0x1b/0x30
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3007
> Tested-by: Tomáš Trnka <trnka@scm.com>
> Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org # 6.6.x only
> Signed-off-by: Tomáš Trnka <trnka@scm.com>
> [TT: trivially adjusted for 6.6 which does not have commit 05d249352f
> (third argument to drm_exec_init removed)]
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-06-13 8:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 14:18 [PATCH] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms Alex Deucher
2024-06-01 5:24 ` Greg KH
2024-06-03 14:31 ` Deucher, Alexander
2024-06-12 12:06 ` Greg KH
2024-06-13 8:04 ` Tomáš Trnka
2024-06-13 8:14 ` Greg KH
2024-06-13 8:36 ` Tomáš Trnka
2024-06-13 8:50 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox