pthread_mutex_lock sometimes fails on Linux 2.4.5
Quoted 4 lines · David G
On a 4P Lion with Red Hat 7.0.98 installed and a 2.4.5 kernel, a 4P fft application sometimes hangs in a barrier. All 4 threads get into the barrier and none get out because a count gets up to 3 and they are waiting for it to get to 4.
Stock 2.4.5 or something else?
Bill
RE: [Linux-ia64] Re: pthread_mutex_lock sometimes fails on Linux
Quoted 1 line
Stock 2.4.5 or something else?
Something else. We have features of our own in the kernel for system validation. I guess I should try it on a stock kernel.
David
RE: [Linux-ia64] Re: pthread_mutex_lock sometimes fails on Linux
In reply to Bill NottinghamThe problem I previously reported occurs on a 2.4.5 kernel built from stock source code (No Alan Cox patches, only the ia64 patch).
I slightly misstated the problem. Here is what actually happens:
Four threads have entered a barrier (my own C code). Within the barrier, they call pthread_mutex_lock and increment a counter while holding the lock. Three threads are waiting on the counter, whose value is three, to go to four. The fourth CPU is looping in the kernel in cpu_idle. I don't know how it got there, but probably it has something to do with calling pthread_mutex_lock.
As I said, if anyone wants to investigate this I will provide a test case.
David
Quoted 21 lines
-----Original Message-----
From: Robboy, David G [mailto:[email protected]]
Sent: Wednesday, June 27, 2001 11:30 AM
To: 'Bill Nottingham'; '[email protected]'
Subject: RE: [Linux-ia64] Re:pthread_mutex_locksometimes fails on Linux 2.4.5Quoted 1 line
Stock 2.4.5 or something else?
Something else. We have features of our own in the kernel for system validation. I guess I should try it on a stock kernel.
David
_______________________________________________
Linux-IA64 mailing list
[email protected]
http://lists.linuxia64.org/lists/listinfo/linux-ia64
RE: [Linux-ia64] Re: pthread_mutex_lock sometimes fails on Linux
In reply to Bill NottinghamThis sounds similar to a problem that I saw a few weeks ago. In my case threads would spin for an inordinate amount of time in __pthread_lock() because re-reading of the __status field was optimised out of the loop (it isn't declared as volatile). Newer versions of glibc (2.2.2 IIRC) have some __asm() magic in the loop to force the re-read (the glibc folks didn't want to make the __status field volatile because of lots of other pointer casting changes that would have been needed).
See if a newer glibc helps with your problem too.
-Tony Luck
-----Original Message-----
I slightly misstated the problem. Here is what actually happens:
Four threads have entered a barrier (my own C code). Within the barrier, they call pthread_mutex_lock and increment a counter while holding the lock. Three threads are waiting on the counter, whose value is three, to go to four. The fourth CPU is looping in the kernel in cpu_idle. I don't know how it got there, but probably it has something to do with calling pthread_mutex_lock.
Quoted 3 lines
As I said, if anyone wants to investigate this I will provide a test case.
David
I am seeing something similar in ia32 mode, in my case, this is not new (saw it since 2.4.1).
Could you send me your test case ? As it may help me to investigate.
Thanks
Jose