Changeset 269396 in webkit


Ignore:
Timestamp:
Nov 4, 2020 3:07:34 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Add new build option USE(64KB_PAGE_BLOCK)
https://bugs.webkit.org/show_bug.cgi?id=217989

Patch by Michael Catanzaro <Michael Catanzaro> on 2020-11-04
Reviewed by Yusuke Suzuki.

.:

Why do we need this option? Because JSC and bmalloc both want to know the userspace page
size at compile time, which is impossible on Linux because it's a runtime setting. We
cannot test the system page size at build time in hopes that it will be the same on the
target system, because (a) cross compiling wouldn't work, and (b) the build system could
use a different page size than the target system (which will be true for Fedora aarch64,
because Fedora is built using RHEL), so the best we can do is guess based on the target CPU
architecture. In practice, guessing works for all architectures except aarch64 (unless
unusual page sizes are used), but it fails for aarch64 because distros are split between
using 4 KB and 64 KB pages there. Most distros (including Fedora) use 4 KB, but RHEL uses
64 KB. SUSE actually supports both. Since there is no way to guess correctly, the best we
can do is provide an option for it. You should probably only use this if building for
aarch64. Otherwise, known CPUs except PowerPC will use 4 KB, while PowerPC and unknown CPUs
will use 64 KB (see wtf/PageBlock.h). aarch64 will continue to default to 4 KB because this
is a much better default on systems where it doesn't crash.

Having one flag will help avoid mistakes. E.g. both RHEL and SUSE were manually passing
-DENABLE_JIT=OFF and -DUSE_SYSTEM_MALLOC=ON, but we missed -DENABLE_C_LOOP=ON and
-DENABLE_SAMPLING_PROFILER=OFF, so wound up running with both JIT and cloop disabled, a
configuration not otherwise used on Linux (and not supported by GTK or WPE ports). It will
be easier to not mess up if we only have to pass one special build option. This will also
allow us to stop patching PageBlock.h downstream, because I don't like downstream patches
that we have to keep forever.

  • Source/cmake/WebKitFeatures.cmake:

