![]() |
|
|||
0001 #ifndef _UAPI_LINUX_MEMBARRIER_H 0002 #define _UAPI_LINUX_MEMBARRIER_H 0003 0004 /* 0005 * linux/membarrier.h 0006 * 0007 * membarrier system call API 0008 * 0009 * Copyright (c) 2010, 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> 0010 * 0011 * Permission is hereby granted, free of charge, to any person obtaining a copy 0012 * of this software and associated documentation files (the "Software"), to deal 0013 * in the Software without restriction, including without limitation the rights 0014 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 0015 * copies of the Software, and to permit persons to whom the Software is 0016 * furnished to do so, subject to the following conditions: 0017 * 0018 * The above copyright notice and this permission notice shall be included in 0019 * all copies or substantial portions of the Software. 0020 * 0021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0022 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0024 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 0026 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 0027 * SOFTWARE. 0028 */ 0029 0030 /** 0031 * enum membarrier_cmd - membarrier system call command 0032 * @MEMBARRIER_CMD_QUERY: Query the set of supported commands. It returns 0033 * a bitmask of valid commands. 0034 * @MEMBARRIER_CMD_GLOBAL: Execute a memory barrier on all running threads. 0035 * Upon return from system call, the caller thread 0036 * is ensured that all running threads have passed 0037 * through a state where all memory accesses to 0038 * user-space addresses match program order between 0039 * entry to and return from the system call 0040 * (non-running threads are de facto in such a 0041 * state). This covers threads from all processes 0042 * running on the system. This command returns 0. 0043 * @MEMBARRIER_CMD_GLOBAL_EXPEDITED: 0044 * Execute a memory barrier on all running threads 0045 * of all processes which previously registered 0046 * with MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. 0047 * Upon return from system call, the caller thread 0048 * is ensured that all running threads have passed 0049 * through a state where all memory accesses to 0050 * user-space addresses match program order between 0051 * entry to and return from the system call 0052 * (non-running threads are de facto in such a 0053 * state). This only covers threads from processes 0054 * which registered with 0055 * MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. 0056 * This command returns 0. Given that 0057 * registration is about the intent to receive 0058 * the barriers, it is valid to invoke 0059 * MEMBARRIER_CMD_GLOBAL_EXPEDITED from a 0060 * non-registered process. 0061 * @MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED: 0062 * Register the process intent to receive 0063 * MEMBARRIER_CMD_GLOBAL_EXPEDITED memory 0064 * barriers. Always returns 0. 0065 * @MEMBARRIER_CMD_PRIVATE_EXPEDITED: 0066 * Execute a memory barrier on each running 0067 * thread belonging to the same process as the current 0068 * thread. Upon return from system call, the 0069 * caller thread is ensured that all its running 0070 * threads siblings have passed through a state 0071 * where all memory accesses to user-space 0072 * addresses match program order between entry 0073 * to and return from the system call 0074 * (non-running threads are de facto in such a 0075 * state). This only covers threads from the 0076 * same process as the caller thread. This 0077 * command returns 0 on success. The 0078 * "expedited" commands complete faster than 0079 * the non-expedited ones, they never block, 0080 * but have the downside of causing extra 0081 * overhead. A process needs to register its 0082 * intent to use the private expedited command 0083 * prior to using it, otherwise this command 0084 * returns -EPERM. 0085 * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED: 0086 * Register the process intent to use 0087 * MEMBARRIER_CMD_PRIVATE_EXPEDITED. Always 0088 * returns 0. 0089 * @MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE: 0090 * In addition to provide memory ordering 0091 * guarantees described in 0092 * MEMBARRIER_CMD_PRIVATE_EXPEDITED, ensure 0093 * the caller thread, upon return from system 0094 * call, that all its running threads siblings 0095 * have executed a core serializing 0096 * instruction. (architectures are required to 0097 * guarantee that non-running threads issue 0098 * core serializing instructions before they 0099 * resume user-space execution). This only 0100 * covers threads from the same process as the 0101 * caller thread. This command returns 0 on 0102 * success. The "expedited" commands complete 0103 * faster than the non-expedited ones, they 0104 * never block, but have the downside of 0105 * causing extra overhead. If this command is 0106 * not implemented by an architecture, -EINVAL 0107 * is returned. A process needs to register its 0108 * intent to use the private expedited sync 0109 * core command prior to using it, otherwise 0110 * this command returns -EPERM. 0111 * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE: 0112 * Register the process intent to use 0113 * MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE. 0114 * If this command is not implemented by an 0115 * architecture, -EINVAL is returned. 0116 * Returns 0 on success. 0117 * @MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ: 0118 * Ensure the caller thread, upon return from 0119 * system call, that all its running thread 0120 * siblings have any currently running rseq 0121 * critical sections restarted if @flags 0122 * parameter is 0; if @flags parameter is 0123 * MEMBARRIER_CMD_FLAG_CPU, 0124 * then this operation is performed only 0125 * on CPU indicated by @cpu_id. If this command is 0126 * not implemented by an architecture, -EINVAL 0127 * is returned. A process needs to register its 0128 * intent to use the private expedited rseq 0129 * command prior to using it, otherwise 0130 * this command returns -EPERM. 0131 * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ: 0132 * Register the process intent to use 0133 * MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ. 0134 * If this command is not implemented by an 0135 * architecture, -EINVAL is returned. 0136 * Returns 0 on success. 0137 * @MEMBARRIER_CMD_SHARED: 0138 * Alias to MEMBARRIER_CMD_GLOBAL. Provided for 0139 * header backward compatibility. 0140 * 0141 * Command to be passed to the membarrier system call. The commands need to 0142 * be a single bit each, except for MEMBARRIER_CMD_QUERY which is assigned to 0143 * the value 0. 0144 */ 0145 enum membarrier_cmd { 0146 MEMBARRIER_CMD_QUERY = 0, 0147 MEMBARRIER_CMD_GLOBAL = (1 << 0), 0148 MEMBARRIER_CMD_GLOBAL_EXPEDITED = (1 << 1), 0149 MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = (1 << 2), 0150 MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), 0151 MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), 0152 MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5), 0153 MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6), 0154 MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ = (1 << 7), 0155 MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ = (1 << 8), 0156 0157 /* Alias for header backward compatibility. */ 0158 MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL, 0159 }; 0160 0161 enum membarrier_cmd_flag { 0162 MEMBARRIER_CMD_FLAG_CPU = (1 << 0), 0163 }; 0164 0165 #endif /* _UAPI_LINUX_MEMBARRIER_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |