public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Zack Rusin <zackr@vmware.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
	"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
	"ckoenig.leichtzumerken@gmail.com"
	<ckoenig.leichtzumerken@gmail.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 03/15] dma-buf & drm/amdgpu: remove dma_resv workaround
Date: Fri, 22 Apr 2022 09:47:46 +0200	[thread overview]
Message-ID: <a8768665-beba-5897-82fb-df1e4bd3b058@amd.com> (raw)
In-Reply-To: <3da8b3f4240a2f8bbc442abf57982bb321aca789.camel@vmware.com>

Am 21.04.22 um 23:13 schrieb Zack Rusin:
> On Thu, 2022-04-21 at 12:17 +0200, Christian König wrote:
>> ⚠ External Email
>>
>> Am 20.04.22 um 21:28 schrieb Zack Rusin:
>>> [SNIP]
>>>> To figure out what it is could you try the following code
>>>> fragment:
>>>>
>>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
>>>> b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
>>>> index f46891012be3..a36f89d3f36d 100644
>>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
>>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
>>>> @@ -288,7 +288,7 @@ int vmw_validation_add_bo(struct
>>>> vmw_validation_context *ctx,
>>>>                    val_buf->bo = ttm_bo_get_unless_zero(&vbo-
>>>>> base);
>>>>                    if (!val_buf->bo)
>>>>                            return -ESRCH;
>>>> -               val_buf->num_shared = 0;
>>>> +               val_buf->num_shared = 16;
>>>>                    list_add_tail(&val_buf->head, &ctx->bo_list);
>>>>                    bo_node->as_mob = as_mob;
>>>>                    bo_node->cpu_blit = cpu_blit;
>>> Fails the same BUG_ON with num_fences and max_fences == 0.
>> Thanks for testing this.
>>
>> So the buffer object is not reserved through
>> vmw_validation_bo_reserve(), but comes from somewhere else.
>> Unfortunately I absolutely can't find where that's coming from.
>>
>> Do you have some documentation howto setup vmwgfx? E.g. sample VM
>> which
>> I can download somewhere etc..
> I don't have an external machine to upload it to. Getting an external
> machine to run Mesa CI on has been on our todo for a while, so I'll try
> to setup something next week.
>
> The issue here seems to be that vmwgfx always had some buffers that
> didn't immediately go through vmw_validation_bo_reserve. What's
> happening is that in vmwgfx_execbuf.c in vmw_execbuf_process we call
> vmw_validation_bo_reserve and after it we call
> vmw_validation_res_validate. Inside vmw_validation_res_validate (in
> vmwgfx_validation.c) we call vmw_resource_validate, which calls
> vmw_resource_do_validate . vmw_resource_do_validate has this code "ret
> = func->create(res);" which is an issue for vmwgfx_cotable.c . The
> func->create for cotable's is vmw_cotable_create which calls
> vmw_cotable_resize which creates, reserves and validates a new bo.

Just wow! No wonder that I missed that, I would have never ever been 
able to find it.

>
> In short a new bo is created in vmw_cotable_resize between
> ttm_eu_reserve_buffers and ttm_eu_fence_buffer_objects calls.

Well then the fix is trivial, we just need to call 
dma_resv_reserve_fences() on this new BO to make sure that at least one 
fence slot is reserved.

I will try to come up with a patch. Thanks a lot for that!

Regards,
Christian.

>
> z


  reply	other threads:[~2022-04-22  7:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  8:59 DMA-resv usage Christian König
2022-04-07  8:59 ` [PATCH 01/15] dma-buf: add enum dma_resv_usage v4 Christian König
2022-04-07  8:59 ` [PATCH 02/15] dma-buf: specify usage while adding fences to dma_resv obj v7 Christian König
2022-04-07  9:14   ` Daniel Vetter
2022-04-07 13:08   ` Javier Martinez Canillas
2022-04-07 13:13     ` Christian König
2022-04-07 13:16       ` Javier Martinez Canillas
2022-04-07  8:59 ` [PATCH 03/15] dma-buf & drm/amdgpu: remove dma_resv workaround Christian König
2022-04-20  3:56   ` Zack Rusin
2022-04-20  7:37     ` Christian König
2022-04-20 17:38       ` Zack Rusin
2022-04-20 17:40         ` Christian König
2022-04-20 18:41           ` Zack Rusin
2022-04-20 18:49             ` Christian König
2022-04-20 18:56               ` Christian König
2022-04-20 19:28                 ` Zack Rusin
2022-04-21 10:17                   ` Christian König
2022-04-21 21:13                     ` Zack Rusin
2022-04-22  7:47                       ` Christian König [this message]
2022-04-07  8:59 ` [PATCH 04/15] dma-buf: add DMA_RESV_USAGE_KERNEL v3 Christian König
2022-04-07  8:59 ` [PATCH 05/15] drm/amdgpu: use DMA_RESV_USAGE_KERNEL Christian König
2022-04-07  8:59 ` [PATCH 06/15] drm/radeon: " Christian König
2022-04-07  8:59 ` [PATCH 07/15] drm/nouveau: only wait for kernel fences in nouveau_bo_vm_cleanup Christian König
2022-04-07  8:59 ` [PATCH 08/15] RDMA: use DMA_RESV_USAGE_KERNEL Christian König
2022-04-07  8:59 ` [PATCH 09/15] dma-buf: add DMA_RESV_USAGE_BOOKKEEP v3 Christian König
2022-04-07  8:59 ` [PATCH 10/15] drm/amdgpu: use DMA_RESV_USAGE_BOOKKEEP Christian König
2022-04-07  8:59 ` [PATCH 11/15] dma-buf: wait for map to complete for static attachments Christian König
2022-04-07  8:59 ` [PATCH 12/15] drm/i915: drop bo->moving dependency Christian König
2022-04-08  9:05   ` Jani Nikula
2022-04-08  9:27     ` Christian König
2022-04-08  9:33       ` Daniel Vetter
2022-04-08  9:39         ` Christian König
2022-04-08 10:15       ` Jani Nikula
2022-04-08 10:41         ` Christian König
2022-04-07  8:59 ` [PATCH 13/15] drm/ttm: remove bo->moving Christian König
2022-04-07  8:59 ` [PATCH 14/15] dma-buf: drop seq count based update Christian König
2022-04-07  8:59 ` [PATCH 15/15] seqlock: drop seqcount_ww_mutex_t Christian König
2022-04-07  9:19   ` Daniel Vetter
2022-04-07 11:48     ` Christian König
2022-04-07  9:26   ` Peter Zijlstra
2022-04-07  9:15 ` DMA-resv usage 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=a8768665-beba-5897-82fb-df1e4bd3b058@amd.com \
    --to=christian.koenig@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=zackr@vmware.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