Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: ron.jolly@gefanuc.com (Ron Jolly)
Subject: Blocked kernel thread  misses wakeup  on SMP - Tru64 5.1A
Date: 23 Sep 2003 14:36:47 -0700	[thread overview]
Message-ID: <c76164d.0309231336.377f5148@posting.google.com> (raw)

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


             reply	other threads:[~2003-09-23 21:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-23 21:36 Ron Jolly [this message]
2003-09-24 20:55 ` Blocked kernel thread misses wakeup on SMP - Tru64 5.1A Eric Dumazet
2003-09-25 19:04   ` Ron Jolly
2003-09-26 17:39     ` Eric Dumazet
2003-09-25 10:35 ` David Butenhof
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox