All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update
@ 2024-12-17 17:22 Michel Dänzer
  2024-12-18  8:32 ` Christian König
  2024-12-19  0:25 ` Jure Repinc
  0 siblings, 2 replies; 5+ messages in thread
From: Michel Dänzer @ 2024-12-17 17:22 UTC (permalink / raw)
  To: Alex Deucher, Christian König; +Cc: amd-gfx

From: Michel Dänzer <mdaenzer@redhat.com>

Third time's the charm, I hope?

Fixes: d3116756a710 ("drm/ttm: rename bo->mem and make it a pointer")
Issue: https://gitlab.freedesktop.org/drm/amd/-/issues/3837
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
---

Or should amdgpu_vm_bo_evicted be called in the !bo->tbo.resource case
as well?

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index ddd7f05e4db9..c9c48b782ec1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1266,10 +1266,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
 	 * next command submission.
 	 */
 	if (amdgpu_vm_is_bo_always_valid(vm, bo)) {
-		uint32_t mem_type = bo->tbo.resource->mem_type;
-
-		if (!(bo->preferred_domains &
-		      amdgpu_mem_type_to_domain(mem_type)))
+		if (bo->tbo.resource &&
+		    !(bo->preferred_domains &
+		      amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type)))
 			amdgpu_vm_bo_evicted(&bo_va->base);
 		else
 			amdgpu_vm_bo_idle(&bo_va->base);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update
  2024-12-17 17:22 [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update Michel Dänzer
@ 2024-12-18  8:32 ` Christian König
  2024-12-18  8:59   ` Michel Dänzer
  2024-12-19  0:25 ` Jure Repinc
  1 sibling, 1 reply; 5+ messages in thread
From: Christian König @ 2024-12-18  8:32 UTC (permalink / raw)
  To: Michel Dänzer, Alex Deucher; +Cc: amd-gfx

Am 17.12.24 um 18:22 schrieb Michel Dänzer:
> From: Michel Dänzer <mdaenzer@redhat.com>
>
> Third time's the charm, I hope?

More like the twenties. It's astonishing how many use cases for BOs 
without a backing store we have.

>
> Fixes: d3116756a710 ("drm/ttm: rename bo->mem and make it a pointer")

Please double check if that code wasn't introduced later than this patch.

> Issue: https://gitlab.freedesktop.org/drm/amd/-/issues/3837
> Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>
> Or should amdgpu_vm_bo_evicted be called in the !bo->tbo.resource case
> as well?
>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index ddd7f05e4db9..c9c48b782ec1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1266,10 +1266,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
>   	 * next command submission.
>   	 */
>   	if (amdgpu_vm_is_bo_always_valid(vm, bo)) {
> -		uint32_t mem_type = bo->tbo.resource->mem_type;
> -
> -		if (!(bo->preferred_domains &
> -		      amdgpu_mem_type_to_domain(mem_type)))
> +		if (bo->tbo.resource &&
> +		    !(bo->preferred_domains &
> +		      amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type)))
>   			amdgpu_vm_bo_evicted(&bo_va->base);
>   		else
>   			amdgpu_vm_bo_idle(&bo_va->base);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update
  2024-12-18  8:32 ` Christian König
@ 2024-12-18  8:59   ` Michel Dänzer
  2024-12-18 14:50     ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Michel Dänzer @ 2024-12-18  8:59 UTC (permalink / raw)
  To: Christian König, Alex Deucher; +Cc: amd-gfx

On 2024-12-18 09:32, Christian König wrote:
> Am 17.12.24 um 18:22 schrieb Michel Dänzer:
>> From: Michel Dänzer <mdaenzer@redhat.com>
>>
>> Third time's the charm, I hope?
> 
> More like the twenties.

The reference is to it being the third time in amdgpu_vm_bo_update.


>> Fixes: d3116756a710 ("drm/ttm: rename bo->mem and make it a pointer")
> 
> Please double check if that code wasn't introduced later than this patch.

Checked before adding this to the commit log and double-checked, d3116756a710 modified this code, no other commit has touched it since.


>> Issue: https://gitlab.freedesktop.org/drm/amd/-/issues/3837
>> Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>

Thanks!


-- 
Earthling Michel Dänzer       \        GNOME / Xwayland / Mesa developer
https://redhat.com             \               Libre software enthusiast

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update
  2024-12-18  8:59   ` Michel Dänzer
@ 2024-12-18 14:50     ` Alex Deucher
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2024-12-18 14:50 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: Christian König, Alex Deucher, amd-gfx

Applied.  Thanks!

On Wed, Dec 18, 2024 at 3:59 AM Michel Dänzer <michel@daenzer.net> wrote:
>
> On 2024-12-18 09:32, Christian König wrote:
> > Am 17.12.24 um 18:22 schrieb Michel Dänzer:
> >> From: Michel Dänzer <mdaenzer@redhat.com>
> >>
> >> Third time's the charm, I hope?
> >
> > More like the twenties.
>
> The reference is to it being the third time in amdgpu_vm_bo_update.
>
>
> >> Fixes: d3116756a710 ("drm/ttm: rename bo->mem and make it a pointer")
> >
> > Please double check if that code wasn't introduced later than this patch.
>
> Checked before adding this to the commit log and double-checked, d3116756a710 modified this code, no other commit has touched it since.
>
>
> >> Issue: https://gitlab.freedesktop.org/drm/amd/-/issues/3837
> >> Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
> >
> > Reviewed-by: Christian König <christian.koenig@amd.com>
>
> Thanks!
>
>
> --
> Earthling Michel Dänzer       \        GNOME / Xwayland / Mesa developer
> https://redhat.com             \               Libre software enthusiast

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update
  2024-12-17 17:22 [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update Michel Dänzer
  2024-12-18  8:32 ` Christian König
@ 2024-12-19  0:25 ` Jure Repinc
  1 sibling, 0 replies; 5+ messages in thread
From: Jure Repinc @ 2024-12-19  0:25 UTC (permalink / raw)
  To: amd-gfx

[-- Attachment #1: Type: text/plain, Size: 1702 bytes --]

> From: Michel Dänzer <mdaenzer@redhat.com>
> 
> Third time's the charm, I hope?
> 
> Fixes: d3116756a710 ("drm/ttm: rename bo->mem and make it a pointer")
> Issue: https://gitlab.freedesktop.org/drm/amd/-/issues/3837
> Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
> ---
> 
> Or should amdgpu_vm_bo_evicted be called in the !bo->tbo.resource case
> as well?
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index ddd7f05e4db9..c9c48b782ec1
> 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1266,10 +1266,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
> struct amdgpu_bo_va *bo_va, * next command submission.
>  	 */
>  	if (amdgpu_vm_is_bo_always_valid(vm, bo)) {
> -		uint32_t mem_type = bo->tbo.resource->mem_type;
> -
> -		if (!(bo->preferred_domains &
> -		      amdgpu_mem_type_to_domain(mem_type)))
> +		if (bo->tbo.resource &&
> +		    !(bo->preferred_domains &
> +		      amdgpu_mem_type_to_domain(bo->tbo.resource-
>mem_type)))
>  			amdgpu_vm_bo_evicted(&bo_va->base);
>  		else
>  			amdgpu_vm_bo_idle(&bo_va->base);

Hi

I reported the issue and just replying to confirm the fix works for me. I 
applied the patch to the openSUSE kernel sources of the same kernel version 
that I got the original bug with and tested again with this patch and now all 
applications works fine.

Thanks!

-- 
         Jabber/XMPP: JLP@jabber.org
              Matrix: @jlp:matrix.org
Mastodon/ActivityPub: @JRepin@mstdn.io

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4066 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-19  7:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17 17:22 [PATCH] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update Michel Dänzer
2024-12-18  8:32 ` Christian König
2024-12-18  8:59   ` Michel Dänzer
2024-12-18 14:50     ` Alex Deucher
2024-12-19  0:25 ` Jure Repinc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.