Changeset 619 for trunk/kernel/kern/rpc.c
- Timestamp:
- Feb 12, 2019, 1:15:47 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r614 r619 143 143 client_core_lid = this->core->lid; 144 144 145 // check calling thread can yield when client threadis not the IDLE thread145 // check calling thread can yield when is not the IDLE thread 146 146 // RPCs executed by the IDLE thread during kernel_init do not deschedule 147 147 if( this->type != THREAD_IDLE ) thread_assert_can_yield( this , __FUNCTION__ ); … … 184 184 while( full ); 185 185 186 hal_fence();187 188 186 #if DEBUG_RPC_CLIENT_GENERIC 189 187 uint32_t cycle = (uint32_t)hal_get_cycles(); … … 199 197 200 198 // wait RPC completion before returning if blocking RPC : 201 // - deschedul ingwithout blocking if thread idle (in kernel init)199 // - deschedule without blocking if thread idle (in kernel init) 202 200 // - block and deschedule policy for any other thread 203 201 if ( rpc->blocking ) … … 212 210 __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle ); 213 211 #endif 214 215 while( rpc->responses ) sched_yield( "busy waiting on RPC"); 216 212 while( 1 ) 213 { 214 // check responses counter 215 if( hal_remote_l32( XPTR( local_cxy , rpc->rsp ) ) == 0 ) break; 216 217 // deschedule 218 sched_yield("busy_waiting RPC completion"); 219 } 220 217 221 #if DEBUG_RPC_CLIENT_GENERIC 218 222 cycle = (uint32_t)hal_get_cycles(); … … 242 246 cycle = (uint32_t)hal_get_cycles(); 243 247 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 244 printk("\n[%s] thread[%x,%x] resumes for rpc %s / cycle %d\n",248 printk("\n[%s] thread[%x,%x] resumes after rpc %s / cycle %d\n", 245 249 __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle ); 246 250 #endif … … 248 252 249 253 // response must be available for a blocking RPC 250 assert( ( rpc->responses== 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] );254 assert( (*rpc->rsp == 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] ); 251 255 252 256 } … … 270 274 271 275 //////////////////////////// 272 void rpc_ thread_func( void )276 void rpc_server_func( void ) 273 277 { 274 278 error_t empty; // local RPC fifo state … … 278 282 uint32_t index; // RPC request index 279 283 thread_t * client_ptr; // local pointer on client thread 284 xptr_t client_xp; // extended pointer on client thread 285 lid_t client_lid; // local index of client core 280 286 thread_t * server_ptr; // local pointer on server thread 281 287 xptr_t server_xp; // extended pointer on server thread 282 lid_t client_core_lid; // local index of client core 283 lid_t server_core_lid; // local index of server core 284 bool_t blocking; // blocking RPC when true 288 lid_t server_lid; // local index of server core 285 289 remote_fifo_t * rpc_fifo; // local pointer on RPC fifo 286 uint32_t count; // current number of expected responses 287 290 uint32_t * rsp_ptr; // local pointer on responses counter 291 xptr_t rsp_xp; // extended pointer on responses counter 292 uint32_t responses; // number of expected responses 293 288 294 // makes RPC thread not preemptable 289 295 hal_disable_irq( NULL ); … … 291 297 server_ptr = CURRENT_THREAD; 292 298 server_xp = XPTR( local_cxy , server_ptr ); 293 server_ core_lid= server_ptr->core->lid;294 rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[server_ core_lid];299 server_lid = server_ptr->core->lid; 300 rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[server_lid]; 295 301 296 302 // "infinite" RPC thread loop … … 305 311 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 306 312 printk("\n[%s] RPC thread[%x,%x] on core[%d] takes RPC_FIFO ownership / cycle %d\n", 307 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_ core_lid, cycle );313 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_lid, cycle ); 308 314 #endif 309 315 // try to consume one RPC request … … 320 326 desc_ptr = GET_PTR( desc_xp ); 321 327 328 // get relevant infos from RPC descriptor 322 329 index = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->index ) ); 323 blocking = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->blocking ) );324 330 client_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) ); 331 rsp_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->rsp ) ); 332 client_lid = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->lid ) ); 333 334 rsp_xp = XPTR( desc_cxy , rsp_ptr ); 335 client_xp = XPTR( desc_cxy , client_ptr ); 325 336 326 337 #if DEBUG_RPC_SERVER_GENERIC … … 332 343 #endif 333 344 // register client thread in RPC thread descriptor 334 server_ptr->rpc_client_xp = XPTR( desc_cxy , client_ptr );345 server_ptr->rpc_client_xp = client_xp; 335 346 336 347 // call the relevant server function … … 343 354 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, rpc_str[index], desc_cxy, cycle ); 344 355 #endif 345 // decrement expected responses counter in RPC descriptor346 count = hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 );347 348 // decrement response counter in RPC descriptorif last response349 if( count== 1 )356 // decrement expected responses counter 357 responses = hal_remote_atomic_add( rsp_xp , -1 ); 358 359 // unblock client thread if last response 360 if( responses == 1 ) 350 361 { 351 // get client thread pointer and client core lid from RPC descriptor352 client_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) );353 client_core_lid = hal_remote_l32 ( XPTR( desc_cxy , &desc_ptr->lid ) );354 355 362 // unblock client thread 356 thread_unblock( XPTR( desc_cxy , client_ptr ), THREAD_BLOCKED_RPC );363 thread_unblock( client_xp , THREAD_BLOCKED_RPC ); 357 364 358 365 hal_fence(); … … 360 367 #if DEBUG_RPC_SERVER_GENERIC 361 368 cycle = (uint32_t)hal_get_cycles(); 369 trdid_t client_trdid = hal_remote_l32( XPTR( desc_cxy , &client_ptr->trdid ) ); 370 process_t * process = hal_remote_lpt( XPTR( desc_cxy , &client_ptr->process ) ); 371 pid_t client_pid = hal_remote_l32( XPTR( desc_cxy , &process->pid ) ); 362 372 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 363 373 printk("\n[%s] RPC thread[%x,%x] unblocked client thread[%x,%x] / cycle %d\n", 364 374 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, 365 client_p tr->process->pid, client_ptr->trdid, cycle );375 client_pid, client_trdid, cycle ); 366 376 #endif 367 377 // send IPI to client core 368 dev_pic_send_ipi( desc_cxy , client_ core_lid );378 dev_pic_send_ipi( desc_cxy , client_lid ); 369 379 } 370 380 } // end RPC handling if fifo non empty … … 372 382 373 383 // sucide if too many RPC threads 374 if( LOCAL_CLUSTER->rpc_threads[server_ core_lid] >= CONFIG_RPC_THREADS_MAX )384 if( LOCAL_CLUSTER->rpc_threads[server_lid] >= CONFIG_RPC_THREADS_MAX ) 375 385 { 376 386 … … 382 392 #endif 383 393 // update RPC threads counter 384 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_ core_lid] , -1 );394 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_lid] , -1 ); 385 395 386 396 // RPC thread blocks on GLOBAL … … 397 407 uint32_t cycle = (uint32_t)hal_get_cycles(); 398 408 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 399 printk("\n[%s] RPC thread[%x,%x] block IDLE& deschedules / cycle %d\n",409 printk("\n[%s] RPC thread[%x,%x] blocks & deschedules / cycle %d\n", 400 410 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, cycle ); 401 411 #endif … … 407 417 } 408 418 } // end infinite loop 409 } // end rpc_thread_func() 419 420 } // end rpc_server_func() 410 421 411 422 … … 427 438 #endif 428 439 429 assert( (cxy != local_cxy) , "server cluster is not remote\n");440 uint32_t responses = 1; 430 441 431 442 // initialise RPC descriptor header … … 433 444 rpc.index = RPC_PMEM_GET_PAGES; 434 445 rpc.blocking = true; 435 rpc.r esponses = 1;446 rpc.rsp = &responses; 436 447 437 448 // set input arguments in RPC descriptor … … 485 496 486 497 ///////////////////////////////////////////////////////////////////////////////////////// 487 // [1] Marshaling functions attached to RPC_PMEM_RELEASE_PAGES (blocking)498 // [1] Marshaling functions attached to RPC_PMEM_RELEASE_PAGES 488 499 ///////////////////////////////////////////////////////////////////////////////////////// 489 500 … … 500 511 #endif 501 512 502 assert( (cxy != local_cxy) , "server cluster is not remote\n");513 uint32_t responses = 1; 503 514 504 515 // initialise RPC descriptor header … … 506 517 rpc.index = RPC_PMEM_RELEASE_PAGES; 507 518 rpc.blocking = true; 508 rpc.r esponses = 1;519 rpc.rsp = &responses; 509 520 510 521 // set input arguments in RPC descriptor … … 559 570 560 571 ///////////////////////////////////////////////////////////////////////////////////////// 561 // [3] Marshaling functions attached to RPC_PROCESS_MAKE_FORK (blocking)572 // [3] Marshaling functions attached to RPC_PROCESS_MAKE_FORK 562 573 ///////////////////////////////////////////////////////////////////////////////////////// 563 574 … … 578 589 #endif 579 590 580 assert( (cxy != local_cxy) , "server cluster is not remote\n");591 uint32_t responses = 1; 581 592 582 593 // initialise RPC descriptor header … … 584 595 rpc.index = RPC_PROCESS_MAKE_FORK; 585 596 rpc.blocking = true; 586 rpc.r esponses = 1;597 rpc.rsp = &responses; 587 598 588 599 // set input arguments in RPC descriptor … … 651 662 652 663 ///////////////////////////////////////////////////////////////////////////////////////// 653 // [4] Marshaling functions attached to RPC_USER_DIR_CREATE (blocking)664 // [4] Marshaling functions attached to RPC_USER_DIR_CREATE 654 665 ///////////////////////////////////////////////////////////////////////////////////////// 655 666 … … 668 679 #endif 669 680 670 assert( (cxy != local_cxy) , "server cluster is not remote\n");681 uint32_t responses = 1; 671 682 672 683 // initialise RPC descriptor header … … 674 685 rpc.index = RPC_USER_DIR_CREATE; 675 686 rpc.blocking = true; 676 rpc.r esponses = 1;687 rpc.rsp = &responses; 677 688 678 689 // set input arguments in RPC descriptor … … 732 743 733 744 ///////////////////////////////////////////////////////////////////////////////////////// 734 // [5] Marshaling functions attached to RPC_USER_DIR_DESTROY (blocking)745 // [5] Marshaling functions attached to RPC_USER_DIR_DESTROY 735 746 ///////////////////////////////////////////////////////////////////////////////////////// 736 747 … … 748 759 #endif 749 760 750 assert( (cxy != local_cxy) , "server cluster is not remote\n");761 uint32_t responses = 1; 751 762 752 763 // initialise RPC descriptor header … … 754 765 rpc.index = RPC_USER_DIR_DESTROY; 755 766 rpc.blocking = true; 756 rpc.r esponses = 1;767 rpc.rsp = &responses; 757 768 758 769 // set input arguments in RPC descriptor … … 805 816 806 817 ///////////////////////////////////////////////////////////////////////////////////////// 807 // [6] Marshaling functions attached to RPC_THREAD_USER_CREATE (blocking)818 // [6] Marshaling functions attached to RPC_THREAD_USER_CREATE 808 819 ///////////////////////////////////////////////////////////////////////////////////////// 809 820 … … 824 835 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 825 836 #endif 826 827 assert( (cxy != local_cxy) , "server cluster is not remote\n");837 838 uint32_t responses = 1; 828 839 829 840 // initialise RPC descriptor header … … 831 842 rpc.index = RPC_THREAD_USER_CREATE; 832 843 rpc.blocking = true; 833 rpc.r esponses = 1;844 rpc.rsp = &responses; 834 845 835 846 // set input arguments in RPC descriptor … … 929 940 #endif 930 941 931 assert( (cxy != local_cxy) , "server cluster is not remote\n");942 uint32_t responses = 1; 932 943 933 944 // initialise RPC descriptor header … … 935 946 rpc.index = RPC_THREAD_KERNEL_CREATE; 936 947 rpc.blocking = true; 937 rpc.r esponses = 1;948 rpc.rsp = &responses; 938 949 939 950 // set input arguments in RPC descriptor … … 1007 1018 1008 1019 ///////////////////////////////////////////////////////////////////////////////////////// 1009 // [9] Marshaling functions attached to RPC_PROCESS_SIGACTION (non blocking)1020 // [9] Marshaling functions attached to RPC_PROCESS_SIGACTION 1010 1021 ///////////////////////////////////////////////////////////////////////////////////////// 1011 1022 1012 1023 //////////////////////////////////////////////////// 1013 1024 void rpc_process_sigaction_client( cxy_t cxy, 1014 rpc_desc_t * rpc ) 1025 pid_t pid, 1026 uint32_t action ) 1015 1027 { 1016 1028 #if DEBUG_RPC_PROCESS_SIGACTION … … 1018 1030 thread_t * this = CURRENT_THREAD; 1019 1031 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 1020 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1021 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1022 #endif 1023 1024 // check RPC "index" and "blocking" arguments 1025 assert( (rpc->blocking == false) , "must be non-blocking\n"); 1026 assert( (rpc->index == RPC_PROCESS_SIGACTION ) , "bad RPC index\n" ); 1027 1028 // register RPC request in remote RPC fifo and return 1029 rpc_send( cxy , rpc ); 1032 printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n", 1033 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, 1034 process_action_str( action ), pid, cycle ); 1035 #endif 1036 1037 uint32_t responses = 1; 1038 rpc_desc_t rpc; 1039 1040 // initialise RPC descriptor header 1041 rpc.index = RPC_PROCESS_SIGACTION; 1042 rpc.blocking = true; 1043 rpc.rsp = &responses; 1044 1045 // set input arguments in RPC descriptor 1046 rpc.args[0] = (uint64_t)pid; 1047 rpc.args[1] = (uint64_t)action; 1048 1049 // register RPC request in remote RPC fifo 1050 rpc_send( cxy , &rpc ); 1030 1051 1031 1052 #if DEBUG_RPC_PROCESS_SIGACTION 1032 1053 cycle = (uint32_t)hal_get_cycles(); 1033 1054 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 1034 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1035 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1055 printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n", 1056 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, 1057 process_action_str( action ), pid, cycle ); 1036 1058 #endif 1037 1059 } // end rpc_process_sigaction_client() … … 1040 1062 void rpc_process_sigaction_server( xptr_t xp ) 1041 1063 { 1042 #if DEBUG_RPC_PROCESS_SIGACTION1043 uint32_t cycle = (uint32_t)hal_get_cycles();1044 thread_t * this = CURRENT_THREAD;1045 if( DEBUG_RPC_PROCESS_SIGACTION < cycle )1046 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",1047 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );1048 #endif1049 1050 1064 // get client cluster identifier and pointer on RPC descriptor 1051 1065 cxy_t client_cxy = GET_CXY( xp ); … … 1056 1070 uint32_t action = (uint32_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) ); 1057 1071 1072 #if DEBUG_RPC_PROCESS_SIGACTION 1073 uint32_t cycle = (uint32_t)hal_get_cycles(); 1074 thread_t * this = CURRENT_THREAD; 1075 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 1076 printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n", 1077 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, 1078 process_action_str( action ), pid, cycle ); 1079 #endif 1080 1058 1081 // get client thread pointers 1059 1082 thread_t * client_ptr = hal_remote_lpt( XPTR( client_cxy , &desc->thread ) ); … … 1063 1086 process_t * process = cluster_get_local_process_from_pid( pid ); 1064 1087 1065 // call relevant kernel function 1066 if ( action == DELETE_ALL_THREADS ) process_delete_threads ( process , client_xp ); 1067 else if ( action == BLOCK_ALL_THREADS ) process_block_threads ( process ); 1068 else if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process ); 1088 // call relevant kernel function if found / does nothing if not found 1089 if( process != NULL ) 1090 { 1091 if ( action == DELETE_ALL_THREADS ) process_delete_threads ( process , client_xp ); 1092 if ( action == BLOCK_ALL_THREADS ) process_block_threads ( process ); 1093 if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process ); 1094 } 1069 1095 1070 1096 #if DEBUG_RPC_PROCESS_SIGACTION 1071 1097 cycle = (uint32_t)hal_get_cycles(); 1072 1098 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 1073 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1074 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 1099 printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n", 1100 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, 1101 process_action_str( action ), pid, cycle ); 1075 1102 #endif 1076 1103 } // end rpc_process_sigaction_server() 1077 1104 1078 1105 ///////////////////////////////////////////////////////////////////////////////////////// 1079 // [10] Marshaling functions attached to RPC_VFS_INODE_CREATE (blocking)1106 // [10] Marshaling functions attached to RPC_VFS_INODE_CREATE 1080 1107 ///////////////////////////////////////////////////////////////////////////////////////// 1081 1108 … … 1099 1126 #endif 1100 1127 1101 assert( (cxy != local_cxy) , "server cluster is not remote\n");1128 uint32_t responses = 1; 1102 1129 1103 1130 // initialise RPC descriptor header … … 1105 1132 rpc.index = RPC_VFS_INODE_CREATE; 1106 1133 rpc.blocking = true; 1107 rpc.r esponses = 1;1134 rpc.rsp = &responses; 1108 1135 1109 1136 // set input arguments in RPC descriptor … … 1184 1211 1185 1212 ///////////////////////////////////////////////////////////////////////////////////////// 1186 // [11] Marshaling functions attached to RPC_VFS_INODE_DESTROY (blocking)1213 // [11] Marshaling functions attached to RPC_VFS_INODE_DESTROY 1187 1214 ///////////////////////////////////////////////////////////////////////////////////////// 1188 1215 … … 1199 1226 #endif 1200 1227 1201 assert( (cxy != local_cxy) , "server cluster is not remote\n");1228 uint32_t responses = 1; 1202 1229 1203 1230 // initialise RPC descriptor header … … 1205 1232 rpc.index = RPC_VFS_INODE_DESTROY; 1206 1233 rpc.blocking = true; 1207 rpc.r esponses = 1;1234 rpc.rsp = &responses; 1208 1235 1209 1236 // set input arguments in RPC descriptor … … 1253 1280 1254 1281 ///////////////////////////////////////////////////////////////////////////////////////// 1255 // [12] Marshaling functions attached to RPC_VFS_DENTRY_CREATE (blocking)1282 // [12] Marshaling functions attached to RPC_VFS_DENTRY_CREATE 1256 1283 ///////////////////////////////////////////////////////////////////////////////////////// 1257 1284 … … 1271 1298 #endif 1272 1299 1273 assert( (cxy != local_cxy) , "server cluster is not remote\n");1300 uint32_t responses = 1; 1274 1301 1275 1302 // initialise RPC descriptor header … … 1277 1304 rpc.index = RPC_VFS_DENTRY_CREATE; 1278 1305 rpc.blocking = true; 1279 rpc.r esponses = 1;1306 rpc.rsp = &responses; 1280 1307 1281 1308 // set input arguments in RPC descriptor … … 1344 1371 1345 1372 ///////////////////////////////////////////////////////////////////////////////////////// 1346 // [13] Marshaling functions attached to RPC_VFS_DENTRY_DESTROY (blocking)1373 // [13] Marshaling functions attached to RPC_VFS_DENTRY_DESTROY 1347 1374 ///////////////////////////////////////////////////////////////////////////////////////// 1348 1375 … … 1359 1386 #endif 1360 1387 1361 assert( (cxy != local_cxy) , "server cluster is not remote\n");1388 uint32_t responses = 1; 1362 1389 1363 1390 // initialise RPC descriptor header … … 1365 1392 rpc.index = RPC_VFS_DENTRY_DESTROY; 1366 1393 rpc.blocking = true; 1367 rpc.r esponses = 1;1394 rpc.rsp = &responses; 1368 1395 1369 1396 // set input arguments in RPC descriptor … … 1414 1441 1415 1442 ///////////////////////////////////////////////////////////////////////////////////////// 1416 // [14] Marshaling functions attached to RPC_VFS_FILE_CREATE (blocking)1443 // [14] Marshaling functions attached to RPC_VFS_FILE_CREATE 1417 1444 ///////////////////////////////////////////////////////////////////////////////////////// 1418 1445 … … 1432 1459 #endif 1433 1460 1434 assert( (cxy != local_cxy) , "server cluster is not remote\n");1461 uint32_t responses = 1; 1435 1462 1436 1463 // initialise RPC descriptor header … … 1438 1465 rpc.index = RPC_VFS_FILE_CREATE; 1439 1466 rpc.blocking = true; 1440 rpc.r esponses = 1;1467 rpc.rsp = &responses; 1441 1468 1442 1469 // set input arguments in RPC descriptor … … 1501 1528 1502 1529 ///////////////////////////////////////////////////////////////////////////////////////// 1503 // [15] Marshaling functions attached to RPC_VFS_FILE_DESTROY (blocking)1530 // [15] Marshaling functions attached to RPC_VFS_FILE_DESTROY 1504 1531 ///////////////////////////////////////////////////////////////////////////////////////// 1505 1532 … … 1516 1543 #endif 1517 1544 1518 assert( (cxy != local_cxy) , "server cluster is not remote\n");1545 uint32_t responses = 1; 1519 1546 1520 1547 // initialise RPC descriptor header … … 1522 1549 rpc.index = RPC_VFS_FILE_DESTROY; 1523 1550 rpc.blocking = true; 1524 rpc.r esponses = 1;1551 rpc.rsp = &responses; 1525 1552 1526 1553 // set input arguments in RPC descriptor … … 1570 1597 1571 1598 ///////////////////////////////////////////////////////////////////////////////////////// 1572 // [16] Marshaling functions attached to RPC_VFS_FS_GET_DENTRY (blocking)1599 // [16] Marshaling functions attached to RPC_VFS_FS_GET_DENTRY 1573 1600 ///////////////////////////////////////////////////////////////////////////////////////// 1574 1601 … … 1588 1615 #endif 1589 1616 1590 assert( (cxy != local_cxy) , "server cluster is not remote\n");1617 uint32_t responses = 1; 1591 1618 1592 1619 // initialise RPC descriptor header … … 1594 1621 rpc.index = RPC_VFS_FS_GET_DENTRY; 1595 1622 rpc.blocking = true; 1596 rpc.r esponses = 1;1623 rpc.rsp = &responses; 1597 1624 1598 1625 // set input arguments in RPC descriptor … … 1661 1688 1662 1689 ///////////////////////////////////////////////////////////////////////////////////////// 1663 // [17] Marshaling function attached to RPC_VFS_FS_ADD_DENTRY (blocking)1690 // [17] Marshaling function attached to RPC_VFS_FS_ADD_DENTRY 1664 1691 ///////////////////////////////////////////////////////////////////////////////////////// 1665 1692 … … 1677 1704 #endif 1678 1705 1679 assert( (cxy != local_cxy) , "server cluster is not remote\n");1706 uint32_t responses = 1; 1680 1707 1681 1708 // initialise RPC descriptor header … … 1683 1710 rpc.index = RPC_VFS_FS_ADD_DENTRY; 1684 1711 rpc.blocking = true; 1685 rpc.r esponses = 1;1712 rpc.rsp = &responses; 1686 1713 1687 1714 // set input arguments in RPC descriptor … … 1703 1730 } 1704 1731 1705 ////////////////////////////////////////////// ///1732 ////////////////////////////////////////////// 1706 1733 void rpc_vfs_fs_add_dentry_server( xptr_t xp ) 1707 1734 { … … 1741 1768 1742 1769 ///////////////////////////////////////////////////////////////////////////////////////// 1743 // [18] Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY (blocking)1770 // [18] Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY 1744 1771 ///////////////////////////////////////////////////////////////////////////////////////// 1745 1772 … … 1757 1784 #endif 1758 1785 1759 assert( (cxy != local_cxy) , "server cluster is not remote\n");1786 uint32_t responses = 1; 1760 1787 1761 1788 // initialise RPC descriptor header … … 1763 1790 rpc.index = RPC_VFS_FS_REMOVE_DENTRY; 1764 1791 rpc.blocking = true; 1765 rpc.r esponses = 1;1792 rpc.rsp = &responses; 1766 1793 1767 1794 // set input arguments in RPC descriptor … … 1821 1848 1822 1849 ///////////////////////////////////////////////////////////////////////////////////////// 1823 // [19] Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES (blocking)1850 // [19] Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES 1824 1851 ///////////////////////////////////////////////////////////////////////////////////////// 1825 1852 … … 1837 1864 #endif 1838 1865 1839 assert( (cxy != local_cxy) , "server cluster is not remote\n");1866 uint32_t responses = 1; 1840 1867 1841 1868 // initialise RPC descriptor header … … 1843 1870 rpc.index = RPC_VFS_INODE_LOAD_ALL_PAGES; 1844 1871 rpc.blocking = true; 1845 rpc.r esponses = 1;1872 rpc.rsp = &responses; 1846 1873 1847 1874 // set input arguments in RPC descriptor … … 1898 1925 1899 1926 ///////////////////////////////////////////////////////////////////////////////////////// 1900 // [20] Marshaling functions attached to RPC_VMM_GET_VSEG (blocking)1927 // [20] Marshaling functions attached to RPC_VMM_GET_VSEG 1901 1928 ///////////////////////////////////////////////////////////////////////////////////////// 1902 1929 … … 1916 1943 #endif 1917 1944 1918 assert( (cxy != local_cxy) , "server cluster is not remote\n");1945 uint32_t responses = 1; 1919 1946 1920 1947 // initialise RPC descriptor header … … 1922 1949 rpc.index = RPC_VMM_GET_VSEG; 1923 1950 rpc.blocking = true; 1924 rpc.r esponses = 1;1951 rpc.rsp = &responses; 1925 1952 1926 1953 // set input arguments in RPC descriptor … … 1986 2013 1987 2014 ///////////////////////////////////////////////////////////////////////////////////////// 1988 // [21] Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE (blocking)2015 // [21] Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE 1989 2016 ///////////////////////////////////////////////////////////////////////////////////////// 1990 2017 … … 2004 2031 #endif 2005 2032 2006 assert( (cxy != local_cxy) , "server cluster is not remote\n");2033 uint32_t responses = 1; 2007 2034 2008 2035 // initialise RPC descriptor header … … 2010 2037 rpc.index = RPC_VMM_GLOBAL_UPDATE_PTE; 2011 2038 rpc.blocking = true; 2012 rpc.r esponses = 1;2039 rpc.rsp = &responses; 2013 2040 2014 2041 // set input arguments in RPC descriptor … … 2067 2094 2068 2095 ///////////////////////////////////////////////////////////////////////////////////////// 2069 // [22] Marshaling functions attached to RPC_KCM_ALLOC (blocking)2096 // [22] Marshaling functions attached to RPC_KCM_ALLOC 2070 2097 ///////////////////////////////////////////////////////////////////////////////////////// 2071 2098 … … 2073 2100 void rpc_kcm_alloc_client( cxy_t cxy, 2074 2101 uint32_t kmem_type, // in 2075 xptr_t *buf_xp ) // out2102 xptr_t * buf_xp ) // out 2076 2103 { 2077 2104 #if DEBUG_RPC_KCM_ALLOC … … 2083 2110 #endif 2084 2111 2085 assert( (cxy != local_cxy) , "server cluster is not remote\n");2112 uint32_t responses = 1; 2086 2113 2087 2114 // initialise RPC descriptor header … … 2089 2116 rpc.index = RPC_KCM_ALLOC; 2090 2117 rpc.blocking = true; 2091 rpc.r esponses = 1;2118 rpc.rsp = &responses; 2092 2119 2093 2120 // set input arguments in RPC descriptor … … 2145 2172 2146 2173 ///////////////////////////////////////////////////////////////////////////////////////// 2147 // [23] Marshaling functions attached to RPC_KCM_FREE (blocking)2174 // [23] Marshaling functions attached to RPC_KCM_FREE 2148 2175 ///////////////////////////////////////////////////////////////////////////////////////// 2149 2176 … … 2161 2188 #endif 2162 2189 2163 assert( (cxy != local_cxy) , "server cluster is not remote\n");2190 uint32_t responses = 1; 2164 2191 2165 2192 // initialise RPC descriptor header … … 2167 2194 rpc.index = RPC_KCM_FREE; 2168 2195 rpc.blocking = true; 2169 rpc.r esponses = 1;2196 rpc.rsp = &responses; 2170 2197 2171 2198 // set input arguments in RPC descriptor … … 2222 2249 2223 2250 ///////////////////////////////////////////////////////////////////////////////////////// 2224 // [25] Marshaling functions attached to RPC_MAPPER_HANDLE_MISS (blocking)2251 // [25] Marshaling functions attached to RPC_MAPPER_HANDLE_MISS 2225 2252 ///////////////////////////////////////////////////////////////////////////////////////// 2226 2253 … … 2240 2267 #endif 2241 2268 2242 assert( (cxy != local_cxy) , "server cluster is not remote\n");2269 uint32_t responses = 1; 2243 2270 2244 2271 // initialise RPC descriptor header … … 2246 2273 rpc.index = RPC_MAPPER_HANDLE_MISS; 2247 2274 rpc.blocking = true; 2248 rpc.r esponses = 1;2275 rpc.rsp = &responses; 2249 2276 2250 2277 // set input arguments in RPC descriptor … … 2309 2336 2310 2337 ///////////////////////////////////////////////////////////////////////////////////////// 2311 // [26] Marshaling functions attached to RPC_VMM_DELETE_VSEG (parallel / non blocking)2338 // [26] Marshaling functions attached to RPC_VMM_DELETE_VSEG 2312 2339 ///////////////////////////////////////////////////////////////////////////////////////// 2313 2340 2314 2341 ////////////////////////////////////////////////// 2315 2342 void rpc_vmm_delete_vseg_client( cxy_t cxy, 2316 rpc_desc_t * rpc ) 2343 pid_t pid, 2344 intptr_t vaddr ) 2317 2345 { 2318 2346 #if DEBUG_RPC_VMM_DELETE_VSEG … … 2324 2352 #endif 2325 2353 2326 // check RPC "index" and "blocking" arguments 2327 assert( (rpc->blocking == false) , "must be non-blocking\n"); 2328 assert( (rpc->index == RPC_VMM_DELETE_VSEG ) , "bad RPC index\n" ); 2354 uint32_t responses = 1; 2355 rpc_desc_t rpc; 2356 2357 // initialise RPC descriptor header 2358 rpc.index = RPC_VMM_DELETE_VSEG; 2359 rpc.blocking = true; 2360 rpc.rsp = &responses; 2361 2362 // set input arguments in RPC descriptor 2363 rpc.args[0] = (uint64_t)pid; 2364 rpc.args[1] = (uint64_t)vaddr; 2329 2365 2330 2366 // register RPC request in remote RPC fifo 2331 rpc_send( cxy , rpc );2367 rpc_send( cxy , &rpc ); 2332 2368 2333 2369 #if DEBUG_RPC_VMM_DELETE_VSEG … … 2370 2406 2371 2407 ///////////////////////////////////////////////////////////////////////////////////////// 2372 // [27] Marshaling functions attached to RPC_VMM_CREATE_VSEG (blocking)2408 // [27] Marshaling functions attached to RPC_VMM_CREATE_VSEG 2373 2409 ///////////////////////////////////////////////////////////////////////////////////////// 2374 2410 … … 2393 2429 #endif 2394 2430 2395 assert( (cxy != local_cxy) , "server cluster is not remote\n");2431 uint32_t responses = 1; 2396 2432 2397 2433 // initialise RPC descriptor header … … 2399 2435 rpc.index = RPC_VMM_CREATE_VSEG; 2400 2436 rpc.blocking = true; 2401 rpc.r esponses = 1;2437 rpc.rsp = &responses; 2402 2438 2403 2439 // set input arguments in RPC descriptor … … 2472 2508 2473 2509 ///////////////////////////////////////////////////////////////////////////////////////// 2474 // [28] Marshaling functions attached to RPC_VMM_SET_COW (blocking)2510 // [28] Marshaling functions attached to RPC_VMM_SET_COW 2475 2511 ///////////////////////////////////////////////////////////////////////////////////////// 2476 2512 … … 2479 2515 process_t * process ) 2480 2516 { 2481 assert( (cxy != local_cxy) , "server cluster is not remote\n"); 2517 #if DEBUG_RPC_VMM_SET_COW 2518 thread_t * this = CURRENT_THREAD; 2519 uint32_t cycle = (uint32_t)hal_get_cycles(); 2520 if( cycle > DEBUG_RPC_VMM_SET_COW ) 2521 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2522 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2523 #endif 2524 2525 uint32_t responses = 1; 2482 2526 2483 2527 // initialise RPC descriptor header … … 2485 2529 rpc.index = RPC_VMM_SET_COW; 2486 2530 rpc.blocking = true; 2487 rpc.r esponses = 1;2531 rpc.rsp = &responses; 2488 2532 2489 2533 // set input arguments in RPC descriptor … … 2493 2537 rpc_send( cxy , &rpc ); 2494 2538 2539 #if DEBUG_RPC_VMM_SET_COW 2540 cycle = (uint32_t)hal_get_cycles(); 2541 if( cycle > DEBUG_RPC_VMM_SET_COW ) 2542 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2543 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2544 #endif 2495 2545 } 2496 2546 … … 2498 2548 void rpc_vmm_set_cow_server( xptr_t xp ) 2499 2549 { 2550 #if DEBUG_RPC_VMM_SET_COW 2551 thread_t * this = CURRENT_THREAD; 2552 uint32_t cycle = (uint32_t)hal_get_cycles(); 2553 if( cycle > DEBUG_RPC_VMM_SET_COW ) 2554 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2555 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2556 #endif 2557 2500 2558 process_t * process; 2501 2559 … … 2510 2568 vmm_set_cow( process ); 2511 2569 2512 } 2513 2514 ///////////////////////////////////////////////////////////////////////////////////////// 2515 // [29] Marshaling functions attached to RPC_VMM_DISPLAY (blocking) 2570 #if DEBUG_RPC_VMM_SET_COW 2571 cycle = (uint32_t)hal_get_cycles(); 2572 if( cycle > DEBUG_RPC_VMM_SET_COW ) 2573 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2574 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2575 #endif 2576 } 2577 2578 ///////////////////////////////////////////////////////////////////////////////////////// 2579 // [29] Marshaling functions attached to RPC_VMM_DISPLAY 2516 2580 ///////////////////////////////////////////////////////////////////////////////////////// 2517 2581 … … 2521 2585 bool_t detailed ) 2522 2586 { 2523 assert( (cxy != local_cxy) , "server cluster is not remote\n"); 2587 #if DEBUG_RPC_VMM_DISPLAY 2588 thread_t * this = CURRENT_THREAD; 2589 uint32_t cycle = (uint32_t)hal_get_cycles(); 2590 if( cycle > DEBUG_RPC_VMM_DISPLAY ) 2591 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2592 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2593 #endif 2594 2595 uint32_t responses = 1; 2524 2596 2525 2597 // initialise RPC descriptor header … … 2527 2599 rpc.index = RPC_VMM_DISPLAY; 2528 2600 rpc.blocking = true; 2529 rpc.r esponses = 1;2601 rpc.rsp = &responses; 2530 2602 2531 2603 // set input arguments in RPC descriptor … … 2536 2608 rpc_send( cxy , &rpc ); 2537 2609 2610 #if DEBUG_RPC_VMM_DISPLAY 2611 cycle = (uint32_t)hal_get_cycles(); 2612 if( cycle > DEBUG_RPC_VMM_DISPLAY ) 2613 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2614 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2615 #endif 2538 2616 } 2539 2617 … … 2541 2619 void rpc_vmm_display_server( xptr_t xp ) 2542 2620 { 2621 #if DEBUG_RPC_VMM_DISPLAY 2622 thread_t * this = CURRENT_THREAD; 2623 uint32_t cycle = (uint32_t)hal_get_cycles(); 2624 if( cycle > DEBUG_RPC_VMM_DISPLAY ) 2625 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 2626 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2627 #endif 2628 2543 2629 process_t * process; 2544 2630 bool_t detailed; … … 2555 2641 vmm_display( process , detailed ); 2556 2642 2557 } 2558 2559 2643 #if DEBUG_RPC_VMM_DISPLAY 2644 cycle = (uint32_t)hal_get_cycles(); 2645 if( cycle > DEBUG_RPC_VMM_DISPLAY ) 2646 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 2647 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); 2648 #endif 2649 } 2650 2651
Note: See TracChangeset
for help on using the changeset viewer.