Project

General

Profile

Actions

Bug #19400

closed

YJIT fails to boot on ARM64 systems with 64 KiB pages

Added by xiacunshun (xiacunshun xia) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
Target version:
-
[ruby-core:112179]

Description

  1. Failure:
    TestRubyOptions#test_enable [/builddir/build/BUILD/ruby-3.2.0/test/ruby/test_rubyoptions.rb:176]:
    pid 2482783 killed by SIGABRT (signal 6) (core dumped)
    | thread '' panicked at 'assertion failed: (left == right)
    | left: 16384,
    | right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13
    | note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
    .
  1. [1/2] Assertion for "stdout"
    | <[]> expected but was
    | <["YJIT: rb_yjit_init_rust() panicked. Aborting."]>.
  2. [2/2] Assertion for "stderr"
    | <[]> expected but was
    | <["thread '' panicked at 'assertion failed: (left == right)",
    | " left: 16384,",
    | " right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13",
    | "note: run with RUST_BACKTRACE=1 environment variable to display a backtrace"]>.
  1. Failure:
    TestYJIT#test_string_interpolation [/builddir/build/BUILD/ruby-3.2.0/test/ruby/test_yjit.rb:457]:
    exited with status 134, stderr:
    thread '' panicked at 'assertion failed: (left == right)
    left: 16384,
    right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
  2. Failure:
    TestYJIT#test_string_then_nil [/builddir/build/BUILD/ruby-3.2.0/test/ruby/test_yjit.rb:302]:
    exited with status 134, stderr:
    thread '' panicked at 'assertion failed: (left == right)
    left: 16384,
    right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Updated by xiacunshun (xiacunshun xia) about 1 year ago

xiacunshun (xiacunshun xia) wrote:

  1. Failure:
    TestRubyOptions#test_enable [/builddir/build/BUILD/ruby-3.2.0/test/ruby/test_rubyoptions.rb:176]:
    pid 2482783 killed by SIGABRT (signal 6) (core dumped)
    | thread '' panicked at 'assertion failed: (left == right)
    | left: 16384,
    | right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13
    | note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
    .
  1. [1/2] Assertion for "stdout"
    | <[]> expected but was
    | <["YJIT: rb_yjit_init_rust() panicked. Aborting."]>.
  2. [2/2] Assertion for "stderr"
    | <[]> expected but was
    | <["thread '' panicked at 'assertion failed: (left == right)",
    | " left: 16384,",
    | " right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13",
    | "note: run with RUST_BACKTRACE=1 environment variable to display a backtrace"]>.
  1. Failure:
    TestYJIT#test_string_interpolation [/builddir/build/BUILD/ruby-3.2.0/test/ruby/test_yjit.rb:457]:
    exited with status 134, stderr:
    thread '' panicked at 'assertion failed: (left == right)
    left: 16384,
    right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
  2. Failure:
    TestYJIT#test_string_then_nil [/builddir/build/BUILD/ruby-3.2.0/test/ruby/test_yjit.rb:302]:
    exited with status 134, stderr:
    thread '' panicked at 'assertion failed: (left == right)
    left: 16384,
    right: 0: code page size is not page-aligned', /builddir/build/BUILD/ruby-3.2.0/yjit/src/codegen.rs:7235:13
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

I run into this problem on armv8 and the pagesize is 64K.
The page_size of CodeBlock is const 16K, which leads to 16K % 64K = 16K.

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to yjit
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED

Updated by alanwu (Alan Wu) about 1 year ago

Curious what OS distribution you're using for reproduction.
I guess you compile your own custom Linux kernel?

Updated by xiacunshun (xiacunshun xia) about 1 year ago

alanwu (Alan Wu) wrote in #note-4:

Curious what OS distribution you're using for reproduction.
I guess you compile your own custom Linux kernel?

We are building ruby on OpenCloudOS stream.
Yes, we use the kernel which is compiled by ourself.

Actions #6

Updated by alanwu (Alan Wu) about 1 year ago

  • Subject changed from testcase failed on 3.2.0 to YJIT fails to boot on ARM64 systems with 64 KiB pages
Actions #7

Updated by alanwu (Alan Wu) about 1 year ago

  • Status changed from Assigned to Closed

Applied in changeset git|b78f871d838c168789648738e5c67b071beb8a19.


YJIT: Use the system page size when the code page size is too small (#7267)

Previously on ARM64 Linux systems that use 64 KiB pages
(CONFIG_ARM64_64K_PAGES=y), YJIT was panicking on boot due to a failed
assertion.

The assertion was making sure that code GC can free the last code page
that YJIT manages without freeing unrelated memory. YJIT prefers picking
16 KiB as the granularity at which to free code memory, but when the
system can only free at 64 KiB granularity, that is not possible.

The fix is to use the system page size as the code page size when the
system page size is 64 KiB. Continue to use 16 KiB as the code page size
on common systems that use 16/4 KiB pages.

Add asserts to code_gc() and free_page() about code GC's assumptions.

Fixes [Bug #19400]

Updated by naruse (Yui NARUSE) about 1 year ago

  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE

ruby_3_2 f93c7b9f58966fd04496bfeb2538fb1ff41f788e merged revision(s) b78f871d838c168789648738e5c67b071beb8a19,ecd0cdaf820af789f355f1a18c31d6adfe8aad94.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0