AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>, samuel.pitoiset@gmail.com
Subject: [PATCH 4/4] drm/amdgpu: refine fault cache updates
Date: Thu, 27 Jul 2023 14:10:48 -0400	[thread overview]
Message-ID: <20230727181048.1222388-5-alexander.deucher@amd.com> (raw)
In-Reply-To: <20230727181048.1222388-1-alexander.deucher@amd.com>

Don't update the fault cache if status is 0.  In the multiple
fault case, subsequent faults will return a 0 status which is
useless for userspace and replaces the useful fault status, so
only update if status is non-0.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 9294264b15745..39ea2404f38aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2757,7 +2757,12 @@ void amdgpu_vm_update_fault_cache(struct amdgpu_device *adev,
 	xa_lock_irqsave(&adev->vm_manager.pasids, flags);
 
 	vm = xa_load(&adev->vm_manager.pasids, pasid);
-	if (vm) {
+	/* Don't update the fault cache if status is 0.  In the multiple
+	 * fault case, subsequent faults will return a 0 status which is
+	 * useless for userspace and replaces the useful fault status, so
+	 * only update if status is non-0.
+	 */
+	if (vm && status) {
 		vm->fault_info.addr = addr;
 		vm->fault_info.status = status;
 		if (AMDGPU_IS_GFXHUB(vmhub)) {
-- 
2.41.0


  parent reply	other threads:[~2023-07-27 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 18:10 [PATCH v3 0/4] Add GPU page fault query interface Alex Deucher
2023-07-27 18:10 ` [PATCH 1/4] drm/amdgpu: add cached GPU fault structure to vm struct Alex Deucher
2023-07-27 18:10 ` [PATCH 2/4] drm/amdgpu: cache gpuvm fault information for gmc7+ Alex Deucher
2023-07-27 18:10 ` [PATCH 3/4] drm/amdgpu: add new INFO ioctl query for the last GPU page fault Alex Deucher
2023-07-27 18:10 ` Alex Deucher [this message]
2023-08-10 19:35 ` [PATCH v3 0/4] Add GPU page fault query interface Alex Deucher
2023-08-16 15:20   ` Alex Deucher
  -- strict thread matches above, loose matches on Subject: below --
2023-09-28 20:06 [PATCH v4 " Alex Deucher
2023-09-28 20:06 ` [PATCH 4/4] drm/amdgpu: refine fault cache updates Alex Deucher

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=20230727181048.1222388-5-alexander.deucher@amd.com \
    --to=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=samuel.pitoiset@gmail.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