diff options
Diffstat (limited to 'include/uapi/linux/membarrier.h')
-rw-r--r-- | include/uapi/linux/membarrier.h | 74 |
1 files changed, 66 insertions, 8 deletions
diff --git a/include/uapi/linux/membarrier.h b/include/uapi/linux/membarrier.h index 4e01ad7ffe98..5891d7614c8c 100644 --- a/include/uapi/linux/membarrier.h +++ b/include/uapi/linux/membarrier.h | |||
@@ -31,7 +31,7 @@ | |||
31 | * enum membarrier_cmd - membarrier system call command | 31 | * enum membarrier_cmd - membarrier system call command |
32 | * @MEMBARRIER_CMD_QUERY: Query the set of supported commands. It returns | 32 | * @MEMBARRIER_CMD_QUERY: Query the set of supported commands. It returns |
33 | * a bitmask of valid commands. | 33 | * a bitmask of valid commands. |
34 | * @MEMBARRIER_CMD_SHARED: Execute a memory barrier on all running threads. | 34 | * @MEMBARRIER_CMD_GLOBAL: Execute a memory barrier on all running threads. |
35 | * Upon return from system call, the caller thread | 35 | * Upon return from system call, the caller thread |
36 | * is ensured that all running threads have passed | 36 | * is ensured that all running threads have passed |
37 | * through a state where all memory accesses to | 37 | * through a state where all memory accesses to |
@@ -40,6 +40,28 @@ | |||
40 | * (non-running threads are de facto in such a | 40 | * (non-running threads are de facto in such a |
41 | * state). This covers threads from all processes | 41 | * state). This covers threads from all processes |
42 | * running on the system. This command returns 0. | 42 | * running on the system. This command returns 0. |
43 | * @MEMBARRIER_CMD_GLOBAL_EXPEDITED: | ||
44 | * Execute a memory barrier on all running threads | ||
45 | * of all processes which previously registered | ||
46 | * with MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. | ||
47 | * Upon return from system call, the caller thread | ||
48 | * is ensured that all running threads have passed | ||
49 | * through a state where all memory accesses to | ||
50 | * user-space addresses match program order between | ||
51 | * entry to and return from the system call | ||
52 | * (non-running threads are de facto in such a | ||
53 | * state). This only covers threads from processes | ||
54 | * which registered with | ||
55 | * MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. | ||
56 | * This command returns 0. Given that | ||
57 | * registration is about the intent to receive | ||
58 | * the barriers, it is valid to invoke | ||
59 | * MEMBARRIER_CMD_GLOBAL_EXPEDITED from a | ||
60 | * non-registered process. | ||
61 | * @MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED: | ||
62 | * Register the process intent to receive | ||
63 | * MEMBARRIER_CMD_GLOBAL_EXPEDITED memory | ||
64 | * barriers. Always returns 0. | ||
43 | * @MEMBARRIER_CMD_PRIVATE_EXPEDITED: | 65 | * @MEMBARRIER_CMD_PRIVATE_EXPEDITED: |
44 | * Execute a memory barrier on each running | 66 | * Execute a memory barrier on each running |
45 | * thread belonging to the same process as the current | 67 | * thread belonging to the same process as the current |
@@ -51,7 +73,7 @@ | |||
51 | * to and return from the system call | 73 | * to and return from the system call |
52 | * (non-running threads are de facto in such a | 74 | * (non-running threads are de facto in such a |
53 | * state). This only covers threads from the | 75 | * state). This only covers threads from the |
54 | * same processes as the caller thread. This | 76 | * same process as the caller thread. This |
55 | * command returns 0 on success. The | 77 | * command returns 0 on success. The |
56 | * "expedited" commands complete faster than | 78 | * "expedited" commands complete faster than |
57 | * the non-expedited ones, they never block, | 79 | * the non-expedited ones, they never block, |
@@ -64,18 +86,54 @@ | |||
64 | * Register the process intent to use | 86 | * Register the process intent to use |
65 | * MEMBARRIER_CMD_PRIVATE_EXPEDITED. Always | 87 | * MEMBARRIER_CMD_PRIVATE_EXPEDITED. Always |
66 | * returns 0. | 88 | * returns 0. |
89 | * @MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE: | ||
90 | * In addition to provide memory ordering | ||
91 | * guarantees described in | ||
92 | * MEMBARRIER_CMD_PRIVATE_EXPEDITED, ensure | ||
93 | * the caller thread, upon return from system | ||
94 | * call, that all its running threads siblings | ||
95 | * have executed a core serializing | ||
96 | * instruction. (architectures are required to | ||
97 | * guarantee that non-running threads issue | ||
98 | * core serializing instructions before they | ||
99 | * resume user-space execution). This only | ||
100 | * covers threads from the same process as the | ||
101 | * caller thread. This command returns 0 on | ||
102 | * success. The "expedited" commands complete | ||
103 | * faster than the non-expedited ones, they | ||
104 | * never block, but have the downside of | ||
105 | * causing extra overhead. If this command is | ||
106 | * not implemented by an architecture, -EINVAL | ||
107 | * is returned. A process needs to register its | ||
108 | * intent to use the private expedited sync | ||
109 | * core command prior to using it, otherwise | ||
110 | * this command returns -EPERM. | ||
111 | * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE: | ||
112 | * Register the process intent to use | ||
113 | * MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE. | ||
114 | * If this command is not implemented by an | ||
115 | * architecture, -EINVAL is returned. | ||
116 | * Returns 0 on success. | ||
117 | * @MEMBARRIER_CMD_SHARED: | ||
118 | * Alias to MEMBARRIER_CMD_GLOBAL. Provided for | ||
119 | * header backward compatibility. | ||
67 | * | 120 | * |
68 | * Command to be passed to the membarrier system call. The commands need to | 121 | * Command to be passed to the membarrier system call. The commands need to |
69 | * be a single bit each, except for MEMBARRIER_CMD_QUERY which is assigned to | 122 | * be a single bit each, except for MEMBARRIER_CMD_QUERY which is assigned to |
70 | * the value 0. | 123 | * the value 0. |
71 | */ | 124 | */ |
72 | enum membarrier_cmd { | 125 | enum membarrier_cmd { |
73 | MEMBARRIER_CMD_QUERY = 0, | 126 | MEMBARRIER_CMD_QUERY = 0, |
74 | MEMBARRIER_CMD_SHARED = (1 << 0), | 127 | MEMBARRIER_CMD_GLOBAL = (1 << 0), |
75 | /* reserved for MEMBARRIER_CMD_SHARED_EXPEDITED (1 << 1) */ | 128 | MEMBARRIER_CMD_GLOBAL_EXPEDITED = (1 << 1), |
76 | /* reserved for MEMBARRIER_CMD_PRIVATE (1 << 2) */ | 129 | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = (1 << 2), |
77 | MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), | 130 | MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), |
78 | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), | 131 | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), |
132 | MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5), | ||
133 | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6), | ||
134 | |||
135 | /* Alias for header backward compatibility. */ | ||
136 | MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL, | ||
79 | }; | 137 | }; |
80 | 138 | ||
81 | #endif /* _UAPI_LINUX_MEMBARRIER_H */ | 139 | #endif /* _UAPI_LINUX_MEMBARRIER_H */ |