From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Christian König" <christian.koenig@amd.com>
Subject: [RFC PATCH 1/2] drm/amdgpu: Move dma_resv waiting outside the notifier lock
Date: Thu, 7 Oct 2021 15:26:29 +0200 [thread overview]
Message-ID: <20211007132630.495184-2-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20211007132630.495184-1-thomas.hellstrom@linux.intel.com>
While the range notifier is executing, we have the write-side mmu interval
seqlock, and mmu_interval_read_retry() is always returning true,
which means that if amdgpu_cs_submit grabs the notifier lock during the
fence wait, it will retry anyway when checking the userptr validity
and block when retrying in mmu_interval_read_begin().
(See the extensive comments in mmu_interval_read_begin())
Hence we can release the notifier lock before the fence wait and avoid
a device-wide command submission block during invalidation.
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index 4b153daf283d..d3d340a6129c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -75,9 +75,10 @@ static bool amdgpu_mn_invalidate_gfx(struct mmu_interval_notifier *mni,
mmu_interval_set_seq(mni, cur_seq);
+ mutex_unlock(&adev->notifier_lock);
+
r = dma_resv_wait_timeout(bo->tbo.base.resv, true, false,
MAX_SCHEDULE_TIMEOUT);
- mutex_unlock(&adev->notifier_lock);
if (r <= 0)
DRM_ERROR("(%ld) failed to wait for user bo\n", r);
return true;
--
2.31.1
next prev parent reply other threads:[~2021-10-07 13:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 13:26 [RFC PATCH 0/2] drm/amdgpu: Reduce the notifier_lock contention Thomas Hellström
2021-10-07 13:26 ` Thomas Hellström [this message]
2021-10-07 14:57 ` [RFC PATCH 1/2] drm/amdgpu: Move dma_resv waiting outside the notifier lock Christian König
2021-10-08 6:43 ` Thomas Hellström
2021-10-07 13:26 ` [RFC PATCH 2/2] drm/amdgpu: Use an rwsem for " Thomas Hellström
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=20211007132630.495184-2-thomas.hellstrom@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.