source: trunk/kernel/kern/rpc.h @ 611

Last change on this file since 611 was 611, checked in by alain, 3 years ago

Introduce sigificant modifs in VFS to support the <ls> command,
and the . and .. directories entries.

File size: 34.2 KB
Line 
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
36struct process_s;
37struct page_s;
38struct vseg_s;
39struct exec_info_s;
40struct pthread_attr_s;
41struct remote_sem_s;
42struct fragment_s;
43struct vfs_inode_s;
44struct vfs_dentry_s;
45struct vfs_file_s;
46struct thread_s;
47struct 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[] arrays defined in in the rpc.c file.
57 **********************************************************************************/
58
59typedef 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,       // non blocking
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_ADD_DENTRY         = 17,
80    RPC_VFS_FS_REMOVE_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_UNDEFINED_24              = 24,
88    RPC_MAPPER_HANDLE_MISS        = 25,
89    RPC_VMM_DELETE_VSEG           = 26,      // non blocking
90    RPC_VMM_CREATE_VSEG           = 27,
91    RPC_VMM_SET_COW               = 28,
92    RPC_VMM_DISPLAY               = 29,
93
94    RPC_MAX_INDEX                 = 30,
95}
96rpc_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
103typedef  void (rpc_server_t) ( xptr_t xp );
104
105/***********************************************************************************
106 *  This structure defines the RPC descriptor
107 **********************************************************************************/
108
109typedef 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} 
118rpc_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 **********************************************************************************/
141void 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 **********************************************************************************/
162void rpc_thread_func( void );
163
164/***********************************************************************************
165 * This function is executed in case of illegal RPC index.
166 **********************************************************************************/
167void __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 **********************************************************************************/
183void rpc_pmem_get_pages_client( cxy_t             cxy,
184                                uint32_t          order,
185                                struct page_s  ** page );
186
187void 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 **********************************************************************************/
195void rpc_pmem_release_pages_client( cxy_t            cxy,
196                                    struct page_s  * page );
197
198void 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 **********************************************************************************/
218void 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
225void 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 **********************************************************************************/
246void 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
254void 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 **********************************************************************************/
269void 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
276void rpc_thread_kernel_create_server( xptr_t xp );
277
278/***********************************************************************************
279 * [8] undefined slot
280 **********************************************************************************/
281
282/***********************************************************************************
283 * [9] The non blocking RPC_PROCESS_SIGACTION allows any client thread running in
284 * any cluster to send parallel RPC requests to one or several servers (that can be
285 * local or remote), to execute a given sigaction, defined by the <action_type>
286 * argument[1], for a given process identified by the <pid> argument[0].
287 *
288 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
289 * to several servers. The RPC descriptor, containing the <action_type> and <pid>
290 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
291 * be allocated and initialised by the calling function itself.
292 * Each RPC server thread atomically decrements the <response> field in this
293 * shared RPC descriptor. The last server thread unblock the client thread,
294 * that blocked only after sending all parallel RPC requests to all servers.
295 ***********************************************************************************
296 * @ cxy     : server cluster identifier.
297 * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
298 **********************************************************************************/
299void rpc_process_sigaction_client( cxy_t               cxy,
300                                   struct rpc_desc_s * rpc );
301                             
302void rpc_process_sigaction_server( xptr_t xp );
303
304/***********************************************************************************
305 * [10] The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a
306 * remote cluster. The parent dentry must have been previously created.
307 * It returns an extended pointer on the created inode.
308 ***********************************************************************************
309 * @ cxy        :  server cluster identifier.
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 **********************************************************************************/
319void rpc_vfs_inode_create_client( cxy_t      cxy,
320                                  uint32_t   fs_type,
321                                  uint32_t   inode_type,
322                                  uint32_t   attr,   
323                                  uint32_t   rights, 
324                                  uint32_t   uid,
325                                  uint32_t   gid,
326                                  xptr_t   * inode_xp,
327                                  error_t  * error );
328
329void rpc_vfs_inode_create_server( xptr_t xp );
330
331/***********************************************************************************
332 * [11] The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor
333 * and for the associated mapper in a remote cluster.
334 ***********************************************************************************
335 * @ cxy       :  server cluster identifier
336 * @ inode     : [in]  local pointer on inode.
337 **********************************************************************************/
338void rpc_vfs_inode_destroy_client( cxy_t                cxy,
339                                   struct vfs_inode_s * inode );
340
341void rpc_vfs_inode_destroy_server( xptr_t xp );
342
343/***********************************************************************************
344 * [12] The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster.
345 * It returns an extended pointer on the created dentry.
346 ***********************************************************************************
347 * @ cxy        :  server cluster identifier
348 * @ type       : [in]  file system type.
349 * @ name       : [in]  directory entry name.
350 * @ dentry_xp  : [out] buffer for extended pointer on created dentry.
351 * @ error      : [out] error status (0 if success).
352 **********************************************************************************/
353void rpc_vfs_dentry_create_client( cxy_t                  cxy,
354                                   uint32_t               type,
355                                   char                 * name,   
356                                   xptr_t               * dentry_xp,
357                                   error_t              * error );
358
359void rpc_vfs_dentry_create_server( xptr_t xp );
360
361/***********************************************************************************
362 * [13] The RPC_VFS_DENTRY_DESTROY remove a denfry from the parent inode XHTAB,
363 * and releases memory allocated for the dentry descriptor in a remote cluster.
364 ***********************************************************************************
365 * @ cxy       :  server cluster identifier
366 * @ dentry     : [in]  local pointer on dentry.
367 **********************************************************************************/
368void rpc_vfs_dentry_destroy_client( cxy_t                 cxy,
369                                    struct vfs_dentry_s * dentry );
370
371void rpc_vfs_dentry_destroy_server( xptr_t xp );
372
373/***********************************************************************************
374 * [14] The RPC_VFS_FILE_CREATE creates a file descriptor in a remote cluster.
375 * It returns an extended pointer on the created file structure.
376 ***********************************************************************************
377 * @ cxy        :  server cluster identifier
378 * @ inode      : [in]  local pointer on parent inode.
379 * @ file_attr  : [in]  new file attributes.
380 * @ file_xp    : [out] buffer for extended pointer on created file.
381 * @ error      : [out] error status (0 if success).
382 **********************************************************************************/
383void rpc_vfs_file_create_client( cxy_t                  cxy,
384                                 struct vfs_inode_s   * inode,
385                                 uint32_t               file_attr,
386                                 xptr_t               * file_xp,
387                                 error_t              * error );
388
389void rpc_vfs_file_create_server( xptr_t xp );
390
391/***********************************************************************************
392 * [15] The RPC_VFS_FILE_DESTROY releases memory allocated for a file descriptor
393 * in a remote cluster.
394 ***********************************************************************************
395 * @ cxy       :  server cluster identifier
396 * @ file       : [in]  local pointer on file.
397 **********************************************************************************/
398void rpc_vfs_file_destroy_client( cxy_t               cxy,
399                                  struct vfs_file_s * file );
400
401void rpc_vfs_file_destroy_server( xptr_t xp );
402
403/***********************************************************************************
404 * [16] The RPC_VFS_FS_CHILD_INIT calls the vfs_fs_child_init_load_inode()
405 * function in a remote cluster containing a parent inode directory to scan the
406 * associated mapper, find a directory entry identified by its name, and update
407 * both the child inode and the dentry.
408 ***********************************************************************************
409 * @ cxy            : server cluster identifier
410 * @ parent_inode   : [in]  local pointer on parent inode.
411 * @ name           : [in]  local pointer on child name (in client cluster).
412 * @ child_inode_xp : [in]  extended pointer on child inode (in another cluster).
413 * @ error          : [out] error status (0 if success).
414 **********************************************************************************/
415void rpc_vfs_fs_child_init_client( cxy_t                cxy,
416                                   struct vfs_inode_s * parent_inode,
417                                   char               * name,
418                                   xptr_t               child_inode_xp,
419                                   error_t            * error );
420
421void rpc_vfs_fs_child_init_server( xptr_t xp );
422
423/***********************************************************************************
424 * [17] The RPC_VFS_FS_ADD_DENTRY calls the vfs_fs_add_dentry() function in a
425 * remote cluster containing a directory inode and mapper, to add a new dentry
426 * in the mapper of this directory.
427 ***********************************************************************************
428 * @ cxy            : server cluster identifier
429 * @ parent         : [in]  local pointer on directory inode.
430 * @ dentry         : [in]  local pointer on dentry.
431 * @ error          : [out] error status (0 if success).
432 **********************************************************************************/
433void rpc_vfs_fs_add_dentry_client( cxy_t,
434                                   struct vfs_inode_s  * parent,
435                                   struct vfs_dentry_s * dentry,
436                                   error_t             * error );
437
438void rpc_vfs_fs_add_dentry_server( xptr_t xp );
439
440/***********************************************************************************
441 * [18] The RPC_VFS_FS_REMOVE_DENTRY calls the vfs_fs_remove_dentry() function in a
442 * remote cluster containing a directory inode and mapper, to remove a dentry from
443 * the mapper of this directory.
444 ***********************************************************************************
445 * @ cxy            : server cluster identifier
446 * @ parent         : [in]  local pointer on directory inode.
447 * @ dentry         : [in]  local pointer on dentry.
448 * @ error          : [out] error status (0 if success).
449 **********************************************************************************/
450void rpc_vfs_fs_remove_dentry_client( cxy_t,
451                                      struct vfs_inode_s  * parent,
452                                      struct vfs_dentry_s * dentry,
453                                      error_t             * error );
454
455void rpc_vfs_fs_remove_dentry_server( xptr_t xp );
456
457/***********************************************************************************
458 * [19] The RPC_VFS_INODE_LOAD_ALL_PAGES calls the vfs_inode_load_all_pages()
459 * function a remote cluster containing an inode to load all pages in the
460 * associated mapper. 
461 ***********************************************************************************
462 * @ cxy     : server cluster identifier
463 * @ inode   : [in]  local pointer on inode in server cluster.
464 * @ error   : [out] error status (0 if success).
465 **********************************************************************************/
466void rpc_vfs_inode_load_all_pages_client( cxy_t                cxy,
467                                          struct vfs_inode_s * inode,
468                                          error_t            * error );
469
470void rpc_vfs_inode_load_all_pages_server( xptr_t xp );
471
472/***********************************************************************************
473 * [20] The RPC_VMM_GET_VSEG returns an extended pointer
474 * on the vseg containing a given virtual address in a given process.
475 * The server cluster is supposed to be the reference cluster.
476 * It returns a non zero error value if no vseg has been founded.
477 ***********************************************************************************
478 * @ cxy     : server cluster identifier.
479 * @ process : [in]   pointer on process descriptor in server cluster.
480 * @ vaddr   : [in]   virtual address to be searched.
481 * @ vseg_xp : [out]  buffer for extended pointer on vseg in client cluster.
482 * @ error   : [out] local pointer on buffer for error code (in client cluster).
483 **********************************************************************************/
484void rpc_vmm_get_vseg_client( cxy_t              cxy,
485                              struct process_s * process,
486                              intptr_t           vaddr,
487                              xptr_t           * vseg_xp,
488                              error_t          * error );
489
490void rpc_vmm_get_vseg_server( xptr_t xp );
491
492/***********************************************************************************
493 * [21] The RPC_VMM_GLOBAL_UPDATE_PTE can be used by a thread that is not running
494 * in reference cluster, to ask the reference cluster to update a specific entry,
495 * identified by the <vpn> argument in all GPT copies of a process identified by
496 * the <process> argument, using the values defined by <attr> and <ppn> arguments.
497 * The server cluster is supposed to be the reference cluster.
498 * It does not return any error code as the called function vmm_global_update_pte()
499 * cannot fail.
500 ***********************************************************************************
501 * @ cxy     : server cluster identifier.
502 * @ process : [in]  pointer on process descriptor in server cluster.
503 * @ vpn     : [in]  virtual address to be searched.
504 * @ attr    : [in]  PTE attributes.
505 * @ ppn     : [it]  PTE PPN.
506 **********************************************************************************/
507void rpc_vmm_global_update_pte_client( cxy_t              cxy,
508                                       struct process_s * process,
509                                       vpn_t              vpn,
510                                       uint32_t           attr,
511                                       ppn_t              ppn );
512
513void rpc_vmm_global_update_pte_server( xptr_t xp );
514
515/***********************************************************************************
516 * [22] The RPC_KCM_ALLOC allocates memory from a given KCM in a remote cluster,
517 * and returns an extended pointer on the allocated object.
518  It returns XPTR_NULL if physical memory cannot be allocated.
519 ***********************************************************************************
520 * @ cxy       : server cluster identifier.
521 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
522 * @ buf_xp    : [out] buffer for extended pointer on allocated buffer.
523 **********************************************************************************/
524void rpc_kcm_alloc_client( cxy_t      cxy,
525                           uint32_t   kmem_type,
526                           xptr_t   * buf_xp ); 
527
528void rpc_kcm_alloc_server( xptr_t xp );
529
530/***********************************************************************************
531 * [23] The RPC_KCM_FREE releases memory allocated for a KCM object of a given type,
532 * in a remote cluster.
533 ***********************************************************************************
534 * @ cxy       : server cluster identifier.
535 * @ buf       : [in] local pointer on allocated buffer.
536 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
537 **********************************************************************************/
538void rpc_kcm_free_client( cxy_t     cxy,
539                          void    * buf,
540                          uint32_t  kmem_type );
541
542void rpc_kcm_free_server( xptr_t xp );
543
544/***********************************************************************************
545 * [24] undefined slot
546 **********************************************************************************/
547
548/***********************************************************************************
549 * [25] The RPC__MAPPER_HANDLE_MISS allows a client thread to request a remote
550 * mapper to load a missing page from the IOC device.
551 * On the server side, this RPC call the mapper_handle_miss() function and return
552 * an extended pointer on the allocated page descriptor and an error status.
553 ***********************************************************************************
554 * @ cxy         : server cluster identifier.
555 * @ mapper      : [in]  local pointer on mapper.
556 * @ page_id     : [in]  missing page index in mapper
557 * @ buffer      : [in]  user space pointer / kernel extended pointer
558 * @ page_xp     : [out] pointer on buffer for extended pointer on page descriptor.
559 * @ error       : [out] error status (0 if success).
560 **********************************************************************************/
561void rpc_mapper_handle_miss_client( cxy_t             cxy,
562                                    struct mapper_s * mapper,
563                                    uint32_t          page_id,
564                                    xptr_t          * page_xp,
565                                    error_t         * error );
566 
567void rpc_mapper_handle_miss_server( xptr_t xp );
568
569/***********************************************************************************
570 * [26] The non blocking RPC_VMM_DELETE_VSEG allows any client thread running in
571 * any cluster to send parallel RPC requests to one or several clusters (that can be
572 * local or remote), to delete from a given VMM, identified by the <pid> argument[0]
573 * a given vseg, identified by the <vaddr> argument[1].
574 *
575 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
576 * to several servers. The RPC descriptor, containing the <pid> and <vaddr>
577 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
578 * be allocated and initialised by the calling function itself.
579 * Each RPC server thread atomically decrements the the <response> field in this
580 * shared RPC descriptor. The last server thread unblock the client thread,
581 * that blocked only after sending all paralle RPC requests to all servers.
582 ***********************************************************************************
583 * @ cxy         : server cluster identifier.
584 * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
585 **********************************************************************************/
586void rpc_vmm_delete_vseg_client( cxy_t               cxy,
587                                 struct rpc_desc_s * rpc );
588 
589void rpc_vmm_delete_vseg_server( xptr_t xp );
590
591/***********************************************************************************
592 * [27] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote
593 * reference cluster of a given process to allocate and register in the reference
594 * process VMM a new vseg descriptor.
595 * On the server side, this RPC uses the vmm_create_vseg() function, and returns
596 * to the client the local pointer on the created vseg descriptor.
597 ***********************************************************************************
598 * @ cxy         : server cluster identifier.
599 * @ process     : [in]  local pointer on process descriptor in server.
600 * @ type        : [in]  vseg type.
601 * @ base        : [in]  base address (unused for dynamically allocated vsegs).
602 * @ size        : [in]  number of bytes.
603 * @ file_offset : [in]  offset in file (for CODE, DATA, FILE types).
604 * @ file_size   : [in]  can be smaller than size for DATA type.
605 * @ mapper_xp   : [in]  extended pointer on mapper (for CODE, DATA, FILE types).
606 * @ vseg_cxy    : [in]  target cluster for mapping (if not data type).
607 * @ vseg        : [out] local pointer on vseg descriptor / NULL if failure.
608 **********************************************************************************/
609void rpc_vmm_create_vseg_client( cxy_t              cxy,
610                                 struct process_s * process,
611                                 vseg_type_t        type,
612                                 intptr_t           base,
613                                 uint32_t           size,
614                                 uint32_t           file_offset,
615                                 uint32_t           file_size,
616                                 xptr_t             mapper_xp,
617                                 cxy_t              vseg_cxy,
618                                 struct vseg_s   ** vseg );
619
620void rpc_vmm_create_vseg_server( xptr_t xp );
621
622/***********************************************************************************
623 * [28] The RPC_VMM_SET_COW allows a client thread to request the remote reference
624 * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for
625 * the DATA, MMAP and REMOTE vsegs of process identified by the <process> argument.
626
627 * of a remote scheduler, identified by the <lid> argument.
628 ***********************************************************************************
629 * @ cxy         : server cluster identifier.
630 * @ process     : [in]  local pointer on reference process descriptor.
631 **********************************************************************************/
632void rpc_vmm_set_cow_client( cxy_t              cxy,
633                             struct process_s * process );
634
635void rpc_vmm_set_cow_server( xptr_t xp );
636
637/***********************************************************************************
638 * [29] The RPC_VMM_DISPLAY allows any client thread to display the VMM state
639 * of a remote reference process identified by the <cxy> and <process> arguments.
640 * The type of display is defined by the <detailed> boolean argument.
641 ***********************************************************************************
642 * @ cxy         : server cluster identifier.
643 * @ process     : [in]  local pointer on reference process descriptor.
644 * @ detailed    : [in]  detailed display if true.
645 **********************************************************************************/
646void rpc_vmm_display_client( cxy_t              cxy,
647                             struct process_s * process,
648                             bool_t             detailed );
649
650void rpc_vmm_display_server( xptr_t xp );
651
652
653#endif
Note: See TracBrowser for help on using the repository browser.