From owner-freebsd-threads@FreeBSD.ORG Mon Sep 12 04:00:43 2005 Return-Path: X-Original-To: freebsd-threads@hub.freebsd.org Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C12BA16A426 for ; Mon, 12 Sep 2005 04:00:42 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7774243D46 for ; Mon, 12 Sep 2005 04:00:39 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j8C40dwA068557 for ; Mon, 12 Sep 2005 04:00:39 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j8C40dcF068556; Mon, 12 Sep 2005 04:00:39 GMT (envelope-from gnats) Resent-Date: Mon, 12 Sep 2005 04:00:39 GMT Resent-Message-Id: <200509120400.j8C40dcF068556@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-threads@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Justin Shumaker Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E3D4316A41F for ; Mon, 12 Sep 2005 03:55:13 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id B3FB843D45 for ; Mon, 12 Sep 2005 03:55:13 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j8C3tDbt028075 for ; Mon, 12 Sep 2005 03:55:13 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j8C3tDgc028074; Mon, 12 Sep 2005 03:55:13 GMT (envelope-from nobody) Message-Id: <200509120355.j8C3tDgc028074@www.freebsd.org> Date: Mon, 12 Sep 2005 03:55:13 GMT From: Justin Shumaker To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: threads/86004: libthr broken on amd64 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2005 04:00:43 -0000 >Number: 86004 >Category: threads >Synopsis: libthr broken on amd64 >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 12 04:00:38 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Justin Shumaker >Release: 5.4 AMD64 >Organization: U.S. Army Research Laboratory >Environment: FreeBSD xxx.army.mil 5.4-RELEASE-p6 FreeBSD 5.4-RELEASE-p6 #0: Wed Sep 7 17:41:09 EST 2005 >Description: maping libpthread to libthr on AMD-64 causes multithreaded apps to core dump. >How-To-Repeat: Write a simple multithreaded test program in C. Here is a snippet of my test appplication. I have also tested with 3 other threaded apps all with the same results, so before complaining about a line of code in the below code, try cooking up your own. The application runs with libpthread. #include #include #define WORK_SIZE 1024*128*8 int queue; void* work(void *ptr) { unsigned int i, q; float a; q = queue; while(q--) { a = 1; for(i = 0; i < 128; i++) a *= 1.001; } return 0; } int main(int argc, char *args[]) { unsigned int i, tnum, n; pthread_t t[8]; if(argc < 2) { fprintf(stderr, "thread argument [1..8] required.\n"); exit(1); } tnum = atoi(args[1]); if(tnum < 1 || tnum > 8) { fprintf(stderr, "thread number must be from 1 to 8\n"); exit(1); } for(n = 0; n < 4; n++) { queue = WORK_SIZE / tnum; /* Launch the threads */ for(i = 0; i < tnum; i++) pthread_create(&t[i], 0, work, 0); /* Join the threads and finish */ for(i = 0; i < tnum; i++) { pthread_join(t[i], 0); printf("done: %d\n", i); } } exit(0); } >Fix: No idea, will require combing the libthr source and finding 64-bit unfriendly code or something it's tickling in the kernel. >Release-Note: >Audit-Trail: >Unformatted: