From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2397 Path: news.gmane.org!not-for-mail From: Justin Cormack Newsgroups: gmane.linux.lib.musl.general Subject: Re: some issues with #defines Date: Sun, 2 Dec 2012 08:39:53 +0000 Message-ID: References: <20121202032622.GG20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b62226e9ddf6604cfda9320 X-Trace: ger.gmane.org 1354437615 31556 80.91.229.3 (2 Dec 2012 08:40:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Dec 2012 08:40:15 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2398-gllmg-musl=m.gmane.org@lists.openwall.com Sun Dec 02 09:40:28 2012 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 1Tf568-0002Q7-Li for gllmg-musl@plane.gmane.org; Sun, 02 Dec 2012 09:40:24 +0100 Original-Received: (qmail 30288 invoked by uid 550); 2 Dec 2012 08:40:06 -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 30256 invoked from network); 2 Dec 2012 08:40:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=specialbusservice.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=YxZAYoLToWKCBaNaRqbqxK5qLhM0kynUEvNdgu+Hz7o=; b=nKc2CaLYoQKjy/emymkrQCey0llFu6bNYM2kkam66ydE3N0wW2UdFPRU3uaBK6xrHN MODJf50jJ9ZatjXFPb8qQfIJ95IibmEI76pikIGkCSyMnFg5L1jz/Kb0DupDQEEcRWOm YlrIY+9hhHVCrvJCzW7P4vkE3FFCFgH6tlR5A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=YxZAYoLToWKCBaNaRqbqxK5qLhM0kynUEvNdgu+Hz7o=; b=BUbLpSouf6caN7o9fiUvdnteIIg0gnxMB/vWsXQJyUCuVtXgj6R3kbuRDFgHE6CjZa iCW9lqpN3RJtlIHV2TOu7qCPW8IxMQvMpv9/QO4feevYJ2n3fl2hBitVdVVxrVIymCAD gXaaa3TuaxTk8KtjsP6Op6QR8A5pbFya3c1VUPvc7YTZZaz/WYiioUReH5b45wTltf8A nnfoBv+0jKAs3pLaE8y77sv5ZujZvQ2HZI7Qnfqj+gCbOKIeYYGSePuceLclryNNaKic mA9O3g5N1hyYiDsv4hM3sqoMxskIQwGMYxVv2M8bmPMLWl5zk8VB/FGtwCNPZEUJpPDQ EtWg== In-Reply-To: <20121202032622.GG20323@brightrain.aerifal.cx> X-Gm-Message-State: ALoCoQkx6AI5MM/UQtX87dyRTigsyxaaNRsHMRLZw7VXQQ1XbHEBLCkG/MTYZzlI4OjlwHxc9ycL Xref: news.gmane.org gmane.linux.lib.musl.general:2397 Archived-At: --047d7b62226e9ddf6604cfda9320 Content-Type: text/plain; charset=UTF-8 On 2 Dec 2012 03:26, "Rich Felker" wrote: > > On Sat, Dec 01, 2012 at 11:52:19PM +0000, Justin Cormack wrote: > > PAGE_SIZE is defined in include/bits/limits.h but I am not sure it should > > be. As far as I can see glibc does not define it at all any more fo > > userspace (see man page for getpagesize). > > I'm aware that glibc does not define it because they consider it > variable. musl considers it constant because increasing it just wastes > large amounts of memory. The OS is still free to use larger hardware > pages transparently when possible; all PAGE_SIZE really represents the > the granularity of mmap. > > I've only run into one program which had a problem due to musl > defining PAGE_SIZE; it was using PAGE_SIZE for its own purposes. This > usage is non-portable since POSIX defines PAGE_SIZE. Per POSIX, if > PAGE_SIZE is defined it's a contant, and if it's not defined, it might > be variable, and the application must use sysconf() to query the page > size. Portable applications can always use sysconf() if desired, but > portable applications wanting to be more efficient can conditionally > use PAGE_SIZE directly if it's defined (allowing a lot of compile-time > constant propagation optimizations) and only fallback to the slower > and more bloated runtime calculations on systems that lack the macro. Thanks for that. It is including it because it is also including kernel headers which is always a mess. > > Running into other issues too with includes but suspect they are include > > bugs and need to look at them further, was looking at compiling native kvm > > tool. > > There are still lots of issues with very-low-level programs that do > hackish trace/debugger/jit type stuff not liking musl's headers. I'm > working on improving the situation in some respects, but I'm not sure > how successful things will be without some help from their side too. > Yes it is basically defining userspace kernel drivers so liable to be messy. However it only seems to be a few places so will have a look at patching it. It gives a way to run KVM without qemu and with much less code (5k lines) so would be nice to have. Justin --047d7b62226e9ddf6604cfda9320 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On 2 Dec 2012 03:26, "Rich Felker" <dalias@aerifal.cx> wrote:
>
> On Sat, Dec 01, 2012 at 11:52:19PM +0000, Justin Cormack wrote:
> > PAGE_SIZE is defined in include/bits/limits.h but I am not sure i= t should
> > be. As far as I can see glibc does not define it at all any more = fo
> > userspace (see man page for getpagesize).
>
> I'm aware that glibc does not define it because they consider it > variable. musl considers it constant because increasing it just wastes=
> large amounts of memory. The OS is still free to use larger hardware > pages transparently when possible; all PAGE_SIZE really represents the=
> the granularity of mmap.
>
> I've only run into one program which had a problem due to musl
> defining PAGE_SIZE; it was using PAGE_SIZE for its own purposes. This<= br> > usage is non-portable since POSIX defines PAGE_SIZE. Per POSIX, if
> PAGE_SIZE is defined it's a contant, and if it's not defined, = it might
> be variable, and the application must use sysconf() to query the page<= br> > size. Portable applications can always use sysconf() if desired, but > portable applications wanting to be more efficient can conditionally > use PAGE_SIZE directly if it's defined (allowing a lot of compile-= time
> constant propagation optimizations) and only fallback to the slower > and more bloated runtime calculations on systems that lack the macro.<= /p>

Thanks for that. It is including it because it is also inclu= ding kernel headers which is always a mess.

> > Running into other issues too with includes but su= spect they are include
> > bugs and need to look at them further, was looking at compiling n= ative kvm
> > tool.
>
> There are still lots of issues with very-low-level programs that do > hackish trace/debugger/jit type stuff not liking musl's headers. I= 'm
> working on improving the situation in some respects, but I'm not s= ure
> how successful things will be without some help from their side too. >

Yes it is basically defining userspace kernel drivers so lia= ble to be messy. However it only seems to be a few places so will have a lo= ok at patching it. It gives a way to run KVM without qemu and with much les= s code (5k lines) so would be nice to have.

Justin

--047d7b62226e9ddf6604cfda9320--