Hi Felix,

On Sun, 2006-10-01 at 17:44 -0400, Felix Kühling wrote: 
> 
> 1: drm_lock.c: drm_unlock uses a new tasklet_lock. That leads to hangs
> on my system (for some reason the driver can't find an IRQ for my PCI
> card). Fortunately the NMI watchdog detects the lockup and kills the
> Xserver, so I can recover the system without rebooting.
> 
> I can see that tasklet_lock is only initialized in drm_irq_install and
> only if the DRIVER_IRQ_VBL is enabled. Thus you can't unconditionally
> use that spinlock in drm_unlock. The patch adds a condition
> dev->irq_enabled, but I'm not sure if this is the right condition. I
> believe dev->irq_enabled can be set even without DRIVER_IRQ_VBL being
> enabled. Michel, what's would be the right way to handle this?

I think initializing the spinlock unconditionally in drm_fill_in_dev()
is the simplest solution. Fixed in
3a16e615cabfed18b1891a732e7243ef41dc0ad0.


> 2: drm_drawable.c: make idx and id signed integers in drm_rmdraw. There
> are some comparisons such as id < 0 and idx >= 0 in there that don't
> make sense for unsigned integers. And I actually got kernel oopses when
> running glxinfo or glxgears in a naked Xserver when it destroyed the
> last drawable. It crapped out here:
> 
>       ...
>       /* Can we shrink the arrays? */
>       if (idx == bitfield_length - 1) {
>               while (idx >= 0 && !bitfield[idx])
>                       --idx;
>               ...
> 
> idx will always be >= 0 if it's unsigned. --idx will make the value wrap
> around and the next access to bitfield[idx] oopses.

Good catch! I must have been 'lucky' for never hitting this on my
development machine, but I'm also slightly disappointed that gcc didn't
warn about it. Anyway, I pushed your fix as
d58389968124191a546a14b42ef84edc224be23d.


Thanks for the detailed report,


-- 
Earthling Michel Dänzer           |          http://tungstengraphics.com
Libre software enthusiast         |          Debian, X and DRI developer


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to