From: Rich Felker <dalias@libc.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>,
GNU C Library <libc-alpha@sourceware.org>,
nd@arm.com, Jeff Law <law@redhat.com>,
Richard Earnshaw <Richard.Earnshaw@arm.com>,
Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
James Greenhalgh <James.Greenhalgh@arm.com>
Subject: Re: [RFC] nptl: change default stack guard size of threads
Date: Wed, 29 Nov 2017 20:52:00 -0000 [thread overview]
Message-ID: <20171129205148.GG1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <5c796246-1907-8cf4-00fc-eee11614b092@redhat.com>
On Wed, Nov 29, 2017 at 09:44:14PM +0100, Florian Weimer wrote:
> On 11/29/2017 07:40 PM, Szabolcs Nagy wrote:
> >On 29/11/17 15:18, Florian Weimer wrote:
> >>On 11/29/2017 03:59 PM, Szabolcs Nagy wrote:
> >>>The change can be made for aarch64 only
> >>
> >>That doesn't seem to be the case, looking at the patch.
> >>
> >>So what you intended to do, exactly?
> >
> >it seems the issue applies to all targets, and since
> >glibc itself have 64k stack jumps i sent the rfc
> >patch for all targets to err on the safe side.
>
> glibc has many arbitrarily large stack jumps (although we've been
> eliminating them manually for a while).
>
> What should guide the default size of the guard is not what glibc
> needs for its own routines, but what the stack probing in GCC needs
> to be correct.
Agreed.
> >>A 64 KiB probe interval on legacy 32-bit architectures is really a no-go. It means we have to increase the
> >>guard region size to 64 KiB. But we cannot do that: The guard allocation comes out of the overall thread stack
> >>size, and existing applications do not expect that 60K of configured stack suddenly becomes unavailable.
> >>Adding the guard size on top of the allocation will break setups which are carefully tuned for a maximum number
> >>of threads.
> >
> >i was aware of the address space limitation on 32bit
> >but e.g. aarch64 ilp32 will need the 64k guardsize too.
>
> Why?
>
> This is a new feature. Why make this less usable from the start?
>
> (I don't care about aarc64 ILP32 and page sizes smaller than 64 KiB
> on aarch64 in general, so I wont argue this, and this is just a
> courtesy notification that what you are doing is Very Wrong Indeed.)
I'm not sure I follow, but from the standpoint of virtual address
space and what is an acceptable cost in wasted address space, any
ILP32-on-64 ABIs should be considered the same as 32-bit archs. As
such, I think GCC really needs to do the stack probe every 4k, not
64k, and the default (and certainly minimum-supported) guard size
should be kept at 4k, not 64k or anything larger.
> >(i think there are other 32bit targets that support
> >> 4k page size, those may not mind the increase either,
> >they have to portably support large page size anyway)
>
> GCC needs to emit probe intervals for the smallest supported page
> size on the the target architecture. If it does not do that, we end
> up in trouble on the glibc side.
Agreed.
> We can throw new code at this problem and solve it for 64-bit. For
> 32-bit, we simply do not have a universally applicable solution. My
> understanding was that everywhere except on ARM, GCC was compatible
> with the pioneering glibc/Linux work in this area (the guard page we
> added to thread stacks, and the guard page added by the kernel). If
> this isn't the case, then I'm really disappointed in the disregard
> of existing practice on the GCC side.
Hm? What are you thinking of that GCC might have gotten wrong?
Rich
next prev parent reply other threads:[~2017-11-29 20:52 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 14:59 Szabolcs Nagy
2017-11-29 15:18 ` Florian Weimer
2017-11-29 18:17 ` Carlos O'Donell
2017-11-29 18:29 ` Rich Felker
2017-11-29 20:33 ` Florian Weimer
2017-11-29 18:40 ` Szabolcs Nagy
2017-11-29 20:44 ` Florian Weimer
2017-11-29 20:52 ` Rich Felker [this message]
2017-11-29 21:02 ` Florian Weimer
2017-11-29 23:13 ` Szabolcs Nagy
2017-12-05 10:55 ` James Greenhalgh
2017-12-06 12:51 ` Florian Weimer
2017-12-11 23:49 ` Jeff Law
2017-12-12 11:43 ` Szabolcs Nagy
2017-12-12 16:36 ` Rich Felker
2017-12-12 18:07 ` Szabolcs Nagy
2017-12-12 19:30 ` Florian Weimer
2017-12-13 11:58 ` Szabolcs Nagy
2017-12-19 12:35 ` James Greenhalgh
2017-12-19 13:06 ` Florian Weimer
2017-12-19 18:21 ` Szabolcs Nagy
2017-12-19 20:34 ` Rich Felker
2017-12-20 4:42 ` Jeff Law
2017-12-20 4:49 ` Rich Felker
2017-12-27 13:08 ` Wilco Dijkstra
2017-12-20 4:45 ` Jeff Law
2017-11-29 22:28 ` Wilco Dijkstra
2017-11-29 22:38 ` Carlos O'Donell
2017-12-06 12:53 ` Florian Weimer
2017-12-06 13:10 ` Wilco Dijkstra
2017-12-06 13:13 ` Florian Weimer
2017-11-29 23:02 ` Rich Felker
2017-12-06 13:16 ` Florian Weimer
2017-12-06 13:40 ` Joseph Myers
2017-12-06 13:51 ` Florian Weimer
2017-12-06 14:44 ` Jeff Law
2017-12-06 14:27 ` Wilco Dijkstra
2017-12-06 20:41 ` Szabolcs Nagy
2017-12-06 21:24 ` Adhemerval Zanella
2017-12-06 22:08 ` Rich Felker
2017-12-08 18:28 ` Szabolcs Nagy
2017-11-29 22:45 ` Szabolcs Nagy
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=20171129205148.GG1627@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=James.Greenhalgh@arm.com \
--cc=Richard.Earnshaw@arm.com \
--cc=Wilco.Dijkstra@arm.com \
--cc=fweimer@redhat.com \
--cc=law@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=nd@arm.com \
--cc=szabolcs.nagy@arm.com \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).