[Intel-gfx] [PATCH 00/12] fbdev helper locking rework and deferred setup

Liviu Dudau liviu at dudau.co.uk
Fri Jun 23 12:34:26 UTC 2017


On Fri, Jun 23, 2017 at 09:38:49AM +0200, Daniel Vetter wrote:
> On Thu, Jun 22, 2017 at 4:54 PM, Liviu Dudau <liviu at dudau.co.uk> wrote:
> > On Wed, Jun 21, 2017 at 08:28:03PM +0200, Daniel Vetter wrote:
> >> Hi all,
> >>
> >> This is Thierry's deferred fbdev setup series, with the locking rework almost
> >> entirely redone. The much wider scope is to get rid of drm_modeset_lock_all
> >> calls for atomic drivers and remove users of the fairly nasty
> >> mode_config->acquire_ctx hack, which breaks when doing multiple atomic commits.
> >>
> >> Testing&review very much appreciated, especially from people who care about the
> >> various fbdev emulation things and the deferred setup stuff.
> >
> > Tested on my Juno dev board on a bit of a convoluted setup: the dev board has
> > built into the SoC 2x HDLCD instances and I also have an FPGA daughter board
> > with Mali DP 650 running again on a 2x configuration. On boot I'm getting this
> > warning:
> >
> > juno-r0-ld login: [  241.986785] INFO: task kworker/3:1:80 blocked for more than 120 seconds.
> > [  241.993652]       Not tainted 4.12.0-rc5-01275-g1e2237a19156 #2
> > [  241.999689] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> > [  242.007660] kworker/3:1     D    0    80      2 0x00000000
> > [  242.013340] Workqueue: events output_poll_execute [drm_kms_helper]
> > [  242.019637] Call trace:
> > [  242.022132] [<ffff000008085798>] __switch_to+0x98/0xb0
> > [  242.027373] [<ffff00000886b3d4>] __schedule+0x19c/0x5e8
> > [  242.032699] [<ffff00000886b858>] schedule+0x38/0xa0
> > [  242.037672] [<ffff00000886bd38>] schedule_preempt_disabled+0x20/0x38
> > [  242.044144] [<ffff00000886c968>] __mutex_lock.isra.0+0x140/0x530
> > [  242.050262] [<ffff00000886cd68>] __mutex_lock_slowpath+0x10/0x18
> > [  242.056379] [<ffff00000886cda0>] mutex_lock+0x30/0x38
> > [  242.061597] [<ffff000000929660>] drm_fb_helper_hotplug_event.part.22+0x20/0x100 [drm_kms_helper]
> > [  242.070611] [<ffff000000929764>] drm_fb_helper_hotplug_event+0x24/0x38 [drm_kms_helper]
> > [  242.078828] [<ffff00000092a360>] drm_fbdev_cma_hotplug_event+0x10/0x20 [drm_kms_helper]
> > [  242.086984] [<ffff000000b44494>] hdlcd_fb_output_poll_changed+0x14/0x20 [hdlcd]
> > [  242.094495] [<ffff000000919e90>] drm_kms_helper_hotplug_event+0x28/0x38 [drm_kms_helper]
> > [  242.102801] [<ffff00000091a090>] output_poll_execute+0x1a0/0x1f0 [drm_kms_helper]
> > [  242.110424] [<ffff0000080d7fd4>] process_one_work+0x1d4/0x330
> > [  242.116280] [<ffff0000080d8178>] worker_thread+0x48/0x468
> > [  242.121781] [<ffff0000080ddf64>] kthread+0x12c/0x130
> > [  242.126839] [<ffff000008082ec0>] ret_from_fork+0x10/0x50
> > [  242.132252] INFO: task kworker/5:1:82 blocked for more than 120 seconds.
> > [  242.139074]       Not tainted 4.12.0-rc5-01275-g1e2237a19156 #2
> > [  242.145099] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> > [  242.153064] kworker/5:1     D    0    82      2 0x00000000
> > [  242.158724] Workqueue: events output_poll_execute [drm_kms_helper]
> > [  242.165019] Call trace:
> > [  242.167519] [<ffff000008085798>] __switch_to+0x98/0xb0
> > [  242.172755] [<ffff00000886b3d4>] __schedule+0x19c/0x5e8
> > [  242.178079] [<ffff00000886b858>] schedule+0x38/0xa0
> > [  242.183051] [<ffff00000886bd38>] schedule_preempt_disabled+0x20/0x38
> > [  242.189520] [<ffff00000886c968>] __mutex_lock.isra.0+0x140/0x530
> > [  242.195639] [<ffff00000886cd68>] __mutex_lock_slowpath+0x10/0x18
> > [  242.201756] [<ffff00000886cda0>] mutex_lock+0x30/0x38
> > [  242.206972] [<ffff000000929660>] drm_fb_helper_hotplug_event.part.22+0x20/0x100 [drm_kms_helper]
> > [  242.215984] [<ffff000000929764>] drm_fb_helper_hotplug_event+0x24/0x38 [drm_kms_helper]
> > [  242.224201] [<ffff00000092a360>] drm_fbdev_cma_hotplug_event+0x10/0x20 [drm_kms_helper]
> > [  242.232367] [<ffff000000b543a4>] malidp_output_poll_changed+0x14/0x20 [mali_dp]
> > [  242.239880] [<ffff000000919e90>] drm_kms_helper_hotplug_event+0x28/0x38 [drm_kms_helper]
> > [  242.248188] [<ffff00000091a090>] output_poll_execute+0x1a0/0x1f0 [drm_kms_helper]
> > [  242.255808] [<ffff0000080d7fd4>] process_one_work+0x1d4/0x330
> > [  242.261664] [<ffff0000080d8178>] worker_thread+0x48/0x468
> > [  242.267196] [<ffff0000080ddf64>] kthread+0x12c/0x130
> > [  242.272312] [<ffff000008082ec0>] ret_from_fork+0x10/0x50
> >
> > Each hardware type has only one instance of each driver being connected to an
> > output, HDLCD is connected to an HDMI monitor that is not "active" (i.e.
> > input is switched to DP connection), while the Mali DP instance is connected to
> > a monitor.
> >
> > Suggestions on where to look next are welcome.
> 
> I'm betting I've fumbled an unlock path somewhere and now your stuck
> trying to get a lock you can't get. Can you pls recompile with lockdep
> enabled and repro? That will directly tell us where and what went
> wrong.

