From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QDL6a-00086R-8n for qemu-devel@nongnu.org; Fri, 22 Apr 2011 14:29:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QDL6Z-0000jx-70 for qemu-devel@nongnu.org; Fri, 22 Apr 2011 14:29:24 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:38319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QDL6Z-0000jr-2O for qemu-devel@nongnu.org; Fri, 22 Apr 2011 14:29:23 -0400 Received: by pzk36 with SMTP id 36so541460pzk.4 for ; Fri, 22 Apr 2011 11:29:21 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 22 Apr 2011 11:29:21 -0700 Message-ID: From: Yale Zhang Content-Type: multipart/alternative; boundary=bcaec53960745b2e0904a18609a9 Subject: Re: [Qemu-devel] why does qemu i386 userspace emulation crashes when pthread used? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --bcaec53960745b2e0904a18609a9 Content-Type: text/plain; charset=ISO-8859-1 I have found the problem and fix. NEW_STACK_SIZE for clone() should be increased from the default 16384 (x86_64) to 256 KiB. On Tue, Apr 19, 2011 at 6:33 PM, Yale Zhang wrote: > Hi. I'm want to run some pthread programs using qemu userspace emulation > (target=i386, host=x86_64,arm), but see NPTL support isn't supported for the > i386 target. I have applied a patch from here > http://patchwork.ozlabs.org/patch/45206/ and used it to run a simple > pthread fork, join program. The program is able to launch multiple threads, > but the 1st thread that exits causes the program to crash inside the pthread > library. > > What are the reasons NPTL isn't supported for i386 and was it ever > supported in the past? I even wrote another simple program that does the > equivalent, but with using fork(), waitpid() instead of pthread_create(), > pthread_join(), and it works correctly. This seems to suggest thread local > storage wasn't implemented correctly? > > Thanks, > Yale > > --bcaec53960745b2e0904a18609a9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I have found the problem and fix. NEW_STACK_SIZE for clone() =A0should be i= ncreased from the default 16384 (x86_64) to =A0256 KiB.

On Tue, Apr 19, 2011 at 6:33 PM, Yale Zhang <yzhang1985@gmail.com>= ; wrote:
Hi. I'm= want to run some pthread programs using qemu userspace emulation (target= =3Di386, host=3Dx86_64,arm), but see NPTL support isn't supported for t= he i386 target. I have applied a patch from here=A0http://patchwork.ozlabs.org/= patch/45206/=A0and used it to run a simple pthread fork, join program. = The program is able to launch multiple threads, but the 1st thread that exi= ts causes the program to crash inside the pthread library.
=A0
What are the reasons NPTL isn't supported for i386 a= nd was it ever supported in the past? I even wrote another simple program t= hat does the equivalent, but with using fork(), waitpid() instead of pthrea= d_create(), pthread_join(), and it works correctly. This seems to suggest t= hread local storage wasn't implemented correctly?

Thanks,
Yale


--bcaec53960745b2e0904a18609a9--