Bug 221198

Summary: CeilingOnPageSize too low for Loongson CPUs
Product: WebKit Reporter: Alberto Garcia <berto>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: angelos, benjamin, berto, cdumez, chengzhpchn, cmarcelo, ews-watchlist, mcatanzaro, webkit-bug-importer, xan.lopez
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Alberto Garcia 2021-02-01 02:26:46 PST
CeilingOnPageSize is set to 4KB for MIPS on Linux, but that value is not permitted on Loongson CPUs which have a 16KB page size:

https://sources.debian.org/src/linux/5.10.9-1/arch/mips/Kconfig/#L2213-L2215
Comment 1 Xan Lopez 2021-02-01 02:56:04 PST
Our guess is that we are crashing in WTF::pageSize():

        RELEASE_ASSERT_WITH_MESSAGE(s_pageSize <= CeilingOnPageSize, "CeilingOnPageSize is too low, raise it in PageBlock.h!");

For Loongson CPUs that will be 16 <= 4, which won't work.

We can change the general ceiling value for MIPS to something else, at least 16KB, or try to detect Loongson CPUs and change it just for those.
Comment 2 Alberto Garcia 2021-02-01 02:59:32 PST
(In reply to Xan Lopez from comment #1)
> We can change the general ceiling value for MIPS to something else,
> at least 16KB, or try to detect Loongson CPUs and change it just for
> those.

For distributions I don't think the latter is an option, because
there's no guarantee that the machine where the package is built is
the same where it is installed and run.

But I can patch that downstream if there's no good general solution.
Comment 3 Radar WebKit Bug Importer 2021-02-08 02:27:13 PST
<rdar://problem/74089683>
Comment 4 Alberto Garcia 2021-05-15 14:13:58 PDT
This was fixed for 32-bit MIPS in r276583 (bug 225030), I think we should also do it for MIPS64.
Comment 5 Michael Catanzaro 2021-05-15 15:46:19 PDT
(In reply to Alberto Garcia from comment #4)
> This was fixed for 32-bit MIPS in r276583 (bug 225030), I think we should
> also do it for MIPS64.

Do it!
Comment 6 Alberto Garcia 2021-05-15 15:57:25 PDT
Created attachment 428747 [details]
Patch
Comment 7 EWS 2021-05-15 16:55:01 PDT
Committed r277551 (237779@main): <https://commits.webkit.org/237779@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 428747 [details].
Comment 8 Michael Catanzaro 2022-02-15 07:47:51 PST
*** Bug 223721 has been marked as a duplicate of this bug. ***