diff mbox

drm/ttm: once more fix ttm_buffer_object_transfer

Message ID 20171030135940.12778-1-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Oct. 30, 2017, 1:59 p.m. UTC
From: Christian König <christian.koenig@amd.com>

When the mutex is locked just in the moment we copy it we end up with a
warning that we release a locked mutex.

Fix this by properly reinitializing the mutex.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Dieter Nützel Oct. 30, 2017, 2:06 p.m. UTC | #1
Hello Christian,

is this for these warnings flooding my dmesg-log or do I have to open a 
new ticket:

Current amd-staging-drm-next commit #7781a8c68a6a from you ;-)

[ 6588.429302] WARNING: CPU: 5 PID: 2957 at 
drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:132 
generic_reg_update_ex+0xdc/0x120 [amdgpu]
[ 6588.429303] Modules linked in: fuse rfcomm rpcsec_gss_krb5 
auth_rpcgss nfsv4 nf_log_ipv6 xt_comment nf_log_ipv4 nf_log_common 
xt_LOG xt_limit dns_resolver nfs lockd nfnetlink_cthelper nfnetlink 
grace sunrpc fscache af_packet ipmi_ssif iscsi_ibft iscsi_boot_sysfs 
ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT 
nf_reject_ipv4 xt_pkttype xt_tcpudp iptable_filter ip6table_mangle 
nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 
nf_defrag_ipv4 ip_tables xt_conntrack nf_conntrack libcrc32c bnep 
ip6table_filter ip6_tables x_tables jc42 joydev snd_hda_codec_hdmi 
snd_hda_intel intel_powerclamp coretemp snd_hda_codec kvm_intel 
snd_hwdep kvm snd_hda_core snd_pcm e1000e iTCO_wdt hid_generic snd_timer 
iTCO_vendor_support snd usbhid irqbypass btusb crc32c_intel btrtl btbcm
[ 6588.429340]  pcspkr ptp soundcore btintel bluetooth pps_core 
i7core_edac i2c_i801 tpm_infineon tpm_tis lpc_ich shpchp tpm_tis_core 
ipmi_si tpm ipmi_devintf ipmi_msghandler ac button rfkill ecdh_generic 
acpi_cpufreq tcp_bbr raid1 md_mod amdkfd amd_iommu_v2 serio_raw amdgpu 
sr_mod cdrom chash i2c_algo_bit drm_kms_helper syscopyarea ehci_pci 
sysfillrect sysimgblt ehci_hcd fb_sys_fops mpt3sas raid_class ttm 
scsi_transport_sas usbcore drm sg dm_multipath dm_mod scsi_dh_rdac 
scsi_dh_emc scsi_dh_alua
[ 6588.429370] CPU: 5 PID: 2957 Comm: X Tainted: G        W       
4.13.0-rc5-1.g7262353-default+ #1
[ 6588.429371] Hardware name: FUJITSU                          PRIMERGY 
TX150 S7             /D2759, BIOS 6.00 Rev. 1.19.2759.A1           
09/26/2012
[ 6588.429373] task: ffff8841a3658080 task.stack: ffff9ce4c3c38000
[ 6588.429426] RIP: 0010:generic_reg_update_ex+0xdc/0x120 [amdgpu]
[ 6588.429427] RSP: 0018:ffff9ce4c3c3b760 EFLAGS: 00010246
[ 6588.429429] RAX: 0000000000000030 RBX: 0000000000000000 RCX: 
0000000000000000
[ 6588.429430] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 
ffff8841a36c1980
[ 6588.429431] RBP: ffff9ce4c3c3b7c8 R08: 00000000000000ff R09: 
ffff9ce4c3c3b778
[ 6588.429432] R10: 0000000000000000 R11: 0000000000000002 R12: 
ffff9ce4c3c3b7f8
[ 6588.429433] R13: 0000000000000000 R14: 0000000000000000 R15: 
0000000000000000
[ 6588.429436] FS:  00007f206d780a40(0000) GS:ffff8841bfd40000(0000) 
knlGS:0000000000000000
[ 6588.429437] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6588.429439] CR2: 00007f745636a000 CR3: 00000006654a5000 CR4: 
00000000000006e0
[ 6588.429439] Call Trace:
[ 6588.429498]  dce_mi_program_pte_vm+0x211/0x270 [amdgpu]
[ 6588.429555]  dce110_program_front_end_for_pipe+0x256/0x370 [amdgpu]
[ 6588.429613]  dce110_apply_ctx_for_surface+0xda/0x200 [amdgpu]
[ 6588.429668]  dc_commit_updates_for_stream+0x46a/0x4e0 [amdgpu]
[ 6588.429725]  dc_commit_planes_to_stream+0x322/0x380 [amdgpu]
[ 6588.429783]  amdgpu_dm_atomic_commit_tail+0x72a/0xaf0 [amdgpu]
[ 6588.429787]  ? ww_mutex_unlock+0x26/0x30
[ 6588.429844]  ? dm_plane_helper_prepare_fb+0xd2/0x230 [amdgpu]
[ 6588.429853]  ? drm_atomic_helper_wait_for_dependencies+0x89/0x160 
[drm_kms_helper]
[ 6588.429861]  ? drm_atomic_helper_swap_state+0x18d/0x360 
[drm_kms_helper]
[ 6588.429868]  commit_tail+0x3f/0x60 [drm_kms_helper]
[ 6588.429875]  drm_atomic_helper_commit+0x106/0x110 [drm_kms_helper]
[ 6588.429931]  amdgpu_dm_atomic_commit+0x8d/0xa0 [amdgpu]
[ 6588.429948]  drm_atomic_commit+0x4b/0x50 [drm]
[ 6588.429957]  drm_atomic_helper_legacy_gamma_set+0x114/0x150 
[drm_kms_helper]
[ 6588.429971]  drm_mode_gamma_set_ioctl+0x127/0x190 [drm]
[ 6588.429985]  ? drm_mode_crtc_set_gamma_size+0xb0/0xb0 [drm]
[ 6588.429997]  drm_ioctl_kernel+0x5d/0xb0 [drm]
[ 6588.430009]  drm_ioctl+0x31a/0x3d0 [drm]
[ 6588.430024]  ? drm_mode_crtc_set_gamma_size+0xb0/0xb0 [drm]
[ 6588.430027]  ? vfs_writev+0xaa/0xf0
[ 6588.430063]  amdgpu_drm_ioctl+0x4f/0x90 [amdgpu]
[ 6588.430065]  do_vfs_ioctl+0x92/0x5c0
[ 6588.430067]  ? __fget+0x6e/0x90
[ 6588.430069]  ? __fget+0x6e/0x90
[ 6588.430071]  SyS_ioctl+0x79/0x90
[ 6588.430075]  entry_SYSCALL_64_fastpath+0x1e/0xa9
[ 6588.430077] RIP: 0033:0x7f206b0fa077
[ 6588.430078] RSP: 002b:00007ffd89a37978 EFLAGS: 00003246 ORIG_RAX: 
0000000000000010
[ 6588.430080] RAX: ffffffffffffffda RBX: 000000c3495ed210 RCX: 
00007f206b0fa077
[ 6588.430081] RDX: 00007ffd89a379b0 RSI: 00000000c02064a5 RDI: 
000000000000000d
[ 6588.430082] RBP: 000000c34a30a690 R08: 000000c349740ce0 R09: 
000000c349740ee0
[ 6588.430083] R10: 0000000000000001 R11: 0000000000003246 R12: 
000000c3488cd300
[ 6588.430084] R13: 000000c34a30a690 R14: 000000c34a6c3980 R15: 
0000000000000020
[ 6588.430086] Code: 45 21 e8 44 31 c3 41 39 d3 75 ab 45 84 d2 75 45 48 
8b 7f 18 89 da 48 8b 07 ff 50 38 48 83 c4 48 89 d8 5b 41 5a 41 5c 41 5d 
5d c3 <0f> ff eb c8 0f ff e9 5b ff ff ff 41 8b 0c 24 41 89 c0 49 83 c4
[ 6588.430119] ---[ end trace 067f92f2eff57946 ]---

