Date: Thu, 21 Apr 2022 08:25:13 -0400 From: Rich Felker <dalias@...c.org> To: Leonid Shamis <leonid.shamis@...il.com> Cc: musl@...ts.openwall.com Subject: Re: robust list not issuing FUTEX_WAKE On Wed, Apr 20, 2022 at 07:56:17PM -0400, Rich Felker wrote: > On Wed, Apr 20, 2022 at 04:46:23PM -0700, Leonid Shamis wrote: > > Hey Musl Folks, > > > > I'm trying to understand the futex robust list and it's not quite working > > how I would expect it to from a reading of the man pages. > > > > In a minimal example, I'm getting the futex changed to FUTEX_OWNER_DIED > > instead of FUTEX_OWNER_DIED|tid and I'm not getting a FUTEX_WAKE event. > > Any idea why this might be? > > > > Happy to share the minimal example. > > Can you clarify if you're trying to use robust mutexes under musl or > roll your own thing using the kernel robust list directly? I don't > think I'm understanding what you're confused about. If the owner of a > robust mutex dies, its tid can no longer be in the futex word because > that tid is immediately available to be assigned to a new task, and > the next thread trying to lock the mutex would not be able to > distinguish whether it's owned by a new thread with that tid, or > available. > > So as far as the kernel is concerned, FUTEX_OWNER_DIED is more of a > value than a flag. It's what the futex word gets set to when the owner > dies with it held. In musl, we use FUTEX_OWNER_DIED as a flag as well > for a robust mutex whose old owner died and who has a new owner but > hasn't yet called pthread_mutex_consistent (in which case it would > become unrecoverable on unlock). Also: you only get the FUTEX_WAIT if the waiters but (bit 31) was set when the owner died.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.