From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29514 invoked by alias); 31 Jan 2013 22:05:45 -0000 Received: (qmail 29483 invoked by uid 22791); 31 Jan 2013 22:05:44 -0000 X-SWARE-Spam-Status: No, hits=-7.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BL,TW_DM,TW_OV X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 31 Jan 2013 22:05:34 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0VM5QKM019608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 31 Jan 2013 17:05:27 -0500 Received: from stumpy.slc.redhat.com (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0VM5O16020860; Thu, 31 Jan 2013 17:05:25 -0500 Message-ID: <510AEAA4.20306@redhat.com> Date: Thu, 31 Jan 2013 22:05:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: "Carlos O'Donell" CC: "Joseph S. Myers" , Mike Frysinger , libc-alpha , libc-ports@sourceware.org, Marcus Shawcroft Subject: Re: [PATCH] Memory fencing problem in pthread cancellation References: <50F46969.1000305@redhat.com> <50F48281.3070207@systemhalted.org> In-Reply-To: <50F48281.3070207@systemhalted.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00086.txt.bz2 On 01/14/2013 03:11 PM, Carlos O'Donell wrote: > On 01/14/2013 03:24 PM, Jeff Law wrote: > > > You need to fix the assembly also. [ ... ] > > Thus you need something like this completely untested patch: > > diff --git a/ports/sysdeps/arm/bits/atomic.h b/ports/sysdeps/arm/bits/atomic.h > index 6e20df7..b0f45ad 100644 > --- a/ports/sysdeps/arm/bits/atomic.h > +++ b/ports/sysdeps/arm/bits/atomic.h > @@ -42,6 +42,7 @@ void __arm_link_error (void); > # define atomic_full_barrier() __sync_synchronize () > #else > # define atomic_full_barrier() __arm_assisted_full_barrier () > +# define atomic_asm_full_barrier() __arm_asm_assisted_full_barrier () > #endif Added. > > /* An OS-specific bits/atomic.h file will define this macro if > diff --git a/ports/sysdeps/unix/sysv/linux/arm/bits/atomic.h b/ports/sysdeps/unix/sysv/linux/arm/bits/atomic.h > index c76b8f3..726d3ce 100644 > --- a/ports/sysdeps/unix/sysv/linux/arm/bits/atomic.h > +++ b/ports/sysdeps/unix/sysv/linux/arm/bits/atomic.h > @@ -17,7 +17,8 @@ > . */ > > /* If the compiler doesn't provide a primitive, we'll use this macro > - to get assistance from the kernel. */ > + to get assistance from the kernel. This should call the > + __kuser_memory_barrier helper in the kernel. */ > #ifdef __thumb2__ > # define __arm_assisted_full_barrier() \ > __asm__ __volatile__ \ > @@ -25,6 +26,11 @@ > "movt\tip, #0xffff\n\t" \ > "blx\tip" \ > : : : "ip", "lr", "cc", "memory"); > +/* The asm variant is used as an insert into existing asm statements. */ > +# define __arm_asm_assisted_full_barrier() \ > + " movw ip, #0x0fa0\n" \ > + " movt ip, #0xffff\n" \ > + " blx ip" > #else > # define __arm_assisted_full_barrier() \ > __asm__ __volatile__ \ > @@ -32,6 +38,11 @@ > "mov\tlr, pc\n\t" \ > "add\tpc, ip, #(0xffff0fa0 - 0xffff0fff)" \ > : : : "ip", "lr", "cc", "memory"); > +/* The asm variant is used as an insert into existing asm statements. */ > +# define __arm_asm_assisted_full_barrier() \ > + " mov ip, #0xffff0fff\n" \ > + " mov lr, pc\n" \ > + " add pc, ip, #(0xffff0fa0 - 0xffff0fff)" > #endif Added. > > /* Atomic compare and exchange. This sequence relies on the kernel to > diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c > index 58ca9ac..d7ac847 100644 > --- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c > +++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c > @@ -104,6 +104,7 @@ asm ( > " mov r6, r0\n" > " cmp r3, #0\n" > " beq 4f\n" > + atomic_asm_full_barrier() > "5: mov r0, r6\n" > " ldmfd sp!, {r4, r5, r6, lr}\n" > " " CFI_ADJUST_CFA_OFFSET (-16) "\n" > @@ -123,7 +124,7 @@ asm ( > #else > "1: .word _GLOBAL_OFFSET_TABLE_ - 3b - 8\n" > #endif > -"2: .word libgcc_s_resume(GOTOFF)\n" > +"2: .word libgcc_s_handle(GOTOFF)\n" > " .size _Unwind_Resume, .-_Unwind_Resume\n" > ); Not added as there's a later revision. jeff