Source/WTF:

  • wtf/PageBlock.h:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r269209 r269396  
     12020-11-04  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        Add new build option USE(64KB_PAGE_BLOCK)
     4        https://bugs.webkit.org/show_bug.cgi?id=217989
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Why do we need this option? Because JSC and bmalloc both want to know the userspace page
     9        size at compile time, which is impossible on Linux because it's a runtime setting. We
     10        cannot test the system page size at build time in hopes that it will be the same on the
     11        target system, because (a) cross compiling wouldn't work, and (b) the build system could
     12        use a different page size than the target system (which will be true for Fedora aarch64,
     13        because Fedora is built using RHEL), so the best we can do is guess based on the target CPU
     14        architecture. In practice, guessing works for all architectures except aarch64 (unless
     15        unusual page sizes are used), but it fails for aarch64 because distros are split between
     16        using 4 KB and 64 KB pages there. Most distros (including Fedora) use 4 KB, but RHEL uses
     17        64 KB. SUSE actually supports both. Since there is no way to guess correctly, the best we
     18        can do is provide an option for it. You should probably only use this if building for
     19        aarch64. Otherwise, known CPUs except PowerPC will use 4 KB, while PowerPC and unknown CPUs
     20        will use 64 KB (see wtf/PageBlock.h). aarch64 will continue to default to 4 KB because this
     21        is a much better default on systems where it doesn't crash.
     22
     23        Having one flag will help avoid mistakes. E.g. both RHEL and SUSE were manually passing
     24        -DENABLE_JIT=OFF and -DUSE_SYSTEM_MALLOC=ON, but we missed -DENABLE_C_LOOP=ON and
     25        -DENABLE_SAMPLING_PROFILER=OFF, so wound up running with both JIT and cloop disabled, a
     26        configuration not otherwise used on Linux (and not supported by GTK or WPE ports). It will
     27        be easier to not mess up if we only have to pass one special build option. This will also
     28        allow us to stop patching PageBlock.h downstream, because I don't like downstream patches
     29        that we have to keep forever.
     30
     31        * Source/cmake/WebKitFeatures.cmake:
     32
    1332020-10-30  Ryosuke Niwa  <rniwa@webkit.org>
    234
  • trunk/Source/WTF/ChangeLog

    r269394 r269396  
     12020-11-04  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        Add new build option USE(64KB_PAGE_BLOCK)
     4        https://bugs.webkit.org/show_bug.cgi?id=217989
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * wtf/PageBlock.h:
     9
    1102020-11-04  Aditya Keerthi  <akeerthi@apple.com>
    211
  • trunk/Source/WTF/wtf/PageBlock.h

    r260431 r269396  
    5050#if OS(DARWIN) || PLATFORM(PLAYSTATION)
    5151constexpr size_t CeilingOnPageSize = 16 * KB;
     52#elif USE(64KB_PAGE_BLOCK) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(UNKNOWN)
     53constexpr size_t CeilingOnPageSize = 64 * KB;
    5254#elif OS(WINDOWS) || CPU(MIPS) || CPU(MIPS64) || CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64)
    5355constexpr size_t CeilingOnPageSize = 4 * KB;
    54 #elif CPU(UNKNOWN) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE)
    55 constexpr size_t CeilingOnPageSize = 64 * KB;
    5656#else
    5757#error Must set CeilingOnPageSize in PageBlock.h when adding a new CPU architecture!
  • trunk/Source/cmake/WebKitFeatures.cmake

    r269045 r269396  
    6060endmacro()
    6161
     62# We can't use WEBKIT_OPTION_DEFINE for USE_64KB_PAGE_BLOCK because it's needed to set the default
     63# value of other options. Why do we need this option? Because JSC and bmalloc both want to know the
     64# userspace page size at compile time, which is impossible on Linux because it's a runtime setting.
     65# We cannot test the system page size at build time in hopes that it will be the same on the target
     66# system, because (a) cross compiling wouldn't work, and (b) the build system could use a different
     67# page size than the target system (which will be true for Fedora aarch64, because Fedora is built
     68# using RHEL), so the best we can do is guess based on based on the target CPU architecture. In
     69# practice, guessing works for all architectures except aarch64 (unless unusual page sizes are
     70# used), but it fails for aarch64 because distros are split between using 4 KB and 64 KB pages
     71# there. Most distros (including Fedora) use 4 KB, but RHEL uses 16 KB. SUSE actually supports both.
     72# Since there is no way to guess correctly, the best we can do is provide an option for it. You
     73# should probably only use this if building for aarch64. Otherwise, known CPUs except PowerPC
     74# will use 4 KB, while PowerPC and unknown CPUs will use 64 KB (see wtf/PageBlock.h). aarch64 will
     75# continue to default to 4 KB because this is a better default on systems where it doesn't crash.
     76# (Linux aarch64 is different from Apple's ARM64, which uses 16 KB.)
     77option(USE_64KB_PAGE_BLOCK "Force support 64 KB userspace page size (reduces security and performance)" OFF)
     78
    6279macro(WEBKIT_OPTION_BEGIN)
    6380    set(_SETTING_WEBKIT_OPTIONS TRUE)
    6481
    65     if (WTF_CPU_ARM64 OR WTF_CPU_X86_64)
     82    if (USE_64KB_PAGE_BLOCK)
     83        set(ENABLE_JIT_DEFAULT OFF)
     84        set(ENABLE_FTL_DEFAULT OFF)
     85        set(USE_SYSTEM_MALLOC_DEFAULT ON)
     86        set(ENABLE_C_LOOP_DEFAULT ON)
     87        set(ENABLE_SAMPLING_PROFILER_DEFAULT OFF)
     88    elseif (WTF_CPU_ARM64 OR WTF_CPU_X86_64)
    6689        set(ENABLE_JIT_DEFAULT ON)
    6790        set(ENABLE_FTL_DEFAULT ON)
Note: See TracChangeset for help on using the changeset viewer.