From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: ffc1e,2a3ebc1d720b61f6 X-Google-Attributes: gidffc1e,public X-Google-Thread: fa528,2a3ebc1d720b61f6 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-09-24 13:55:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!peer1.news.newnet.co.uk!peer1.news.newnet.co.uk!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail From: "Eric Dumazet" Newsgroups: comp.unix.tru64,comp.programming.threads References: Subject: Re: Blocked kernel thread misses wakeup on SMP - Tru64 5.1A Date: Wed, 24 Sep 2003 22:55:16 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <3f7204be$0$10421$626a54ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 24 Sep 2003 22:55:26 MEST NNTP-Posting-Host: 81.249.77.242 X-Trace: 1064436926 news1-1.free.fr 10421 81.249.77.242:1265 X-Complaints-To: abuse@proxad.net Xref: archiver1.google.com comp.unix.tru64:10815 comp.programming.threads:19033 "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