All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Christian König" <christian.koenig@amd.com>,
	"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>,
	"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: Wed, 20 Apr 2022 20:56:38 +0200	[thread overview]
Message-ID: <ac12f900-fb47-37d6-9a1c-ac44bc711069@gmail.com> (raw)
In-Reply-To: <baa19a2d-6ad9-63ea-20f4-284a794f8998@amd.com>

Am 20.04.22 um 20:49 schrieb Christian König:
> Am 20.04.22 um 20:41 schrieb Zack Rusin:
>> On Wed, 2022-04-20 at 19:40 +0200, Christian König wrote:
>>> Am 20.04.22 um 19:38 schrieb Zack Rusin:
>>>> On Wed, 2022-04-20 at 09:37 +0200, Christian König wrote:
>>>>> ⚠ External Email
>>>>>
>>>>> Hi Zack,
>>>>>
>>>>> Am 20.04.22 um 05:56 schrieb Zack Rusin:
>>>>>> On Thu, 2022-04-07 at 10:59 +0200, Christian König wrote:
>>>>>>> Rework the internals of the dma_resv object to allow adding
>>>>>>> more
>>>>>>> than
>>>>>>> one
>>>>>>> write fence and remember for each fence what purpose it had.
>>>>>>>
>>>>>>> This allows removing the workaround from amdgpu which used a
>>>>>>> container
>>>>>>> for
>>>>>>> this instead.
>>>>>>>
>>>>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>>>>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>>>>>> Cc: amd-gfx@lists.freedesktop.org
>>>>>> afaict this change broke vmwgfx which now kernel oops right
>>>>>> after
>>>>>> boot.
>>>>>> I haven't had the time to look into it yet, so I'm not sure
>>>>>> what's
>>>>>> the
>>>>>> problem. I'll look at this tomorrow, but just in case you have
>>>>>> some
>>>>>> clues, the backtrace follows:
>>>>> that's a known issue and should already be fixed with:
>>>>>
>>>>> commit d72dcbe9fce505228dae43bef9da8f2b707d1b3d
>>>>> Author: Christian König <christian.koenig@amd.com>
>>>>> Date:   Mon Apr 11 15:21:59 2022 +0200
>>>> Unfortunately that doesn't seem to be it. The backtrace is from the
>>>> current (as of the time of sending of this email) drm-misc-next,
>>>> which
>>>> has this change, so it's something else.
>>> Ok, that's strange. In this case I need to investigate further.
>>>
>>> Maybe VMWGFX is adding more than one fence and we actually need to
>>> reserve multiple slots.
>> This might be helper code issue with CONFIG_DEBUG_MUTEXES set. On 
>> that config
>> dma_resv_reset_max_fences does:
>>     fences->max_fences = fences->num_fences;
>> For some objects num_fences is 0 and so after max_fences and 
>> num_fences are both 0.
>> And then BUG_ON(num_fences >= max_fences) is triggered.
>
> Yeah, but that's expected behavior.
>
> What's not expected is that max_fences is still 0 (or equal to old 
> num_fences) when VMWGFX tries to add a new fence. The function 
> ttm_eu_reserve_buffers() should have reserved at least one fence slot.
>
> So the underlying problem is that either ttm_eu_reserve_buffers() was 
> never called or VMWGFX tried to add more than one fence.


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;

Thanks,
Christian.

>
> Regards,
> Christian.
>
>>
>> z
>>
>


WARNING: multiple messages have this Message-ID (diff)
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Christian König" <christian.koenig@amd.com>,
	"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>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 03/15] dma-buf & drm/amdgpu: remove dma_resv workaround
Date: Wed, 20 Apr 2022 20:56:38 +0200	[thread overview]
Message-ID: <ac12f900-fb47-37d6-9a1c-ac44bc711069@gmail.com> (raw)
In-Reply-To: <baa19a2d-6ad9-63ea-20f4-284a794f8998@amd.com>

