From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ffc1e,2a3ebc1d720b61f6,start X-Google-Attributes: gidffc1e,public X-Google-Thread: fa528,2a3ebc1d720b61f6,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-09-23 14:36:51 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: ron.jolly@gefanuc.com (Ron Jolly) Newsgroups: comp.unix.tru64,comp.programming.threads Subject: Blocked kernel thread misses wakeup on SMP - Tru64 5.1A Date: 23 Sep 2003 14:36:47 -0700 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 24.75.75.18 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1064353010 4048 127.0.0.1 (23 Sep 2003 21:36:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 23 Sep 2003 21:36:50 GMT Xref: archiver1.google.com comp.unix.tru64:10813 comp.programming.threads:18994 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, 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