AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: YiPeng Chai <YiPeng.Chai@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Hawking.Zhang@amd.com>, <Tao.Zhou1@amd.com>,
	<Candice.Li@amd.com>, <KevinYang.Wang@amd.com>,
	<Stanley.Yang@amd.com>, YiPeng Chai <YiPeng.Chai@amd.com>
Subject: [PATCH 1/5] drm/amdgpu: add condition check for waking up thread
Date: Thu, 13 Jun 2024 10:25:00 +0800	[thread overview]
Message-ID: <20240613022504.81787-1-YiPeng.Chai@amd.com> (raw)

1. Cannot add messages to fifo in gpu reset mode.
2. Only when the message is successfully saved to the
fifo, the thread can be awakened.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 16 ++++++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 18 +++++++++++-------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index d0dcd3d37e6d..ed260966363f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -2093,12 +2093,16 @@ static void amdgpu_ras_interrupt_poison_creation_handler(struct ras_manager *obj
 	if (amdgpu_ip_version(obj->adev, UMC_HWIP, 0) >= IP_VERSION(12, 0, 0)) {
 		struct amdgpu_ras *con = amdgpu_ras_get_context(obj->adev);
 
-		amdgpu_ras_put_poison_req(obj->adev,
-			AMDGPU_RAS_BLOCK__UMC, 0, NULL, NULL, false);
-
-		atomic_inc(&con->page_retirement_req_cnt);
-
-		wake_up(&con->page_retirement_wq);
+		if (!amdgpu_in_reset(obj->adev) && !atomic_read(&con->in_recovery)) {
+			int ret;
+
+			ret = amdgpu_ras_put_poison_req(obj->adev,
+				AMDGPU_RAS_BLOCK__UMC, 0, NULL, NULL, false);
+			if (!ret) {
+				atomic_inc(&con->page_retirement_req_cnt);
+				wake_up(&con->page_retirement_wq);
+			}
+		}
 	}
 #endif
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
index 1dbe69eabb9a..94181ae85886 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
@@ -293,16 +293,20 @@ int amdgpu_umc_pasid_poison_handler(struct amdgpu_device *adev,
 
 			amdgpu_ras_error_data_fini(&err_data);
 		} else {
-				struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
-
 #ifdef HAVE_KFIFO_PUT_NON_POINTER
-				amdgpu_ras_put_poison_req(adev,
-					block, pasid, pasid_fn, data, reset);
-#endif
+			struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
 
-				atomic_inc(&con->page_retirement_req_cnt);
+			if (!amdgpu_in_reset(adev) && !atomic_read(&con->in_recovery)) {
+				int ret;
 
-				wake_up(&con->page_retirement_wq);
+				ret = amdgpu_ras_put_poison_req(adev,
+					block, pasid, pasid_fn, data, reset);
+				if (!ret) {
+					atomic_inc(&con->page_retirement_req_cnt);
+					wake_up(&con->page_retirement_wq);
+				}
+			}
+#endif
 		}
 	} else {
 		if (adev->virt.ops && adev->virt.ops->ras_poison_handler)
-- 
2.34.1


             reply	other threads:[~2024-06-13  2:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  2:25 YiPeng Chai [this message]
2024-06-13  2:25 ` [PATCH 2/5] drm/amdgpu: add threshold to interrupt waiting for DE data to be ready YiPeng Chai
2024-06-13  2:25 ` [PATCH 3/5] drm/amdgpu: clear all messages reset flags in fifo before gpu reset YiPeng Chai
2024-06-13  2:25 ` [PATCH 4/5] drm/amdgpu: wait for gpu to complete reset YiPeng Chai
2024-06-13 10:19   ` Christian König
2024-06-13  2:25 ` [PATCH 5/5] drm/amdgpu: add gpu reset check before page retirement thread runs YiPeng Chai
2024-06-13 10:21   ` Christian König
2024-06-13  8:11 ` [PATCH 1/5] drm/amdgpu: add condition check for waking up thread Lazar, Lijo

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=20240613022504.81787-1-YiPeng.Chai@amd.com \
    --to=yipeng.chai@amd.com \
    --cc=Candice.Li@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=KevinYang.Wang@amd.com \
    --cc=Stanley.Yang@amd.com \
    --cc=Tao.Zhou1@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