dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Andrey Grodzovsky <andrey.grodzovsky@amd.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: horace.chen@amd.com, lijo.lazar@amd.com, jingwech@amd.com,
	christian.koenig@amd.com, Monk.Liu@amd.com,
	Liu Shaoyun <Shaoyun.Liu@amd.com>
Subject: Re: [RFC v4 04/11] drm/amd/virt: For SRIOV send GPU reset directly to TDR queue.
Date: Wed, 9 Feb 2022 08:54:41 +0100	[thread overview]
Message-ID: <947e0106-5c92-2f92-8a3d-502c25a7126d@gmail.com> (raw)
In-Reply-To: <20220209002320.6077-5-andrey.grodzovsky@amd.com>



Am 09.02.22 um 01:23 schrieb Andrey Grodzovsky:
> No need to to trigger another work queue inside the work queue.
>
> v3:
>
> Problem:
> Extra reset caused by host side FLR notification
> following guest side triggered reset.
> Fix: Preven qeuing flr_work from mailbox irq if guest
> already executing a reset.
>
> Suggested-by: Liu Shaoyun <Shaoyun.Liu@amd.com>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>

Feel free to add an Acked-by: Christian König 
<christian.koenig@amd.com>, but an rb from somebody more familiar with 
the code would be better.

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 9 ++++++---
>   drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 9 ++++++---
>   drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c | 9 ++++++---
>   3 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
> index 56da5ab82987..5869d51d8bee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
> @@ -282,7 +282,7 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work)
>   	if (amdgpu_device_should_recover_gpu(adev)
>   		&& (!amdgpu_device_has_job_running(adev) ||
>   		adev->sdma_timeout == MAX_SCHEDULE_TIMEOUT))
> -		amdgpu_device_gpu_recover(adev, NULL);
> +		amdgpu_device_gpu_recover_imp(adev, NULL);
>   }
>   
>   static int xgpu_ai_set_mailbox_rcv_irq(struct amdgpu_device *adev,
> @@ -307,8 +307,11 @@ static int xgpu_ai_mailbox_rcv_irq(struct amdgpu_device *adev,
>   
>   	switch (event) {
>   		case IDH_FLR_NOTIFICATION:
> -		if (amdgpu_sriov_runtime(adev))
> -			schedule_work(&adev->virt.flr_work);
> +		if (amdgpu_sriov_runtime(adev) && !amdgpu_in_reset(adev))
> +			WARN_ONCE(!queue_work(adev->reset_domain.wq,
> +					      &adev->virt.flr_work),
> +				  "Failed to queue work! at %s",
> +				  __func__);
>   		break;
>   		case IDH_QUERY_ALIVE:
>   			xgpu_ai_mailbox_send_ack(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c
> index 477d0dde19c5..5728a6401d73 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c
> @@ -309,7 +309,7 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work)
>   		adev->gfx_timeout == MAX_SCHEDULE_TIMEOUT ||
>   		adev->compute_timeout == MAX_SCHEDULE_TIMEOUT ||
>   		adev->video_timeout == MAX_SCHEDULE_TIMEOUT))
> -		amdgpu_device_gpu_recover(adev, NULL);
> +		amdgpu_device_gpu_recover_imp(adev, NULL);
>   }
>   
>   static int xgpu_nv_set_mailbox_rcv_irq(struct amdgpu_device *adev,
> @@ -337,8 +337,11 @@ static int xgpu_nv_mailbox_rcv_irq(struct amdgpu_device *adev,
>   
>   	switch (event) {
>   	case IDH_FLR_NOTIFICATION:
> -		if (amdgpu_sriov_runtime(adev))
> -			schedule_work(&adev->virt.flr_work);
> +		if (amdgpu_sriov_runtime(adev) && !amdgpu_in_reset(adev))
> +			WARN_ONCE(!queue_work(adev->reset_domain.wq,
> +					      &adev->virt.flr_work),
> +				  "Failed to queue work! at %s",
> +				  __func__);
>   		break;
>   		/* READY_TO_ACCESS_GPU is fetched by kernel polling, IRQ can ignore
>   		 * it byfar since that polling thread will handle it,
> diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
> index aef9d059ae52..02290febfcf4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
> @@ -521,7 +521,7 @@ static void xgpu_vi_mailbox_flr_work(struct work_struct *work)
>   
>   	/* Trigger recovery due to world switch failure */
>   	if (amdgpu_device_should_recover_gpu(adev))
> -		amdgpu_device_gpu_recover(adev, NULL);
> +		amdgpu_device_gpu_recover_imp(adev, NULL);
>   }
>   
>   static int xgpu_vi_set_mailbox_rcv_irq(struct amdgpu_device *adev,
> @@ -550,8 +550,11 @@ static int xgpu_vi_mailbox_rcv_irq(struct amdgpu_device *adev,
>   		r = xgpu_vi_mailbox_rcv_msg(adev, IDH_FLR_NOTIFICATION);
>   
>   		/* only handle FLR_NOTIFY now */
> -		if (!r)
> -			schedule_work(&adev->virt.flr_work);
> +		if (!r && !amdgpu_in_reset(adev))
> +			WARN_ONCE(!queue_work(adev->reset_domain.wq,
> +					      &adev->virt.flr_work),
> +				  "Failed to queue work! at %s",
> +				  __func__);
>   	}
>   
>   	return 0;


  parent reply	other threads:[~2022-02-09  7:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  0:23 [RFC v4 00/11] Define and use reset domain for GPU recovery in amdgpu Andrey Grodzovsky
2022-02-09  0:23 ` [RFC v4 01/11] drm/amdgpu: Introduce reset domain Andrey Grodzovsky
2022-02-09  0:23 ` [RFC v4 02/11] drm/amdgpu: Move scheduler init to after XGMI is ready Andrey Grodzovsky
2022-02-09  7:53   ` Christian König
2022-02-09 18:06     ` Andrey Grodzovsky
2022-02-24  6:47       ` JingWen Chen
2022-02-24 16:24         ` Andrey Grodzovsky
2022-02-24 17:12           ` Deucher, Alexander
2022-02-24 17:26             ` Andrey Grodzovsky
2022-02-25  3:13               ` JingWen Chen
2022-02-09  0:23 ` [RFC v4 03/11] drm/amdgpu: Serialize non TDR gpu recovery with TDRs Andrey Grodzovsky
2022-02-09  0:23 ` [RFC v4 04/11] drm/amd/virt: For SRIOV send GPU reset directly to TDR queue Andrey Grodzovsky
2022-02-09  0:49   ` Liu, Shaoyun
2022-02-09  7:54   ` Christian König [this message]
2022-02-09  0:23 ` [RFC v4 05/11] drm/amdgpu: Drop hive->in_reset Andrey Grodzovsky
2022-02-09  0:23 ` [RFC v4 06/11] drm/amdgpu: Drop concurrent GPU reset protection for device Andrey Grodzovsky
2022-02-09  0:23 ` [RFC v4 07/11] drm/amdgpu: Rework reset domain to be refcounted Andrey Grodzovsky
2022-02-09  7:57   ` Christian König
2022-02-09  0:23 ` [RFC v4 08/11] drm/amdgpu: Move reset sem into reset_domain Andrey Grodzovsky
2022-02-09  7:59   ` Christian König
2022-02-09  0:23 ` [RFC v4 09/11] drm/amdgpu: Move in_gpu_reset " Andrey Grodzovsky
2022-02-09  8:00   ` Christian König
2022-02-09  0:23 ` [RFC v4 10/11] drm/amdgpu: Rework amdgpu_device_lock_adev Andrey Grodzovsky
2022-02-09  8:04   ` Christian König
2022-02-09  0:23 ` [RFC v4 11/11] Revert 'drm/amdgpu: annotate a false positive recursive locking' Andrey Grodzovsky
2022-02-09  8:06   ` Christian König

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=947e0106-5c92-2f92-8a3d-502c25a7126d@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Monk.Liu@amd.com \
    --cc=Shaoyun.Liu@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrey.grodzovsky@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=horace.chen@amd.com \
    --cc=jingwech@amd.com \
    --cc=lijo.lazar@amd.com \
    /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