|
Prev: RtlFillMemoryUlonglong
Next: 1394 camera suspend/resume
From: Wilco on 25 Apr 2008 05:11 Hello everybody, I have written a driver for a pci data acquasition card. When testing the driver on serveral processors I got a deadlock which maybe you can enlighten me on. Construct in my driver: I use a spinlock in a datastructure in non paged memory to access the data within. This spinlock is aquired in an ioctrl to register and deregister a datachannel with the card. It also is used in a DPC that is queued from the ISR to determine the data rate of all channels currently registert. The DPC does not recurse on itself and neither do the register and deregister ioctrls. The release spinlock functions are also in the correct place. The issue: When I use a AMD X2 dual core cpu the system somtimes deadlocks on the KeAcquireSpinLockAtDpcLevel (which is located in the DPC routine). Connecting with the debugger reveals the system in trying to aquire this spinlock at both cores from a DPC and deadlocks at that point. Is this normal behaviour? I thought the spinlock should always get acquired by one of the two. That is; when an ioctrl is run they run at DISPATCH_LEVEL and if an interrupt occurs, it just queues the DPC. Which in turn is run at the end of the ioctrl (since this is the currently executing code on DISPATCH level). The DPC could only be queued once and then run on one core. That's when the system can queue another dpc and could execute it on the other core right? But I just should sit tight until it gets the spinlock... I checked the DDK and several posts on forums but they all tell me I'm doing the right thing. E.g.: http://groups.google.com/group/microsoft.public.development.device.drivers/browse_thread/thread/e585a74c3ca6d60f http://maddimax.dyndns.org/maddi/?p=15 Anyone got a clue why none of the two gets the spinlock? Thanks in advance. Wilco
From: Alexander Grigoriev on 25 Apr 2008 10:33 Make sure to use plain KeAcquireSpinLock in your ioctl handler, not *AtDpcLevel "Wilco" <w.vanterve(a)gmail.com> wrote in message news:e196e29c-3469-48eb-bf68-cb8140541e9d(a)d1g2000hsg.googlegroups.com... > Hello everybody, > > I have written a driver for a pci data acquasition card. When testing > the driver on serveral processors I got a deadlock which maybe you can > enlighten me on. > > Construct in my driver: > I use a spinlock in a datastructure in non paged memory to access the > data within. This spinlock is aquired in an ioctrl to register and > deregister a datachannel with the card. It also is used in a DPC that > is queued from the ISR to determine the data rate of all channels > currently registert. The DPC does not recurse on itself and neither do > the register and deregister ioctrls. The release spinlock functions > are also in the correct place. > > The issue: > When I use a AMD X2 dual core cpu the system somtimes deadlocks on the > KeAcquireSpinLockAtDpcLevel (which is located in the DPC routine). > Connecting with the debugger reveals the system in trying to aquire > this spinlock at both cores from a DPC and deadlocks at that point. > > Is this normal behaviour? I thought the spinlock should always get > acquired by one of the two. That is; when an ioctrl is run they run at > DISPATCH_LEVEL and if an interrupt occurs, it just queues the DPC. > Which in turn is run at the end of the ioctrl (since this is the > currently executing code on DISPATCH level). The DPC could only be > queued once and then run on one core. That's when the system can queue > another dpc and could execute it on the other core right? But I just > should sit tight until it gets the spinlock... I checked the DDK and > several posts on forums but they all tell me I'm doing the right > thing. E.g.: > http://groups.google.com/group/microsoft.public.development.device.drivers/browse_thread/thread/e585a74c3ca6d60f > http://maddimax.dyndns.org/maddi/?p=15 > > Anyone got a clue why none of the two gets the spinlock? > Thanks in advance. > > Wilco
From: Pavel A. on 25 Apr 2008 15:47 "Wilco" <w.vanterve(a)gmail.com> wrote in message news:e196e29c-3469-48eb-bf68-cb8140541e9d(a)d1g2000hsg.googlegroups.com... > Hello everybody, > > I have written a driver for a pci data acquasition card. When testing > the driver on serveral processors I got a deadlock which maybe you can > enlighten me on. > > Construct in my driver: > I use a spinlock in a datastructure in non paged memory to access the > data within. This spinlock is aquired in an ioctrl to register and > deregister a datachannel with the card. It also is used in a DPC that > is queued from the ISR to determine the data rate of all channels > currently registert. The DPC does not recurse on itself and neither do > the register and deregister ioctrls. The release spinlock functions > are also in the correct place. > > The issue: > When I use a AMD X2 dual core cpu the system somtimes deadlocks on the > KeAcquireSpinLockAtDpcLevel (which is located in the DPC routine). > Connecting with the debugger reveals the system in trying to aquire > this spinlock at both cores from a DPC and deadlocks at that point. > > Is this normal behaviour? I thought the spinlock should always get > acquired by one of the two. That is; when an ioctrl is run they run at > DISPATCH_LEVEL and if an interrupt occurs, it just queues the DPC. > Which in turn is run at the end of the ioctrl (since this is the > currently executing code on DISPATCH level). The DPC could only be > queued once and then run on one core. That's when the system can queue > another dpc and could execute it on the other core right? Yes, same DPC function can run on several CPUs. > But I just > should sit tight until it gets the spinlock... I checked the DDK and > several posts on forums but they all tell me I'm doing the right > thing. E.g.: > http://groups.google.com/group/microsoft.public.development.device.drivers/browse_thread/thread/e585a74c3ca6d60f > http://maddimax.dyndns.org/maddi/?p=15 > > Anyone got a clue why none of the two gets the spinlock? Do you also release the spinlock after acquiring? :) Or, is there another lock, so it may be a deadlock ( taking two locks in a wrong order) ? > Thanks in advance. > > Wilco
|
Pages: 1 Prev: RtlFillMemoryUlonglong Next: 1394 camera suspend/resume |