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

Last change on this file since 615 was 614, checked in by alain, 6 years ago

1) introduce a dev_ioc_sync_write() function in IOC API,

to improve the DEVFS synchronous update.

2) fix a big bug in both the user_dir_create() and user_dir_destroy()

functions: add an extended pointer on the reference client process
in the function's arguments.

File size: 35.9 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{
[601]62    RPC_PMEM_GET_PAGES            = 0,
63    RPC_PMEM_RELEASE_PAGES        = 1,
64    RPC_UNDEFINED_2               = 2,     
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,
70    RPC_UNDEFINED_8               = 8,
[611]71    RPC_PROCESS_SIGACTION         = 9,       // non blocking
[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,
[612]79    RPC_VFS_FS_GET_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,
[610]88    RPC_UNDEFINED_24              = 24,
[601]89    RPC_MAPPER_HANDLE_MISS        = 25,
[611]90    RPC_VMM_DELETE_VSEG           = 26,      // non blocking
[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/***********************************************************************************
107 *  This structure defines the RPC descriptor
108 **********************************************************************************/
109
110typedef struct rpc_desc_s
111{
[407]112        rpc_index_t         index;       /*! index of requested RPC service           */
[438]113        volatile uint32_t   responses;   /*! number of expected responses             */
[407]114    struct thread_s   * thread;      /*! local pointer on client thread           */
115    uint32_t            lid;         /*! index of core running the calling thread */ 
[416]116    bool_t              blocking;    /*! blocking RPC when true                   */
[407]117    uint64_t            args[10];    /*! input/output arguments buffer            */
[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 **********************************************************************************/
[485]163void rpc_thread_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.
[1]179 ***********************************************************************************
180 * @ cxy     : server cluster identifier
181 * @ order   : [in]  ln2( number of requested pages )
[313]182 * @ page    : [out] local pointer on page descriptor / NULL if failure
[1]183 **********************************************************************************/
[313]184void rpc_pmem_get_pages_client( cxy_t             cxy,
185                                uint32_t          order,
186                                struct page_s  ** page );
[1]187
188void rpc_pmem_get_pages_server( xptr_t xp );
189
190/***********************************************************************************
[409]191 * [1] The RPC_PMEM_RELEASE_PAGES release one or several pages to a remote cluster.
192 ***********************************************************************************
193 * @ cxy     : server cluster identifier
194 * @ page    : [in] local pointer on page descriptor to release.
195 **********************************************************************************/
196void rpc_pmem_release_pages_client( cxy_t            cxy,
197                                    struct page_s  * page );
198
199void rpc_pmem_release_pages_server( xptr_t xp );
200
201/***********************************************************************************
[433]202 * [2] undefined slot
[1]203 **********************************************************************************/
204
205/***********************************************************************************
[409]206 * [3] The RPC_PROCESS_MAKE_FORK creates a "child" process descriptor, and the
[408]207 * associated "child" thread descriptor in a target remote cluster that can be
208 * any cluster.  The child process is initialized from informations found in the
209 * "parent" process descriptor (that must be the parent reference cluster),
210 * and from the "parent" thread descriptor that can be in any cluster.
[1]211 ***********************************************************************************
[408]212 * @ cxy              : server cluster identifier.
213 * @ ref_process_xp   : [in]  extended pointer on reference parent process.
214 * @ parent_thread_xp : [in]  extended pointer on parent thread.
215 * @ child_pid        : [out] child process identifier.
216 * @ child_thread_ptr : [out] local pointer on child thread.
217 * @ error            : [out]  error status (0 if success).
[1]218 **********************************************************************************/
[408]219void rpc_process_make_fork_client( cxy_t              cxy,
220                                   xptr_t             ref_process_xp,
221                                   xptr_t             parent_thread_xp,
222                                   pid_t            * child_pid,
223                                   struct thread_s ** child_thread_ptr,
224                                   error_t          * error );
[1]225
[408]226void rpc_process_make_fork_server( xptr_t xp );
[1]227
228/***********************************************************************************
[612]229 * [4] The RPC_USER_DIR_CREATE allows a client thread to create an user_dir_t
230 * structure and the associated array of dirents in a remote cluster containing
[614]231 * the target directory <inode>. It creates an ANON vseg in the user reference
232 * process VMM identified by the <ref_xp>. This reference cluster cluster can be
233 * different from both the client and server clusters.
234 * It is called by the sys_opendir() function.
[612]235 ***********************************************************************************
236 * @ cxy        : server cluster identifier.
237 * @ inode      : [in]   local pointer on inode in server cluster.
[614]238 * @ ref_xp     : [in]   extended pointer on user reference process descriptor.
[612]239 * @ dir        : [out]  local pointer on created user_dir structure.
[1]240 **********************************************************************************/
[612]241void rpc_user_dir_create_client( cxy_t                 cxy,
242                                 struct vfs_inode_s  * inode,
[614]243                                 xptr_t                ref_xp,
[612]244                                 struct user_dir_s  ** dir );
[1]245
[612]246void rpc_user_dir_create_server( xptr_t xp );
247
[1]248/***********************************************************************************
[612]249 * [5] The RPC_USER_DIR_DESTROY allows a client thread to delete an user_dir_t
250 * structure and the associated array of dirents in a remote cluster containing
251 * the target directory inode. It is called by the sys_closedir() function.
252 ***********************************************************************************
253 * @ cxy        : server cluster identifier.
254 * @ dir        : [in]  local pointer on created user_dir structure.
[614]255 * @ ref_xp     : [in]   extended pointer on user reference process descriptor.
[409]256 **********************************************************************************/
[612]257void rpc_user_dir_destroy_client( cxy_t               cxy,
[614]258                                  struct user_dir_s * dir,
259                                  xptr_t              ref_xp );
[409]260
[612]261void rpc_user_dir_destroy_server( xptr_t xp );
262
[409]263/***********************************************************************************
264 * [6] The RPC_THREAD_USER_CREATE creates an user thread in the server cluster,
[23]265 * as specified by the arguments. It returns an extended pointer on the new
266 * thread descriptor in server cluster, and an error code.
267 * It is called by the sys_thread_create() system call.
[1]268 ***********************************************************************************
269 * @ cxy       : server cluster identifier.
[407]270 * @ attr      : [in]  local pointer on pthread_attr_t in client cluster.
271 * @ thread_xp : [out] buffer for thread extended pointer.
[1]272 * @ error     : [out] error status (0 if success).
273 **********************************************************************************/
274void rpc_thread_user_create_client( cxy_t                   cxy,
[23]275                                    pid_t                   pid,
276                                    void                  * start_func,
277                                    void                  * start_arg,
[407]278                                    pthread_attr_t        * attr,
[1]279                                    xptr_t                * thread_xp,
280                                    error_t               * error );
281
282void rpc_thread_user_create_server( xptr_t xp );
283
284/***********************************************************************************
[409]285 * [7] The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster,
[1]286 * as specified by the type, func and args arguments. It returns the local pointer
287 * on the thread descriptor in server cluster and an error code.
[23]288 * It is used by the dev_init() function to create the device server thread.
[1]289 ***********************************************************************************
290 * @ cxy       : server cluster identifier.
291 * @ type      : [in]  type of kernel thread.
292 * @ func      : [in]  local pointer on thread function.
293 * @ args      : [in]  local pointer on function arguments.
294 * @ thread_xp : [out] pointer on buffer for thread extended pointer.
295 * @ error     : [out] error status (0 if success).
296 **********************************************************************************/
297void rpc_thread_kernel_create_client( cxy_t     cxy,
298                                      uint32_t  type,
299                                      void    * func,
300                                      void    * args,
301                                      xptr_t  * thread_xp,
302                                      error_t * error );
303
304void rpc_thread_kernel_create_server( xptr_t xp );
305
[23]306/***********************************************************************************
[436]307 * [8] undefined slot
[23]308 **********************************************************************************/
309
[409]310/***********************************************************************************
[611]311 * [9] The non blocking RPC_PROCESS_SIGACTION allows any client thread running in
312 * any cluster to send parallel RPC requests to one or several servers (that can be
313 * local or remote), to execute a given sigaction, defined by the <action_type>
314 * argument[1], for a given process identified by the <pid> argument[0].
[409]315 *
[611]316 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
317 * to several servers. The RPC descriptor, containing the <action_type> and <pid>
318 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
319 * be allocated and initialised by the calling function itself.
320 * Each RPC server thread atomically decrements the <response> field in this
321 * shared RPC descriptor. The last server thread unblock the client thread,
322 * that blocked only after sending all parallel RPC requests to all servers.
[409]323 ***********************************************************************************
[436]324 * @ cxy     : server cluster identifier.
[611]325 * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
[409]326 **********************************************************************************/
[436]327void rpc_process_sigaction_client( cxy_t               cxy,
328                                   struct rpc_desc_s * rpc );
[409]329                             
330void rpc_process_sigaction_server( xptr_t xp );
331
[1]332/***********************************************************************************
[23]333 * [10] The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a
[1]334 * remote cluster. The parent dentry must have been previously created.
335 * It returns an extended pointer on the created inode.
336 ***********************************************************************************
[23]337 * @ cxy        :  server cluster identifier.
338 * @ fs_type    : [in]  file system type.
339 * @ inode_type : [in]  file system type.
340 * @ attr       : [in]  inode attributes.
341 * @ rights     : [in]  access rights
342 * @ uid        : [in]  user ID
343 * @ gid        : [in]  group ID
344 * @ inode_xp   : [out] buffer for extended pointer on created inode.
345 * @ error      : [out] error status (0 if success).
[1]346 **********************************************************************************/
347void rpc_vfs_inode_create_client( cxy_t      cxy,
[23]348                                  uint32_t   fs_type,
349                                  uint32_t   inode_type,
[1]350                                  uint32_t   attr,   
[23]351                                  uint32_t   rights, 
[1]352                                  uint32_t   uid,
353                                  uint32_t   gid,
354                                  xptr_t   * inode_xp,
355                                  error_t  * error );
356
357void rpc_vfs_inode_create_server( xptr_t xp );
358
359/***********************************************************************************
[23]360 * [11] The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor
[1]361 * and for the associated mapper in a remote cluster.
362 ***********************************************************************************
363 * @ cxy       :  server cluster identifier
364 * @ inode     : [in]  local pointer on inode.
365 **********************************************************************************/
[601]366void rpc_vfs_inode_destroy_client( cxy_t                cxy,
367                                   struct vfs_inode_s * inode );
[1]368
369void rpc_vfs_inode_destroy_server( xptr_t xp );
370
371/***********************************************************************************
[23]372 * [12] The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster.
[1]373 * It returns an extended pointer on the created dentry.
374 ***********************************************************************************
375 * @ cxy        :  server cluster identifier
376 * @ type       : [in]  file system type.
377 * @ name       : [in]  directory entry name.
378 * @ dentry_xp  : [out] buffer for extended pointer on created dentry.
379 * @ error      : [out] error status (0 if success).
380 **********************************************************************************/
381void rpc_vfs_dentry_create_client( cxy_t                  cxy,
382                                   uint32_t               type,
383                                   char                 * name,   
384                                   xptr_t               * dentry_xp,
385                                   error_t              * error );
386
387void rpc_vfs_dentry_create_server( xptr_t xp );
388
389/***********************************************************************************
[459]390 * [13] The RPC_VFS_DENTRY_DESTROY remove a denfry from the parent inode XHTAB,
391 * and releases memory allocated for the dentry descriptor in a remote cluster.
[1]392 ***********************************************************************************
393 * @ cxy       :  server cluster identifier
394 * @ dentry     : [in]  local pointer on dentry.
395 **********************************************************************************/
396void rpc_vfs_dentry_destroy_client( cxy_t                 cxy,
[601]397                                    struct vfs_dentry_s * dentry );
[1]398
399void rpc_vfs_dentry_destroy_server( xptr_t xp );
400
[23]401/***********************************************************************************
402 * [14] The RPC_VFS_FILE_CREATE creates a file descriptor in a remote cluster.
403 * It returns an extended pointer on the created file structure.
404 ***********************************************************************************
405 * @ cxy        :  server cluster identifier
406 * @ inode      : [in]  local pointer on parent inode.
407 * @ file_attr  : [in]  new file attributes.
408 * @ file_xp    : [out] buffer for extended pointer on created file.
409 * @ error      : [out] error status (0 if success).
410 **********************************************************************************/
411void rpc_vfs_file_create_client( cxy_t                  cxy,
412                                 struct vfs_inode_s   * inode,
413                                 uint32_t               file_attr,
414                                 xptr_t               * file_xp,
415                                 error_t              * error );
[1]416
[23]417void rpc_vfs_file_create_server( xptr_t xp );
[1]418
[23]419/***********************************************************************************
420 * [15] The RPC_VFS_FILE_DESTROY releases memory allocated for a file descriptor
421 * in a remote cluster.
422 ***********************************************************************************
423 * @ cxy       :  server cluster identifier
424 * @ file       : [in]  local pointer on file.
425 **********************************************************************************/
426void rpc_vfs_file_destroy_client( cxy_t               cxy,
427                                  struct vfs_file_s * file );
[1]428
[23]429void rpc_vfs_file_destroy_server( xptr_t xp );
430
[238]431/***********************************************************************************
[612]432 * [16] The RPC_VFS_FS_GET_DENTRY calls the vfs_fs_get_dentry()
[601]433 * function in a remote cluster containing a parent inode directory to scan the
434 * associated mapper, find a directory entry identified by its name, and update
[612]435 * both the - existing - child inode and dentry.
[238]436 ***********************************************************************************
[601]437 * @ cxy            : server cluster identifier
[238]438 * @ parent_inode   : [in]  local pointer on parent inode.
439 * @ name           : [in]  local pointer on child name (in client cluster).
440 * @ child_inode_xp : [in]  extended pointer on child inode (in another cluster).
441 * @ error          : [out] error status (0 if success).
442 **********************************************************************************/
[612]443void rpc_vfs_fs_get_dentry_client( cxy_t                cxy,
[601]444                                   struct vfs_inode_s * parent_inode,
445                                   char               * name,
446                                   xptr_t               child_inode_xp,
447                                   error_t            * error );
[238]448
[612]449void rpc_vfs_fs_get_dentry_server( xptr_t xp );
[238]450
451/***********************************************************************************
[601]452 * [17] The RPC_VFS_FS_ADD_DENTRY calls the vfs_fs_add_dentry() function in a
453 * remote cluster containing a directory inode and mapper, to add a new dentry
454 * in the mapper of this directory.
[238]455 ***********************************************************************************
[601]456 * @ cxy            : server cluster identifier
457 * @ parent         : [in]  local pointer on directory inode.
458 * @ dentry         : [in]  local pointer on dentry.
459 * @ error          : [out] error status (0 if success).
[238]460 **********************************************************************************/
[601]461void rpc_vfs_fs_add_dentry_client( cxy_t,
462                                   struct vfs_inode_s  * parent,
463                                   struct vfs_dentry_s * dentry,
464                                   error_t             * error );
[238]465
[601]466void rpc_vfs_fs_add_dentry_server( xptr_t xp );
[238]467
[601]468/***********************************************************************************
469 * [18] The RPC_VFS_FS_REMOVE_DENTRY calls the vfs_fs_remove_dentry() function in a
470 * remote cluster containing a directory inode and mapper, to remove a dentry from
471 * the mapper of this directory.
[23]472 ***********************************************************************************
[601]473 * @ cxy            : server cluster identifier
474 * @ parent         : [in]  local pointer on directory inode.
475 * @ dentry         : [in]  local pointer on dentry.
476 * @ error          : [out] error status (0 if success).
[23]477 **********************************************************************************/
[601]478void rpc_vfs_fs_remove_dentry_client( cxy_t,
479                                      struct vfs_inode_s  * parent,
480                                      struct vfs_dentry_s * dentry,
481                                      error_t             * error );
[23]482
[601]483void rpc_vfs_fs_remove_dentry_server( xptr_t xp );
[23]484
485/***********************************************************************************
[601]486 * [19] The RPC_VFS_INODE_LOAD_ALL_PAGES calls the vfs_inode_load_all_pages()
487 * function a remote cluster containing an inode to load all pages in the
488 * associated mapper. 
489 ***********************************************************************************
490 * @ cxy     : server cluster identifier
491 * @ inode   : [in]  local pointer on inode in server cluster.
492 * @ error   : [out] error status (0 if success).
[433]493 **********************************************************************************/
[601]494void rpc_vfs_inode_load_all_pages_client( cxy_t                cxy,
495                                          struct vfs_inode_s * inode,
496                                          error_t            * error );
[433]497
[601]498void rpc_vfs_inode_load_all_pages_server( xptr_t xp );
499
[433]500/***********************************************************************************
[389]501 * [20] The RPC_VMM_GET_VSEG returns an extended pointer
[1]502 * on the vseg containing a given virtual address in a given process.
503 * The server cluster is supposed to be the reference cluster.
[389]504 * It returns a non zero error value if no vseg has been founded.
[1]505 ***********************************************************************************
506 * @ cxy     : server cluster identifier.
507 * @ process : [in]   pointer on process descriptor in server cluster.
508 * @ vaddr   : [in]   virtual address to be searched.
[16]509 * @ vseg_xp : [out]  buffer for extended pointer on vseg in client cluster.
[389]510 * @ error   : [out] local pointer on buffer for error code (in client cluster).
[1]511 **********************************************************************************/
[389]512void rpc_vmm_get_vseg_client( cxy_t              cxy,
513                              struct process_s * process,
514                              intptr_t           vaddr,
515                              xptr_t           * vseg_xp,
[401]516                              error_t          * error );
[1]517
[389]518void rpc_vmm_get_vseg_server( xptr_t xp );
[1]519
520/***********************************************************************************
[583]521 * [21] The RPC_VMM_GLOBAL_UPDATE_PTE can be used by a thread that is not running
522 * in reference cluster, to ask the reference cluster to update a specific entry,
523 * identified by the <vpn> argument in all GPT copies of a process identified by
524 * the <process> argument, using the values defined by <attr> and <ppn> arguments.
525 * The server cluster is supposed to be the reference cluster.
526 * It does not return any error code as the called function vmm_global_update_pte()
527 * cannot fail.
[1]528 ***********************************************************************************
529 * @ cxy     : server cluster identifier.
[583]530 * @ process : [in]  pointer on process descriptor in server cluster.
531 * @ vpn     : [in]  virtual address to be searched.
532 * @ attr    : [in]  PTE attributes.
533 * @ ppn     : [it]  PTE PPN.
[1]534 **********************************************************************************/
[583]535void rpc_vmm_global_update_pte_client( cxy_t              cxy,
536                                       struct process_s * process,
537                                       vpn_t              vpn,
538                                       uint32_t           attr,
539                                       ppn_t              ppn );
[1]540
[583]541void rpc_vmm_global_update_pte_server( xptr_t xp );
[1]542
543/***********************************************************************************
[23]544 * [22] The RPC_KCM_ALLOC allocates memory from a given KCM in a remote cluster,
545 * and returns an extended pointer on the allocated object.
546  It returns XPTR_NULL if physical memory cannot be allocated.
[1]547 ***********************************************************************************
[23]548 * @ cxy       : server cluster identifier.
549 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
550 * @ buf_xp    : [out] buffer for extended pointer on allocated buffer.
[1]551 **********************************************************************************/
[23]552void rpc_kcm_alloc_client( cxy_t      cxy,
553                           uint32_t   kmem_type,
554                           xptr_t   * buf_xp ); 
[1]555
[23]556void rpc_kcm_alloc_server( xptr_t xp );
[1]557
558/***********************************************************************************
[23]559 * [23] The RPC_KCM_FREE releases memory allocated for a KCM object of a given type,
[1]560 * in a remote cluster.
561 ***********************************************************************************
[23]562 * @ cxy       : server cluster identifier.
563 * @ buf       : [in] local pointer on allocated buffer.
564 * @ kmem_type : [in]  KCM object type (as defined in kmem.h).
[1]565 **********************************************************************************/
[23]566void rpc_kcm_free_client( cxy_t     cxy,
567                          void    * buf,
568                          uint32_t  kmem_type );
[1]569
[23]570void rpc_kcm_free_server( xptr_t xp );
[1]571
572/***********************************************************************************
[610]573 * [24] undefined slot
[1]574 **********************************************************************************/
575
[313]576/***********************************************************************************
[601]577 * [25] The RPC__MAPPER_HANDLE_MISS allows a client thread to request a remote
578 * mapper to load a missing page from the IOC device.
579 * On the server side, this RPC call the mapper_handle_miss() function and return
580 * an extended pointer on the allocated page descriptor and an error status.
[611]581 ***********************************************************************************
[313]582 * @ cxy         : server cluster identifier.
583 * @ mapper      : [in]  local pointer on mapper.
[601]584 * @ page_id     : [in]  missing page index in mapper
585 * @ buffer      : [in]  user space pointer / kernel extended pointer
586 * @ page_xp     : [out] pointer on buffer for extended pointer on page descriptor.
587 * @ error       : [out] error status (0 if success).
[313]588 **********************************************************************************/
[601]589void rpc_mapper_handle_miss_client( cxy_t             cxy,
590                                    struct mapper_s * mapper,
591                                    uint32_t          page_id,
592                                    xptr_t          * page_xp,
593                                    error_t         * error );
594 
595void rpc_mapper_handle_miss_server( xptr_t xp );
[1]596
[601]597/***********************************************************************************
[611]598 * [26] The non blocking RPC_VMM_DELETE_VSEG allows any client thread running in
599 * any cluster to send parallel RPC requests to one or several clusters (that can be
600 * local or remote), to delete from a given VMM, identified by the <pid> argument[0]
601 * a given vseg, identified by the <vaddr> argument[1].
602 *
603 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel
604 * to several servers. The RPC descriptor, containing the <pid> and <vaddr>
605 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must
606 * be allocated and initialised by the calling function itself.
607 * Each RPC server thread atomically decrements the the <response> field in this
608 * shared RPC descriptor. The last server thread unblock the client thread,
609 * that blocked only after sending all paralle RPC requests to all servers.
610 ***********************************************************************************
611 * @ cxy         : server cluster identifier.
612 * @ rpc     : pointer on shared RPC descriptor initialized by the client thread.
[601]613 **********************************************************************************/
[611]614void rpc_vmm_delete_vseg_client( cxy_t               cxy,
615                                 struct rpc_desc_s * rpc );
616 
617void rpc_vmm_delete_vseg_server( xptr_t xp );
[1]618
[407]619/***********************************************************************************
[601]620 * [27] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote
[407]621 * reference cluster of a given process to allocate and register in the reference
622 * process VMM a new vseg descriptor.
623 * On the server side, this RPC uses the vmm_create_vseg() function, and returns
624 * to the client the local pointer on the created vseg descriptor.
625 ***********************************************************************************
626 * @ cxy         : server cluster identifier.
627 * @ process     : [in]  local pointer on process descriptor in server.
628 * @ type        : [in]  vseg type.
629 * @ base        : [in]  base address (unused for dynamically allocated vsegs).
630 * @ size        : [in]  number of bytes.
631 * @ file_offset : [in]  offset in file (for CODE, DATA, FILE types).
632 * @ file_size   : [in]  can be smaller than size for DATA type.
633 * @ mapper_xp   : [in]  extended pointer on mapper (for CODE, DATA, FILE types).
634 * @ vseg_cxy    : [in]  target cluster for mapping (if not data type).
635 * @ vseg        : [out] local pointer on vseg descriptor / NULL if failure.
636 **********************************************************************************/
637void rpc_vmm_create_vseg_client( cxy_t              cxy,
638                                 struct process_s * process,
639                                 vseg_type_t        type,
640                                 intptr_t           base,
641                                 uint32_t           size,
642                                 uint32_t           file_offset,
643                                 uint32_t           file_size,
644                                 xptr_t             mapper_xp,
645                                 cxy_t              vseg_cxy,
646                                 struct vseg_s   ** vseg );
647
648void rpc_vmm_create_vseg_server( xptr_t xp );
649
650/***********************************************************************************
[408]651 * [28] The RPC_VMM_SET_COW allows a client thread to request the remote reference
652 * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for
653 * the DATA, MMAP and REMOTE vsegs of process identified by the <process> argument.
654
655 * of a remote scheduler, identified by the <lid> argument.
656 ***********************************************************************************
657 * @ cxy         : server cluster identifier.
658 * @ process     : [in]  local pointer on reference process descriptor.
659 **********************************************************************************/
660void rpc_vmm_set_cow_client( cxy_t              cxy,
661                             struct process_s * process );
662
663void rpc_vmm_set_cow_server( xptr_t xp );
664
[428]665/***********************************************************************************
666 * [29] The RPC_VMM_DISPLAY allows any client thread to display the VMM state
667 * of a remote reference process identified by the <cxy> and <process> arguments.
668 * The type of display is defined by the <detailed> boolean argument.
669 ***********************************************************************************
670 * @ cxy         : server cluster identifier.
671 * @ process     : [in]  local pointer on reference process descriptor.
672 * @ detailed    : [in]  detailed display if true.
673 **********************************************************************************/
674void rpc_vmm_display_client( cxy_t              cxy,
675                             struct process_s * process,
676                             bool_t             detailed );
677
678void rpc_vmm_display_server( xptr_t xp );
679
680
[1]681#endif
Note: See TracBrowser for help on using the repository browser.