From: Jeff Law <law@redhat.com>
To: "Carlos O'Donell" <carlos@systemhalted.org>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
Mike Frysinger <vapier@gentoo.org>,
libc-alpha <libc-alpha@sourceware.org>,
libc-ports@sourceware.org,
Marcus Shawcroft <marcus.shawcroft@linaro.org>
Subject: Re: [PATCH] Memory fencing problem in pthread cancellation
Date: Thu, 31 Jan 2013 22:05:00 -0000 [thread overview]
Message-ID: <510AEAA4.20306@redhat.com> (raw)
In-Reply-To: <50F48281.3070207@systemhalted.org>
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 @@
> <http://www.gnu.org/licenses/>. */
>
> /* 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
prev parent reply other threads:[~2013-01-31 22:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <50F46969.1000305@redhat.com>
2013-01-14 22:11 ` Carlos O'Donell
2013-01-14 22:21 ` Joseph S. Myers
2013-01-14 22:58 ` Carlos O'Donell
2013-01-14 23:50 ` Joseph S. Myers
2013-01-31 22:08 ` Jeff Law
2013-01-31 22:05 ` Jeff Law [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=510AEAA4.20306@redhat.com \
--to=law@redhat.com \
--cc=carlos@systemhalted.org \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=libc-ports@sourceware.org \
--cc=marcus.shawcroft@linaro.org \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).