Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(187)

Issue 313800043: i#1680 large pages: Add code to discover page size. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
8 years ago by Edmund.Grimley.Evans
Modified:
8 years ago
Reviewers:
bruening
CC:
dynamorio-devs_googlegroups.com
Visibility:
Public.

Description

Commit log for first patchset: --------------- i#1680 large pages: Add code to discover page size. The stack pointer is passed as a third argument to relocate_dynamorio and on Linux this is used to search the auxiliary vector for AT_PAGESZ. On MacOS, and on Linux if for some reason os_page_size is called before relocate_dynamorio, the page size is discovered using the system calls mmap and munmap, which should work on any POSIX system. ---------------

Patch Set 1 #

Total comments: 23

Patch Set 2 : os_page_size_init #

Total comments: 34

Patch Set 3 : v3 #

Total comments: 1

Patch Set 4 : Committed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+122 lines, -5 lines) Patch
M core/arch/aarchxx/aarchxx.asm View 1 chunk +1 line, -1 line 0 comments Download
M core/arch/x86/x86.asm View 1 chunk +1 line, -1 line 0 comments Download
M core/dynamo.c View 1 2 3 2 chunks +6 lines, -0 lines 0 comments Download
M core/os_shared.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M core/unix/loader.c View 1 2 1 chunk +6 lines, -1 line 0 comments Download
M core/unix/os.c View 1 2 3 2 chunks +105 lines, -2 lines 0 comments Download

Messages

Total messages: 22
Edmund.Grimley.Evans
8 years ago (2016-10-11 09:08:29 UTC) #1
bruening
The title of the commit message should prob say "on unix". https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c File core/unix/loader.c (right): ...
8 years ago (2016-10-12 16:03:36 UTC) #2
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c File core/unix/loader.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c#newcode1611 core/unix/loader.c:1611: set_page_size(sp); On 2016/10/12 16:03:36, bruening wrote: > What about ...
8 years ago (2016-10-12 17:11:06 UTC) #3
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/1/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/os.c#newcode9634 core/unix/os.c:9634: if ((ptr_uint_t)addr >= (ptr_uint_t)-4096) /* mmap failed */ On ...
8 years ago (2016-10-12 17:26:12 UTC) #4
bruening
https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c File core/unix/loader.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c#newcode1611 core/unix/loader.c:1611: set_page_size(sp); On 2016/10/12 17:11:05, Edmund.Grimley.Evans wrote: > On 2016/10/12 ...
8 years ago (2016-10-12 17:29:14 UTC) #5
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c File core/unix/loader.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c#newcode1611 core/unix/loader.c:1611: set_page_size(sp); On 2016/10/12 17:29:14, bruening wrote: > On 2016/10/12 ...
8 years ago (2016-10-12 18:36:42 UTC) #6
bruening
https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c File core/unix/loader.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c#newcode1611 core/unix/loader.c:1611: set_page_size(sp); On 2016/10/12 18:36:42, Edmund.Grimley.Evans wrote: > On 2016/10/12 ...
8 years ago (2016-10-12 19:05:38 UTC) #7
Edmund.Grimley.Evans
Commit log for latest patchset: --------------- i#1680 large pages: Add code to discover page size ...
8 years ago (2016-10-13 16:16:05 UTC) #8
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c File core/unix/loader.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/loader.c#newcode1594 core/unix/loader.c:1594: for (++p; p[0] != 0; p += 2) { ...
8 years ago (2016-10-13 16:37:21 UTC) #9
bruening
https://codereview.appspot.com/313800043/diff/1/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/os.c#newcode9625 core/unix/os.c:9625: * discovered in any other way, such as from ...
8 years ago (2016-10-14 16:29:03 UTC) #10
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/1/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/os.c#newcode9625 core/unix/os.c:9625: * discovered in any other way, such as from ...
8 years ago (2016-10-14 16:38:19 UTC) #11
bruening
https://codereview.appspot.com/313800043/diff/1/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/os.c#newcode9625 core/unix/os.c:9625: * discovered in any other way, such as from ...
8 years ago (2016-10-14 17:11:41 UTC) #12
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/1/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/os.c#newcode9625 core/unix/os.c:9625: * discovered in any other way, such as from ...
8 years ago (2016-10-14 18:09:49 UTC) #13
bruening
Looks like it won't build on Windows https://codereview.appspot.com/313800043/diff/1/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/313800043/diff/1/core/unix/os.c#newcode9625 core/unix/os.c:9625: * discovered ...
8 years ago (2016-10-15 01:25:52 UTC) #14
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/20001/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/313800043/diff/20001/core/unix/os.c#newcode9708 core/unix/os.c:9708: struct auxval { ptr_uint_t type, val; } *auxv; On ...
8 years ago (2016-10-15 07:01:01 UTC) #15
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/20001/core/os_shared.h File core/os_shared.h (right): https://codereview.appspot.com/313800043/diff/20001/core/os_shared.h#newcode513 core/os_shared.h:513: void os_page_size_init(char **env); On 2016/10/15 01:25:51, bruening wrote: > ...
8 years ago (2016-10-17 11:16:49 UTC) #16
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/20001/core/dynamo.c File core/dynamo.c (right): https://codereview.appspot.com/313800043/diff/20001/core/dynamo.c#newcode370 core/dynamo.c:370: os_page_size_init(our_environ); On 2016/10/15 01:25:51, bruening wrote: > This will ...
8 years ago (2016-10-17 13:15:29 UTC) #17
Edmund.Grimley.Evans
Commit log for latest patchset: --------------- i#1680 large pages: Add code to discover page size ...
8 years ago (2016-10-17 15:10:37 UTC) #18
bruening
LGTM w/ a couple of comments https://codereview.appspot.com/313800043/diff/20001/core/dynamo.c File core/dynamo.c (right): https://codereview.appspot.com/313800043/diff/20001/core/dynamo.c#newcode370 core/dynamo.c:370: os_page_size_init(our_environ); On 2016/10/17 ...
8 years ago (2016-10-17 16:59:34 UTC) #19
Edmund.Grimley.Evans
https://codereview.appspot.com/313800043/diff/20001/core/dynamo.c File core/dynamo.c (right): https://codereview.appspot.com/313800043/diff/20001/core/dynamo.c#newcode370 core/dynamo.c:370: os_page_size_init(our_environ); On 2016/10/17 16:59:33, bruening wrote: > On 2016/10/17 ...
8 years ago (2016-10-17 17:33:12 UTC) #20
bruening
(On phone so replying top level) Ok that makes sense. On Monday, October 17, 2016, ...
8 years ago (2016-10-17 18:10:42 UTC) #21
Edmund.Grimley.Evans
8 years ago (2016-10-18 09:05:29 UTC) #22
Committed as
https://github.com/DynamoRIO/dynamorio/commit/efa2d7b6a7ee5543d1ef7240a12afcf...

Final commit log: 
---------------
i#1680 large pages: Add code to discover page size on Unix.

The stack pointer is passed as a third argument to relocate_dynamorio
and on Linux this is used to search the auxiliary vector for AT_PAGESZ.
Similarly, there are calls to os_page_size_init in dynamorio_app_init
and standalone_init to do the same thing. On MacOS, and on Linux if
for some reason os_page_size is called before these initialisations,
the page size is discovered using the system calls mmap and munmap,
which should work on any POSIX system.

A later commit should get Mac OSX to use sysctl_query on hw.pagesize.

Review-URL: https://codereview.appspot.com/313800043
---------------
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b