On Wed, 2005-06-01 at 01:32 +0100, Dave Airlie wrote:
> In radeon_irq.c:radeon_wait_irq
> 
> There is a comment
> /* This is a hack to work around mysterious freezes on certain
>  * systems:
>  */
>         radeon_acknowledge_irqs(dev_priv);
> 
> 
> On my 7500 system I've been seeing mysterious hangs after a week or so
> running, and I've removed this "hack" from my system and my hangs seem to
> have gone away, I've talked to Keith about it and he can't remember
> exactly what it fixed but he remembered never producing it on his own
> system, and it is a bad idea IMHO..
> 
> I'm mainly sending this mail as I can guarantee about 5 mins after I send
> one of my machines wil hang :-)

It looks quite wrong to "ack" the interrupt that way indeed... It's a
good way to lose interrupts. Besides, it causes the wait on SWI irq to
also "ack" (and thus clear possible pending) vblanks. Bad.

Also, I don't understand why radeon_driver_irq_handler() is ack'ing
interrupts _after_ doing work. That may also cause a loss of irqs. It
should ack them first, and then do work.

I suggest this (untested) patch:

Index: linux-work/drivers/char/drm/radeon_irq.c
===================================================================
--- linux-work.orig/drivers/char/drm/radeon_irq.c       2005-05-02 
10:48:09.000000000 +1000
+++ linux-work/drivers/char/drm/radeon_irq.c    2005-06-01 17:20:31.000000000 
+1000
@@ -35,6 +35,16 @@
 #include "radeon_drm.h"
 #include "radeon_drv.h"
 
+static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv)
+{
+       u32 irqq = RADEON_READ( RADEON_GEN_INT_STATUS )
+               & (RADEON_SW_INT_TEST_ACK | RADEON_CRTC_VBLANK_STAT);
+       if (irqs)
+               RADEON_WRITE( RADEON_GEN_INT_STATUS, irqs );
+       return irqs;
+}
+
+
 /* Interrupts - Used for device synchronization and flushing in the
  * following circumstances:
  *
@@ -63,8 +73,7 @@
        /* Only consider the bits we're interested in - others could be used
         * outside the DRM
         */
-       stat = RADEON_READ(RADEON_GEN_INT_STATUS)
-            & (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT);
+       stat = radeon_acknowledge_irqs(dev_priv);
        if (!stat)
                return IRQ_NONE;
 
@@ -80,19 +89,9 @@
                drm_vbl_send_signals( dev );
        }
 
-       /* Acknowledge interrupts we handle */
-       RADEON_WRITE(RADEON_GEN_INT_STATUS, stat);
        return IRQ_HANDLED;
 }
 
-static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv)
-{
-       u32 tmp = RADEON_READ( RADEON_GEN_INT_STATUS )
-               & (RADEON_SW_INT_TEST_ACK | RADEON_CRTC_VBLANK_STAT);
-       if (tmp)
-               RADEON_WRITE( RADEON_GEN_INT_STATUS, tmp );
-}
-
 static int radeon_emit_irq(drm_device_t *dev)
 {
        drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -123,11 +122,6 @@
 
        dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE;
 
-       /* This is a hack to work around mysterious freezes on certain
-        * systems:
-        */ 
-       radeon_acknowledge_irqs( dev_priv );
-
        DRM_WAIT_ON( ret, dev_priv->swi_queue, 3 * DRM_HZ, 
                     RADEON_READ( RADEON_LAST_SWI_REG ) >= swi_nr );
 




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to