|
Message-ID: <20130725132928.22f5c40c@vostro> Date: Thu, 25 Jul 2013 13:29:28 +0300 From: Timo Teras <timo.teras@....fi> To: musl@...ts.openwall.com Cc: rob@...dley.net Subject: Re: Proposed roadmap to 1.0 On Wed, 24 Jul 2013 13:36:53 -0500 Rob Landley <rob@...dley.net> 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
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.