"Ron Jolly" a �crit dans le message de news:c76164d.0309231336.377f5148@posting.google.com... > Hello all, > I have a device driver operating on Tru64 that appears to miss > catching a thread_wakeup_one() only on a SMP system. > > Here is the scenario: > The driver is for a PCI network memory board that has a DMA controller > for moving data from the PCI contained memory to main system memory. > I have a command line utility which allows me to select DMA reads or > writes through an API call. > When a DMA operation needs to be performed, > the driver sets up a simple_lock(), sets the DMA controller registers, > then as the last operation, starts the > DMA. I then go into an mpsleep(), unlock the simple > lock, and block waiting for a wakeup or timeout. When the DMA has > finished, what do you mean ? You manually unlock the simple lock before calling mpsleep() ? The locking kernel services works only if you use it correctly as : lock_write(&mydriverlock) ; initiate_transfert() ; while (!finished_transfert()) { mpsleep(&mycondaddr, PCATCH | (PZERO + 1), "mydrivername", 0, &mydriverlock, MS_LOCK_WRITE | MS_LOCK_ON_ERROR) ; } ok_done: lock_done(&mydriverlock) ; > an interrupt is generated and the interrupt handler initiates a > thread_wakeup_one() to send to the blocked kernel thread. > This works fine on a uniprocessor system and one customer who has > a GS160 NUMA system indicates that it always works on that system. My > problem > is on my DS20 SMP system. If the DMA transfer is a length of > 2k-4kbytes or larger, I have no problem. If the DMA transfer size is > set to approximately > 512 bytes or less, I sometimes, > and I mean something like once every 30 - 40 thousand DMA transfers, > will get a EWOULDBLOCK returned from mpsleep() a and I can see that it > has timed out because I allow 3 seconds for the DMA to complete. > Now if attempt the same small DMA transfer of 512 bytes or less, but > initiate the command line utility > with a "runon 0 readdma" I never get the EWOULDBLOCK error and the > DMA executes without any errors. If I execute the utility "runon 1 > readdma" I will get the EWOULDBLOCK error. > > My theory is that during a small DMA transfer, the transfer starts > and finishes before the kernel thread is ready to correctly block and > the thread_wakeup_one() call has been sent and so the > kernel thread misses the wakeup call. I think it may work correctly > with larger DMA transfers because the DMA takes more time and the > blocked kernel thread is properly waitng for the wakeup call. > Another theory is that the kernel thread is started on one CPU and the > interrupt handler is executing > on the alternate CPU. Is this possible? > I have considered implementing the bind_to_cpu for the driver itself > but do not know if that would work and anyway it seems to be a rather > draconian technique. > The environment is a DS-20, Tru64 5.1A with Patch Kit 5 and I did make > sure that the DecThreads fix Patch #1220, upgrades to DecThreads > V3.18-150 is installed. > > Any suggestions welcomed... > thanks, > Ron Jolly > GE Embedded Systems > ron.jolly at gefanuc dot com