Re: [Dri-devel] i810 sharing interrupts race condition..

2003-03-24 Thread Keith Whitwell

It looks fine to me, though I can't test it myself.  Even if it doesn't
completely fix the problem, I think it's the 'Right Thing' to do.  I've
committed the i810/i830_dri.c fix to the DRI trunk (I also added the
drmCtlUninstHandler symbol to the referenced symbol list in
i810_driver.c).  If someone can verify that this fix works with a Linux
2.4.x drm module, I can submit this to XFree86 as well for the 4.3.x
branch.
OK, I can put an i810 box together once I get a bit of spare time (tomorrow, 
hooray).

Keith



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [Dri-devel] i810 sharing interrupts race condition..

2003-03-24 Thread Leif Delgass
On Mon, 24 Mar 2003, Keith Whitwell wrote:

> Leif Delgass wrote:
> > On Mon, 24 Mar 2003, Keith Whitwell wrote:
> > 
> > 
> >>Dave Airlie wrote:
> >>
> >>>I've just had the misfortune of having my NFSROOT system (lots of network
> >>>interrupts), have its card sharing interrupts with the i810 graphics..
> >>>once I run anything 3d the kernel oops..
> >>>
> >>>The attached patch contains the quick fix which is to check in thr irq
> >>>handler if dev->dev_private is NULL or not before going using it .. also a
> >>>udelay patch included which I think the DRI tree has but the LK one
> >>>doesn't(arrgg too many trees :-)..
> >>>
> >>>I've attached a second patch to
> >>>xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c that may also
> >>>fix the problem but which I haven't tested,
> >>>
> >>>What happens is the DMA cleanup occurs which frees the private data, and
> >>>an interrupt comes in from the network card most likely but the i810
> >>>driver is let know as the IRQ hasn't been deregistered yet..
> >>>
> >>>This issue also will affect the i830 and gamma (not that anyone cares) but
> >>>maybe others as well as my DRI tree is old enough at this stage
> >>
> >>What codebase is this patch against?  I was of the opinion that we'd actually 
> >>eliminated the use of interrupts from the i810 driver.
> >>
> >>Keith
> > 
> > 
> > It looks like the i810 and i830 drm modules in the 2.4.x kernel tree still
> > use interrupts. 
> 
> Oh, wow.
> 
> > In any case, I think the patch against i810/i830_dri.c
> > should be applied so we have a drmCtlUninstHandler to match the
> > drmCtlInstHandler -- which is there for backward compatibility with older
> > drm modules.  Also, this would be used if vblank support is added for
> > i810/i830.
> 
> I'm well snowed under right now - can you commit this if it looks right?
> 
> Keith

It looks fine to me, though I can't test it myself.  Even if it doesn't
completely fix the problem, I think it's the 'Right Thing' to do.  I've
committed the i810/i830_dri.c fix to the DRI trunk (I also added the
drmCtlUninstHandler symbol to the referenced symbol list in
i810_driver.c).  If someone can verify that this fix works with a Linux
2.4.x drm module, I can submit this to XFree86 as well for the 4.3.x
branch.

-- 
Leif Delgass 
http://www.retinalburn.net







---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [Dri-devel] i810 sharing interrupts race condition..

2003-03-24 Thread Leif Delgass
On Mon, 24 Mar 2003, Keith Whitwell wrote:

> Dave Airlie wrote:
> > I've just had the misfortune of having my NFSROOT system (lots of network
> > interrupts), have its card sharing interrupts with the i810 graphics..
> > once I run anything 3d the kernel oops..
> > 
> > The attached patch contains the quick fix which is to check in thr irq
> > handler if dev->dev_private is NULL or not before going using it .. also a
> > udelay patch included which I think the DRI tree has but the LK one
> > doesn't(arrgg too many trees :-)..
> > 
> > I've attached a second patch to
> > xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c that may also
> > fix the problem but which I haven't tested,
> > 
> > What happens is the DMA cleanup occurs which frees the private data, and
> > an interrupt comes in from the network card most likely but the i810
> > driver is let know as the IRQ hasn't been deregistered yet..
> > 
> > This issue also will affect the i830 and gamma (not that anyone cares) but
> > maybe others as well as my DRI tree is old enough at this stage
> 
> What codebase is this patch against?  I was of the opinion that we'd actually 
> eliminated the use of interrupts from the i810 driver.
> 
> Keith

It looks like the i810 and i830 drm modules in the 2.4.x kernel tree still
use interrupts.  In any case, I think the patch against i810/i830_dri.c
should be applied so we have a drmCtlUninstHandler to match the
drmCtlInstHandler -- which is there for backward compatibility with older
drm modules.  Also, this would be used if vblank support is added for
i810/i830.

-- 
Leif Delgass 
http://www.retinalburn.net



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [Dri-devel] i810 sharing interrupts race condition..