Thanks,
Dieter

Am 30.10.2017 14:59, schrieb Christian König:
> From: Christian König <christian.koenig@amd.com>
> 
> When the mutex is locked just in the moment we copy it we end up with a
> warning that we release a locked mutex.
> 
> Fix this by properly reinitializing the mutex.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/ttm/ttm_bo_util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
> b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 78cb99be7146..e7a519f1849b 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -474,6 +474,7 @@ static int ttm_buffer_object_transfer(struct
> ttm_buffer_object *bo,
>  	INIT_LIST_HEAD(&fbo->lru);
>  	INIT_LIST_HEAD(&fbo->swap);
>  	INIT_LIST_HEAD(&fbo->io_reserve_lru);
> +	mutex_init(&fbo->wu_mutex);
>  	fbo->moving = NULL;
>  	drm_vma_node_reset(&fbo->vma_node);
>  	atomic_set(&fbo->cpu_writers, 0);
Alex Deucher Oct. 30, 2017, 5:06 p.m. UTC | #2
> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Christian König

> Sent: Monday, October 30, 2017 10:00 AM

> To: dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org

> Subject: [PATCH] drm/ttm: once more fix ttm_buffer_object_transfer

> 

> From: Christian König <christian.koenig@amd.com>

> 

> When the mutex is locked just in the moment we copy it we end up with a

> warning that we release a locked mutex.

> 

> Fix this by properly reinitializing the mutex.

> 

> Signed-off-by: Christian König <christian.koenig@amd.com>


Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


Stable?

Alex

> ---

>  drivers/gpu/drm/ttm/ttm_bo_util.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c

> b/drivers/gpu/drm/ttm/ttm_bo_util.c

> index 78cb99be7146..e7a519f1849b 100644

> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c

> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c

> @@ -474,6 +474,7 @@ static int ttm_buffer_object_transfer(struct

> ttm_buffer_object *bo,

>  	INIT_LIST_HEAD(&fbo->lru);

>  	INIT_LIST_HEAD(&fbo->swap);

>  	INIT_LIST_HEAD(&fbo->io_reserve_lru);

> +	mutex_init(&fbo->wu_mutex);

>  	fbo->moving = NULL;

>  	drm_vma_node_reset(&fbo->vma_node);

>  	atomic_set(&fbo->cpu_writers, 0);

> --

> 2.11.0

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 78cb99be7146..e7a519f1849b 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -474,6 +474,7 @@  static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 	INIT_LIST_HEAD(&fbo->lru);
 	INIT_LIST_HEAD(&fbo->swap);
 	INIT_LIST_HEAD(&fbo->io_reserve_lru);
+	mutex_init(&fbo->wu_mutex);
 	fbo->moving = NULL;
 	drm_vma_node_reset(&fbo->vma_node);
 	atomic_set(&fbo->cpu_writers, 0);