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

Last change on this file since 632 was 632, checked in by alain, 5 years ago

This version replace the RPC by direct remote memory access
for physical pages allacation/release.
It is commited before being tested.

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