Module intel_tsx_rtm::intrinsics [] [src]

Very low-level intrinsics closely matching those defined in gcc, clang and Andi Kleen's tsx-tools.

Constants

_XABORT_CAPACITY

If this flag is in the return code from _xbegin(), and the return code was not _XBEGIN_STARTED, then a transaction was aborted by the CPU because the CPU's (small) amount of memory for tracking transactions was exceeded. This is typically because many memory locations were read or written during the transaction, or because too many CPUs were doing transactions at once. It may be worth retrying the transaction if the _XABORT_RETRY flag is set, but only once or twice; typically this result means that the transaction logic is 'trying to do too much'.

_XABORT_CONFLICT

If this flag is in the return code from _xbegin(), and the return code was not _XBEGIN_STARTED, then a transaction was aborted by the CPU because it read or wrote memory that was also read to or written to by another hyperthreaded (logical) CPU. Such reads and writes may fully or partially overlap.

_XABORT_DEBUG

If this flag is in the return code from _xbegin(), and the return code was not _XBEGIN_STARTED, then a transaction was aborted by the CPU because a debug trap was hit. It may be worth retrying the transaction if the _XABORT_RETRY flag is set. This flag should not be in the return code in normal, production use.

_XABORT_EXPLICIT

If this flag is in the return code from _xbegin(), and the return code was not _XBEGIN_STARTED, then a transaction explicitly aborted by transaction logic calling _xabort(). The bottom 8-bits of the status code passed to _xabort(status) can be extracted using the function _XABORT_CODE().

_XABORT_NESTED

If this flag is in the return code from _xbegin(), and the return code was not _XBEGIN_STARTED, then a transaction was aborted by the CPU because a second call to _xbegin() was made inside transactional logic, ie a an attempt was made to nest transactions. This is not supported and indicates programmer error.

_XABORT_RETRY

If this flag is in the return code from _xbegin(), and the return code was not _XBEGIN_STARTED, then a transaction that was aborted can be retried. It should only be retried for a small number of times. Retries may occur because of, say, page faults when accessing memory or interrupts.

_XBEGIN_STARTED

Value returned from _xbegin() if beginning a transaction.

Functions

_XABORT_CODE

If the flag _XABORT_EXPLICIT is in the return code from _xbegin(), and the return code was not _XBEGIN_STARTED, then this function returns the status value of a transaction explicitly aborted by transaction logic calling _xabort(status)

_xabort

Aborts a transaction. Will raise the signal SIGILL (an illegal instruction abort) on CPUs without Intel TSX support, so be careful. Returns the bottom 8 bits of status as a result code embedded in the return code from _xbegin(). It is unclear what happens to the top 24-bits of status; you're advised to make them 0. Additionally, it will be difficult to distinguish an abort code of 0 from success in higher-level transaction handling logic. The status value of 0xFF is unofficially reserved (and is used in libitm) to mean 'transaction failed due to busy lock'.

_xbegin

Begin a transaction. Will raise the signal SIGILL (an illegal instruction abort) on CPUs without Intel TSX support, so be careful. Can appear to execute twice, a bit like setjmp / longjmp or fork(). If a transaction has started, then the return code is _XBEGIN_STARTED. If a transaction is committed successfully, then the return code will be zero, 0. If a transaction aborts or rolls back, execution restarts here with all memory effects undone and a return code that is not _XBEGIN_STARTED; in which case, the return code is a mix of a bit set of flags and a result code.

_xend

Ends a transaction by committing it. Will raise the signal SIGILL (an illegal instruction abort) on CPUs without Intel TSX support, so be careful. The value returned as the result code of _xbegin() will be zero, 0, if the CPU can commit this transaction without any other thread having changed the memory read or written to by it.

_xtest

Tests whether code is executing in a transaction. Will raise the signal SIGILL (an illegal instruction abort) on CPUs without Intel TSX support, so be careful.