mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Pedro Giffuni <pfg@FreeBSD.org>
To: Felix Fietkau <nbd@openwrt.org>, musl@lists.openwall.com
Subject: Re: FreeBSD's Google Summer of Code 2016
Date: Mon, 7 Mar 2016 08:10:21 -0500	[thread overview]
Message-ID: <56DD7DBD.6010703@FreeBSD.org> (raw)
In-Reply-To: <56DD3C91.2070403@openwrt.org>



On 03/07/16 03:32, Felix Fietkau wrote:
> On 2016-03-06 01:25, Rich Felker wrote:
>> On Sat, Mar 05, 2016 at 07:14:34PM -0500, Pedro Giffuni wrote:
... <snip>

>>> Of course I ahould have meant "based on regular FreeBSD kernel services".
>>>
>>>>> http://thread.gmane.org/gmane.linux.debian.ports.bsd/11702
>>>>>
>>>>> I am certain this will require more research but it would be useful
>>>>> for other ports as well.
>>>>
>>>
>>> We could ask Petr Salinger for the details, but I am pretty sure
>>> FreeBSD has the required functionality natively.
>>>
>>>> Glibc/NPTL has a lot of what I'd call "gratuitous abstraction" (like
>>>> the lll stuff) in their pthread primitives which makes this
>>>> "possible". I call it gratuitous because it's really really hard to
>>>> achieve correct implementations of the pthread sync primitives that
>>>> don't have serious corner-case bugs, and it's unlikely that their
>>>> abstractions actually suffice to make correct alternate
>>>> implementations.
>>>>
>>>> musl does not have any such abstraction. We require a compare-and-swap
>>>> operation or equivalent on which arbitrary atomic operations can be
>>>> constructed, a futex or equivalent operation that's roughly
>>>> while(*addr==expected) sleep(), and implement all the sync primitives
>>>> just once on top of these.
>>>>
>>>
>>> I am not a threading expert (or even a CS guy), but it sounds like
>>> mutex(9) with condvar(9) would do [1]:
>>
>> No, they don't satisfy the needs of musl; they have their own
>> additional storage requirements and are probably not AS-safe. It might
>> be possible to use them to implement a userspace-emulated futex queue
>> (only if they are AS-safe), but I don't see a way to extend that to
>> the process-shared case.
> What about umtx? It's supposed to be just like linux futex.
>

Yes, that's it.

It is not well documented beyond the <sys/umtx.h>  header but it
is indeed used to implement the linux abi futex and the native
libthr on FreeBSD.

Pedro.


      parent reply	other threads:[~2016-03-07 13:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-05 20:11 Pedro Giffuni
2016-03-05 21:25 ` Rich Felker
2016-03-05 22:41   ` Pedro Giffuni
2016-03-05 23:32     ` Rich Felker
2016-03-06  0:14       ` Pedro Giffuni
2016-03-06  0:25         ` Rich Felker
2016-03-06  0:31           ` Rich Felker
2016-03-06  1:11             ` Pedro Giffuni
2016-03-06  0:59           ` Pedro Giffuni
2016-03-06  1:08             ` Rich Felker
2016-03-07  8:32           ` Felix Fietkau
2016-03-07 13:06             ` Szabolcs Nagy
2016-03-07 14:22               ` Pedro Giffuni
2016-03-07 13:10             ` Pedro Giffuni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56DD7DBD.6010703@FreeBSD.org \
    --to=pfg@freebsd.org \
    --cc=musl@lists.openwall.com \
    --cc=nbd@openwrt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).