Return-Path: X-Original-To: apmail-harmony-dev-archive@www.apache.org Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B93D916A9 for ; Tue, 26 Apr 2011 02:44:06 +0000 (UTC) Received: (qmail 63594 invoked by uid 500); 26 Apr 2011 02:44:06 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 63422 invoked by uid 500); 26 Apr 2011 02:44:04 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 63413 invoked by uid 99); 26 Apr 2011 02:44:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 02:44:01 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_FROM,FSL_RU_URL,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ilya.berezhniuk@gmail.com designates 74.125.82.43 as permitted sender) Received: from [74.125.82.43] (HELO mail-ww0-f43.google.com) (74.125.82.43) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 02:43:55 +0000 Received: by wwb17 with SMTP id 17so189294wwb.0 for ; Mon, 25 Apr 2011 19:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=v5zLHGn9RvBAzoT3W7c78W9sXGJp5FSs7qANnbrbviU=; b=rYUiS/dkcJeQ3cW4kiJAh7Qyotb3arBt+83JZTLPQXUcNP4LxEYB+M7p8kR2138Z9Q BQ3RPmep6wPo7u6U4KJfSlm14oyjMe99FG8vll+leinyX5cKmyOf8bkerLMz4JS6MhMs ptxDVQ58byuiPQ/EyV9iOZ9vgw4ZI6c5H0F88= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=qpuO9vvK8XvnjRBiHA3iOy6hC/yRBqwpcwT+2PaEt/AzH6pFuCUD4DBKxmHQbfu/sq YuaQvE2aAhgDXYq/e4fDZWAYpb9xOBRk8JVJnKhYen/6kDSYwFdkbuHMMUraG/TRUWZO g9e3saPQZzfhgBhwnWU6Nn1HriCg/+S+Ui0SI= Received: by 10.216.242.134 with SMTP id i6mr4237367wer.81.1303785815190; Mon, 25 Apr 2011 19:43:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.3.148 with HTTP; Mon, 25 Apr 2011 19:43:05 -0700 (PDT) In-Reply-To: References: <3B18D33A-7F6D-4D2E-8A47-2D37B7561185@zenika.com> From: Ilya Berezhniuk Date: Mon, 25 Apr 2011 19:43:05 -0700 Message-ID: Subject: Re: [drlvm][thread] stacksize To: dev@harmony.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Pierre, 1) The stack size you see is most probably a main thread stack size, obtained once the global instance of "port shared data" object is created, while attaching main thread to the port threading system. You cannot change main thread stack size via Xss, it's set up in compile time I believe. To get size of all managed threads created by the VM, you can examine results returned by the call to find_stack_addr_size() in init_stack() function (vm/port/src/thread/linux/thread_os.c:395). 2) The meaning of the test is to check if our current stack position (obtained through getting an address of local variable) with a fixed spare space (mem_protect_size) overlaps with an area which is to be protected by set_guard_page() later in this function. If they do overlap, then we have way too small stack to work properly, even less than 0x400 (0x100 on 32-bit) bytes between current stack and special area supposed for catching stack overflow. Thanks, Ilya. On Thu, Apr 21, 2011 at 1:45 PM, Alexei Fedotov wrote: > Pierre, > > Please try the following searches: > > The parameter is set: > http://www.google.com/codesearch?q=3D"thread.stacksize"&exact_package=3Dh= ttp%3A%2F%2Fsvn.apache.org%2Frepos%2Fasf%2Fharmony%2Fenhanced%2F > > The thread is created: > http://www.google.com/codesearch?lr=3D&q=3D"port_thread_create"&sbtn=3D= =D0=9F=D0=BE=D0=B8=D1=81=D0=BA&exact_package=3Dhttp%3A%2F%2Fsvn.apache.org%= 2Frepos%2Fasf%2Fharmony%2Fenhanced%2F > > Maybe if you add more debugging there, this will help. > > -- > With best regards / =D1=81 =D0=BD=D0=B0=D0=B8=D0=BB=D1=83=D1=87=D1=88=D0= =B8=D0=BC=D0=B8 =D0=BF=D0=BE=D0=B6=D0=B5=D0=BB=D0=B0=D0=BD=D0=B8=D1=8F=D0= =BC=D0=B8, > Alexei Fedotov / =D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9 =D0=A4=D0=B5= =D0=B4=D0=BE=D1=82=D0=BE=D0=B2, > http://dataved.ru/ > +7 916 562 8095 > > > > On Fri, Apr 22, 2011 at 12:13 AM, Pierre Queinnec < > pierre.queinnec@zenika.com> wrote: > >> Hi guys, >> >> I'm seeing some strange thread stack size behavior while porting to Mac, >> and I've been trying to compare to a build on a 64bit linux (Debian 6). >> >> Here's what I see on Linux, whatever I can define for my Xss, the stack >> size in init_psd_structure always calculates 8M : >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> queinnec@squeezy:~/Code/harmony-svn-java6/target/hdk/jdk$ ./bin/java >> -Xmx1024m -Xss12m -version >> init_psd_structure: stack_size =3D 8388608 >> init_psd_structure: guard_size =3D 4096 >> init_psd_structure: mem_protect_size =3D 1024 >> PMQ - setup_stack - (&res - mem_protect_size) =3D 140736255271036 >> PMQ - setup_stack - (guard_page_addr + guard_page_size =3D 1407362469601= 28 >> PMQ - setup_stack - (&res - mem_protect_size) =3D 140715543796204 >> PMQ - setup_stack - (guard_page_addr + guard_page_size =3D 1407155417784= 32 >> PMQ - setup_stack - (&res - mem_protect_size) =3D 140715528108524 >> PMQ - setup_stack - (guard_page_addr + guard_page_size =3D 1407155156049= 92 >> PMQ - setup_stack - (&res - mem_protect_size) =3D 140715515521516 >> PMQ - setup_stack - (guard_page_addr + guard_page_size =3D 1407155135037= 44 >> PMQ - setup_stack - (&res - mem_protect_size) =3D 140715513420268 >> PMQ - setup_stack - (guard_page_addr + guard_page_size =3D 1407155114024= 96 >> Apache Harmony Launcher : (c) Copyright 1991, 2010 The Apache Software >> Foundation or its licensors, as applicable. >> java version "1.5.0" >> Apache Harmony (1.5.0) >> DRLVM (1.5.0-r1092753) >> pre-alpha : not complete or compatible >> svn =3D r1092753, (Apr 15 2011), Linux/em64t/gcc 4.4.5, release build >> http://harmony.apache.org >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> (patch attached, maybe I just missed something obvious... I've seen some >> maybe related JIRA but they were supposed to be closed) >> >> As a second question, in drlvm/vm/port/src/thread/linux/thread_os.c ther= e's >> this test : >> >> =C2=A0 =C2=A0 =C2=A0if ((size_t)(&res) - PSD->mem_protect_size >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0< (size_t)tlsdata->guard= _page_addr + tlsdata->guard_page_size) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return EINVAL; >> >> I'm not sure I get this... Anyone care to explain? >> >> As a side note, the port seems to start fine but crashes after starting >> some threads. >> Cheers, >> -- Pierre Queinnec >> >> >> >> >> >> >