From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id D66442F229 for ; Wed, 8 Nov 2000 17:15:29 -0500 (EST) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id eA8MFJ407595 for axp-list@listman.redhat.com; Wed, 8 Nov 2000 17:15:19 -0500 Received: from piglet.twiddle.net (piglet.twiddle.net [207.104.6.26]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id eA8MFJD07582 for ; Wed, 8 Nov 2000 17:15:19 -0500 Received: (from rth@localhost) by piglet.twiddle.net (8.9.3/8.9.3) id OAA27973 for axp-list@redhat.com; Wed, 8 Nov 2000 14:15:43 -0800 Date: Wed, 8 Nov 2000 14:15:43 -0800 From: Richard Henderson To: axp-list@redhat.com Subject: Re: [Fwd: Alpha SMP problem] Message-ID: <20001108141543.A27935@twiddle.net> References: <3A095A5D.A5C7900D@scs.ch> <3A09B857.79DB9BB2@appnet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3us In-Reply-To: <3A09B857.79DB9BB2@appnet.com> X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0beta4 Precedence: bulk Reply-To: axp-list@redhat.com List-Id: Linux and Red Hat on Alpha processors On Wed, Nov 08, 2000 at 03:32:23PM -0500, Jeff Sturm wrote: > Honestly I didn't try your program, but I wouldn't consider blaming the > kernel or glibc as long as your code is incorrect. I did blame his code until I fixed it and it still failed. The following is actually the best fix; nothing needs to be made volatile, just add write-memory-barriers appropriately. The Big Issue is that sometimes one gets not segmentation faults, but illegal instruction faults. This is a hallmark of incorrect TLB or ASN handling. r~ --- malloctest-old.c Thu Nov 2 11:05:16 2000 +++ malloctest.c Thu Nov 2 14:37:33 2000 @@ -57,13 +57,13 @@ void Free(void *m) while (!mem->delete) Th_Delay(1); - mb(); /* This is important to ensure that mem->buf - has been written to memory yet */ - assert(mem->buf != NULL); assert(mem->delete); free(mem->buf); mem->buf = NULL; + + wmb(); + mem->delete = 0; } } @@ -86,17 +86,14 @@ void DoTest(long Th_Num) th_req[Th_Num]++; + wmb(); mem.delete = 1; while (mem.delete) Th_Delay(1); - mb(); /* This is important to ensure that mem->buf - has been written to memory yet */ - assert(mem.buf == NULL); assert(mem.delete == 0); - } }