Am 20.04.22 um 20:49 schrieb Christian König:
> Am 20.04.22 um 20:41 schrieb Zack Rusin:
>> On Wed, 2022-04-20 at 19:40 +0200, Christian König wrote:
>>> Am 20.04.22 um 19:38 schrieb Zack Rusin:
>>>> On Wed, 2022-04-20 at 09:37 +0200, Christian König wrote:
>>>>> ⚠ External Email
>>>>>
>>>>> Hi Zack,
>>>>>
>>>>> Am 20.04.22 um 05:56 schrieb Zack Rusin:
>>>>>> On Thu, 2022-04-07 at 10:59 +0200, Christian König wrote:
>>>>>>> Rework the internals of the dma_resv object to allow adding
>>>>>>> more
>>>>>>> than
>>>>>>> one
>>>>>>> write fence and remember for each fence what purpose it had.
>>>>>>>
>>>>>>> This allows removing the workaround from amdgpu which used a
>>>>>>> container
>>>>>>> for
>>>>>>> this instead.
>>>>>>>
>>>>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>>>>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>>>>>> Cc: amd-gfx@lists.freedesktop.org
>>>>>> afaict this change broke vmwgfx which now kernel oops right
>>>>>> after
>>>>>> boot.
>>>>>> I haven't had the time to look into it yet, so I'm not sure
>>>>>> what's
>>>>>> the
>>>>>> problem. I'll look at this tomorrow, but just in case you have
>>>>>> some
>>>>>> clues, the backtrace follows:
>>>>> that's a known issue and should already be fixed with:
>>>>>
>>>>> commit d72dcbe9fce505228dae43bef9da8f2b707d1b3d
>>>>> Author: Christian König <christian.koenig@amd.com>
>>>>> Date:   Mon Apr 11 15:21:59 2022 +0200
>>>> Unfortunately that doesn't seem to be it. The backtrace is from the
>>>> current (as of the time of sending of this email) drm-misc-next,
>>>> which
>>>> has this change, so it's something else.
>>> Ok, that's strange. In this case I need to investigate further.
>>>
>>> Maybe VMWGFX is adding more than one fence and we actually need to
>>> reserve multiple slots.
>> This might be helper code issue with CONFIG_DEBUG_MUTEXES set. On 
>> that config
>> dma_resv_reset_max_fences does:
>>     fences->max_fences = fences->num_fences;
>> For some objects num_fences is 0 and so after max_fences and 
>> num_fences are both 0.
>> And then BUG_ON(num_fences >= max_fences) is triggered.
>
> Yeah, but that's expected behavior.
>
> What's not expected is that max_fences is still 0 (or equal to old 
> num_fences) when VMWGFX tries to add a new fence. The function 
> ttm_eu_reserve_buffers() should have reserved at least one fence slot.
>
> So the underlying problem is that either ttm_eu_reserve_buffers() was 
> never called or VMWGFX tried to add more than one fence.


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;

Thanks,
Christian.

