| 1 |
.\" |
| 2 |
.\" Copyright 2013 Samy Al Bahra. |
| 3 |
.\" All rights reserved. |
| 4 |
.\" |
| 5 |
.\" Redistribution and use in source and binary forms, with or without |
| 6 |
.\" modification, are permitted provided that the following conditions |
| 7 |
.\" are met: |
| 8 |
.\" 1. Redistributions of source code must retain the above copyright |
| 9 |
.\" notice, this list of conditions and the following disclaimer. |
| 10 |
.\" 2. Redistributions in binary form must reproduce the above copyright |
| 11 |
.\" notice, this list of conditions and the following disclaimer in the |
| 12 |
.\" documentation and/or other materials provided with the distribution. |
| 13 |
.\" |
| 14 |
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 15 |
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 17 |
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 18 |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 19 |
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 20 |
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 21 |
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 22 |
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 23 |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 24 |
.\" SUCH DAMAGE. |
| 25 |
.\" |
| 26 |
.\" |
| 27 |
.Dd December 17, 2013 |
| 28 |
.Dt ck_pr_rtm 3 |
| 29 |
.Sh NAME |
| 30 |
.Nm ck_pr_rtm_begin , |
| 31 |
.Nm ck_pr_rtm_end , |
| 32 |
.Nm ck_pr_rtm_abort , |
| 33 |
.Nm ck_pr_rtm_test |
| 34 |
.Nd restricted transactional memory |
| 35 |
.Sh LIBRARY |
| 36 |
Concurrency Kit (libck, \-lck) |
| 37 |
.Sh SYNOPSIS |
| 38 |
.In ck_pr.h |
| 39 |
.Ft unsigned int |
| 40 |
.Fn ck_pr_rtm_begin "void" |
| 41 |
.Ft void |
| 42 |
.Fn ck_pr_rtm_end "void" |
| 43 |
.Ft void |
| 44 |
.Fn ck_pr_rtm_abort "const unsigned int status" |
| 45 |
.Ft bool |
| 46 |
.Fn ck_pr_rtm_test "void" |
| 47 |
.Sh DESCRIPTION |
| 48 |
These family of functions implement support for restricted |
| 49 |
transactional memory, if available on the underlying platform. |
| 50 |
Currently, support is only provided for Intel Haswell and |
| 51 |
newer x86 microarchitectures that have the TSX-NI feature. |
| 52 |
.Pp |
| 53 |
The |
| 54 |
.Fn ck_pr_rtm_begin |
| 55 |
function returns CK_PR_RTM_STARTED if a transaction was successfully |
| 56 |
started. In case of an abort, either internal (through a ck_pr_rtm_abort) |
| 57 |
or external, program flow will return to the point which the function |
| 58 |
was called except the return value will consist of a bitmap with one or |
| 59 |
more of the following bits set: |
| 60 |
.Bl -tag -width indent |
| 61 |
.It CK_PR_RTM_EXPLICIT |
| 62 |
Set if the transactionally was explicitly aborted through |
| 63 |
.Fn ck_pr_rtm_abort . |
| 64 |
.It CK_PR_RTM_RETRY |
| 65 |
Set if the transaction failed but can still succeed if |
| 66 |
retried. |
| 67 |
.It CK_PR_RTM_CONFLICT |
| 68 |
The transaction failed due to a conflict in one of the memory |
| 69 |
addresses that are part of the working set of the transaction. |
| 70 |
.It CK_PR_RTM_CAPACITY |
| 71 |
Set if the architecture-defined transaction size limit was exceeded. |
| 72 |
.It CK_PR_RTM_DEBUG |
| 73 |
Set if a hardware breakpoint was triggered. |
| 74 |
.It CK_PR_RTM_NESTED |
| 75 |
Set if a nested transaction failed. |
| 76 |
.El |
| 77 |
.Pp |
| 78 |
The user is also able to specify a one byte abort status |
| 79 |
by calling |
| 80 |
.Fn ck_pr_rtm_abort . |
| 81 |
This status byte can be extracted by calling the |
| 82 |
.Fn CK_PR_RTM_CODE |
| 83 |
function with the return value of |
| 84 |
.Fn ck_pr_rtm_begin |
| 85 |
as an argument. The return value of |
| 86 |
.Fn CK_PR_RTM_CODE |
| 87 |
will be the value of this status byte. |
| 88 |
For additional information, please see the Intel instruction |
| 89 |
set manuals. |
| 90 |
.Sh SEE ALSO |
| 91 |
.Xr ck_pr_fence_load 3 , |
| 92 |
.Xr ck_pr_fence_load_depends 3 , |
| 93 |
.Xr ck_pr_fence_store 3 , |
| 94 |
.Xr ck_pr_fence_memory 3 , |
| 95 |
.Xr ck_pr_load 3 , |
| 96 |
.Xr ck_pr_store 3 , |
| 97 |
.Xr ck_pr_fas 3 , |
| 98 |
.Xr ck_pr_faa 3 , |
| 99 |
.Xr ck_pr_inc 3 , |
| 100 |
.Xr ck_pr_dec 3 , |
| 101 |
.Xr ck_pr_neg 3 , |
| 102 |
.Xr ck_pr_not 3 , |
| 103 |
.Xr ck_pr_sub 3 , |
| 104 |
.Xr ck_pr_and 3 , |
| 105 |
.Xr ck_pr_or 3 , |
| 106 |
.Xr ck_pr_xor 3 , |
| 107 |
.Xr ck_pr_add 3 , |
| 108 |
.Xr ck_pr_btc 3 , |
| 109 |
.Xr ck_pr_bts 3 , |
| 110 |
.Xr ck_pr_btr 3 |
| 111 |
.Pp |
| 112 |
Additional information available at http://concurrencykit.org/ |