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