From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Pixel Ding <Pixel.Ding-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/2] drm/amdgpu: use irq-safe lock for adev->ring_lru_list_lock
Date: Tue, 7 Nov 2017 11:36:08 +0100 [thread overview]
Message-ID: <eea538eb-8484-bfcc-060e-3e7a88960f4e@gmail.com> (raw)
In-Reply-To: <1510039608-15811-2-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
Am 07.11.2017 um 08:26 schrieb Pixel Ding:
> From: pding <Pixel.Ding@amd.com>
>
> This lock is used during register accessing in SRIOV guest
> since KIQ uses general ring submission (amdgpu_ring_commit).
> The register accessing could happen both in irq enabled and
> irq disabled cases. Always use irq-safe lock.
I would rather completely skip calling amdgpu_ring_lru_touch() for the
KIQ ring.
That is completely unused in this case anyway and just additional overhead.
Regards,
Christian.
>
> Signed-off-by: pding <Pixel.Ding@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index e5ece1f..d7997b5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -401,11 +401,12 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type,
> bool lru_pipe_order, struct amdgpu_ring **ring)
> {
> struct amdgpu_ring *entry;
> + unsigned long flags;
>
> /* List is sorted in LRU order, find first entry corresponding
> * to the desired HW IP */
> *ring = NULL;
> - spin_lock(&adev->ring_lru_list_lock);
> + spin_lock_irqsave(&adev->ring_lru_list_lock, flags);
> list_for_each_entry(entry, &adev->ring_lru_list, lru_list) {
> if (entry->funcs->type != type)
> continue;
> @@ -430,7 +431,7 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type,
> if (*ring)
> amdgpu_ring_lru_touch_locked(adev, *ring);
>
> - spin_unlock(&adev->ring_lru_list_lock);
> + spin_unlock_irqrestore(&adev->ring_lru_list_lock, flags);
>
> if (!*ring) {
> DRM_ERROR("Ring LRU contains no entries for ring type:%d\n", type);
> @@ -450,9 +451,11 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type,
> */
> void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring)
> {
> - spin_lock(&adev->ring_lru_list_lock);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&adev->ring_lru_list_lock, flags);
> amdgpu_ring_lru_touch_locked(adev, ring);
> - spin_unlock(&adev->ring_lru_list_lock);
> + spin_unlock_irqrestore(&adev->ring_lru_list_lock, flags);
> }
>
> /*
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-11-07 10:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-07 7:26 [PATCH 1/2] drm/amdgpu: use irq-safe lock for kiq->ring_lock Pixel Ding
[not found] ` <1510039608-15811-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-11-07 7:26 ` [PATCH 2/2] drm/amdgpu: use irq-safe lock for adev->ring_lru_list_lock Pixel Ding
[not found] ` <1510039608-15811-2-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-11-07 10:36 ` Christian König [this message]
2017-11-07 10:36 ` [PATCH 1/2] drm/amdgpu: use irq-safe lock for kiq->ring_lock Christian König
2017-11-07 12:09 ` Grazvydas Ignotas
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=eea538eb-8484-bfcc-060e-3e7a88960f4e@gmail.com \
--to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=Pixel.Ding-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.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