2003-03-24 Thread Keith Whitwell
Dave Airlie wrote:
I've just had the misfortune of having my NFSROOT system (lots of network
interrupts), have its card sharing interrupts with the i810 graphics..
once I run anything 3d the kernel oops..
The attached patch contains the quick fix which is to check in thr irq
handler if dev->dev_private is NULL or not before going using it .. also a
udelay patch included which I think the DRI tree has but the LK one
doesn't(arrgg too many trees :-)..
I've attached a second patch to
xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c that may also
fix the problem but which I haven't tested,
What happens is the DMA cleanup occurs which frees the private data, and
an interrupt comes in from the network card most likely but the i810
driver is let know as the IRQ hasn't been deregistered yet..
This issue also will affect the i830 and gamma (not that anyone cares) but
maybe others as well as my DRI tree is old enough at this stage
What codebase is this patch against?  I was of the opinion that we'd actually 
eliminated the use of interrupts from the i810 driver.

Keith



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [Dri-devel] i810 sharing interrupts race condition..

2003-03-23 Thread Dave Airlie

>
> I've attached a second patch to
> xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c that may also
> fix the problem but which I haven't tested,

yeah you can ignore the patch, but the idea is correct I think, the patch
is bogus using variables from places that dont exist :-)...

of course what it should do it is more like :

--- xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c.orig  2003-03-24 
15:17:38.0 +1100
+++ xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c   2003-03-24 
16:21:08.0 +1100
@@ -948,6 +948,12 @@
 {
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I810Ptr pI810 = I810PTR(pScrn);
+   I810DRIPtr pI810DRI = (I810DRIPtr) pI810->pDRIInfo->devPrivate;
+
+   if (pI810DRI->irq) {
+  drmCtlUninstHandler(pI810->drmSubFD);
+  pI810DRI->irq = 0;
+   }

I810CleanupDma(pScrn);



---
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
___
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel


[Dri-devel] i810 sharing interrupts race condition..

2003-03-23 Thread Dave Airlie

I've just had the misfortune of having my NFSROOT system (lots of network
interrupts), have its card sharing interrupts with the i810 graphics..
once I run anything 3d the kernel oops..

The attached patch contains the quick fix which is to check in thr irq
handler if dev->dev_private is NULL or not before going using it .. also a
udelay patch included which I think the DRI tree has but the LK one
doesn't(arrgg too many trees :-)..

I've attached a second patch to
xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c that may also
fix the problem but which I haven't tested,

What happens is the DMA cleanup occurs which frees the private data, and
an interrupt comes in from the network card most likely but the i810
driver is let know as the IRQ hasn't been deregistered yet..

This issue also will affect the i830 and gamma (not that anyone cares) but
maybe others as well as my DRI tree is old enough at this stage

Dave.

-- 
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / [EMAIL PROTECTED]
pam_smb / Linux DecStation / Linux VAX / ILUG personIndex: drivers/char/drm/i810_dma.c
===
RCS file: /home/sapphire/saphcvs/kernel-2.4/drivers/char/drm/i810_dma.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 i810_dma.c
--- drivers/char/drm/i810_dma.c 26 Feb 2003 01:37:26 -  1.1.1.2
+++ drivers/char/drm/i810_dma.c 24 Mar 2003 04:01:46 -
@@ -36,6 +36,7 @@
 #include "i810_drv.h"
 #include/* For task queue support */
 #include 
+#include 
 
 /* in case we don't have a 2.3.99-pre6 kernel or later: */
 #ifndef VM_DONTCOPY
@@ -317,7 +318,7 @@
goto out_wait_ring;
}
 
-   for (i = 0 ; i < 2000 ; i++) ;
+   udelay(1);
}
 
 out_wait_ring:
@@ -894,19 +895,23 @@
 void i810_dma_service(int irq, void *device, struct pt_regs *regs)
 {
drm_device_t *dev = (drm_device_t *)device;
-   drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
+   drm_i810_private_t *dev_priv;
u16 temp;
 
-   atomic_inc(&dev->counts[_DRM_STAT_IRQ]);
-   temp = I810_READ16(I810REG_INT_IDENTITY_R);
-   temp = temp & ~(0x6000);
-   if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R,
+   if (dev->dev_private) {
+   dev_priv = (drm_i810_private_t *)dev->dev_private;
+   
+   atomic_inc(&dev->counts[_DRM_STAT_IRQ]);
+   temp = I810_READ16(I810REG_INT_IDENTITY_R);
+   temp = temp & ~(0x6000);
+   if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R,
   temp); /* Clear all interrupts */
-   else
-  return;
+   else
+  return;
 
-   queue_task(&dev->tq, &tq_immediate);
-   mark_bh(IMMEDIATE_BH);
+   queue_task(&dev->tq, &tq_immediate);
+   mark_bh(IMMEDIATE_BH);
+   }
 }
 
 void i810_dma_immediate_bh(void *device)
--- xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c.orig  2003-03-24 
15:17:38.0 +1100
+++ xc/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c   2003-03-24 
15:19:00.0 +1100
@@ -949,6 +949,11 @@
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I810Ptr pI810 = I810PTR(pScrn);

+   if (info->irq) {
+  drmCtlUninstHandler(pI810->drmSubFD);
+  info->irq = 0;
+   }
+
I810CleanupDma(pScrn);

if (pI810->dcacheHandle)