From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Xinhui.Pan@amd.com, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/6] drm/ttm: replace dma_resv object on deleted BOs v2
Date: Tue, 11 Feb 2020 16:15:17 +0100 [thread overview]
Message-ID: <52b7754b-548d-9166-5285-a5ca35405fa2@gmail.com> (raw)
In-Reply-To: <20200211141402.GB2363188@phenom.ffwll.local>
Am 11.02.20 um 15:14 schrieb Daniel Vetter:
> On Mon, Feb 10, 2020 at 04:09:06PM +0100, Christian König wrote:
>> When non-imported BOs are resurrected for delayed delete we replace
>> the dma_resv object to allow for easy reclaiming of the resources.
>>
>> v2: move that to ttm_bo_individualize_resv
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>> drivers/gpu/drm/ttm/ttm_bo.c | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index d0624685f5d2..4d161038de98 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -393,6 +393,14 @@ static int ttm_bo_individualize_resv(struct ttm_buffer_object *bo)
>>
>> r = dma_resv_copy_fences(&bo->base._resv, bo->base.resv);
>> dma_resv_unlock(&bo->base._resv);
>> + if (r)
>> + return r;
>> +
>> + if (bo->type != ttm_bo_type_sg) {
>> + spin_lock(&ttm_bo_glob.lru_lock);
>> + bo->base.resv = &bo->base._resv;
> Having the dma_resv pointer be protected by the lru_lock for ttm internal
> stuff, but invariant everywhere else is really confusing. Not sure that's
> a great idea, I've just chased some ttm code around freaking out about
> that.
The key point is that the reference counter is zero in this moment.
Taking the LRU spinlock was just a precaution and might actually be not
even necessary here.
I will double check,
Christian.
> -Daniel
>
>> + spin_unlock(&ttm_bo_glob.lru_lock);
>> + }
>>
>> return r;
>> }
>> @@ -720,7 +728,7 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
>>
>> if (bo->base.resv == ctx->resv) {
>> dma_resv_assert_held(bo->base.resv);
>> - if (ctx->flags & TTM_OPT_FLAG_ALLOW_RES_EVICT || bo->deleted)
>> + if (ctx->flags & TTM_OPT_FLAG_ALLOW_RES_EVICT)
>> ret = true;
>> *locked = false;
>> if (busy)
>> --
>> 2.17.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-02-11 15:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 15:09 Cleanup TTMs delayed delete handling Christian König
2020-02-10 15:09 ` [PATCH 1/6] drm/ttm: refine ghost BO resv criteria Christian König
2020-02-10 15:09 ` [PATCH 2/6] drm/ttm: cleanup ttm_buffer_object_transfer Christian König
2020-02-10 15:09 ` [PATCH 3/6] drm/ttm: use RCU in ttm_bo_flush_all_fences Christian König
2020-02-10 15:09 ` [PATCH 4/6] drm/ttm: rework BO delayed delete Christian König
2020-02-11 5:26 ` Pan, Xinhui
2020-02-11 5:43 ` Pan, Xinhui
2020-02-11 13:41 ` Christian König
2020-02-10 15:09 ` [PATCH 5/6] drm/ttm: replace dma_resv object on deleted BOs v2 Christian König
2020-02-11 14:14 ` Daniel Vetter
2020-02-11 15:02 ` Pan, Xinhui
2020-02-11 15:23 ` Christian König
2020-02-11 15:36 ` Daniel Vetter
2020-02-11 15:15 ` Christian König [this message]
2020-02-10 15:09 ` [PATCH 6/6] drm/ttm: individualize resv objects before calling release_notify Christian König
2020-02-11 11:06 ` Cleanup TTMs delayed delete handling Pan, Xinhui
2020-02-11 11:13 ` Daniel Vetter
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=52b7754b-548d-9166-5285-a5ca35405fa2@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Xinhui.Pan@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox