Closed Bug 819674 Opened 12 years ago Closed 9 years ago

Memory: JeMalloc: Add support for Loongson-series CPU-s

Categories

(Core :: Memory Allocator, defect)

17 Branch
SGI
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 901211

People

(Reporter: liushiwei, Assigned: hev)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux mips64; rv:17.0) Gecko/20100101 Firefox/17.0 Iceweasel/17.0.1
Build ID: 20121207072104

Steps to reproduce:

build iceweasel 17.0.1  at   fuloong  box , a mips loongson2f  cpu  minipc  , 


Actual results:

build fail.
build log:
  adding: hyphenation/hyph_ca.dic (deflated 61%)
  adding: hyphenation/hyph_it.dic (deflated 55%)
  adding: update.locale (stored 0%)
<jemalloc>Compile-time page size does not divide the runtime one.
Redirecting call to abort() to mozalloc_abort
Segmentation fault



Core was generated by `/home/src/iceweasel/iceweasel-16.0.2/build-xulrunner/dist/bin/xpcshell -g /home'.
Program terminated with signal 11, Segmentation fault.
#0  0x2c781080 in js::gc::InitMemorySubsystem () at /home/src/iceweasel/iceweasel-16.0.2/js/src/gc/Memory.cpp:306
306            MOZ_CRASH();
(gdb) list
301   
302    void
303    InitMemorySubsystem()
304    {
305        if (size_t(sysconf(_SC_PAGESIZE)) != PageSize)
306            MOZ_CRASH();
307    }
308   
309    void *
310    MapAlignedPages(size_t size, size_t alignment)
(gdb) bt
#0  0x2c781080 in js::gc::InitMemorySubsystem () at /home/src/iceweasel/iceweasel-16.0.2/js/src/gc/Memory.cpp:306
#1  0x2c57ab50 in JS_Init (maxbytes=33554432) at /home/src/iceweasel/iceweasel-16.0.2/js/src/jsapi.cpp:1004
#2  0x2ba27e70 in XPCJSRuntime::XPCJSRuntime (this=0x2ee06810, aXPConnect=<optimized out>) at /home/src/iceweasel/iceweasel-16.0.2/js/xpconnect/src/XPCJSRuntime.cpp:2060
#3  0x2ba29c00 in XPCJSRuntime::newXPCJSRuntime (aXPConnect=<optimized out>) at /home/src/iceweasel/iceweasel-16.0.2/js/xpconnect/src/XPCJSRuntime.cpp:2140
#4  0x2ba02b88 in nsXPConnect::nsXPConnect (this=<optimized out>) at /home/src/iceweasel/iceweasel-16.0.2/js/xpconnect/src/nsXPConnect.cpp:84
#5  0x2ba02c68 in nsXPConnect::GetXPConnect () at /home/src/iceweasel/iceweasel-16.0.2/js/xpconnect/src/nsXPConnect.cpp:144
#6  0x2b370018 in nsContentUtils::Init () at /home/src/iceweasel/iceweasel-16.0.2/content/base/src/nsContentUtils.cpp:342
#7  0x2b12d5fc in nsLayoutStatics::Initialize () at /home/src/iceweasel/iceweasel-16.0.2/layout/build/nsLayoutStatics.cpp:137
#8  0x2b12b828 in Initialize () at /home/src/iceweasel/iceweasel-16.0.2/layout/build/nsLayoutModule.cpp:340
#9  0x2bf52cc4 in nsComponentManagerImpl::KnownModule::Load (this=0x4679d0) at /home/src/iceweasel/iceweasel-16.0.2/xpcom/components/nsComponentManager.cpp:699
#10 0x2bf52e88 in nsFactoryEntry::GetFactory (this=0x467a10) at /home/src/iceweasel/iceweasel-16.0.2/xpcom/components/nsComponentManager.cpp:1701
#11 0x2bf54c78 in CreateInstanceByContractID (aResult=0x7fd052a4, aIID=..., aDelegate=0x0, aContractID=<optimized out>, this=0x443118)
    at /home/src/iceweasel/iceweasel-16.0.2/xpcom/components/nsComponentManager.cpp:1027
#12 nsComponentManagerImpl::CreateInstanceByContractID (this=0x443118, aContractID=<optimized out>, aDelegate=0x0, aIID=..., aResult=0x7fd052a4)
    at /home/src/iceweasel/iceweasel-16.0.2/xpcom/components/nsComponentManager.cpp:980
#13 0x2bf55cc8 in GetServiceByContractID (result=0x7fd05358, aIID=..., aContractID=0x416628 "@mozilla.org/js/xpc/RuntimeService;1", this=0x443118)
    at /home/src/iceweasel/iceweasel-16.0.2/xpcom/components/nsComponentManager.cpp:1433
#14 nsComponentManagerImpl::GetServiceByContractID (this=0x443118, aContractID=0x416628 "@mozilla.org/js/xpc/RuntimeService;1", aIID=..., result=0x7fd05358)
    at /home/src/iceweasel/iceweasel-16.0.2/xpcom/components/nsComponentManager.cpp:1345
#15 0x00408adc in CallGetService (aContractID=0x416628 "@mozilla.org/js/xpc/RuntimeService;1", aIID=..., aResult=<optimized out>)
    at /home/src/iceweasel/iceweasel-16.0.2/xpcom/glue/nsComponentManagerUtils.cpp:37
#16 0x00408ffc in nsGetServiceByContractID::operator() (this=<optimized out>, aIID=..., aInstancePtr=0x7fd05358) at /home/src/iceweasel/iceweasel-16.0.2/xpcom/glue/nsComponentManagerUtils.cpp:246
#17 0x00408034 in nsCOMPtr_base::assign_from_gs_contractid (this=0x7fd053b8, gs=..., iid=...) at /home/src/iceweasel/iceweasel-16.0.2/xpcom/glue/nsCOMPtr.cpp:92
#18 0x00403b34 in nsCOMPtr (gs=..., this=0x7fd053b8) at ../../../dist/include/nsCOMPtr.h:586
#19 main (argc=5, argv=0x7fd055a4, envp=0x7fd055bc) at /home/src/iceweasel/iceweasel-16.0.2/js/xpconnect/shell/xpcshell.cpp:1766




Expected results:

the attach patch   fix this bug.
Component: Untriaged → jemalloc
Product: Firefox → Core
Summary: build failure on mips loongson2f cpu ,jemalloc → build failure on mips loongson2f cpu, jemalloc
Attachment #690102 - Attachment mime type: application/octet-stream → application/x-gzip
Attachment #690102 - Attachment is patch: true
Attachment #690102 - Attachment mime type: application/x-gzip → text/plain
Attachment #690102 - Attachment is patch: false
Attachment #690102 - Attachment mime type: text/plain → application/x-gtar-compressed
Assignee: nobody → r
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Summary: build failure on mips loongson2f cpu, jemalloc → Memory: JeMalloc: Add support for Loongson-series CPU-s
Thanks!
Attachment #8672276 - Flags: review?(mh+mozilla)
Comment on attachment 8672276 [details] [diff] [review]
0001-Memory-JeMalloc-Add-support-for-Loongson-series-CPU-.patch

Review of attachment 8672276 [details] [diff] [review]:
-----------------------------------------------------------------

::: memory/mozjemalloc/jemalloc.c
@@ +1103,5 @@
>  #define pagesize_2pow			((size_t) 13)
>  #elif defined(__powerpc64__) || defined(__aarch64__)
>  #define pagesize_2pow			((size_t) 16)
> +#elif defined(_MIPS_ARCH_LOONGSON2F) || defined(_MIPS_ARCH_LOONGSON3A)
> +#define pagesize_2pow			((size_t) 14)

What is the status of loongson support in Linux distros? For e.g. Debian, isn't userspace from the traditional mips or mipsel port, with a kernel built for loongson? In that case, a build-time check is not going to be helpful.
Attachment #8672276 - Flags: review?(mh+mozilla)
Flags: needinfo?(r)
(In reply to Mike Hommey [:glandium] from comment #2)
> Comment on attachment 8672276 [details] [diff] [review]
> 0001-Memory-JeMalloc-Add-support-for-Loongson-series-CPU-.patch
> 
> Review of attachment 8672276 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: memory/mozjemalloc/jemalloc.c
> @@ +1103,5 @@
> >  #define pagesize_2pow			((size_t) 13)
> >  #elif defined(__powerpc64__) || defined(__aarch64__)
> >  #define pagesize_2pow			((size_t) 16)
> > +#elif defined(_MIPS_ARCH_LOONGSON2F) || defined(_MIPS_ARCH_LOONGSON3A)
> > +#define pagesize_2pow			((size_t) 14)
> 
> What is the status of loongson support in Linux distros? For e.g. Debian,
> isn't userspace from the traditional mips or mipsel port, with a kernel
> built for loongson? In that case, a build-time check is not going to be
> helpful.

A Fedora/MIPS64 port by Lemote, everything compiled with -march=loongson3a. ;)

Looks the pagesize_2pow is a constant config, I think we can't set page size = 16k for generic build(-march=mips???), so just enabled for -march=loongson2f | loongson3a. Do you think ok?
Flags: needinfo?(r)
MALLOC_STATIC_SIZES should just not be used for those configurations, I guess. Which, in fact, is already the case:

#if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__)
#define MALLOC_STATIC_SIZES 1
#endif

isn't __mips__ defined when building with -march=loongson3a?
(In reply to Mike Hommey [:glandium] from comment #4)
> MALLOC_STATIC_SIZES should just not be used for those configurations, I
> guess. Which, in fact, is already the case:
> 
> #if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__)
> #define MALLOC_STATIC_SIZES 1
> #endif
> 
> isn't __mips__ defined when building with -march=loongson3a?

No, it's defined. sounds runtime detect is possible on mips? did you think runtime detect is better than build time?

also, isn't improve performance when enable static size on mips?
(In reply to Heiher [:hev] from comment #5)
> (In reply to Mike Hommey [:glandium] from comment #4)
> > MALLOC_STATIC_SIZES should just not be used for those configurations, I
> > guess. Which, in fact, is already the case:
> > 
> > #if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__)
> > #define MALLOC_STATIC_SIZES 1
> > #endif
> > 
> > isn't __mips__ defined when building with -march=loongson3a?
> 
> No, it's defined. sounds runtime detect is possible on mips?

Sounds like runtime detection is already enabled on mips, and should be enabled on loongson as a consequence.

> did you think runtime detect is better than build time?

It's generally better because different machines using the same binary from distros may be using different page sizes.
 
> also, isn't improve performance when enable static size on mips?

It is, but the difference is likely marginal, and doesn't outweigh the possibility to use a single build on various different setups.

All in all, it seems this bug is a duplicate of bug 901211, which, while more recent, was fixed a while ago.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: