From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3742 Path: news.gmane.org!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: Proposed roadmap to 1.0 Date: Thu, 25 Jul 2013 13:29:28 +0300 Message-ID: <20130725132928.22f5c40c@vostro> References: <20130717160204.GF12469@brightrain.aerifal.cx> <1374691013.3031.6@driftwood> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1374748149 15125 80.91.229.3 (25 Jul 2013 10:29:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Jul 2013 10:29:09 +0000 (UTC) Cc: rob@landley.net To: musl@lists.openwall.com Original-X-From: musl-return-3746-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jul 25 12:29:11 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1V2InH-0005Iz-4c for gllmg-musl@plane.gmane.org; Thu, 25 Jul 2013 12:29:11 +0200 Original-Received: (qmail 7680 invoked by uid 550); 25 Jul 2013 10:29:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7672 invoked from network); 25 Jul 2013 10:29:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :x-mailer:mime-version:content-type:content-transfer-encoding; bh=023tQfoa5geaAGOSmerRObteVhIQylPm0Q4ZXIMwjks=; b=MNVJvcsIecu/S7KpdybBkWavtZw0URxSF9MwojBRunwP948A+ncGjyyucXD926EkyZ 3bctGEtHE0gH5GPghw34d1S11IWarmtzWH6+Q/BdV1GWtO7qt0WZdH7idpbCQ9Whu9LH /L9GvWGMqASQA12FqampRR4y9SKCC7HS/wi9/PbNp5GPnTAeA7Rfhu0MfBX65cM8R3RM TigS1Sn0pDKd4EeMyw2mBi4V71Y5GesZDjM1tqoh/BXUuW0CsoNikEbSEBy1PrpsCKqd mCucKZi9k9a6lNh7oYQI/6AvdbQeihEKJViTpdbFRXShvhhGBKTlZH4CJHN/seoPwMPe FjBw== X-Received: by 10.15.10.8 with SMTP id f8mr42202237eet.110.1374748138891; Thu, 25 Jul 2013 03:28:58 -0700 (PDT) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: <1374691013.3031.6@driftwood> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.20; i686-pc-linux-gnu) Xref: news.gmane.org gmane.linux.lib.musl.general:3742 Archived-At: On Wed, 24 Jul 2013 13:36:53 -0500 Rob Landley wrote: > On 07/17/2013 11:02:05 AM, Rich Felker wrote: > > > - Affinity/cpuset interfaces. > > > > Last time I started working on this, I got sick of it before I got > > very far. There are just so many tedious macros/inline-functions to > > implement. I was also frustrated with having to put so much code in > > a public header. For this, I'd really like some help on both: > > > > - ideas for making it less hideous, and > > - actually writing it out. > > For toybox I ignored the glibc interfaces and just used the raw > syscall, manipulating the arguments myself with bit shifts. Let's > see... > > Wow the man 3 CPU_SET macros are crazy. Very first one, CPU_ZERO() > does not specify the size of the array. So how does it determine it? > It's gotta be getting it from cpu_set_t which is defined in > /usr/include/*/bits/sched.h: > > /* Data structure to describe CPU mask. */ > typedef struct > { > __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS]; > } cpu_set_t; > > So what's _NCPUBITS? > > /* Size definition for CPU sets. */ > # define __CPU_SETSIZE 1024 > # define __NCPUBITS (8 * sizeof (__cpu_mask)) > > /* Type for array elements in 'cpu_set_t'. */ > typedef unsigned long int __cpu_mask; > > So... it's hardwired to 1024 cpus. > > I don't think there _is_ a way to make this non-ugly. What actually > uses this? Seems also many SMP-aware programs use sched_getaffinity to figure out how many threads to launch. Including, but not limited to, util-linux (nproc) and gccgo. Most should autodetect this, but gccgo seems to just unconditionally use it. Speaking of gccgo, it seems that gcc 4.8.1 without any changes does not compile with musl due to: - libgo/mksysinfo.sh: conflicting kernel and libc #includes - libgo/runtime/getncpu-linux.c: uses sched_getaffinity + cpu_set_t - libgo/runtime/proc.c: uses make/swap/getcontext, and needs configure to detect if TLS segment register (fs/gs on x86) is part of the context or not The first two can be patched easily. But lack of *context is a stopper. I think I'll need the *context for few other projects as well... - Timo