This is what I've got with lockdep debugging enabled. Not sure it is the same
thing as the previous WARN, the stack trace doesn't match the one above (but I still
get that one after 120s).

[   16.536405] [drm] found ARM HDLCD version r0p0                                                                                                                                                     
[   16.670859] tda998x 0-0071: found TDA19988                                                                                                                                                         
[   16.677173] hdlcd 7ff50000.hdlcd: bound 0-0071 (ops tda998x_ops [tda998x])                                                                                                                         
[   16.686092] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).                                                                                                                            
[   16.692783] [drm] No driver support for vblank timestamp query.                                                                                                                                    
[   16.699518] [drm] No outputs connected, deferring setup                                                                                                                                            
[   16.704844]                                                                                                                                                                                        
[   16.706322] =====================================                                                                                                                                                  
[   16.710981] WARNING: bad unlock balance detected!                                                                                                                                                  
[   16.715643] 4.12.0-rc5-01275-g1e2237a19156 #3 Not tainted                                                                                                                                          
[   16.720992] -------------------------------------                                                                                                                                                  
[   16.725652] systemd-udevd/176 is trying to release lock (&dev->mode_config.mutex) at:                                                                                                              
[   16.733466] [<ffff000000a3363c>] __drm_fb_helper_initial_config+0x11c/0x570 [drm_kms_helper]                                                                                                       
[   16.741830] but there are no more locks to release!                                                                                                                                                
[   16.746661]                                                                                                                                                                                        
[   16.746661] other info that might help us debug this:                                                                                                                                              
[   16.753135] 4 locks held by systemd-udevd/176:                                                                                                                                                     
[   16.757535]  #0:  (&dev->mutex){......}, at: [<ffff00000854a134>] __driver_attach+0x4c/0xc8                                                                                                        
[   16.774279]  #1:  (&dev->mutex){......}, at: [<ffff00000854a144>] __driver_attach+0x5c/0xc8                                                                                                        
[   16.782571]  #2:  (component_mutex){+.+.+.}, at: [<ffff000008544044>] component_master_add_with_match+0x84/0xf8                                                                                    
[   16.792585]  #3:  (&helper->lock){+.+.+.}, at: [<ffff000000a33ac4>] drm_fb_helper_initial_config+0x34/0x68 [drm_kms_helper]                                                                        
[   16.803669]                                                                                                                                                                                        
[   16.803669] stack backtrace:                                                                                                                                                                       
[   16.807992] CPU: 2 PID: 176 Comm: systemd-udevd Not tainted 4.12.0-rc5-01275-g1e2237a19156 #3                                                                                                      
[   16.816442] Hardware name: ARM Juno development board (r0) (DT)                                                                                                                                    
[   16.822306] Call trace:                                                                                                                                                                            
[   16.824733] [<ffff000008088fc8>] dump_backtrace+0x0/0x238                                                                                                                                          
[   16.830083] [<ffff0000080892cc>] show_stack+0x14/0x20                                                                                                                                              
[   16.835091] [<ffff0000083e7be0>] dump_stack+0xbc/0xf4                                                                                                                                              
[   16.840097] [<ffff00000810d260>] print_unlock_imbalance_bug+0xe8/0xf0                                                                                                                              
[   16.846481] [<ffff00000811170c>] lock_release+0x174/0x368                                                                                                                                          
[   16.851832] [<ffff0000088f6eb4>] __mutex_unlock_slowpath+0x44/0x2b0                                                                                                                                
[   16.858041] [<ffff0000088f7130>] mutex_unlock+0x10/0x18                                                                                                                                            
[   16.863256] [<ffff000000a3363c>] __drm_fb_helper_initial_config+0x11c/0x570 [drm_kms_helper]                                                                                                       
[   16.871661] [<ffff000000a33ad0>] drm_fb_helper_initial_config+0x40/0x68 [drm_kms_helper]                                                                                                           
[   16.871699] [<ffff000000a34510>] drm_fbdev_cma_init_with_funcs+0x88/0x158 [drm_kms_helper]                                                                                                         
[   16.871736] [<ffff000000a345f0>] drm_fbdev_cma_init+0x10/0x20 [drm_kms_helper]                                                                                                                     
[   16.871748] [<ffff000000b5e708>] hdlcd_drm_bind+0x1f0/0x488 [hdlcd]                                                                                                                                
[   16.871752] [<ffff000008543e00>] try_to_bring_up_master+0x178/0x1d8                                                                                                                                
[   16.871756] [<ffff000008544064>] component_master_add_with_match+0xa4/0xf8                                                                                                                         
[   16.871765] [<ffff000000b5e4f0>] hdlcd_probe+0x50/0x78 [hdlcd]                                                                                                                                     
[   16.871770] [<ffff00000854bda8>] platform_drv_probe+0x58/0xb8                                                                                                                                      
[   16.871775] [<ffff00000854a03c>] driver_probe_device+0x224/0x2d0                                                                                                                                   
[   16.871779] [<ffff00000854a1ac>] __driver_attach+0xc4/0xc8                                                                                                                                         
[   16.871783] [<ffff00000854806c>] bus_for_each_dev+0x4c/0x98                                                                                                                                        
[   16.871787] [<ffff000008549948>] driver_attach+0x20/0x28                                                                                                                                           
[   16.871791] [<ffff000008549518>] bus_add_driver+0x1c0/0x230                                                                                                                                        
[   16.871794] [<ffff00000854ab60>] driver_register+0x60/0xf8                                                                                                                                         
[   16.871799] [<ffff00000854bcf8>] __platform_driver_register+0x40/0x48                                                                                                                              
[   16.871807] [<ffff000000b6a018>] hdlcd_platform_driver_init+0x18/0x1000 [hdlcd]                                                                                                                    
[   16.871812] [<ffff000008083140>] do_one_initcall+0x38/0x128                                                                                                                                        
[   16.871818] [<ffff000008195c1c>] do_init_module+0x58/0x1bc                                                                                                                                         
[   16.871823] [<ffff00000815093c>] load_module+0x1e94/0x2168                                                                                                                                         
[   16.871827] [<ffff000008150eb0>] SyS_finit_module+0xa8/0xc0                                                                                                                                        
[   16.871831] [<ffff000008082fcc>] __sys_trace_return+0x0/0x4                                                                                                                                        
[   16.872439] [drm] Initialized hdlcd 1.0.0 20151021 for 7ff50000.hdlcd on minor 0                                                                                                                   
[   16.872781] mali-dp 6f200000.malidp: assigned reserved memory node framebuffer at 60000000                                                                                                            
[   16.872859] [drm] found ARM Mali-DP650 version r0p0                                                                                                                                                
[   17.038821] tda998x 1-0070: found TDA19988                                                                                                                                                         
[   17.056417] mali-dp 6f200000.malidp: bound 1-0070 (ops tda998x_ops [tda998x])                                                                                                                      
[   17.063827] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).                                                                                                                            
[   17.070435] [drm] No driver support for vblank timestamp query.                                                                                                                                    
[   17.079290] [drm] No outputs connected, deferring setup                                                                                                                                            
[   17.085265] [drm] Initialized mali-dp 1.0.0 20160106 for 6f200000.malidp on minor 1                                                                                                                
[   17.092701] random: crng init done                                                                                                                                                                 
[   17.096720] [drm] found ARM HDLCD version r0p0                                                                                                                                                     
[   17.227312] tda998x 0-0070: found TDA19988                                                                                                                                                         
[   17.233258] hdlcd 7ff60000.hdlcd: bound 0-0070 (ops tda998x_ops [tda998x])                                                                                                                         
[   17.240152] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).                                                                                                                            
[   17.246781] [drm] No driver support for vblank timestamp query.                                                                                                                                    
[   17.355359] Console: switching to colour frame buffer device 240x75                                                                                                                                
[   17.417368] hdlcd 7ff60000.hdlcd: fb0:  frame buffer device                                                                                                                                        
[   17.436616] [drm] Initialized hdlcd 1.0.0 20151021 for 7ff60000.hdlcd on minor 2

Best regards,
Liviu

> 
> Thanks for testing.
> -Daniel
> 
> >
> > Best regards,
> > Liviu
> >
> >>
> >> Thanks, Daniel
> >>
> >> Daniel Vetter (7):
> >>   drm/i915: Drop FBDEV #ifdev in mst code
> >>   drm/fb-helper: Push locking in fb_is_bound
> >>   drm/fb-helper: Drop locking from the vsync wait ioctl code
> >>   drm/fb-helper: Push locking into pan_display_atomic|legacy
> >>   drm/fb-helper: Push locking into restore_fbdev_mode_atomic|legacy
> >>   drm/fb-helper: Stop using mode_config.mutex for internals
> >>   drm/fb-helper: Split dpms handling into legacy and atomic paths
> >>
> >> Thierry Reding (5):
> >>   drm/fb-helper: Push down modeset lock into FB helpers
> >>   drm/fb-helper: Add top-level lock
> >>   drm/fb-helper: Support deferred setup
> >>   drm/exynos: Remove custom FB helper deferred setup
> >>   drm/hisilicon: Remove custom FB helper deferred setup
> >>
> >>  drivers/gpu/drm/drm_fb_helper.c                 | 361 ++++++++++++++++++------
> >>  drivers/gpu/drm/drm_vblank.c                    |   2 +-
> >>  drivers/gpu/drm/exynos/exynos_drm_drv.c         |   6 +-
> >>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c       |  26 +-
> >>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  21 +-
> >>  drivers/gpu/drm/i915/intel_dp_mst.c             |  43 +--
> >>  drivers/gpu/drm/radeon/radeon_dp_mst.c          |   7 -
> >>  include/drm/drm_fb_helper.h                     |  42 ++-
> >>  8 files changed, 336 insertions(+), 172 deletions(-)
> >>
> >> --
> >> 2.11.0
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> > --
> >    _
> >  _|_|_
> >  ('_')
> >  (⊃  )⊃
> >  |_|_|
> 
> 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch

-- 
   _
 _|_|_
 ('_')
 (⊃  )⊃
 |_|_|


More information about the Intel-gfx mailing list