@@ -147,6 +147,25 @@ Example signal handler:
147147 fix_the_problem(ucp->dar);
148148 }
149149
150+ When in an active transaction that takes a signal, we need to be careful with
151+ the stack. It's possible that the stack has moved back up after the tbegin.
152+ The obvious case here is when the tbegin is called inside a function that
153+ returns before a tend. In this case, the stack is part of the checkpointed
154+ transactional memory state. If we write over this non transactionally or in
155+ suspend, we are in trouble because if we get a tm abort, the program counter and
156+ stack pointer will be back at the tbegin but our in memory stack won't be valid
157+ anymore.
158+
159+ To avoid this, when taking a signal in an active transaction, we need to use
160+ the stack pointer from the checkpointed state, rather than the speculated
161+ state. This ensures that the signal context (written tm suspended) will be
162+ written below the stack required for the rollback. The transaction is aborted
163+ becuase of the treclaim, so any memory written between the tbegin and the
164+ signal will be rolled back anyway.
165+
166+ For signals taken in non-TM or suspended mode, we use the
167+ normal/non-checkpointed stack pointer.
168+
150169
151170Failure cause codes used by kernel
152171==================================
@@ -155,14 +174,18 @@ These are defined in <asm/reg.h>, and distinguish different reasons why the
155174kernel aborted a transaction:
156175
157176 TM_CAUSE_RESCHED Thread was rescheduled.
177+ TM_CAUSE_TLBI Software TLB invalide.
158178 TM_CAUSE_FAC_UNAV FP/VEC/VSX unavailable trap.
159179 TM_CAUSE_SYSCALL Currently unused; future syscalls that must abort
160180 transactions for consistency will use this.
161181 TM_CAUSE_SIGNAL Signal delivered.
162182 TM_CAUSE_MISC Currently unused.
183+ TM_CAUSE_ALIGNMENT Alignment fault.
184+ TM_CAUSE_EMULATE Emulation that touched memory.
163185
164- These can be checked by the user program's abort handler as TEXASR[0:7].
165-
186+ These can be checked by the user program's abort handler as TEXASR[0:7]. If
187+ bit 7 is set, it indicates that the error is consider persistent. For example
188+ a TM_CAUSE_ALIGNMENT will be persistent while a TM_CAUSE_RESCHED will not.q
166189
167190GDB
168191===
0 commit comments