From: "Christian König" <christian.koenig@amd.com>
To: Yunxiang Li <Yunxiang.Li@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, Likun.Gao@amd.com, Hawking.Zhang@amd.com
Subject: Re: [PATCH v2 03/10] drm/amdgpu: abort fence poll if reset is started
Date: Wed, 29 May 2024 08:38:40 +0200 [thread overview]
Message-ID: <32ab9756-ca28-4ec0-919a-1d1df950aee7@amd.com> (raw)
In-Reply-To: <20240528172340.34517-4-Yunxiang.Li@amd.com>
Am 28.05.24 um 19:23 schrieb Yunxiang Li:
> If a reset is triggered, there's no point in waiting for the fence back
> anymore, it just makes the reset code wait for a long time for the
> reset_domain read lock to be dropped.
>
> This also makes our reply to host FLR fast enough so the host doesn't
> timeout.
>
> Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 +++-
> drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 7 +++++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 3 ++-
> drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 2 +-
> 5 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 10832b470448..3c04f034d43e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -376,10 +376,12 @@ signed long amdgpu_fence_wait_polling(struct amdgpu_ring *ring,
> uint32_t wait_seq,
> signed long timeout)
> {
> -
> + int in_reset = amdgpu_in_reset(ring->adev);
> while ((int32_t)(wait_seq - amdgpu_fence_read(ring)) > 0 && timeout > 0) {
> udelay(2);
> timeout -= 2;
> + if (!in_reset && amdgpu_in_reset(ring->adev))
Clear NAK to that approach. This is just a pretty unstable hack.
It's perfectly possible that the reset has already started before we
enter the function.
Regards,
Christian.
> + return 0;
> }
> return timeout > 0 ? timeout : 0;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> index 8c6b0987919f..dd22fd93f572 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> @@ -32,14 +32,17 @@
> #define AMDGPU_MES_MAX_NUM_OF_QUEUES_PER_PROCESS 1024
> #define AMDGPU_ONE_DOORBELL_SIZE 8
>
> -signed long amdgpu_mes_fence_wait_polling(u64 *fence,
> +signed long amdgpu_mes_fence_wait_polling(struct amdgpu_device *adev,
> + u64 *fence,
> u64 wait_seq,
> signed long timeout)
> {
> -
> + int in_reset = amdgpu_in_reset(adev);
> while ((s64)(wait_seq - *fence) > 0 && timeout > 0) {
> udelay(2);
> timeout -= 2;
> + if (!in_reset && amdgpu_in_reset(adev))
> + return 0;
> }
> return timeout > 0 ? timeout : 0;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
> index b99a2b3cffe3..064cb3995a3d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
> @@ -340,7 +340,8 @@ struct amdgpu_mes_funcs {
> #define amdgpu_mes_kiq_hw_init(adev) (adev)->mes.kiq_hw_init((adev))
> #define amdgpu_mes_kiq_hw_fini(adev) (adev)->mes.kiq_hw_fini((adev))
>
> -signed long amdgpu_mes_fence_wait_polling(u64 *fence,
> +signed long amdgpu_mes_fence_wait_polling(struct amdgpu_device *adev,
> + u64 *fence,
> u64 wait_seq,
> signed long timeout);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> index 96629d8130b8..38edd60c6789 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> @@ -212,7 +212,7 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
> else
> dev_dbg(adev->dev, "MES msg=%d was emitted\n", x_pkt->header.opcode);
>
> - r = amdgpu_mes_fence_wait_polling(fence_ptr, (u64)1, timeout);
> + r = amdgpu_mes_fence_wait_polling(adev, fence_ptr, (u64)1, timeout);
> amdgpu_device_wb_free(adev, fence_offset);
> if (r < 1) {
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
> index c5a03b79f07e..73430b9c4b27 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
> @@ -202,7 +202,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
> else
> dev_dbg(adev->dev, "MES msg=%d was emitted\n", x_pkt->header.opcode);
>
> - r = amdgpu_mes_fence_wait_polling(fence_ptr, (u64)1, timeout);
> + r = amdgpu_mes_fence_wait_polling(adev, fence_ptr, (u64)1, timeout);
> amdgpu_device_wb_free(adev, fence_offset);
>
> if (r < 1) {
next prev parent reply other threads:[~2024-05-29 6:38 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 17:23 [PATCH v2 00/10] drm/amdgpu: prevent concurrent GPU access during reset Yunxiang Li
2024-05-28 17:23 ` [PATCH v2 01/10] drm/amdgpu: add skip_hw_access checks for sriov Yunxiang Li
2024-05-29 6:36 ` Christian König
2024-05-28 17:23 ` [PATCH v2 02/10] drm/amdgpu: fix sriov host flr handler Yunxiang Li
2024-05-29 6:41 ` Christian König
2024-05-28 17:23 ` [PATCH v2 03/10] drm/amdgpu: abort fence poll if reset is started Yunxiang Li
2024-05-29 6:38 ` Christian König [this message]
2024-05-29 13:22 ` Li, Yunxiang (Teddy)
2024-05-29 13:31 ` Christian König
2024-05-29 13:44 ` Li, Yunxiang (Teddy)
2024-05-29 13:55 ` Christian König
2024-05-29 14:31 ` Li, Yunxiang (Teddy)
2024-05-29 14:35 ` Christian König
2024-05-29 14:48 ` Li, Yunxiang (Teddy)
2024-05-29 15:19 ` Christian König
2024-05-31 14:44 ` Liu, Shaoyun
2024-06-03 10:58 ` Christian König
2024-06-03 18:28 ` Liu, Shaoyun
2024-06-04 8:07 ` Christian König
2024-06-05 12:32 ` Liu, Shaoyun
2024-05-28 17:23 ` [PATCH v2 04/10] drm/amdgpu/kfd: remove is_hws_hang and is_resetting Yunxiang Li
2024-05-29 6:41 ` Christian König
2024-05-29 23:04 ` Felix Kuehling
2024-05-30 0:06 ` Li, Yunxiang (Teddy)
2024-05-28 17:23 ` [PATCH v2 05/10] drm/amd/amdgpu: remove unnecessary flush when enable gart Yunxiang Li
2024-05-29 6:43 ` Christian König
2024-05-28 17:23 ` [PATCH v2 06/10] drm/amdgpu: remove tlb flush in amdgpu_gtt_mgr_recover Yunxiang Li
2024-05-29 6:45 ` Christian König
2024-05-28 17:23 ` [PATCH v2 07/10] drm/amdgpu: use helper in amdgpu_gart_unbind Yunxiang Li
2024-05-29 6:46 ` Christian König
2024-05-28 17:23 ` [PATCH v2 08/10] drm/amdgpu: fix locking scope when flushing tlb Yunxiang Li
2024-05-29 6:49 ` Christian König
2024-05-28 17:23 ` [PATCH v2 09/10] drm/amdgpu: fix missing reset domain locks Yunxiang Li
2024-05-29 6:55 ` Christian König
2024-05-30 22:02 ` Felix Kuehling
2024-05-30 22:35 ` Li, Yunxiang (Teddy)
2024-05-31 6:52 ` Christian König
2024-05-31 15:47 ` Felix Kuehling
2024-06-04 12:52 ` Li, Yunxiang (Teddy)
2024-05-28 17:23 ` [PATCH v2 10/10] Revert "drm/amdgpu: Queue KFD reset workitem in VF FED" Yunxiang Li
2024-05-28 19:04 ` Skvortsov, Victor
2024-05-30 21:47 ` [PATCH v3 0/8] drm/amdgpu: prevent concurrent GPU access during reset Yunxiang Li
2024-05-30 21:47 ` [PATCH v3 1/8] drm/amdgpu: add skip_hw_access checks for sriov Yunxiang Li
2024-05-30 21:47 ` [PATCH v3 2/8] drm/amdgpu: fix sriov host flr handler Yunxiang Li
2024-06-05 1:12 ` Deng, Emily
2024-05-30 21:48 ` [PATCH v3 3/8] drm/amdgpu/kfd: remove is_hws_hang and is_resetting Yunxiang Li
2024-05-30 21:48 ` [PATCH v3 4/8] drm/amd/amdgpu: remove unnecessary flush when enable gart Yunxiang Li
2024-05-30 21:48 ` [PATCH v3 5/8] drm/amdgpu: remove tlb flush in amdgpu_gtt_mgr_recover Yunxiang Li
2024-05-30 21:48 ` [PATCH v3 6/8] drm/amdgpu: use helper in amdgpu_gart_unbind Yunxiang Li
2024-05-30 21:48 ` [PATCH v3 7/8] drm/amdgpu: fix locking scope when flushing tlb Yunxiang Li
2024-05-30 21:48 ` [PATCH v3 8/8] drm/amdgpu: fix missing reset domain locks Yunxiang Li
2024-05-31 6:50 ` 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=32ab9756-ca28-4ec0-919a-1d1df950aee7@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Likun.Gao@amd.com \
--cc=Yunxiang.Li@amd.com \
--cc=amd-gfx@lists.freedesktop.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