Re: [PATCH 03/15] dma-buf & drm/amdgpu: remove dma_resv workaround

Christian König
2022-04-20T07:38:44Z

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

drm/ttm: fix logic inversion in ttm_eu_reserve_buffers

That should have been max, not min.

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: c8d4c18bfbc4 ("dma-buf/drivers: make reserving a shared slot
mandatory v4")
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link:
https://patchwork.freedesktop.org/patch/msgid/20220411134537.2854-1-christian.koenig@amd.com

Just a stupid logic inversion. Sorry for the noise.

Regards,
Christian.

>
> ------------[ cut here ]------------
> kernel BUG at drivers/dma-buf/dma-resv.c:306!
> invalid opcode: 0000 [#1] PREEMPT SMP PTI
> CPU: 1 PID: 1608 Comm: gnome-shell Not tainted 5.18.0-rc1-vmwgfx #18
> Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop
> Reference Platform, BIOS 6.00 11/12/2020
> RIP: 0010:dma_resv_add_fence+0x2ed/0x300
> Code: ff ff be 01 00 00 00 e8 31 7d d9 ff e9 80 fd ff ff be 03 00 00
> 00 e8 22 7d d9 ff e9 ee fe ff ff 0f 1f 44 00 00 e9 bc fe ff ff <0f> 0b
> e8 4c cc 45 00 66 6>
> RSP: 0018:ffffa1e6846c3ab0 EFLAGS: 00010246
> RAX: 0000000000000000 RBX: ffff94c5c5507138 RCX: 902bc24e7b7c70ae
> RDX: 902bc24e7b7c70ae RSI: ffffffffaaf7f437 RDI: ffffffffaaffde66
> RBP: ffffa1e6846c3b08 R08: 0000000000000000 R09: 0000000000000001
> R10: 0000000000000004 R11: 0000000000000000 R12: ffff94c5cba90578
> R13: 0000000000000000 R14: ffff94c5cba8bc00 R15: 0000000000000000
> FS: 00007f9a17c6e600(0000) GS:ffff94c6f9e40000(0000)
> knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f9a14113000 CR3: 000000000144c003 CR4: 00000000003706e0
> Call Trace:
> <TASK>
> ttm_eu_fence_buffer_objects+0x54/0x110 [ttm]
> vmw_execbuf_process+0xcae/0x12a0 [vmwgfx]
> ? vmw_execbuf_release_pinned_bo+0x60/0x60 [vmwgfx]
> vmw_execbuf_ioctl+0xfb/0x160 [vmwgfx]
> ? vmw_execbuf_release_pinned_bo+0x60/0x60 [vmwgfx]
> drm_ioctl_kernel+0xba/0x150 [drm]
> ? __might_fault+0x77/0x80
> drm_ioctl+0x247/0x460 [drm]
> ? vmw_execbuf_release_pinned_bo+0x60/0x60 [vmwgfx]
> ? find_held_lock+0x31/0x90
> ? __fget_files+0xc5/0x190
> ? __this_cpu_preempt_check+0x13/0x20
> ? lock_release+0x142/0x2f0
> ? drm_ioctl_kernel+0x150/0x150 [drm]
> vmw_generic_ioctl+0xa3/0x110 [vmwgfx]
> vmw_unlocked_ioctl+0x15/0x20 [vmwgfx]
> __x64_sys_ioctl+0x91/0xc0
> do_syscall_64+0x3b/0x90
> entry_SYSCALL_64_after_hwframe+0x44/0xae
> RIP: 0033:0x7f9a1af1aaff
> Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48
> 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89
> c0 3d 00 f0 ff ff 7>
> RSP: 002b:00007ffd833696c0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 00007ffd83369780 RCX: 00007f9a1af1aaff
> RDX: 00007ffd83369780 RSI: 000000004028644c RDI: 000000000000000d
> RBP: 000000004028644c R08: 0000000000001248 R09: 00007ffd83369808
> R10: 0000000000000008 R11: 0000000000000246 R12: 00007ffd83369808
> R13: 000000000000000d R14: 000055719cb629c0 R15: 00007ffd83369808
> </TASK>
> Modules linked in: overlay snd_ens1371 intel_rapl_msr snd_ac97_codec
> intel_rapl_common ac97_bus vsock_loopback
> vmw_vsock_virtio_transport_common vmw_vsock_vmci>
> ---[ end trace 0000000000000000 ]---
>
> z