This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I've been reviewing condvar synchronization. Attached is a patch that documents this, covering interactions of wait and signal. I have yet to finish reviewing broadcasts and cancellation. Please have a look and let me know whether this is adequate documentation (scope, verbosity, ...). I tried to find a middle ground between preciseness and brevity. Given that several people (including myself) looked for a while at 14417 without seeing the fault, I think it can't hurt to have rather lengthy documentation for the condvar implementation. We (Siddhesh Poyarekar and I) have been investigating 14417, and we think we have found the fault. The problem is that the non-PI aware condvar implementation does not need to handle spurious wake-up (see the comments in my patch). By spurious wake-up, I mean futex_wait returning -EAGAIN because the futex value changed concurrently, for example. However, with PI and when futex_wait_requeue_pi is used, we have to because this syscall will acquire the mutex unless it returns due to a spurious wake-up. Thus, we don't need to handle this specially for the core concurrent algorithm also used for non-PI condvars, but we have to ensure that (1) we release the mutex if it has been acquired by the syscall but we did not consume the signal, or (2) acquire the mutex if we have consumed the signal but after a spurious wake-up. The latter will not ensure PI, but we believe this is still a reasonable (intermediate) fix. (There is more work left to be done anyway until condvars are fully PI-aware, see BZ 11588.) Siddhesh has been working on a patch that fixes the PI-supporting code and will send it soon I believe. I'd also appreciate feedback on the ABA issue that I mention in the comments. Torvald
Attachment:
patch2
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |