From dev-return-40163-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Thu Apr 21 20:14:28 2011 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 24D85286D for ; Thu, 21 Apr 2011 20:14:28 +0000 (UTC) Received: (qmail 65687 invoked by uid 500); 21 Apr 2011 20:14:27 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 65620 invoked by uid 500); 21 Apr 2011 20:14:27 -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 65611 invoked by uid 99); 21 Apr 2011 20:14:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 20:14:26 +0000 X-ASF-Spam-Status: No, hits=3.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of pierre.queinnec@zenika.com does not designate 84.16.68.90 as permitted sender) Received: from [84.16.68.90] (HELO smtp2.infomaniak.ch) (84.16.68.90) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 20:14:19 +0000 Received: from [192.168.0.20] (mon75-1-81-57-88-5.fbx.proxad.net [81.57.88.5]) (authenticated bits=0) by smtp2.infomaniak.ch (8.14.2/8.14.2) with ESMTP id p3LKDuMD021614 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 21 Apr 2011 22:13:57 +0200 From: Pierre Queinnec Content-Type: multipart/alternative; boundary=Apple-Mail-32-839605578 Subject: [drlvm][thread] stacksize Date: Thu, 21 Apr 2011 22:13:56 +0200 Message-Id: <3B18D33A-7F6D-4D2E-8A47-2D37B7561185@zenika.com> To: dev@harmony.apache.org Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) --Apple-Mail-32-839605578 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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 = 140736246960128 PMQ - setup_stack - (&res - mem_protect_size) =3D 140715543796204 PMQ - setup_stack - (guard_page_addr + guard_page_size =3D = 140715541778432 PMQ - setup_stack - (&res - mem_protect_size) =3D 140715528108524 PMQ - setup_stack - (guard_page_addr + guard_page_size =3D = 140715515604992 PMQ - setup_stack - (&res - mem_protect_size) =3D 140715515521516 PMQ - setup_stack - (guard_page_addr + guard_page_size =3D = 140715513503744 PMQ - setup_stack - (&res - mem_protect_size) =3D 140715513420268 PMQ - setup_stack - (guard_page_addr + guard_page_size =3D = 140715511402496 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 = there's this test : if ((size_t)(&res) - PSD->mem_protect_size < (size_t)tlsdata->guard_page_addr + = tlsdata->guard_page_size) return 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 --Apple-Mail-32-839605578 Content-Type: multipart/mixed; boundary=Apple-Mail-33-839605578 --Apple-Mail-33-839605578 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
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
=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 there's this test = :

     if = ((size_t)(&res) - PSD->mem_protect_size
   =           < = (size_t)tlsdata->guard_page_addr + = tlsdata->guard_page_size)
         = return 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



= --Apple-Mail-33-839605578 Content-Disposition: attachment; filename=drlvm-stacksize-printf.diff Content-Type: application/octet-stream; name="drlvm-stacksize-printf.diff" Content-Transfer-Encoding: 7bit Index: drlvm/vm/port/src/thread/linux/port_thread_tls_os.c =================================================================== --- drlvm/vm/port/src/thread/linux/port_thread_tls_os.c (revision 1092753) +++ drlvm/vm/port/src/thread/linux/port_thread_tls_os.c (working copy) @@ -61,6 +61,7 @@ pthread_attr_init(&pthread_attr); err = pthread_attr_getstacksize(&pthread_attr, &stack_size); + printf("init_psd_structure: stack_size = %li\n", stack_size); pthread_attr_destroy(&pthread_attr); if (err != 0) @@ -68,6 +69,7 @@ pthread_attr_init(&pthread_attr); err = pthread_attr_getguardsize(&pthread_attr, &guard_size); + printf("init_psd_structure: guard_size = %li\n", guard_size); pthread_attr_destroy(&pthread_attr); if (err != 0) @@ -79,6 +81,7 @@ data->foreign_stack_size = stack_size; data->guard_page_size = guard_size; data->mem_protect_size = MEM_PROTECT_SIZE; + printf("init_psd_structure: mem_protect_size = %li\n", data->mem_protect_size); data->req_type = THREADREQ_NONE; data->signal_set = FALSE; Index: drlvm/vm/port/src/thread/linux/thread_os.c =================================================================== --- drlvm/vm/port/src/thread/linux/thread_os.c (revision 1092753) +++ drlvm/vm/port/src/thread/linux/thread_os.c (working copy) @@ -332,6 +332,9 @@ // mapping_size = tlsdata->stack_size // - ((size_t)tlsdata->stack_addr - mapping_addr); + printf("PMQ - setup_stack - (&res - mem_protect_size) = %zu\n", (size_t)(&res) - PSD->mem_protect_size); + printf("PMQ - setup_stack - (guard_page_addr + guard_page_size = %zu\n", (size_t)tlsdata->guard_page_addr + tlsdata->guard_page_size); + if ((size_t)(&res) - PSD->mem_protect_size < (size_t)tlsdata->guard_page_addr + tlsdata->guard_page_size) return EINVAL; --Apple-Mail-33-839605578 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
--Apple-Mail-33-839605578-- --Apple-Mail-32-839605578--