>
> Regards,
> Christian.
>
>>
>> z
>>
>


  reply	other threads:[~2022-04-20 18:56 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  8:59 [Intel-gfx] DMA-resv usage Christian König
2022-04-07  8:59 ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 01/15] dma-buf: add enum dma_resv_usage v4 Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 02/15] dma-buf: specify usage while adding fences to dma_resv obj v7 Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  9:14   ` [Intel-gfx] " Daniel Vetter
2022-04-07  9:14     ` Daniel Vetter
2022-04-07  9:14     ` Daniel Vetter
2022-04-07 13:08   ` [Intel-gfx] " Javier Martinez Canillas
2022-04-07 13:08     ` Javier Martinez Canillas
2022-04-07 13:13     ` [Intel-gfx] " Christian König
2022-04-07 13:13       ` Christian König
2022-04-07 13:16       ` [Intel-gfx] " Javier Martinez Canillas
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-07  8:59   ` [Intel-gfx] " Christian König
2022-04-20  3:56   ` Zack Rusin
2022-04-20  3:56     ` Zack Rusin
2022-04-20  3:56     ` [Intel-gfx] " Zack Rusin
2022-04-20  7:37     ` Christian König
2022-04-20  7:37       ` [Intel-gfx] " Christian König
2022-04-20 17:38       ` Zack Rusin
2022-04-20 17:38         ` [Intel-gfx] " Zack Rusin
2022-04-20 17:40         ` Christian König
2022-04-20 17:40           ` [Intel-gfx] " Christian König
2022-04-20 18:41           ` Zack Rusin
2022-04-20 18:41             ` [Intel-gfx] " Zack Rusin
2022-04-20 18:49             ` Christian König
2022-04-20 18:49               ` [Intel-gfx] " Christian König
2022-04-20 18:56               ` Christian König [this message]
2022-04-20 18:56                 ` Christian König
2022-04-20 19:28                 ` Zack Rusin
2022-04-20 19:28                   ` [Intel-gfx] " Zack Rusin
2022-04-21 10:17                   ` Christian König
2022-04-21 10:17                     ` [Intel-gfx] " Christian König
2022-04-21 21:13                     ` Zack Rusin
2022-04-21 21:13                       ` [Intel-gfx] " Zack Rusin
2022-04-22  7:47                       ` Christian König
2022-04-22  7:47                         ` [Intel-gfx] " Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 04/15] dma-buf: add DMA_RESV_USAGE_KERNEL v3 Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 05/15] drm/amdgpu: use DMA_RESV_USAGE_KERNEL Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 06/15] drm/radeon: " Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 07/15] drm/nouveau: only wait for kernel fences in nouveau_bo_vm_cleanup Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 08/15] RDMA: use DMA_RESV_USAGE_KERNEL Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 09/15] dma-buf: add DMA_RESV_USAGE_BOOKKEEP v3 Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 10/15] drm/amdgpu: use DMA_RESV_USAGE_BOOKKEEP Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 11/15] dma-buf: wait for map to complete for static attachments Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 12/15] drm/i915: drop bo->moving dependency Christian König
2022-04-07  8:59   ` Christian König
2022-04-08  9:05   ` [Intel-gfx] " Jani Nikula
2022-04-08  9:05     ` Jani Nikula
2022-04-08  9:05     ` Jani Nikula
2022-04-08  9:27     ` [Intel-gfx] " Christian König
2022-04-08  9:27       ` Christian König
2022-04-08  9:27       ` Christian König
2022-04-08  9:33       ` [Intel-gfx] " Daniel Vetter
2022-04-08  9:33         ` Daniel Vetter
2022-04-08  9:33         ` Daniel Vetter
2022-04-08  9:39         ` [Intel-gfx] " Christian König
2022-04-08  9:39           ` Christian König
2022-04-08  9:39           ` Christian König
2022-04-08 10:15       ` [Intel-gfx] " Jani Nikula
2022-04-08 10:15         ` Jani Nikula
2022-04-08 10:15         ` Jani Nikula
2022-04-08 10:41         ` [Intel-gfx] " Christian König
2022-04-08 10:41           ` Christian König
2022-04-08 10:41           ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 13/15] drm/ttm: remove bo->moving Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 14/15] dma-buf: drop seq count based update Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59 ` [Intel-gfx] [PATCH 15/15] seqlock: drop seqcount_ww_mutex_t Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  8:59   ` Christian König
2022-04-07  9:19   ` [Intel-gfx] " Daniel Vetter
2022-04-07  9:19     ` Daniel Vetter
2022-04-07  9:19     ` Daniel Vetter
2022-04-07 11:48     ` [Intel-gfx] " Christian König
2022-04-07 11:48       ` Christian König
2022-04-07  9:26   ` [Intel-gfx] " Peter Zijlstra
2022-04-07  9:26     ` Peter Zijlstra
2022-04-07  9:26     ` Peter Zijlstra
2022-04-07  9:15 ` [Intel-gfx] DMA-resv usage Daniel Vetter
2022-04-07  9:15   ` Daniel Vetter
2022-04-07  9:15   ` Daniel Vetter
2022-04-25 13:05 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [01/15] dma-buf: add enum dma_resv_usage v4 (rev2) Patchwork

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=ac12f900-fb47-37d6-9a1c-ac44bc711069@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.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 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.