From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9521 Path: news.gmane.org!not-for-mail From: Pedro Giffuni Newsgroups: gmane.linux.lib.musl.general Subject: Re: FreeBSD's Google Summer of Code 2016 Date: Mon, 7 Mar 2016 08:10:21 -0500 Message-ID: <56DD7DBD.6010703@FreeBSD.org> References: <56DB3D70.8010601@FreeBSD.org> <20160305212517.GK9349@brightrain.aerifal.cx> <56DB6095.4060204@FreeBSD.org> <20160305233254.GL9349@brightrain.aerifal.cx> <56DB766A.3050500@FreeBSD.org> <20160306002547.GM9349@brightrain.aerifal.cx> <56DD3C91.2070403@openwrt.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1457356193 6730 80.91.229.3 (7 Mar 2016 13:09:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Mar 2016 13:09:53 +0000 (UTC) To: Felix Fietkau , musl@lists.openwall.com Original-X-From: musl-return-9534-gllmg-musl=m.gmane.org@lists.openwall.com Mon Mar 07 14:09:47 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1acuuw-0001eb-He for gllmg-musl@m.gmane.org; Mon, 07 Mar 2016 14:09:46 +0100 Original-Received: (qmail 30668 invoked by uid 550); 7 Mar 2016 13:09:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 30623 invoked from network); 7 Mar 2016 13:09:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1457356169; bh=a3GaEWT9kMkD+w6f91nWoMXB9+bDIiUu4+5FXv27UC4=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=kpU7KUQjAWIGG/O34n5+vUD+rZwbs95i1TfLOWwvryoX5tStNS17IjjP2Zy25soeVzXfqBlqxi5kbv9A+7P8XOCI7V2hkHTBbom5gWB88tRSWoy0EHeguMrkX9ouGHoB7trH7R/Rc32kNzS+weVcGLYC1eVwSq22vXfGH/CZ4579jBqxmJSq59COM4Ze4CQGhTiBJc6e/uMx1oUESBtOkJ5z5/K2rwZR9G2wb8JRj4RtpqJCWzh8UdMm/X4GJ/52Ztnqz13nt3cUuCNbBFgqy3EU4pVIPvFn8QWjlgRmp8S/EZzMtvCxJ7p0CBsaTtSHbAROP49uwHp7wfM/DOBF5A== X-Yahoo-Newman-Id: 805325.50004.bm@smtp207.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: AgCYzccVM1ngMqPLAEZ8K8JIcq.J1XKH.RMocCqNwFuQd8w 1jSq04SLRYQrYpGqJbvJg9Wic2E3E0OBbAeaClG4zOIxwYWoqgRxoTgHg4NB nVbXnF3Yq2DCl.b7e.FBonKfM1emYfKTzKUorHw0fUhE02Z3HD.0ENufpLim YZ4JSp0kQZAqrXydKOtaI4ud2ngmEH_obLdWJdvNOUoQH7mgk0B9bXKxY2pJ mMAeT9vWjMhxHBz0JxaXpA5pH4l5jcerTZ_9SbPRXKlceoYSKtFCD9COs0.W 3LrVbaDdfRDFYcgX6mIRU_0TX9pVvwIB7tZDyNGe2NrIRnDBwzJeCPdoPrnY ALbQI3xabdNUxFA7dJBrIaZowsTRfTdq2QqyJdzmM_5hWT6BEACfLlH6012e a96VQfnmvki93zfl8GIKpg85YSvlN..QUOA.CIyr07QxiqUfw6MTCCYhS_hZ QX.iRMeLlwjw1oI9kBdLnZ1IuY0z6e7S9Q22iLYyx2tgp2.uSpbO8tzqKczT jzaaFLvVT7WxjY8feJP0GJRdaPM09XJuz X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <56DD3C91.2070403@openwrt.org> Xref: news.gmane.org gmane.linux.lib.musl.general:9521 Archived-At: 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: ... >>> 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 header but it is indeed used to implement the linux abi futex and the native libthr on FreeBSD. Pedro.