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