Bug 3408 - [mga] Kernel oops when X-server restarts
Summary: [mga] Kernel oops when X-server restarts
Status: RESOLVED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/other (show other bugs)
Version: DRI git
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Ian Romanick
QA Contact:
URL: http://marc.theaimsgroup.com/?t=11167...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-26 16:15 UTC by Ian Romanick
Modified: 2005-06-08 21:39 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Move deallocation of dev_private (878 bytes, patch)
2005-06-02 14:31 UTC, Ian Romanick
no flags Details | Splinter Review
Completely re-initialize DMA settings (6.00 KB, patch)
2005-06-06 10:06 UTC, Ian Romanick
no flags Details | Splinter Review

Description Ian Romanick 2005-05-26 16:15:12 UTC
Current CVS hits an oops when the X-server is started, stoped, and restarted. 
This was originally reported to the DRI mailing list by Chris Rankin.  I looked
into it a bit, and it appears that when the X-server exits, dev->dev_private
becomes NULL.  When the X-server restarts and calls mga_dma_init, it oopses when
mga_do_dma_init dereferences dev->dev_private.
Comment 1 Ian Romanick 2005-06-02 14:31:40 UTC
Created attachment 2817 [details] [review]
Move deallocation of dev_private

This moves the deallocation of dev_private.  Since dev_private is allocated
when the driver is loaded and is always expected to be around, it should only
be deallocated when the driver is unloaded.
Comment 2 Ian Romanick 2005-06-03 17:38:18 UTC
The patch was commited to DRI CVS today.
Comment 3 FreeDesktop Bugzilla Database Corruption Fix User 2005-06-04 08:27:22 UTC
This patch solves the oops for me, but generates the following messages when I
unload the module:

__iounmap: bad address dab30000
__iounmap: bad address dac00000
[drm] Module unloaded
Comment 4 Ian Romanick 2005-06-06 10:06:09 UTC
Created attachment 2835 [details] [review]
Completely re-initialize DMA settings

There were two problems.  First, the 'warp' and 'primary' pointers weren't
cleared, so mga_do_cleanup_dma, which gets called multiple times, would try to
ioremapfree them multiple times.  This resulted in the new error messages to
syslog.  The second problem was the, since the dev_private structure isn't
reallocated and cleaned out in mga_do_init_dma, when the server is reloaded
idle-waits would wait for impossible values.

I have given this patch some more riggorous testing.  This includes:

- Load module, start server, run GL app, stop server, unload module.
- Load module, start server, run GL app, stop server, unload module, reload
module, restart server, run GL app.
- Load module, start server, run GL app, stop server, restart server, run GL
app, stop server, unload module.

In all three cases, everything worked as expected.  Please let me know if there
are any further regressions with this patch.
Comment 5 Ian Romanick 2005-06-09 14:39:07 UTC
Patch #2835 committed to DRM CVS on 9-June-2005.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.