1 | /* |
---|
2 | * rpc.h - RPC (Remote Procedure Call) operations definition. |
---|
3 | * |
---|
4 | * Author Alain Greiner (2016,2017,2018) |
---|
5 | * |
---|
6 | * Copyright (c) UPMC Sorbonne Universites |
---|
7 | * |
---|
8 | * This file is part of ALMOS-MKH. |
---|
9 | * |
---|
10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
11 | * under the terms of the GNU General Public License as published by |
---|
12 | * the Free Software Foundation; version 2.0 of the License. |
---|
13 | * |
---|
14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | * General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef _RPC_H_ |
---|
25 | #define _RPC_H_ |
---|
26 | |
---|
27 | #include <kernel_config.h> |
---|
28 | #include <hal_kernel_types.h> |
---|
29 | #include <hal_atomic.h> |
---|
30 | #include <bits.h> |
---|
31 | #include <vseg.h> |
---|
32 | #include <remote_fifo.h> |
---|
33 | |
---|
34 | /**** Forward declarations ****/ |
---|
35 | |
---|
36 | struct process_s; |
---|
37 | struct page_s; |
---|
38 | struct vseg_s; |
---|
39 | struct exec_info_s; |
---|
40 | struct pthread_attr_s; |
---|
41 | struct remote_sem_s; |
---|
42 | struct user_dir_s; |
---|
43 | struct fragment_s; |
---|
44 | struct vfs_inode_s; |
---|
45 | struct vfs_dentry_s; |
---|
46 | struct vfs_file_s; |
---|
47 | struct thread_s; |
---|
48 | struct mapper_s; |
---|
49 | |
---|
50 | |
---|
51 | /**********************************************************************************/ |
---|
52 | /************** structures for Remote Procedure Calls ****************************/ |
---|
53 | /**********************************************************************************/ |
---|
54 | |
---|
55 | /*********************************************************************************** |
---|
56 | * This enum defines all RPC indexes. |
---|
57 | * It must be consistent with the rpc_server[] arrays defined in in the rpc.c file. |
---|
58 | **********************************************************************************/ |
---|
59 | |
---|
60 | typedef enum |
---|
61 | { |
---|
62 | RPC_PMEM_GET_PAGES = 0, |
---|
63 | RPC_PMEM_RELEASE_PAGES = 1, |
---|
64 | RPC_UNDEFINED_2 = 2, |
---|
65 | RPC_PROCESS_MAKE_FORK = 3, |
---|
66 | RPC_USER_DIR_CREATE = 4, |
---|
67 | RPC_USER_DIR_DESTROY = 5, |
---|
68 | RPC_THREAD_USER_CREATE = 6, |
---|
69 | RPC_THREAD_KERNEL_CREATE = 7, |
---|
70 | RPC_VFS_FS_UPDATE_DENTRY = 8, |
---|
71 | RPC_PROCESS_SIGACTION = 9, |
---|
72 | |
---|
73 | RPC_VFS_INODE_CREATE = 10, |
---|
74 | RPC_VFS_INODE_DESTROY = 11, |
---|
75 | RPC_VFS_DENTRY_CREATE = 12, |
---|
76 | RPC_VFS_DENTRY_DESTROY = 13, |
---|
77 | RPC_VFS_FILE_CREATE = 14, |
---|
78 | RPC_VFS_FILE_DESTROY = 15, |
---|
79 | RPC_VFS_FS_GET_DENTRY = 16, |
---|
80 | RPC_VFS_FS_ADD_DENTRY = 17, |
---|
81 | RPC_VFS_FS_REMOVE_DENTRY = 18, |
---|
82 | RPC_VFS_INODE_LOAD_ALL_PAGES = 19, |
---|
83 | |
---|
84 | RPC_VMM_GET_VSEG = 20, |
---|
85 | RPC_VMM_GLOBAL_UPDATE_PTE = 21, |
---|
86 | RPC_KCM_ALLOC = 22, |
---|
87 | RPC_KCM_FREE = 23, |
---|
88 | RPC_MAPPER_SYNC = 24, |
---|
89 | RPC_MAPPER_HANDLE_MISS = 25, |
---|
90 | RPC_VMM_DELETE_VSEG = 26, |
---|
91 | RPC_VMM_CREATE_VSEG = 27, |
---|
92 | RPC_VMM_SET_COW = 28, |
---|
93 | RPC_VMM_DISPLAY = 29, |
---|
94 | |
---|
95 | RPC_MAX_INDEX = 30, |
---|
96 | } |
---|
97 | rpc_index_t; |
---|
98 | |
---|
99 | /*********************************************************************************** |
---|
100 | * This defines the prototype of the rpc_server functions, |
---|
101 | * defined by the rpc_server[] array in the rpc.c file. |
---|
102 | **********************************************************************************/ |
---|
103 | |
---|
104 | typedef void (rpc_server_t) ( xptr_t xp ); |
---|
105 | |
---|
106 | /*********************************************************************************** |
---|
107 | * This structure defines the RPC descriptor (100 bytes on a 32bits core) |
---|
108 | **********************************************************************************/ |
---|
109 | |
---|
110 | typedef struct rpc_desc_s |
---|
111 | { |
---|
112 | rpc_index_t index; /*! index of requested RPC service ( 4) */ |
---|
113 | uint32_t * rsp; /*! local pointer ond responses counter ( 4) */ |
---|
114 | struct thread_s * thread; /*! local pointer on client thread ( 4) */ |
---|
115 | uint32_t lid; /*! index of core running client thread ( 4) */ |
---|
116 | bool_t blocking; /*! simple RPC mode when true ( 4) */ |
---|
117 | uint64_t args[10]; /*! input/output arguments buffer (80) */ |
---|
118 | } |
---|
119 | rpc_desc_t; |
---|
120 | |
---|
121 | /**********************************************************************************/ |
---|
122 | /******* Generic functions supporting RPCs : client side **************************/ |
---|
123 | /**********************************************************************************/ |
---|
124 | |
---|
125 | /*********************************************************************************** |
---|
126 | * This function is executed by the client thread in the client cluster. |
---|
127 | * It puts one RPC descriptor defined by the <desc> argument in the remote fifo |
---|
128 | * defined by the <cxy> argument. It sends an IPI to the server if fifo is empty. |
---|
129 | * The RPC descriptor must be allocated in the caller's stack, and initialised by |
---|
130 | * the caller. It exit with a Panic message if remote fifo is still full after |
---|
131 | * (CONFIG_RPC_PUT_MAX_ITERATIONS) retries. |
---|
132 | * - When the RPC <blocking> field is true, this function blocks and deschedule. |
---|
133 | * It returns only when the server acknowledges the RPC by writing in the RPC |
---|
134 | * "response" field, and unblocks the client. |
---|
135 | * - When the <blocking> field is false, this function returns as soon as the RPC |
---|
136 | * has been registered in the FIFO, and the server thread must directly signal |
---|
137 | * completion to the client thread. |
---|
138 | *********************************************************************************** |
---|
139 | * @ cxy : server cluster identifier |
---|
140 | * @ desc : local pointer on RPC descriptor in client cluster |
---|
141 | **********************************************************************************/ |
---|
142 | void rpc_send( cxy_t cxy, |
---|
143 | rpc_desc_t * desc ); |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | /**********************************************************************************/ |
---|
148 | /******* Generic functions supporting RPCs : server side **************************/ |
---|
149 | /**********************************************************************************/ |
---|
150 | |
---|
151 | /*********************************************************************************** |
---|
152 | * This function contains the infinite loop executed by a RPC server thread, |
---|
153 | * to handle pending RPCs registered in the RPC fifo attached to a given core. |
---|
154 | * In each iteration in this loop, it try to handle one RPC request: |
---|
155 | * - it tries to take the RPC FIFO ownership, |
---|
156 | * - it consumes one request when the FIFO is not empty, |
---|
157 | * - it releases the FIFO ownership, |
---|
158 | * - it execute the requested service, |
---|
159 | * - it unblock and send an IPI to the client thread, |
---|
160 | * - it suicides if the number of RPC threads for this core is to large, |
---|
161 | * - it block on IDLE and deschedule otherwise. |
---|
162 | **********************************************************************************/ |
---|
163 | void rpc_server_func( void ); |
---|
164 | |
---|
165 | /*********************************************************************************** |
---|
166 | * This function is executed in case of illegal RPC index. |
---|
167 | **********************************************************************************/ |
---|
168 | void __attribute__((noinline)) rpc_undefined( xptr_t xp __attribute__ ((unused)) ); |
---|
169 | |
---|
170 | |
---|
171 | |
---|
172 | /**********************************************************************************/ |
---|
173 | /******* Marshalling functions attached to the various RPCs ***********************/ |
---|
174 | /**********************************************************************************/ |
---|
175 | |
---|
176 | /*********************************************************************************** |
---|
177 | * [0] The RPC_PMEM_GET_PAGES allocates one or several pages in a remote cluster, |
---|
178 | * and returns the local pointer on the page descriptor. |
---|
179 | *********************************************************************************** |
---|
180 | * @ cxy : server cluster identifier |
---|
181 | * @ order : [in] ln2( number of requested pages ) |
---|
182 | * @ page : [out] local pointer on page descriptor / NULL if failure |
---|
183 | **********************************************************************************/ |
---|
184 | void rpc_pmem_get_pages_client( cxy_t cxy, |
---|
185 | uint32_t order, |
---|
186 | struct page_s ** page ); |
---|
187 | |
---|
188 | void rpc_pmem_get_pages_server( xptr_t xp ); |
---|
189 | |
---|
190 | /*********************************************************************************** |
---|
191 | * [1] The RPC_PMEM_RELEASE_PAGES release one or several pages to a remote cluster. |
---|
192 | *********************************************************************************** |
---|
193 | * @ cxy : server cluster identifier |
---|
194 | * @ page : [in] local pointer on page descriptor to release. |
---|
195 | **********************************************************************************/ |
---|
196 | void rpc_pmem_release_pages_client( cxy_t cxy, |
---|
197 | struct page_s * page ); |
---|
198 | |
---|
199 | void rpc_pmem_release_pages_server( xptr_t xp ); |
---|
200 | |
---|
201 | /*********************************************************************************** |
---|
202 | * [2] undefined slot |
---|
203 | **********************************************************************************/ |
---|
204 | |
---|
205 | /*********************************************************************************** |
---|
206 | * [3] The RPC_PROCESS_MAKE_FORK creates a "child" process descriptor, and the |
---|
207 | * associated "child" thread descriptor in a target remote cluster that can be |
---|
208 | * any cluster. The child process is initialized from informations found in the |
---|
209 | * "parent" process descriptor (that must be the parent reference cluster), |
---|
210 | * and from the "parent" thread descriptor that can be in any cluster. |
---|
211 | *********************************************************************************** |
---|
212 | * @ cxy : server cluster identifier. |
---|
213 | * @ ref_process_xp : [in] extended pointer on reference parent process. |
---|
214 | * @ parent_thread_xp : [in] extended pointer on parent thread. |
---|
215 | * @ child_pid : [out] child process identifier. |
---|
216 | * @ child_thread_ptr : [out] local pointer on child thread. |
---|
217 | * @ error : [out] error status (0 if success). |
---|
218 | **********************************************************************************/ |
---|
219 | void rpc_process_make_fork_client( cxy_t cxy, |
---|
220 | xptr_t ref_process_xp, |
---|
221 | xptr_t parent_thread_xp, |
---|
222 | pid_t * child_pid, |
---|
223 | struct thread_s ** child_thread_ptr, |
---|
224 | error_t * error ); |
---|
225 | |
---|
226 | void rpc_process_make_fork_server( xptr_t xp ); |
---|
227 | |
---|
228 | /*********************************************************************************** |
---|
229 | * [4] The RPC_USER_DIR_CREATE allows a client thread to create an user_dir_t |
---|
230 | * structure and the associated array of dirents in a remote cluster containing |
---|
231 | * the target directory <inode>. It creates an ANON vseg in the user reference |
---|
232 | * process VMM identified by the <ref_xp>. This reference cluster cluster can be |
---|
233 | * different from both the client and server clusters. |
---|
234 | * It is called by the sys_opendir() function. |
---|
235 | *********************************************************************************** |
---|
236 | * @ cxy : server cluster identifier. |
---|
237 | * @ inode : [in] local pointer on inode in server cluster. |
---|
238 | * @ ref_xp : [in] extended pointer on user reference process descriptor. |
---|
239 | * @ dir : [out] local pointer on created user_dir structure. |
---|
240 | **********************************************************************************/ |
---|
241 | void rpc_user_dir_create_client( cxy_t cxy, |
---|
242 | struct vfs_inode_s * inode, |
---|
243 | xptr_t ref_xp, |
---|
244 | struct user_dir_s ** dir ); |
---|
245 | |
---|
246 | void rpc_user_dir_create_server( xptr_t xp ); |
---|
247 | |
---|
248 | /*********************************************************************************** |
---|
249 | * [5] The RPC_USER_DIR_DESTROY allows a client thread to delete an user_dir_t |
---|
250 | * structure and the associated array of dirents in a remote cluster containing |
---|
251 | * the target directory inode. It is called by the sys_closedir() function. |
---|
252 | *********************************************************************************** |
---|
253 | * @ cxy : server cluster identifier. |
---|
254 | * @ dir : [in] local pointer on created user_dir structure. |
---|
255 | * @ ref_xp : [in] extended pointer on user reference process descriptor. |
---|
256 | **********************************************************************************/ |
---|
257 | void rpc_user_dir_destroy_client( cxy_t cxy, |
---|
258 | struct user_dir_s * dir, |
---|
259 | xptr_t ref_xp ); |
---|
260 | |
---|
261 | void rpc_user_dir_destroy_server( xptr_t xp ); |
---|
262 | |
---|
263 | /*********************************************************************************** |
---|
264 | * [6] The RPC_THREAD_USER_CREATE creates an user thread in the server cluster, |
---|
265 | * as specified by the arguments. It returns an extended pointer on the new |
---|
266 | * thread descriptor in server cluster, and an error code. |
---|
267 | * It is called by the sys_thread_create() system call. |
---|
268 | *********************************************************************************** |
---|
269 | * @ cxy : server cluster identifier. |
---|
270 | * @ attr : [in] local pointer on pthread_attr_t in client cluster. |
---|
271 | * @ thread_xp : [out] buffer for thread extended pointer. |
---|
272 | * @ error : [out] error status (0 if success). |
---|
273 | **********************************************************************************/ |
---|
274 | void rpc_thread_user_create_client( cxy_t cxy, |
---|
275 | pid_t pid, |
---|
276 | void * start_func, |
---|
277 | void * start_arg, |
---|
278 | pthread_attr_t * attr, |
---|
279 | xptr_t * thread_xp, |
---|
280 | error_t * error ); |
---|
281 | |
---|
282 | void rpc_thread_user_create_server( xptr_t xp ); |
---|
283 | |
---|
284 | /*********************************************************************************** |
---|
285 | * [7] The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster, |
---|
286 | * as specified by the type, func and args arguments. It returns the local pointer |
---|
287 | * on the thread descriptor in server cluster and an error code. |
---|
288 | * It is used by the dev_init() function to create the device server thread. |
---|
289 | *********************************************************************************** |
---|
290 | * @ cxy : server cluster identifier. |
---|
291 | * @ type : [in] type of kernel thread. |
---|
292 | * @ func : [in] local pointer on thread function. |
---|
293 | * @ args : [in] local pointer on function arguments. |
---|
294 | * @ thread_xp : [out] pointer on buffer for thread extended pointer. |
---|
295 | * @ error : [out] error status (0 if success). |
---|
296 | **********************************************************************************/ |
---|
297 | void rpc_thread_kernel_create_client( cxy_t cxy, |
---|
298 | uint32_t type, |
---|
299 | void * func, |
---|
300 | void * args, |
---|
301 | xptr_t * thread_xp, |
---|
302 | error_t * error ); |
---|
303 | |
---|
304 | void rpc_thread_kernel_create_server( xptr_t xp ); |
---|
305 | |
---|
306 | /*********************************************************************************** |
---|
307 | * [8] The RPC_VFS_FS_UPDATE_DENTRY allows a client thread to request a remote |
---|
308 | * cluster to update the <size> field of a directory entry in the mapper of a |
---|
309 | * remote directory inode, identified by the <inode> local pointer. |
---|
310 | * The target entry name is identified by the <dentry> local pointer. |
---|
311 | *********************************************************************************** |
---|
312 | * @ cxy : server cluster identifier. |
---|
313 | * @ inode : [in] local pointer on remote directory inode. |
---|
314 | * @ dentry : [in] local pointer on remote dentry. |
---|
315 | * @ size : [in] new size value. |
---|
316 | * @ error : [out] error status (0 if success). |
---|
317 | **********************************************************************************/ |
---|
318 | void rpc_vfs_fs_update_dentry_client( cxy_t cxy, |
---|
319 | struct vfs_inode_s * inode, |
---|
320 | struct vfs_dentry_s * dentry, |
---|
321 | uint32_t size, |
---|
322 | error_t * error ); |
---|
323 | |
---|
324 | void rpc_vfs_fs_update_dentry_server( xptr_t xp ); |
---|
325 | |
---|
326 | /*********************************************************************************** |
---|
327 | * [9] The RPC_PROCESS_SIGACTION allows a client thread to request a remote cluster |
---|
328 | * to execute a given sigaction, defined by the <action_type> for a given process, |
---|
329 | * identified by the <pid> argument. |
---|
330 | *********************************************************************************** |
---|
331 | * @ cxy : server cluster identifier. |
---|
332 | * @ pid : [in] target process identifier. |
---|
333 | * @ action : [in] sigaction index. |
---|
334 | **********************************************************************************/ |
---|
335 | void rpc_process_sigaction_client( cxy_t cxy, |
---|
336 | pid_t pid, |
---|
337 | uint32_t action ); |
---|
338 | |
---|
339 | void rpc_process_sigaction_server( xptr_t xp ); |
---|
340 | |
---|
341 | /*********************************************************************************** |
---|
342 | * [10] The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a |
---|
343 | * remote cluster. The parent dentry must have been previously created. |
---|
344 | * It returns an extended pointer on the created inode. |
---|
345 | *********************************************************************************** |
---|
346 | * @ cxy : server cluster identifier. |
---|
347 | * @ fs_type : [in] file system type. |
---|
348 | * @ inode_type : [in] file system type. |
---|
349 | * @ attr : [in] inode attributes. |
---|
350 | * @ rights : [in] access rights |
---|
351 | * @ uid : [in] user ID |
---|
352 | * @ gid : [in] group ID |
---|
353 | * @ inode_xp : [out] buffer for extended pointer on created inode. |
---|
354 | * @ error : [out] error status (0 if success). |
---|
355 | **********************************************************************************/ |
---|
356 | void rpc_vfs_inode_create_client( cxy_t cxy, |
---|
357 | uint32_t fs_type, |
---|
358 | uint32_t attr, |
---|
359 | uint32_t rights, |
---|
360 | uint32_t uid, |
---|
361 | uint32_t gid, |
---|
362 | xptr_t * inode_xp, |
---|
363 | error_t * error ); |
---|
364 | |
---|
365 | void rpc_vfs_inode_create_server( xptr_t xp ); |
---|
366 | |
---|
367 | /*********************************************************************************** |
---|
368 | * [11] The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor |
---|
369 | * and for the associated mapper in a remote cluster. |
---|
370 | *********************************************************************************** |
---|
371 | * @ cxy : server cluster identifier |
---|
372 | * @ inode : [in] local pointer on inode. |
---|
373 | **********************************************************************************/ |
---|
374 | void rpc_vfs_inode_destroy_client( cxy_t cxy, |
---|
375 | struct vfs_inode_s * inode ); |
---|
376 | |
---|
377 | void rpc_vfs_inode_destroy_server( xptr_t xp ); |
---|
378 | |
---|
379 | /*********************************************************************************** |
---|
380 | * [12] The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster. |
---|
381 | * It returns an extended pointer on the created dentry. |
---|
382 | *********************************************************************************** |
---|
383 | * @ cxy : server cluster identifier |
---|
384 | * @ type : [in] file system type. |
---|
385 | * @ name : [in] directory entry name. |
---|
386 | * @ dentry_xp : [out] buffer for extended pointer on created dentry. |
---|
387 | * @ error : [out] error status (0 if success). |
---|
388 | **********************************************************************************/ |
---|
389 | void rpc_vfs_dentry_create_client( cxy_t cxy, |
---|
390 | uint32_t type, |
---|
391 | char * name, |
---|
392 | xptr_t * dentry_xp, |
---|
393 | error_t * error ); |
---|
394 | |
---|
395 | void rpc_vfs_dentry_create_server( xptr_t xp ); |
---|
396 | |
---|
397 | /*********************************************************************************** |
---|
398 | * [13] The RPC_VFS_DENTRY_DESTROY remove a denfry from the parent inode XHTAB, |
---|
399 | * and releases memory allocated for the dentry descriptor in a remote cluster. |
---|
400 | *********************************************************************************** |
---|
401 | * @ cxy : server cluster identifier |
---|
402 | * @ dentry : [in] local pointer on dentry. |
---|
403 | **********************************************************************************/ |
---|
404 | void rpc_vfs_dentry_destroy_client( cxy_t cxy, |
---|
405 | struct vfs_dentry_s * dentry ); |
---|
406 | |
---|
407 | void rpc_vfs_dentry_destroy_server( xptr_t xp ); |
---|
408 | |
---|
409 | /*********************************************************************************** |
---|
410 | * [14] The RPC_VFS_FILE_CREATE creates a file descriptor in a remote cluster. |
---|
411 | * It returns an extended pointer on the created file structure. |
---|
412 | *********************************************************************************** |
---|
413 | * @ cxy : server cluster identifier |
---|
414 | * @ inode : [in] local pointer on parent inode. |
---|
415 | * @ file_attr : [in] new file attributes. |
---|
416 | * @ file_xp : [out] buffer for extended pointer on created file. |
---|
417 | * @ error : [out] error status (0 if success). |
---|
418 | **********************************************************************************/ |
---|
419 | void rpc_vfs_file_create_client( cxy_t cxy, |
---|
420 | struct vfs_inode_s * inode, |
---|
421 | uint32_t file_attr, |
---|
422 | xptr_t * file_xp, |
---|
423 | error_t * error ); |
---|
424 | |
---|
425 | void rpc_vfs_file_create_server( xptr_t xp ); |
---|
426 | |
---|
427 | /*********************************************************************************** |
---|
428 | * [15] The RPC_VFS_FILE_DESTROY releases memory allocated for a file descriptor |
---|
429 | * in a remote cluster. |
---|
430 | *********************************************************************************** |
---|
431 | * @ cxy : server cluster identifier |
---|
432 | * @ file : [in] local pointer on file. |
---|
433 | **********************************************************************************/ |
---|
434 | void rpc_vfs_file_destroy_client( cxy_t cxy, |
---|
435 | struct vfs_file_s * file ); |
---|
436 | |
---|
437 | void rpc_vfs_file_destroy_server( xptr_t xp ); |
---|
438 | |
---|
439 | /*********************************************************************************** |
---|
440 | * [16] The RPC_VFS_FS_GET_DENTRY calls the vfs_fs_new_dentry() |
---|
441 | * function in a remote cluster containing a parent inode directory to scan the |
---|
442 | * associated mapper, find a directory entry identified by its name, and update |
---|
443 | * both the - existing - child inode and dentry. |
---|
444 | *********************************************************************************** |
---|
445 | * @ cxy : server cluster identifier |
---|
446 | * @ parent_inode : [in] local pointer on parent inode. |
---|
447 | * @ name : [in] local pointer on child name (in client cluster). |
---|
448 | * @ child_inode_xp : [in] extended pointer on child inode (in another cluster). |
---|
449 | * @ error : [out] error status (0 if success). |
---|
450 | **********************************************************************************/ |
---|
451 | void rpc_vfs_fs_new_dentry_client( cxy_t cxy, |
---|
452 | struct vfs_inode_s * parent_inode, |
---|
453 | char * name, |
---|
454 | xptr_t child_inode_xp, |
---|
455 | error_t * error ); |
---|
456 | |
---|
457 | void rpc_vfs_fs_new_dentry_server( xptr_t xp ); |
---|
458 | |
---|
459 | /*********************************************************************************** |
---|
460 | * [17] The RPC_VFS_FS_ADD_DENTRY calls the vfs_fs_add_dentry() function in a |
---|
461 | * remote cluster containing a directory inode and mapper, to add a new dentry |
---|
462 | * in the mapper of this directory. |
---|
463 | *********************************************************************************** |
---|
464 | * @ cxy : server cluster identifier |
---|
465 | * @ parent : [in] local pointer on directory inode. |
---|
466 | * @ dentry : [in] local pointer on dentry. |
---|
467 | * @ error : [out] error status (0 if success). |
---|
468 | **********************************************************************************/ |
---|
469 | void rpc_vfs_fs_add_dentry_client( cxy_t, |
---|
470 | struct vfs_inode_s * parent, |
---|
471 | struct vfs_dentry_s * dentry, |
---|
472 | error_t * error ); |
---|
473 | |
---|
474 | void rpc_vfs_fs_add_dentry_server( xptr_t xp ); |
---|
475 | |
---|
476 | /*********************************************************************************** |
---|
477 | * [18] The RPC_VFS_FS_REMOVE_DENTRY calls the vfs_fs_remove_dentry() function in a |
---|
478 | * remote cluster containing a directory inode and mapper, to remove a dentry from |
---|
479 | * the mapper of this directory. |
---|
480 | *********************************************************************************** |
---|
481 | * @ cxy : server cluster identifier |
---|
482 | * @ parent : [in] local pointer on directory inode. |
---|
483 | * @ dentry : [in] local pointer on dentry. |
---|
484 | * @ error : [out] error status (0 if success). |
---|
485 | **********************************************************************************/ |
---|
486 | void rpc_vfs_fs_remove_dentry_client( cxy_t, |
---|
487 | struct vfs_inode_s * parent, |
---|
488 | struct vfs_dentry_s * dentry, |
---|
489 | error_t * error ); |
---|
490 | |
---|
491 | void rpc_vfs_fs_remove_dentry_server( xptr_t xp ); |
---|
492 | |
---|
493 | /*********************************************************************************** |
---|
494 | * [19] The RPC_VFS_INODE_LOAD_ALL_PAGES calls the vfs_inode_load_all_pages() |
---|
495 | * function a remote cluster containing an inode to load all pages in the |
---|
496 | * associated mapper. |
---|
497 | *********************************************************************************** |
---|
498 | * @ cxy : server cluster identifier |
---|
499 | * @ inode : [in] local pointer on inode in server cluster. |
---|
500 | * @ error : [out] error status (0 if success). |
---|
501 | **********************************************************************************/ |
---|
502 | void rpc_vfs_inode_load_all_pages_client( cxy_t cxy, |
---|
503 | struct vfs_inode_s * inode, |
---|
504 | error_t * error ); |
---|
505 | |
---|
506 | void rpc_vfs_inode_load_all_pages_server( xptr_t xp ); |
---|
507 | |
---|
508 | /*********************************************************************************** |
---|
509 | * [20] The RPC_VMM_GET_VSEG returns an extended pointer |
---|
510 | * on the vseg containing a given virtual address in a given process. |
---|
511 | * The server cluster is supposed to be the reference cluster. |
---|
512 | * It returns a non zero error value if no vseg has been founded. |
---|
513 | *********************************************************************************** |
---|
514 | * @ cxy : server cluster identifier. |
---|
515 | * @ process : [in] pointer on process descriptor in server cluster. |
---|
516 | * @ vaddr : [in] virtual address to be searched. |
---|
517 | * @ vseg_xp : [out] buffer for extended pointer on vseg in client cluster. |
---|
518 | * @ error : [out] local pointer on buffer for error code (in client cluster). |
---|
519 | **********************************************************************************/ |
---|
520 | void rpc_vmm_get_vseg_client( cxy_t cxy, |
---|
521 | struct process_s * process, |
---|
522 | intptr_t vaddr, |
---|
523 | xptr_t * vseg_xp, |
---|
524 | error_t * error ); |
---|
525 | |
---|
526 | void rpc_vmm_get_vseg_server( xptr_t xp ); |
---|
527 | |
---|
528 | /*********************************************************************************** |
---|
529 | * [21] The RPC_VMM_GLOBAL_UPDATE_PTE can be used by a thread that is not running |
---|
530 | * in reference cluster, to ask the reference cluster to update a specific entry, |
---|
531 | * identified by the <vpn> argument in all GPT copies of a process identified by |
---|
532 | * the <process> argument, using the values defined by <attr> and <ppn> arguments. |
---|
533 | * The server cluster is supposed to be the reference cluster. |
---|
534 | * It does not return any error code as the called function vmm_global_update_pte() |
---|
535 | * cannot fail. |
---|
536 | *********************************************************************************** |
---|
537 | * @ cxy : server cluster identifier. |
---|
538 | * @ process : [in] pointer on process descriptor in server cluster. |
---|
539 | * @ vpn : [in] virtual address to be searched. |
---|
540 | * @ attr : [in] PTE attributes. |
---|
541 | * @ ppn : [it] PTE PPN. |
---|
542 | **********************************************************************************/ |
---|
543 | void rpc_vmm_global_update_pte_client( cxy_t cxy, |
---|
544 | struct process_s * process, |
---|
545 | vpn_t vpn, |
---|
546 | uint32_t attr, |
---|
547 | ppn_t ppn ); |
---|
548 | |
---|
549 | void rpc_vmm_global_update_pte_server( xptr_t xp ); |
---|
550 | |
---|
551 | /*********************************************************************************** |
---|
552 | * [22] The RPC_KCM_ALLOC allocates memory from a given KCM in a remote cluster, |
---|
553 | * and returns an extended pointer on the allocated object. |
---|
554 | It returns XPTR_NULL if physical memory cannot be allocated. |
---|
555 | *********************************************************************************** |
---|
556 | * @ cxy : server cluster identifier. |
---|
557 | * @ kmem_type : [in] KCM object type (as defined in kmem.h). |
---|
558 | * @ buf_xp : [out] buffer for extended pointer on allocated buffer. |
---|
559 | **********************************************************************************/ |
---|
560 | void rpc_kcm_alloc_client( cxy_t cxy, |
---|
561 | uint32_t kmem_type, |
---|
562 | xptr_t * buf_xp ); |
---|
563 | |
---|
564 | void rpc_kcm_alloc_server( xptr_t xp ); |
---|
565 | |
---|
566 | /*********************************************************************************** |
---|
567 | * [23] The RPC_KCM_FREE releases memory allocated for a KCM object of a given type, |
---|
568 | * in a remote cluster. |
---|
569 | *********************************************************************************** |
---|
570 | * @ cxy : server cluster identifier. |
---|
571 | * @ buf : [in] local pointer on allocated buffer. |
---|
572 | * @ kmem_type : [in] KCM object type (as defined in kmem.h). |
---|
573 | **********************************************************************************/ |
---|
574 | void rpc_kcm_free_client( cxy_t cxy, |
---|
575 | void * buf, |
---|
576 | uint32_t kmem_type ); |
---|
577 | |
---|
578 | void rpc_kcm_free_server( xptr_t xp ); |
---|
579 | |
---|
580 | /*********************************************************************************** |
---|
581 | * [24] The RPC_MAPPER_SYNC allows a client thread to synchronize on disk |
---|
582 | * all dirty pages of a remote mapper. |
---|
583 | *********************************************************************************** |
---|
584 | * @ cxy : server cluster identifier. |
---|
585 | * @ mapper : [in] local pointer on mapper in server cluster. |
---|
586 | * @ error : [out] error status (0 if success). |
---|
587 | **********************************************************************************/ |
---|
588 | void rpc_mapper_sync_client( cxy_t cxy, |
---|
589 | struct mapper_s * mapper, |
---|
590 | error_t * error ); |
---|
591 | |
---|
592 | void rpc_mapper_sync_server( xptr_t xp ); |
---|
593 | |
---|
594 | /*********************************************************************************** |
---|
595 | * [25] The RPC__MAPPER_HANDLE_MISS allows a client thread to request a remote |
---|
596 | * mapper to load a missing page from the IOC device. |
---|
597 | * On the server side, this RPC call the mapper_handle_miss() function and return |
---|
598 | * an extended pointer on the allocated page descriptor and an error status. |
---|
599 | *********************************************************************************** |
---|
600 | * @ cxy : server cluster identifier. |
---|
601 | * @ mapper : [in] local pointer on mapper. |
---|
602 | * @ page_id : [in] missing page index in mapper |
---|
603 | * @ buffer : [in] user space pointer / kernel extended pointer |
---|
604 | * @ page_xp : [out] pointer on buffer for extended pointer on page descriptor. |
---|
605 | * @ error : [out] error status (0 if success). |
---|
606 | **********************************************************************************/ |
---|
607 | void rpc_mapper_handle_miss_client( cxy_t cxy, |
---|
608 | struct mapper_s * mapper, |
---|
609 | uint32_t page_id, |
---|
610 | xptr_t * page_xp, |
---|
611 | error_t * error ); |
---|
612 | |
---|
613 | void rpc_mapper_handle_miss_server( xptr_t xp ); |
---|
614 | |
---|
615 | /*********************************************************************************** |
---|
616 | * [26] The RPC_VMM_DELETE_VSEG allows any client thread to request a remote |
---|
617 | * cluster to delete from a given VMM, identified by the <pid> argument |
---|
618 | * a given vseg, identified by the <vaddr> argument. |
---|
619 | *********************************************************************************** |
---|
620 | * @ cxy : server cluster identifier. |
---|
621 | * @ pid : [in] target process identifier. |
---|
622 | * @ vaddr : [in] vseg base address. |
---|
623 | **********************************************************************************/ |
---|
624 | void rpc_vmm_delete_vseg_client( cxy_t cxy, |
---|
625 | pid_t pid, |
---|
626 | intptr_t vaddr ); |
---|
627 | |
---|
628 | void rpc_vmm_delete_vseg_server( xptr_t xp ); |
---|
629 | |
---|
630 | /*********************************************************************************** |
---|
631 | * [27] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote |
---|
632 | * reference cluster of a given process to allocate and register in the reference |
---|
633 | * process VMM a new vseg descriptor. |
---|
634 | * On the server side, this RPC uses the vmm_create_vseg() function, and returns |
---|
635 | * to the client the local pointer on the created vseg descriptor. |
---|
636 | *********************************************************************************** |
---|
637 | * @ cxy : server cluster identifier. |
---|
638 | * @ process : [in] local pointer on process descriptor in server. |
---|
639 | * @ type : [in] vseg type. |
---|
640 | * @ base : [in] base address (unused for dynamically allocated vsegs). |
---|
641 | * @ size : [in] number of bytes. |
---|
642 | * @ file_offset : [in] offset in file (for CODE, DATA, FILE types). |
---|
643 | * @ file_size : [in] can be smaller than size for DATA type. |
---|
644 | * @ mapper_xp : [in] extended pointer on mapper (for CODE, DATA, FILE types). |
---|
645 | * @ vseg_cxy : [in] target cluster for mapping (if not data type). |
---|
646 | * @ vseg : [out] local pointer on vseg descriptor / NULL if failure. |
---|
647 | **********************************************************************************/ |
---|
648 | void rpc_vmm_create_vseg_client( cxy_t cxy, |
---|
649 | struct process_s * process, |
---|
650 | vseg_type_t type, |
---|
651 | intptr_t base, |
---|
652 | uint32_t size, |
---|
653 | uint32_t file_offset, |
---|
654 | uint32_t file_size, |
---|
655 | xptr_t mapper_xp, |
---|
656 | cxy_t vseg_cxy, |
---|
657 | struct vseg_s ** vseg ); |
---|
658 | |
---|
659 | void rpc_vmm_create_vseg_server( xptr_t xp ); |
---|
660 | |
---|
661 | /*********************************************************************************** |
---|
662 | * [28] The RPC_VMM_SET_COW allows a client thread to request the remote reference |
---|
663 | * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for |
---|
664 | * the DATA, MMAP and REMOTE vsegs of process identified by the <process> argument. |
---|
665 | |
---|
666 | * of a remote scheduler, identified by the <lid> argument. |
---|
667 | *********************************************************************************** |
---|
668 | * @ cxy : server cluster identifier. |
---|
669 | * @ process : [in] local pointer on reference process descriptor. |
---|
670 | **********************************************************************************/ |
---|
671 | void rpc_vmm_set_cow_client( cxy_t cxy, |
---|
672 | struct process_s * process ); |
---|
673 | |
---|
674 | void rpc_vmm_set_cow_server( xptr_t xp ); |
---|
675 | |
---|
676 | /*********************************************************************************** |
---|
677 | * [29] The RPC_VMM_DISPLAY allows any client thread to display the VMM state |
---|
678 | * of a remote reference process identified by the <cxy> and <process> arguments. |
---|
679 | * The type of display is defined by the <detailed> boolean argument. |
---|
680 | *********************************************************************************** |
---|
681 | * @ cxy : server cluster identifier. |
---|
682 | * @ process : [in] local pointer on reference process descriptor. |
---|
683 | * @ detailed : [in] detailed display if true. |
---|
684 | **********************************************************************************/ |
---|
685 | void rpc_hal_vmm_display_client( cxy_t cxy, |
---|
686 | struct process_s * process, |
---|
687 | bool_t detailed ); |
---|
688 | |
---|
689 | void rpc_hal_vmm_display_server( xptr_t xp ); |
---|
690 | |
---|
691 | |
---|
692 | #endif |
---|