Re: [PATCH] drm/amd/display: Fix reference counting for struct dc_sink.

2019-02-21 Thread Mathias Fröhlich
Good Morning,

On Thursday, 21 February 2019 22:00:40 CET Li, Sun peng (Leo) wrote:
> 
> On 2019-02-20 12:24 a.m., Mathias Fröhlich wrote:
> > Hi,
> > 
> > ping?
> > ... to the dc folks?
> > 
> > best
> > Mathias
> 
> Hi Mathias,
> 
> Sorry for the wait, change looks good to me.
> 
> Reviewed-by: Leo Li 
> ...and merged.
> 
> Thanks for cleaning this up.
> Leo
Thanks!

Mathias


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Re: [PATCH] drm/amd/display: Fix reference counting for struct dc_sink.

2019-02-21 Thread Li, Sun peng (Leo)



On 2019-02-20 12:24 a.m., Mathias Fröhlich wrote:
> Hi,
> 
> ping?
> ... to the dc folks?
> 
> best
> Mathias

Hi Mathias,

Sorry for the wait, change looks good to me.

Reviewed-by: Leo Li 
...and merged.

Thanks for cleaning this up.
Leo

> 
> On Wednesday, 13 February 2019 21:38:03 CET Alex Deucher wrote:
>> Add amd-gfx and some DC people.
>>
>> Alex
>>
>> On Sun, Feb 10, 2019 at 5:13 AM  wrote:
>>>
>>> From: Mathias Fröhlich 
>>>
>>> Reference counting in amdgpu_dm_connector for amdgpu_dm_connector::dc_sink
>>> and amdgpu_dm_connector::dc_em_sink as well as in dc_link::local_sink seems
>>> to be out of shape. Thus make reference counting consistent for these
>>> members and just plain increment the reference count when the variable
>>> gets assigned and decrement when the pointer is set to zero or replaced.
>>> Also simplify reference counting in selected function sopes to be sure the
>>> reference is released in any case. In some cases add NULL pointer check
>>> before dereferencing.
>>> At a hand full of places a comment is placed to stat that the reference
>>> increment happened already somewhere else.
>>>
>>> This actually fixes the following kernel bug on my system when enabling
>>> display core in amdgpu. There are some more similar bug reports around,
>>> so it probably helps at more places.
>>>
>>> kernel BUG at mm/slub.c:294!
>>> invalid opcode:  [#1] SMP PTI
>>> CPU: 9 PID: 1180 Comm: Xorg Not tainted 5.0.0-rc1+ #2
>>> Hardware name: Supermicro X10DAi/X10DAI, BIOS 3.0a 02/05/2018
>>> RIP: 0010:__slab_free+0x1e2/0x3d0
>>> Code: 8b 54 24 30 48 89 4c 24 28 e8 da fb ff ff 4c 8b 54 24 28 85 c0 0f 
>>> 85 67 fe ff ff 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b 49 3b 
>>> 5c 24 28 75 ab 48 8b 44 24 30 49 89 4c 24 28 49 89 44
>>> RSP: 0018:b0978589fa90 EFLAGS: 00010246
>>> RAX: 92f12806c400 RBX: 80200019 RCX: 92f12806c400
>>> RDX: 92f12806c400 RSI: dd6421a01a00 RDI: 92ed2f406e80
>>> RBP: b0978589fb40 R08: 0001 R09: c0ee4748
>>> R10: 92f12806c400 R11: 0001 R12: dd6421a01a00
>>> R13: 92f12806c400 R14: 92ed2f406e80 R15: dd6421a01a20
>>> FS:  7f4170be0ac0() GS:92ed2fb4() 
>>> knlGS:
>>> CS:  0010 DS:  ES:  CR0: 80050033
>>> CR2: 562818aaa000 CR3: 00045745a002 CR4: 003606e0
>>> DR0:  DR1:  DR2: 
>>> DR3:  DR6: fffe0ff0 DR7: 0400
>>> Call Trace:
>>>  ? drm_dbg+0x87/0x90 [drm]
>>>  dc_stream_release+0x28/0x50 [amdgpu]
>>>  amdgpu_dm_connector_mode_valid+0xb4/0x1f0 [amdgpu]
>>>  drm_helper_probe_single_connector_modes+0x492/0x6b0 [drm_kms_helper]
>>>  drm_mode_getconnector+0x457/0x490 [drm]
>>>  ? drm_connector_property_set_ioctl+0x60/0x60 [drm]
>>>  drm_ioctl_kernel+0xa9/0xf0 [drm]
>>>  drm_ioctl+0x201/0x3a0 [drm]
>>>  ? drm_connector_property_set_ioctl+0x60/0x60 [drm]
>>>  amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
>>>  do_vfs_ioctl+0xa4/0x630
>>>  ? __sys_recvmsg+0x83/0xa0
>>>  ksys_ioctl+0x60/0x90
>>>  __x64_sys_ioctl+0x16/0x20
>>>  do_syscall_64+0x5b/0x160
>>>  entry_SYSCALL_64_after_hwframe+0x44/0xa9
>>> RIP: 0033:0x7f417110809b
>>> Code: 0f 1e fa 48 8b 05 ed bd 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff 
>>> ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 
>>> ff ff 73 01 c3 48 8b 0d bd bd 0c 00 f7 d8 64 89 01 48
>>> RSP: 002b:7ffdd8d1c268 EFLAGS: 0246 ORIG_RAX: 0010
>>> RAX: ffda RBX: 562818a8ebc0 RCX: 7f417110809b
>>> RDX: 7ffdd8d1c2a0 RSI: c05064a7 RDI: 0012
>>> RBP: 7ffdd8d1c2a0 R08: 562819012280 R09: 0007
>>> R10:  R11: 0246 R12: c05064a7
>>> R13: 0012 R14: 0012 R15: 7ffdd8d1c2a0
>>> Modules linked in: nfsv4 dns_resolver nfs lockd grace fscache fuse vfat 
>>> fat amdgpu intel_rapl sb_edac x86_pkg_temp_thermal intel_powerclamp 
>>> coretemp kvm_intel kvm irqbypass crct10dif_pclmul chash gpu_sched 
>>> crc32_pclmul snd_hda_codec_realtek ghash_clmulni_intel amd_iommu_v2 
>>> iTCO_wdt iTCO_vendor_support ttm snd_hda_codec_generic snd_hda_codec_hdmi 
>>> ledtrig_audio snd_hda_intel drm_kms_helper snd_hda_codec intel_cstate 
>>> snd_hda_core drm snd_hwdep snd_seq snd_seq_device intel_uncore snd_pcm 
>>> intel_rapl_perf snd_timer snd soundcore ioatdma pcspkr 
>>> intel_wmi_thunderbolt mxm_wmi i2c_i801 lpc_ich pcc_cpufreq auth_rpcgss 
>>> sunrpc igb crc32c_intel i2c_algo_bit dca wmi hid_cherry analog gameport 
>>> joydev
>>>
>>> This patch is based on agd5f/drm-next-5.1-wip. This patch does not require
>>> all of that, but agd5f/drm-next-5.1-wip contains at least one more dc_sink
>>> counting fix that I could spot.
>>>

Re: [PATCH] drm/amd/display: Fix reference counting for struct dc_sink.

2019-02-19 Thread Mathias Fröhlich
Hi,

ping?
... to the dc folks?

best
Mathias

On Wednesday, 13 February 2019 21:38:03 CET Alex Deucher wrote:
> Add amd-gfx and some DC people.
> 
> Alex
> 
> On Sun, Feb 10, 2019 at 5:13 AM  wrote:
> >
> > From: Mathias Fröhlich 
> >
> > Reference counting in amdgpu_dm_connector for amdgpu_dm_connector::dc_sink
> > and amdgpu_dm_connector::dc_em_sink as well as in dc_link::local_sink seems
> > to be out of shape. Thus make reference counting consistent for these
> > members and just plain increment the reference count when the variable
> > gets assigned and decrement when the pointer is set to zero or replaced.
> > Also simplify reference counting in selected function sopes to be sure the
> > reference is released in any case. In some cases add NULL pointer check
> > before dereferencing.
> > At a hand full of places a comment is placed to stat that the reference
> > increment happened already somewhere else.
> >
> > This actually fixes the following kernel bug on my system when enabling
> > display core in amdgpu. There are some more similar bug reports around,
> > so it probably helps at more places.
> >
> >kernel BUG at mm/slub.c:294!
> >invalid opcode:  [#1] SMP PTI
> >CPU: 9 PID: 1180 Comm: Xorg Not tainted 5.0.0-rc1+ #2
> >Hardware name: Supermicro X10DAi/X10DAI, BIOS 3.0a 02/05/2018
> >RIP: 0010:__slab_free+0x1e2/0x3d0
> >Code: 8b 54 24 30 48 89 4c 24 28 e8 da fb ff ff 4c 8b 54 24 28 85 c0 0f 
> > 85 67 fe ff ff 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b 49 3b 
> > 5c 24 28 75 ab 48 8b 44 24 30 49 89 4c 24 28 49 89 44
> >RSP: 0018:b0978589fa90 EFLAGS: 00010246
> >RAX: 92f12806c400 RBX: 80200019 RCX: 92f12806c400
> >RDX: 92f12806c400 RSI: dd6421a01a00 RDI: 92ed2f406e80
> >RBP: b0978589fb40 R08: 0001 R09: c0ee4748
> >R10: 92f12806c400 R11: 0001 R12: dd6421a01a00
> >R13: 92f12806c400 R14: 92ed2f406e80 R15: dd6421a01a20
> >FS:  7f4170be0ac0() GS:92ed2fb4() 
> > knlGS:
> >CS:  0010 DS:  ES:  CR0: 80050033
> >CR2: 562818aaa000 CR3: 00045745a002 CR4: 003606e0
> >DR0:  DR1:  DR2: 
> >DR3:  DR6: fffe0ff0 DR7: 0400
> >Call Trace:
> > ? drm_dbg+0x87/0x90 [drm]
> > dc_stream_release+0x28/0x50 [amdgpu]
> > amdgpu_dm_connector_mode_valid+0xb4/0x1f0 [amdgpu]
> > drm_helper_probe_single_connector_modes+0x492/0x6b0 [drm_kms_helper]
> > drm_mode_getconnector+0x457/0x490 [drm]
> > ? drm_connector_property_set_ioctl+0x60/0x60 [drm]
> > drm_ioctl_kernel+0xa9/0xf0 [drm]
> > drm_ioctl+0x201/0x3a0 [drm]
> > ? drm_connector_property_set_ioctl+0x60/0x60 [drm]
> > amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
> > do_vfs_ioctl+0xa4/0x630
> > ? __sys_recvmsg+0x83/0xa0
> > ksys_ioctl+0x60/0x90
> > __x64_sys_ioctl+0x16/0x20
> > do_syscall_64+0x5b/0x160
> > entry_SYSCALL_64_after_hwframe+0x44/0xa9
> >RIP: 0033:0x7f417110809b
> >Code: 0f 1e fa 48 8b 05 ed bd 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff 
> > ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 
> > ff ff 73 01 c3 48 8b 0d bd bd 0c 00 f7 d8 64 89 01 48
> >RSP: 002b:7ffdd8d1c268 EFLAGS: 0246 ORIG_RAX: 0010
> >RAX: ffda RBX: 562818a8ebc0 RCX: 7f417110809b
> >RDX: 7ffdd8d1c2a0 RSI: c05064a7 RDI: 0012
> >RBP: 7ffdd8d1c2a0 R08: 562819012280 R09: 0007
> >R10:  R11: 0246 R12: c05064a7
> >R13: 0012 R14: 0012 R15: 7ffdd8d1c2a0
> >Modules linked in: nfsv4 dns_resolver nfs lockd grace fscache fuse vfat 
> > fat amdgpu intel_rapl sb_edac x86_pkg_temp_thermal intel_powerclamp 
> > coretemp kvm_intel kvm irqbypass crct10dif_pclmul chash gpu_sched 
> > crc32_pclmul snd_hda_codec_realtek ghash_clmulni_intel amd_iommu_v2 
> > iTCO_wdt iTCO_vendor_support ttm snd_hda_codec_generic snd_hda_codec_hdmi 
> > ledtrig_audio snd_hda_intel drm_kms_helper snd_hda_codec intel_cstate 
> > snd_hda_core drm snd_hwdep snd_seq snd_seq_device intel_uncore snd_pcm 
> > intel_rapl_perf snd_timer snd soundcore ioatdma pcspkr 
> > intel_wmi_thunderbolt mxm_wmi i2c_i801 lpc_ich pcc_cpufreq auth_rpcgss 
> > sunrpc igb crc32c_intel i2c_algo_bit dca wmi hid_cherry analog gameport 
> > joydev
> >
> > This patch is based on agd5f/drm-next-5.1-wip. This patch does not require
> > all of that, but agd5f/drm-next-5.1-wip contains at least one more dc_sink
> > counting fix that I could spot.
> >
> > Signed-off-by: Mathias Fröhlich 
> > ---
> >  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++
> >  .../display/amdgpu_dm/amdgpu_dm_mst_types.c   |  1 +
> >  drivers/gpu/drm/amd/display/dc/core/dc_link.c |  1 +
> >  3 files 

Re: [PATCH] drm/amd/display: Fix reference counting for struct dc_sink.

2019-02-15 Thread Mathias Fröhlich
Alex,

On Wednesday, 13 February 2019 21:38:03 CET Alex Deucher wrote:
> Add amd-gfx and some DC people.

Thanks!!
When I sent, I did not remember that there is an other list for amd!
Up to now I am much more on the MESA side ...

Mathias



___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Re: [PATCH] drm/amd/display: Fix reference counting for struct dc_sink.

2019-02-13 Thread Alex Deucher via amd-gfx
Add amd-gfx and some DC people.

Alex

On Sun, Feb 10, 2019 at 5:13 AM  wrote:
>
> From: Mathias Fröhlich 
>
> Reference counting in amdgpu_dm_connector for amdgpu_dm_connector::dc_sink
> and amdgpu_dm_connector::dc_em_sink as well as in dc_link::local_sink seems
> to be out of shape. Thus make reference counting consistent for these
> members and just plain increment the reference count when the variable
> gets assigned and decrement when the pointer is set to zero or replaced.
> Also simplify reference counting in selected function sopes to be sure the
> reference is released in any case. In some cases add NULL pointer check
> before dereferencing.
> At a hand full of places a comment is placed to stat that the reference
> increment happened already somewhere else.
>
> This actually fixes the following kernel bug on my system when enabling
> display core in amdgpu. There are some more similar bug reports around,
> so it probably helps at more places.
>
>kernel BUG at mm/slub.c:294!
>invalid opcode:  [#1] SMP PTI
>CPU: 9 PID: 1180 Comm: Xorg Not tainted 5.0.0-rc1+ #2
>Hardware name: Supermicro X10DAi/X10DAI, BIOS 3.0a 02/05/2018
>RIP: 0010:__slab_free+0x1e2/0x3d0
>Code: 8b 54 24 30 48 89 4c 24 28 e8 da fb ff ff 4c 8b 54 24 28 85 c0 0f 85 
> 67 fe ff ff 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b 49 3b 5c 24 
> 28 75 ab 48 8b 44 24 30 49 89 4c 24 28 49 89 44
>RSP: 0018:b0978589fa90 EFLAGS: 00010246
>RAX: 92f12806c400 RBX: 80200019 RCX: 92f12806c400
>RDX: 92f12806c400 RSI: dd6421a01a00 RDI: 92ed2f406e80
>RBP: b0978589fb40 R08: 0001 R09: c0ee4748
>R10: 92f12806c400 R11: 0001 R12: dd6421a01a00
>R13: 92f12806c400 R14: 92ed2f406e80 R15: dd6421a01a20
>FS:  7f4170be0ac0() GS:92ed2fb4() 
> knlGS:
>CS:  0010 DS:  ES:  CR0: 80050033
>CR2: 562818aaa000 CR3: 00045745a002 CR4: 003606e0
>DR0:  DR1:  DR2: 
>DR3:  DR6: fffe0ff0 DR7: 0400
>Call Trace:
> ? drm_dbg+0x87/0x90 [drm]
> dc_stream_release+0x28/0x50 [amdgpu]
> amdgpu_dm_connector_mode_valid+0xb4/0x1f0 [amdgpu]
> drm_helper_probe_single_connector_modes+0x492/0x6b0 [drm_kms_helper]
> drm_mode_getconnector+0x457/0x490 [drm]
> ? drm_connector_property_set_ioctl+0x60/0x60 [drm]
> drm_ioctl_kernel+0xa9/0xf0 [drm]
> drm_ioctl+0x201/0x3a0 [drm]
> ? drm_connector_property_set_ioctl+0x60/0x60 [drm]
> amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
> do_vfs_ioctl+0xa4/0x630
> ? __sys_recvmsg+0x83/0xa0
> ksys_ioctl+0x60/0x90
> __x64_sys_ioctl+0x16/0x20
> do_syscall_64+0x5b/0x160
> entry_SYSCALL_64_after_hwframe+0x44/0xa9
>RIP: 0033:0x7f417110809b
>Code: 0f 1e fa 48 8b 05 ed bd 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff 
> ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 
> 73 01 c3 48 8b 0d bd bd 0c 00 f7 d8 64 89 01 48
>RSP: 002b:7ffdd8d1c268 EFLAGS: 0246 ORIG_RAX: 0010
>RAX: ffda RBX: 562818a8ebc0 RCX: 7f417110809b
>RDX: 7ffdd8d1c2a0 RSI: c05064a7 RDI: 0012
>RBP: 7ffdd8d1c2a0 R08: 562819012280 R09: 0007
>R10:  R11: 0246 R12: c05064a7
>R13: 0012 R14: 0012 R15: 7ffdd8d1c2a0
>Modules linked in: nfsv4 dns_resolver nfs lockd grace fscache fuse vfat 
> fat amdgpu intel_rapl sb_edac x86_pkg_temp_thermal intel_powerclamp coretemp 
> kvm_intel kvm irqbypass crct10dif_pclmul chash gpu_sched crc32_pclmul 
> snd_hda_codec_realtek ghash_clmulni_intel amd_iommu_v2 iTCO_wdt 
> iTCO_vendor_support ttm snd_hda_codec_generic snd_hda_codec_hdmi 
> ledtrig_audio snd_hda_intel drm_kms_helper snd_hda_codec intel_cstate 
> snd_hda_core drm snd_hwdep snd_seq snd_seq_device intel_uncore snd_pcm 
> intel_rapl_perf snd_timer snd soundcore ioatdma pcspkr intel_wmi_thunderbolt 
> mxm_wmi i2c_i801 lpc_ich pcc_cpufreq auth_rpcgss sunrpc igb crc32c_intel 
> i2c_algo_bit dca wmi hid_cherry analog gameport joydev
>
> This patch is based on agd5f/drm-next-5.1-wip. This patch does not require
> all of that, but agd5f/drm-next-5.1-wip contains at least one more dc_sink
> counting fix that I could spot.
>
> Signed-off-by: Mathias Fröhlich 
> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++
>  .../display/amdgpu_dm/amdgpu_dm_mst_types.c   |  1 +
>  drivers/gpu/drm/amd/display/dc/core/dc_link.c |  1 +
>  3 files changed, 37 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 3a6f595f295e..20fa01bff685 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++