When compiling v8 on the aarch64 platform, there are some questions about the page size(4KB/64KB).

335 views
Skip to first unread message

苏工

unread,
Aug 14, 2020, 5:53:58 AM8/14/20
to v8-users
Hi,

I'm trying to compile the branch master under linux using gn.
centos7.6
gcc 7.3
The aarch64-related toolchain is available. 

The gn build command is as follows: 
gn gen out/arm64 --args='is_debug=true current_os="linux" target_os="linux" current_cpu="arm64" v8_current_cpu="arm64" v8_target_cpu="arm64"  is_clang=false use_custom_libcxx=false icu_use_data_file=false use_sysroot=false treat_warnings_as_errors=false v8_static_library = true symbol_level=2 '

The following problems occur when the Ninja is used for compilation,
# Fatal error in ../../src/heap/memory-chunk-layout.cc, line 40
# Debug check failed: kMaxRegularHeapObjectSize <= memory (131072 vs. 65536).

According to the src/base/build_config.h,only PPC/PPC64 supports 64 KB pages. On the aarch64 platform I use, it's also 64 KB page size. So I added the macro definition to let him make the same choice as PPC64.

After the compilation is complete, the following error is displayed when you use tools/run-tests.py to test functions: 
# Fatal error in ../../src/utils/allocation.cc, line 168
# Debug check failed: hint == AlignedAddress(hint, alignment) (0x3c1dc0714000 vs. 0x3c1dc0710000).

I suspect that this problem is related to the 64kB page  size, which I use, but the code implementation logic is 4KB. 

Modify the src/base/platform/platform-posix.cc file as follows to solve the problem and pass the test.
line290: 0x3FFFFFFFF000  -> 0x3FFFFFFF0000
Ensure that the generated address is 64 KB-aligned. 

As far as I know, only PPC/PPC64 in the source code supports 64 KB page sizes, what else do I need to do if I add platforms such as aarch64 that use 64 KB page sizes? 
Or, if you're using a page size of 4 KB. Whether the current code is adapted when I change the page size to 64 KB. 

Best regards,
Hindsight.
 

Pierre Langlois

unread,
Aug 17, 2020, 9:22:50 AM8/17/20
to v8-u...@googlegroups.com, 苏工
Hi there,

苏工 writes:

> Hi,
>
> I'm trying to compile the branch master under linux using gn.
> centos7.6
> gcc 7.3
> The aarch64-related toolchain is available.
>
> The gn build command is as follows:
> gn gen out/arm64 --args='is_debug=true current_os="linux" target_os="linux" current_cpu="arm64" v8_current_cpu="arm64" v8_target_cpu="arm64" is_clang=false use_custom_libcxx=false icu_use_data_file=false use_sysroot=false treat_warnings_as_errors=false v8_static_library = true symbol_level=2 '
>
> The following problems occur when the Ninja is used for compilation,
> # Fatal error in ../../src/heap/memory-chunk-layout.cc, line 40
> # Debug check failed: kMaxRegularHeapObjectSize <= memory (131072 vs. 65536).

Ouch, that looks like a bug to me :-/.

As you've already worked it out this is related to 64k pages indeed, and
the fixes you've done should work as far as I know.

But, as opposed to PPC64, on arm64 linux we cannot rely on the page size
being fixed at compile-time. For example, I believe it's possible to
have distros building nodejs or chromium packages on machines configured
with 4k pages, for those to be ran on machines that the user configured
with 64k pages.

I'm worried that in this case we're likely to miss this assertion and
cause issues later on. I've opened an issue about this with more info so
we can discuss solutions, see https://bugs.chromium.org/p/v8/issues/detail?id=10808 .

Thank you for bringing this up!
Pierre
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Reply all
Reply to author
Forward
0 new messages