public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Christian König" <christian.koenig@amd.com>,
	"Guchun Chen" <guchun.chen@amd.com>,
	"Mikhail Gavrilov" <mikhail.v.gavrilov@gmail.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH 1/9] drm/amdgpu: make sure BOs are locked in amdgpu_vm_get_memory
Date: Tue, 11 Jul 2023 16:40:44 -0500	[thread overview]
Message-ID: <c065e6f4-35d5-526f-30ab-61fdcc008415@amd.com> (raw)
In-Reply-To: <20230707150734.746135-1-alexander.deucher@amd.com>

On 7/7/23 10:07, Alex Deucher wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> We need to grab the lock of the BO or otherwise can run into a crash
> when we try to inspect the current location.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> Acked-by: Guchun Chen <guchun.chen@amd.com>
> Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> (cherry picked from commit e2ad8e2df432498b1cee2af04df605723f4d75e6)
> Cc: stable@vger.kernel.org # 6.3.x
> ---

Greg,

Just want to make sure you saw these 9 commits as you're processing 
queues since they don't stand out as being sent directly to stable.

>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 69 +++++++++++++++-----------
>   1 file changed, 39 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 5b3a70becbdf..a252a206f37b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -920,42 +920,51 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>   	return r;
>   }
>   
> +static void amdgpu_vm_bo_get_memory(struct amdgpu_bo_va *bo_va,
> +				    struct amdgpu_mem_stats *stats)
> +{
> +	struct amdgpu_vm *vm = bo_va->base.vm;
> +	struct amdgpu_bo *bo = bo_va->base.bo;
> +
> +	if (!bo)
> +		return;
> +
> +	/*
> +	 * For now ignore BOs which are currently locked and potentially
> +	 * changing their location.
> +	 */
> +	if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv &&
> +	    !dma_resv_trylock(bo->tbo.base.resv))
> +		return;
> +
> +	amdgpu_bo_get_memory(bo, stats);
> +	if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv)
> +	    dma_resv_unlock(bo->tbo.base.resv);
> +}
> +
>   void amdgpu_vm_get_memory(struct amdgpu_vm *vm,
>   			  struct amdgpu_mem_stats *stats)
>   {
>   	struct amdgpu_bo_va *bo_va, *tmp;
>   
>   	spin_lock(&vm->status_lock);
> -	list_for_each_entry_safe(bo_va, tmp, &vm->idle, base.vm_status) {
> -		if (!bo_va->base.bo)
> -			continue;
> -		amdgpu_bo_get_memory(bo_va->base.bo, stats);
> -	}
> -	list_for_each_entry_safe(bo_va, tmp, &vm->evicted, base.vm_status) {
> -		if (!bo_va->base.bo)
> -			continue;
> -		amdgpu_bo_get_memory(bo_va->base.bo, stats);
> -	}
> -	list_for_each_entry_safe(bo_va, tmp, &vm->relocated, base.vm_status) {
> -		if (!bo_va->base.bo)
> -			continue;
> -		amdgpu_bo_get_memory(bo_va->base.bo, stats);
> -	}
> -	list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
> -		if (!bo_va->base.bo)
> -			continue;
> -		amdgpu_bo_get_memory(bo_va->base.bo, stats);
> -	}
> -	list_for_each_entry_safe(bo_va, tmp, &vm->invalidated, base.vm_status) {
> -		if (!bo_va->base.bo)
> -			continue;
> -		amdgpu_bo_get_memory(bo_va->base.bo, stats);
> -	}
> -	list_for_each_entry_safe(bo_va, tmp, &vm->done, base.vm_status) {
> -		if (!bo_va->base.bo)
> -			continue;
> -		amdgpu_bo_get_memory(bo_va->base.bo, stats);
> -	}
> +	list_for_each_entry_safe(bo_va, tmp, &vm->idle, base.vm_status)
> +		amdgpu_vm_bo_get_memory(bo_va, stats);
> +
> +	list_for_each_entry_safe(bo_va, tmp, &vm->evicted, base.vm_status)
> +		amdgpu_vm_bo_get_memory(bo_va, stats);
> +
> +	list_for_each_entry_safe(bo_va, tmp, &vm->relocated, base.vm_status)
> +		amdgpu_vm_bo_get_memory(bo_va, stats);
> +
> +	list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status)
> +		amdgpu_vm_bo_get_memory(bo_va, stats);
> +
> +	list_for_each_entry_safe(bo_va, tmp, &vm->invalidated, base.vm_status)
> +		amdgpu_vm_bo_get_memory(bo_va, stats);
> +
> +	list_for_each_entry_safe(bo_va, tmp, &vm->done, base.vm_status)
> +		amdgpu_vm_bo_get_memory(bo_va, stats);
>   	spin_unlock(&vm->status_lock);
>   }
>   


  parent reply	other threads:[~2023-07-11 21:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 15:07 [PATCH 1/9] drm/amdgpu: make sure BOs are locked in amdgpu_vm_get_memory Alex Deucher
2023-07-07 15:07 ` [PATCH 2/9] drm/amdgpu: make sure that BOs have a backing store Alex Deucher
2023-07-07 15:07 ` [PATCH 3/9] drm/amdgpu: Skip mark offset for high priority rings Alex Deucher
2023-07-07 15:07 ` [PATCH 4/9] drm/amd/pm: revise the ASPM settings for thunderbolt attached scenario Alex Deucher
2023-07-07 15:07 ` [PATCH 5/9] drm/amdgpu/sdma4: set align mask to 255 Alex Deucher
2023-07-07 15:07 ` [PATCH 6/9] drm/amd/pm: add abnormal fan detection for smu 13.0.0 Alex Deucher
2023-07-07 15:07 ` [PATCH 7/9] drm/amdgpu: check RAS irq existence for VCN/JPEG Alex Deucher
2023-07-07 15:07 ` [PATCH 8/9] drm/amdgpu: fix number of fence calculations Alex Deucher
2023-07-07 15:07 ` [PATCH 9/9] drm/amd: Don't try to enable secure display TA multiple times Alex Deucher
2023-07-11 21:40 ` Mario Limonciello [this message]
2023-07-12  5:12   ` [PATCH 1/9] drm/amdgpu: make sure BOs are locked in amdgpu_vm_get_memory Greg Kroah-Hartman
2023-07-16 19:16 ` Greg KH
2023-07-16 19:22   ` Mario Limonciello
2023-07-16 19:28     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c065e6f4-35d5-526f-30ab-61fdcc008415@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guchun.chen@amd.com \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox