linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Console unregistration questions
@ 2007-04-24 21:59 Jesse Barnes
  2007-04-24 23:19 ` Antonino A. Daplas
  0 siblings, 1 reply; 13+ messages in thread
From: Jesse Barnes @ 2007-04-24 21:59 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Dave Airlie, Jakob Bornecrantz

In doing the DRM modesetting work, we've been using the FB layer to manage 
regular FB devices and provide a DRM based console to the user (iow DRM 
owns the PCI device but the FB layer is used as a console and to provide 
the familiar /dev/fb interface to existing software).

However, in doing development we noticed that when we remove the new DRM 
based fb driver, our machines tend to hang.  This appears to be due to 
bugs in console unregistration.

The DRM fb driver's cleanup routine is normal, I think:

int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb)
{
	struct fb_info *info = fb->fbdev;
	
	unregister_framebuffer(info);
	framebuffer_release(info);
	/* Unmap framebuffer */
	drm_mem_reg_iounmap(dev, &fb->bo->mem, fb->virtual_base);

	return 0;
}

But since we're using drmfb as a console, the unregister_framebuffer call 
silently fails.  fbcon is builtin to the kernel, so when drmfb exits, 
unregister_framebuffer will end up calling fbcon's fbcon_fb_unregistered() 
function via the notifier chain.  However, when fbcon_fb_unregistered 
calls unregister_con_driver(&fb_con) it ignores the return value, which is 
bad since unregister_con_driver left fbcon's routines active (due to fbcon 
still being bound to the console) even while unregister_framebuffer freed 
their underlying structures.  So when unregister_framebuffer returns, the 
very next console operation causes an oops or worse (I usually see 
hide_cursor->fbcon_cursor die when it tries to get at info->fbcon_par).

However, it doesn't appear that there's a way for fb drivers to unbind 
themselves from the console at unload time, so we have to do it manually.  
Should there be a way to unbind it from driver code?  Maybe by exporting a 
wrapper to unbind_con_driver?  Also, shouldn't callers of 
unregister_con_driver be checking return values?  That would have made 
this bug a lot easier to find at least. :)

Thanks,
Jesse

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-04-27 16:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-24 21:59 Console unregistration questions Jesse Barnes
2007-04-24 23:19 ` Antonino A. Daplas
2007-04-24 23:42   ` Antonino A. Daplas
2007-04-24 23:46     ` Jesse Barnes
2007-04-25  0:07       ` Antonino A. Daplas
2007-04-25  1:17       ` Antonino A. Daplas
2007-04-26 17:00         ` Jesse Barnes
2007-04-27  1:30         ` Jesse Barnes
2007-04-27  6:10           ` Antonino A. Daplas
2007-04-27 15:14             ` Jesse Barnes
2007-04-27 16:10               ` Antonino A. Daplas
2007-04-24 23:42   ` Jesse Barnes
2007-04-25  0:04     ` Antonino A. Daplas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).