This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] libitm: Fix handling of reentrancy in the HTM fastpath
- From: Peter Bergner <bergner at vnet dot ibm dot com>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>, Richard Henderson <rth at redhat dot com>
- Date: Wed, 19 Jun 2013 10:49:12 -0500
- Subject: Re: [patch] libitm: Fix handling of reentrancy in the HTM fastpath
- References: <1371653823 dot 16968 dot 25276 dot camel at triegel dot csb>
On Wed, 2013-06-19 at 16:57 +0200, Torvald Riegel wrote:
> (Re-sending to the proper list. Sorry for the noise at gcc@.)
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57643
>
> The HTM fastpath didn't handle a situation in which a relaxed
> transaction executed unsafe code that in turn starts a transaction; it
> simply tried to wait for the "other" transaction, not checking whether
> the current thread started the other transaction.
[snip]
> Peter and/or Andreas: Could you please check that this fixes the bug you
> see on Power/s390? Thanks.
This patch fixed the hang, but now I'm dying due to an abort in the
test case. Specifically, the first abort in unsafe()
int __attribute__((transaction_unsafe)) unsafe(int i)
{
if (_ITM_inTransaction() != inIrrevocableTransaction)
dying here: abort();
__transaction_atomic {
x++;
}
if (_ITM_inTransaction() != inIrrevocableTransaction)
abort();
return i+1;
}
This is due to the following in _ITM_inTransaction():
47 if (tx && (tx->nesting > 0))
(gdb) p tx
$2 = (GTM::gtm_thread *) 0x10901bf0
(gdb) p tx->nesting
$3 = 1
(gdb) step
49 if (tx->state & gtm_thread::STATE_IRREVOCABLE)
(gdb) p tx->state
$4 = 3
(gdb) p gtm_thread::STATE_IRREVOCABLE
$5 = 2
(gdb) step
50 return inIrrevocableTransaction;
Peter