NPTL Thread lockup issue on ARMv7
Rich Felker
dalias at aerifal.cx
Tue Feb 1 22:54:25 UTC 2011
On Tue, Feb 01, 2011 at 12:32:19AM -0600, Nitin Garg wrote:
> +/* Atomic compare and exchange. These sequences are not actually atomic;
> + there is a race if *MEM != OLDVAL and we are preempted between the two
> + swaps. However, they are very close to atomic, and are the best that a
> + pre-ARMv6 implementation can do without operating system support.
> + LinuxThreads has been using these sequences for many years. */
Assuming no SMP, could this be fixed by querying a cycle counter and
determining that no context change took place? I'm not familiar with
ARM, but it's an idea..
A better fix would probably be to create a global lock on the atomic
compare and exchange function so that only one thread can execute a
compare and exchange at a time. This would impact performance rather
badly, but that's better than having subtle race condition bugs that
occur randomly once in 5 years of execution...
Rich
More information about the uClibc
mailing list