Changeset 436 for trunk/kernel/kern/rpc.c
- Timestamp:
- Mar 7, 2018, 9:02:03 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r435 r436 82 82 &rpc_thread_user_create_server, // 6 83 83 &rpc_thread_kernel_create_server, // 7 84 &rpc_ thread_kill_server, // 884 &rpc_undefined, // 8 unused slot 85 85 &rpc_process_sigaction_server, // 9 86 86 … … 122 122 rpc_desc_t * rpc ) 123 123 { 124 error_t error; 125 126 thread_t * this = CURRENT_THREAD; 127 core_t * core = this->core; 124 volatile error_t full = 0; 125 thread_t * this = CURRENT_THREAD; 126 core_t * core = this->core; 127 128 #if CONFIG_DEBUG_RPC_SEND 129 uint32_t cycle = (uint32_t)hal_get_cycles(); 130 if( CONFIG_DEBUG_RPC_SEND < cycle ) 131 printk("\n[DBG] %s : thread %x enter for rpc[%d] / rpc_ptr %x / cycle %d\n", 132 __FUNCTION__, CURRENT_THREAD, rpc->index, rpc, cycle ); 133 #endif 128 134 129 135 // register client thread pointer and core lid in RPC descriptor 130 rpc->thread 131 rpc->lid 136 rpc->thread = this; 137 rpc->lid = core->lid; 132 138 133 139 // build an extended pointer on the RPC descriptor 134 140 xptr_t desc_xp = XPTR( local_cxy , rpc ); 135 141 136 // get local pointer on rpc_fifo in remote cluster, with the 137 // assumption that local pointers are identical in all clusters 142 // get local pointer on rpc_fifo in remote cluster, 138 143 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 139 144 140 // try to post an item in remote fifo 141 // deschedule and retry if remote fifo full 145 // post RPC in remote fifo / deschedule and retry if fifo full 142 146 do 143 147 { 144 error = remote_fifo_put_item( XPTR( server_cxy , rpc_fifo ), 145 (uint64_t )desc_xp ); 146 if ( error ) 148 full = remote_fifo_put_item( XPTR( server_cxy , rpc_fifo ), (uint64_t )desc_xp ); 149 if ( full ) 147 150 { 148 151 printk("\n[WARNING] %s : cluster %x cannot post RPC to cluster %x\n", 149 152 __FUNCTION__ , local_cxy , server_cxy ); 150 153 151 if( thread_can_yield() ) sched_yield("RPC fifo full"); 154 // deschedule without blocking 155 sched_yield("RPC fifo full"); 152 156 } 153 157 } 154 while( error);158 while( full ); 155 159 156 160 hal_fence(); … … 167 171 { 168 172 169 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s busy waiting after registering RPC\n" 170 " rpc = %d / server = %x / cycle %d\n", 171 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) , 172 rpc->index , server_cxy , hal_time_stamp() ); 173 #if CONFIG_DEBUG_RPC_SEND 174 cycle = (uint32_t)hal_get_cycles(); 175 if( CONFIG_DEBUG_RPC_SEND < cycle ) 176 printk("\n[DBG] %s : thread %x busy waiting / rpc[%d] / server = %x / cycle %d\n", 177 __FUNCTION__, CURRENT_THREAD, rpc->index , server_cxy , cycle ); 178 #endif 173 179 174 180 while( rpc->response ) hal_fixed_delay( 100 ); 175 181 176 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s exit after RPC completion\n", 177 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) ); 178 182 #if CONFIG_DEBUG_RPC_SEND 183 cycle = (uint32_t)hal_get_cycles(); 184 if( CONFIG_DEBUG_RPC_SEND < cycle ) 185 printk("\n[DBG] %s : thread % resume / rpc[%d] / cycle %d\n", 186 __FUNCTION__, CURRENT_THREAD, rpc->index, cycle ); 187 #endif 179 188 } 180 else 189 else // block & deschedule 181 190 { 182 191 183 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s deschedule after registering RPC\n" 184 " rpc = %d / server = %x / cycle %d\n", 185 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) , 186 rpc->index , server_cxy , hal_time_stamp() ); 187 188 thread_block( this , THREAD_BLOCKED_RPC ); 189 sched_yield("BLOCKED on RPC"); 190 191 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s resumes after RPC completion\n", 192 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) ); 193 192 #if CONFIG_DEBUG_RPC_SEND 193 cycle = (uint32_t)hal_get_cycles(); 194 if( CONFIG_DEBUG_RPC_SEND < cycle ) 195 printk("\n[DBG] %s : thread %x block & deschedule / rpc[%d] / server = %x / cycle %d\n", 196 __FUNCTION__, CURRENT_THREAD, rpc->index , server_cxy , cycle ); 197 #endif 198 thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_RPC ); 199 sched_yield("blocked on RPC"); 200 201 #if CONFIG_DEBUG_RPC_SEND 202 cycle = (uint32_t)hal_get_cycles(); 203 if( CONFIG_DEBUG_RPC_SEND < cycle ) 204 printk("\n[DBG] %s : thread % resume / rpcr[%d] / cycle %d\n", 205 __FUNCTION__, CURRENT_THREAD, rpc->index, cycle ); 206 #endif 194 207 } 195 208 … … 199 212 // acknowledge the IPI sent by the server 200 213 dev_pic_ack_ipi(); 214 } 215 else 216 { 217 218 #if CONFIG_DEBUG_RPC_SEND 219 cycle = (uint32_t)hal_get_cycles(); 220 if( CONFIG_DEBUG_RPC_SEND < cycle ) 221 printk("\n[DBG] %s : non blocking rpc[%d] => thread return / cycle %d\n", 222 __FUNCTION__, rpc->index, CURRENT_THREAD, cycle ); 223 #endif 224 201 225 } 202 226 } // end rpc_send() … … 220 244 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 221 245 222 grpc_dmsg("\n[DBG] %s : core[%x,%d] / interrupted thread %s / cycle %d\n", 223 __FUNCTION__, local_cxy, core->lid, thread_type_str(this->type), hal_time_stamp() ); 246 #if CONFIG_DEBUG_RPC_SERVER 247 uint32_t cycle = (uint32_t)hal_get_cycles(); 248 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 249 printk("\n[DBG] %s : thread %x interrupted in cluster %x / cycle %d\n", 250 __FUNCTION__, this, local_cxy, cycle ); 251 #endif 224 252 225 253 // interrupted thread not preemptable during RPC chek … … 262 290 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 ); 263 291 264 grpc_dmsg("\n[DBG] %s : core [%x,%d] creates a new RPC thread %x / trdid %x / cycle %d\n", 265 __FUNCTION__ , local_cxy , core->lid , thread , thread->trdid , hal_time_stamp() ); 266 292 #if CONFIG_DEBUG_RPC_SERVER 293 cycle = (uint32_t)hal_get_cycles(); 294 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 295 printk("\n[DBG] %s : create a new RPC thread %x in cluster %x / cycle %d\n", 296 __FUNCTION__, thread, local_cxy, cycle ); 297 #endif 267 298 } 268 299 } 269 300 } 270 301 271 grpc_dmsg("\n[DBG] %s : core[%x,%d] / interrupted thread %s deschedules / cycle %d\n", 272 __FUNCTION__, local_cxy, core->lid, thread_type_str(this->type), hal_time_stamp() ); 302 #if CONFIG_DEBUG_RPC_SERVER 303 cycle = (uint32_t)hal_get_cycles(); 304 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 305 printk("\n[DBG] %s : interrupted thread %x deschedules in cluster %x / cycle %d\n", 306 __FUNCTION__, this, local_cxy, cycle ); 307 #endif 273 308 274 309 // interrupted thread deschedule always 275 310 sched_yield("IPI received"); 276 311 277 grpc_dmsg("\n[DBG] %s : core[%x,%d] / interrupted thread %s resume / cycle %d\n", 278 __FUNCTION__, local_cxy, core->lid, thread_type_str(this->type), hal_time_stamp() ); 312 #if CONFIG_DEBUG_RPC_SERVER 313 cycle = (uint32_t)hal_get_cycles(); 314 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 315 printk("\n[DBG] %s : interrupted thread %x resumes in cluster %x / cycle %d\n", 316 __FUNCTION__, this, local_cxy, cycle ); 317 #endif 279 318 280 319 // interrupted thread restore IRQs after resume … … 312 351 if( hal_atomic_test_set( &rpc_fifo->owner , this->trdid ) ) 313 352 { 353 354 #if CONFIG_DEBUG_RPC_SERVER 355 uint32_t cycle = (uint32_t)hal_get_cycles(); 356 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 357 printk("\n[DBG] %s : RPC thread %x takes RPC fifo ownership / cluster %x / cycle %d\n", 358 __FUNCTION__, this, local_cxy, cycle ); 359 #endif 314 360 // initializes RPC requests counter 315 361 count = 0; … … 324 370 while( 1 ) // internal loop 325 371 { 326 327 372 empty = local_fifo_get_item( rpc_fifo , (uint64_t *)&desc_xp ); 328 373 … … 330 375 { 331 376 // get client cluster and pointer on RPC descriptor 332 desc_cxy = (cxy_t)GET_CXY( desc_xp ); 333 desc_ptr = (rpc_desc_t *)GET_PTR( desc_xp ); 334 335 // get RPC <index> & <blocking> fields from RPC descriptor 336 index = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->index ) ); 337 blocking = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->blocking ) ); 338 339 grpc_dmsg("\n[DBG] %s : core[%x,%d] / RPC thread %x / starts rpc %d / cycle %d\n", 340 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , index , (uint32_t)hal_get_cycles() ); 341 377 desc_cxy = GET_CXY( desc_xp ); 378 desc_ptr = GET_PTR( desc_xp ); 379 380 index = desc_ptr->index; 381 blocking = desc_ptr->blocking; 382 383 #if CONFIG_DEBUG_RPC_SERVER 384 cycle = (uint32_t)hal_get_cycles(); 385 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 386 printk("\n[DBG] %s : RPC thread %x got rpc[%d] / rpc_ptr %x / cycle %d\n", 387 __FUNCTION__, this, index, desc_ptr, cycle ); 388 #endif 342 389 // call the relevant server function 343 390 rpc_server[index]( desc_xp ); 344 391 345 grpc_dmsg("\n[DBG] %s : core[%x,%d] / RPC thread %x / completes rpc %d / cycle %d\n", 346 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , index , hal_time_stamp() ); 347 392 #if CONFIG_DEBUG_RPC_SERVER 393 cycle = (uint32_t)hal_get_cycles(); 394 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 395 printk("\n[DBG] %s : RPC thread %x completes rpc %d in cluster %x / cycle %d\n", 396 __FUNCTION__, this, index, local_cxy, cycle ); 397 #endif 348 398 // increment handled RPCs counter 349 399 count++; … … 382 432 { 383 433 384 grpc_dmsg("\n[DBG] %s : core[%x,%d] (RPC thread %x) suicide at cycle %d\n", 385 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 386 434 #if CONFIG_DEBUG_RPC_SERVER 435 uint32_t cycle = (uint32_t)hal_get_cycles(); 436 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 437 printk("\n[DBG] %s : RPC thread %x suicides in cluster %x / cycle %d\n", 438 __FUNCTION__, this, local_cxy, cycle ); 439 #endif 387 440 // update RPC threads counter 388 441 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , -1 ); 389 442 390 443 // suicide 391 thread_kill( this ); 444 thread_kill( XPTR( local_cxy , this ), 445 true, // is_exit 446 true ); // is forced 392 447 } 393 448 394 grpc_dmsg("\n[DBG] %s : core[%x,%d] (RPC thread %x) deschedules / cycle %d\n", 395 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 449 #if CONFIG_DEBUG_RPC_SERVER 450 uint32_t cycle = (uint32_t)hal_get_cycles(); 451 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 452 printk("\n[DBG] %s : RPC thread %x deschedules in cluster %x / cycle %d\n", 453 __FUNCTION__, this, local_cxy, cycle ); 454 #endif 396 455 397 456 // deschedule without blocking 398 457 sched_yield("RPC fifo empty or too much work"); 399 458 400 grpc_dmsg("\n[DBG] %s : core[%x,%d] (RPC thread %x) resumes / cycle %d\n", 401 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 459 #if CONFIG_DEBUG_RPC_SERVER 460 cycle = (uint32_t)hal_get_cycles(); 461 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 462 printk("\n[DBG] %s : RPC thread %x resumes in cluster %x / cycle %d\n", 463 __FUNCTION__, this, local_cxy, cycle ); 464 #endif 402 465 403 466 } // end external loop … … 430 493 rpc.args[0] = (uint64_t)order; 431 494 432 // register RPC request in remote RPC fifo (blocking function)495 // register RPC request in remote RPC fifo 433 496 rpc_send( cxy , &rpc ); 434 497 … … 449 512 450 513 // get client cluster identifier and pointer on RPC descriptor 451 cxy_t cxy = (cxy_t)GET_CXY( xp );452 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );514 cxy_t cxy = GET_CXY( xp ); 515 rpc_desc_t * desc = GET_PTR( xp ); 453 516 454 517 // get input arguments from client RPC descriptor … … 489 552 rpc.args[0] = (uint64_t)(intptr_t)page; 490 553 491 // register RPC request in remote RPC fifo (blocking function)554 // register RPC request in remote RPC fifo 492 555 rpc_send( cxy , &rpc ); 493 556 … … 505 568 506 569 // get client cluster identifier and pointer on RPC descriptor 507 cxy_t cxy = (cxy_t)GET_CXY( xp );508 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );570 cxy_t cxy = GET_CXY( xp ); 571 rpc_desc_t * desc = GET_PTR( xp ); 509 572 510 573 // get input arguments from client RPC descriptor … … 554 617 rpc.args[1] = (uint64_t)(intptr_t)parent_thread_xp; 555 618 556 // register RPC request in remote RPC fifo (blocking function)619 // register RPC request in remote RPC fifo 557 620 rpc_send( cxy , &rpc ); 558 621 … … 581 644 582 645 // get client cluster identifier and pointer on RPC descriptor 583 cxy_t client_cxy = (cxy_t)GET_CXY( xp );584 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );646 cxy_t client_cxy = GET_CXY( xp ); 647 rpc_desc_t * desc = GET_PTR( xp ); 585 648 586 649 // get input arguments from cient RPC descriptor … … 613 676 614 677 ///////////////////////////////////////////////////////////////////////////////////////// 615 // [6] 678 // [6] Marshaling functions attached to RPC_THREAD_USER_CREATE (blocking) 616 679 ///////////////////////////////////////////////////////////////////////////////////////// 617 680 … … 633 696 // initialise RPC descriptor header 634 697 rpc_desc_t rpc; 635 rpc.index 636 rpc.response 698 rpc.index = RPC_THREAD_USER_CREATE; 699 rpc.response = 1; 637 700 rpc.blocking = true; 638 701 … … 643 706 rpc.args[3] = (uint64_t)(intptr_t)attr; 644 707 645 // register RPC request in remote RPC fifo (blocking function)708 // register RPC request in remote RPC fifo 646 709 rpc_send( cxy , &rpc ); 647 710 … … 673 736 674 737 // get client cluster identifier and pointer on RPC descriptor 675 cxy_t client_cxy = (cxy_t)GET_CXY( xp );676 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );738 cxy_t client_cxy = GET_CXY( xp ); 739 rpc_desc_t * desc = GET_PTR( xp ); 677 740 678 741 // get pointer on attributes structure in client cluster from RPC descriptor … … 707 770 708 771 ///////////////////////////////////////////////////////////////////////////////////////// 709 // [7] 772 // [7] Marshaling functions attached to RPC_THREAD_KERNEL_CREATE (blocking) 710 773 ///////////////////////////////////////////////////////////////////////////////////////// 711 774 … … 735 798 rpc.args[2] = (uint64_t)(intptr_t)args; 736 799 737 // register RPC request in remote RPC fifo (blocking function)800 // register RPC request in remote RPC fifo 738 801 rpc_send( cxy , &rpc ); 739 802 … … 760 823 761 824 // get client cluster identifier and pointer on RPC descriptor 762 cxy_t client_cxy = (cxy_t)GET_CXY( xp );763 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );825 cxy_t client_cxy = GET_CXY( xp ); 826 rpc_desc_t * desc = GET_PTR( xp ); 764 827 765 828 // get attributes from RPC descriptor … … 785 848 786 849 ///////////////////////////////////////////////////////////////////////////////////////// 787 // [8] Marshaling functions attached to RPC_THREAD_KILL (blocking) 788 ///////////////////////////////////////////////////////////////////////////////////////// 789 790 ///////////////////////////////////////////// 791 void rpc_thread_kill_client( cxy_t cxy, 792 thread_t * thread ) // in 793 { 794 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 795 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 796 CURRENT_THREAD->core->lid , hal_time_stamp() ); 797 798 // this RPC can be called in local cluster 799 800 // initialise RPC descriptor header 801 rpc_desc_t rpc; 802 rpc.index = RPC_THREAD_KILL; 803 rpc.response = 1; 804 rpc.blocking = true; 805 806 // set input arguments in RPC descriptor 807 rpc.args[0] = (uint64_t)(intptr_t)thread; 808 809 // register RPC request in remote RPC fifo (blocking function) 810 rpc_send( cxy , &rpc ); 811 812 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 813 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 814 CURRENT_THREAD->core->lid , hal_time_stamp() ); 815 } 816 817 //////////////////////////////////////// 818 void rpc_thread_kill_server( xptr_t xp ) 819 { 820 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 821 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 822 CURRENT_THREAD->core->lid , hal_time_stamp() ); 823 824 thread_t * thread; // local pointer on process descriptor 825 826 // get client cluster identifier and pointer on RPC descriptor 827 cxy_t client_cxy = (cxy_t)GET_CXY( xp ); 828 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp ); 829 830 // get attributes from RPC descriptor 831 thread = (thread_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); 832 833 // call local kernel function 834 thread_kill( thread ); 835 836 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 837 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 838 CURRENT_THREAD->core->lid , hal_time_stamp() ); 839 } 850 // [8] undefined slot 851 ///////////////////////////////////////////////////////////////////////////////////////// 840 852 841 853 … … 846 858 //////////////////////////////////////////////////// 847 859 void rpc_process_sigaction_client( cxy_t cxy, 848 rpc_desc_t * rpc_ptr ) 849 { 850 rpc_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n", 851 __FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) , 852 ((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() ); 853 854 // register RPC request in remote RPC fifo 855 rpc_send( cxy , rpc_ptr ); 856 857 rpc_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n", 858 __FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) , 859 ((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() ); 860 } 860 rpc_desc_t * rpc ) 861 { 862 863 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1) 864 uint32_t cycle = (uint32_t)hal_get_cycles(); 865 uint32_t action = rpc->args[0]; 866 pid_t pid = rpc->args[1]; 867 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle ) 868 printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n", 869 __FUNCTION__ , process_action_str( action ) , pid , cxy , cycle ); 870 #endif 871 872 // check some RPC arguments 873 assert( (rpc->blocking == false) , __FUNCTION__ , "must be non-blocking\n"); 874 assert( (rpc->index == RPC_PROCESS_SIGACTION ) , __FUNCTION__ , "bad RPC index\n" ); 875 876 // register RPC request in remote RPC fifo and return 877 rpc_send( cxy , rpc ); 878 879 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1) 880 cycle = (uint32_t)hal_get_cycles(); 881 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle ) 882 printk("\n[DBG] %s : exit after requesting to %s process %x in cluster %x / cycle %d\n", 883 __FUNCTION__ , process_action_str( action ) , pid , cxy , cycle ); 884 #endif 885 886 } // end rpc_process_sigaction_client() 861 887 862 888 ////////////////////////////////////////////// … … 864 890 { 865 891 pid_t pid; // target process identifier 866 process_t * process; // pointer on local process descriptor892 process_t * process; // pointer on local target process descriptor 867 893 uint32_t action; // sigaction index 868 thread_t * client_ ptr; // localpointer on client thread in client cluster894 thread_t * client_thread; // pointer on client thread in client cluster 869 895 cxy_t client_cxy; // client cluster identifier 870 xptr_t client_xp; // extended pointer on client thread871 core_t * client_core; // local pointer on core running the client thread872 rpc_desc_t * rpc; // local pointer on rpc descriptor in client cluster873 874 // get client cluster identifier and pointer on RPC descriptor 875 client_cxy = (cxy_t)GET_CXY( xp );876 rpc = (rpc_desc_t *)GET_PTR( xp );896 rpc_desc_t * rpc; // pointer on rpc descriptor in client cluster 897 xptr_t count_xp; // extended pointer on response counter 898 lid_t client_lid; // client core local index 899 900 // get client cluster identifier and pointer on RPC descriptor 901 client_cxy = GET_CXY( xp ); 902 rpc = GET_PTR( xp ); 877 903 878 904 // get arguments from RPC descriptor 879 action = (uint32_t) hal_remote_lwd( XPTR( client_cxy , &rpc->args[0] ) ); 880 pid = (pid_t) hal_remote_lwd( XPTR( client_cxy , &rpc->args[1] ) ); 881 client_ptr = (thread_t *)hal_remote_lpt( XPTR( client_cxy , &rpc->thread ) ); 882 883 rpc_dmsg("\n[DBG] %s : enter to %s process %x / cycle %d\n", 884 __FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() ); 905 action = (uint32_t)hal_remote_lwd( XPTR(client_cxy , &rpc->args[0]) ); 906 pid = (pid_t) hal_remote_lwd( XPTR(client_cxy , &rpc->args[1]) ); 907 908 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1) 909 uint32_t cycle = (uint32_t)hal_get_cycles(); 910 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle ) 911 printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n", 912 __FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle ); 913 #endif 885 914 886 915 // get local process descriptor 887 process = process_get_local_copy( pid ); 888 889 // build extended pointer on client thread 890 client_xp = XPTR( client_cxy , client_ptr ); 916 process = cluster_get_local_process_from_pid( pid ); 891 917 892 918 // call relevant kernel function 893 if (action == DELETE_ALL_THREADS ) process_delete_threads ( process ); 894 else if (action == BLOCK_ALL_THREADS ) process_block_threads ( process ); 895 else if (action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process ); 919 if ( action == DELETE_ALL_THREADS ) process_delete_threads ( process ); 920 else if ( action == BLOCK_ALL_THREADS ) process_block_threads ( process ); 921 else if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process ); 922 923 // build extended pointer on response counter in RPC 924 count_xp = XPTR( client_cxy , &rpc->response ); 896 925 897 926 // decrement the responses counter in RPC descriptor, 898 927 // unblock the client thread only if it is the last response. 899 if( hal_remote_atomic_add( XPTR( client_cxy , &rpc->response ), -1 ) == 1 )928 if( hal_remote_atomic_add( count_xp , -1 ) == 1 ) 900 929 { 901 client_core = (core_t *)hal_remote_lpt( XPTR( client_cxy , &client_ptr->core ) ); 902 thread_unblock( client_xp , THREAD_BLOCKED_RPC ); 903 dev_pic_send_ipi( client_cxy , client_core->lid ); 930 // get client thread pointer and client core lid 931 client_thread = (thread_t *)hal_remote_lpt( XPTR( client_cxy , &rpc->thread ) ); 932 client_lid = (lid_t) hal_remote_lw ( XPTR( client_cxy , &rpc->lid ) ); 933 934 thread_unblock( XPTR( client_cxy , client_thread ) , THREAD_BLOCKED_RPC ); 935 dev_pic_send_ipi( client_cxy , client_lid ); 904 936 } 905 937 906 rpc_dmsg("\n[DBG] %s : exit after %s process %x / cycle %d\n", 907 __FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() ); 908 } 909 910 ///////////////////////////////////////////////////////////////////////////////////////// 911 // [10] Marshaling functions attached to RPC_VFS_INODE_CREATE (blocking) 938 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1) 939 cycle = (uint32_t)hal_get_cycles(); 940 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle ) 941 printk("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n", 942 __FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle ); 943 #endif 944 945 } // end rpc_process_sigaction_server() 946 947 ///////////////////////////////////////////////////////////////////////////////////////// 948 // [10] Marshaling functions attached to RPC_VFS_INODE_CREATE (blocking) 912 949 ///////////////////////////////////////////////////////////////////////////////////////// 913 950 … … 947 984 rpc.args[7] = (uint64_t)gid; 948 985 949 // register RPC request in remote RPC fifo (blocking function)986 // register RPC request in remote RPC fifo 950 987 rpc_send( cxy , &rpc ); 951 988 … … 978 1015 979 1016 // get client cluster identifier and pointer on RPC descriptor 980 cxy_t client_cxy = (cxy_t)GET_CXY( xp );981 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1017 cxy_t client_cxy = GET_CXY( xp ); 1018 rpc_desc_t * desc = GET_PTR( xp ); 982 1019 983 1020 // get input arguments from client rpc descriptor … … 1034 1071 rpc.args[0] = (uint64_t)(intptr_t)inode; 1035 1072 1036 // register RPC request in remote RPC fifo (blocking function)1073 // register RPC request in remote RPC fifo 1037 1074 rpc_send( cxy , &rpc ); 1038 1075 … … 1052 1089 1053 1090 // get client cluster identifier and pointer on RPC descriptor 1054 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1055 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1091 cxy_t client_cxy = GET_CXY( xp ); 1092 rpc_desc_t * desc = GET_PTR( xp ); 1056 1093 1057 1094 // get arguments "inode" from client RPC descriptor … … 1095 1132 rpc.args[2] = (uint64_t)(intptr_t)parent; 1096 1133 1097 // register RPC request in remote RPC fifo (blocking function)1134 // register RPC request in remote RPC fifo 1098 1135 rpc_send( cxy , &rpc ); 1099 1136 … … 1123 1160 1124 1161 // get client cluster identifier and pointer on RPC descriptor 1125 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1126 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1162 cxy_t client_cxy = GET_CXY( xp ); 1163 rpc_desc_t * desc = GET_PTR( xp ); 1127 1164 1128 1165 // get arguments "name", "type", and "parent" from client RPC descriptor … … 1173 1210 rpc.args[0] = (uint64_t)(intptr_t)dentry; 1174 1211 1175 // register RPC request in remote RPC fifo (blocking function)1212 // register RPC request in remote RPC fifo 1176 1213 rpc_send( cxy , &rpc ); 1177 1214 … … 1191 1228 1192 1229 // get client cluster identifier and pointer on RPC descriptor 1193 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1194 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1230 cxy_t client_cxy = GET_CXY( xp ); 1231 rpc_desc_t * desc = GET_PTR( xp ); 1195 1232 1196 1233 // get arguments "dentry" from client RPC descriptor … … 1233 1270 rpc.args[1] = (uint64_t)file_attr; 1234 1271 1235 // register RPC request in remote RPC fifo (blocking function)1272 // register RPC request in remote RPC fifo 1236 1273 rpc_send( cxy , &rpc ); 1237 1274 … … 1258 1295 1259 1296 // get client cluster identifier and pointer on RPC descriptor 1260 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1261 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1297 cxy_t client_cxy = GET_CXY( xp ); 1298 rpc_desc_t * desc = GET_PTR( xp ); 1262 1299 1263 1300 // get arguments "file_attr" and "inode" from client RPC descriptor … … 1302 1339 rpc.args[0] = (uint64_t)(intptr_t)file; 1303 1340 1304 // register RPC request in remote RPC fifo (blocking function)1341 // register RPC request in remote RPC fifo 1305 1342 rpc_send( cxy , &rpc ); 1306 1343 … … 1320 1357 1321 1358 // get client cluster identifier and pointer on RPC descriptor 1322 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1323 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1359 cxy_t client_cxy = GET_CXY( xp ); 1360 rpc_desc_t * desc = GET_PTR( xp ); 1324 1361 1325 1362 // get arguments "dentry" from client RPC descriptor … … 1362 1399 rpc.args[2] = (uint64_t)child_inode_xp; 1363 1400 1364 // register RPC request in remote RPC fifo (blocking function)1401 // register RPC request in remote RPC fifo 1365 1402 rpc_send( cxy , &rpc ); 1366 1403 … … 1388 1425 1389 1426 // get client cluster identifier and pointer on RPC descriptor 1390 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1391 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1427 cxy_t client_cxy = GET_CXY( xp ); 1428 rpc_desc_t * desc = GET_PTR( xp ); 1392 1429 1393 1430 // get arguments "parent", "name", and "child_xp" … … 1435 1472 rpc.args[0] = (uint64_t)(intptr_t)inode; 1436 1473 1437 // register RPC request in remote RPC fifo (blocking function)1474 // register RPC request in remote RPC fifo 1438 1475 rpc_send( cxy , &rpc ); 1439 1476 … … 1457 1494 1458 1495 // get client cluster identifier and pointer on RPC descriptor 1459 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1460 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1496 cxy_t client_cxy = GET_CXY( xp ); 1497 rpc_desc_t * desc = GET_PTR( xp ); 1461 1498 1462 1499 // get arguments "parent", "name", and "child_xp" … … 1529 1566 1530 1567 // get client cluster identifier and pointer on RPC descriptor 1531 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1532 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1568 cxy_t client_cxy = GET_CXY( xp ); 1569 rpc_desc_t * desc = GET_PTR( xp ); 1533 1570 1534 1571 // get input arguments … … 1576 1613 rpc.args[1] = (uint64_t)vaddr; 1577 1614 1578 // register RPC request in remote RPC fifo (blocking function)1615 // register RPC request in remote RPC fifo 1579 1616 rpc_send( cxy , &rpc ); 1580 1617 … … 1602 1639 1603 1640 // get client cluster identifier and pointer on RPC descriptor 1604 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1605 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1641 cxy_t client_cxy = GET_CXY( xp ); 1642 rpc_desc_t * desc = GET_PTR( xp ); 1606 1643 1607 1644 // get input argument from client RPC descriptor … … 1653 1690 rpc.args[2] = (uint64_t)cow; 1654 1691 1655 // register RPC request in remote RPC fifo (blocking function)1692 // register RPC request in remote RPC fifo 1656 1693 rpc_send( cxy , &rpc ); 1657 1694 … … 1681 1718 1682 1719 // get client cluster identifier and pointer on RPC descriptor 1683 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1684 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1720 cxy_t client_cxy = GET_CXY( xp ); 1721 rpc_desc_t * desc = GET_PTR( xp ); 1685 1722 1686 1723 // get input argument "process" & "vpn" from client RPC descriptor … … 1726 1763 rpc.args[0] = (uint64_t)kmem_type; 1727 1764 1728 // register RPC request in remote RPC fifo (blocking function)1765 // register RPC request in remote RPC fifo 1729 1766 rpc_send( cxy , &rpc ); 1730 1767 … … 1745 1782 1746 1783 // get client cluster identifier and pointer on RPC descriptor 1747 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1748 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1784 cxy_t client_cxy = GET_CXY( xp ); 1785 rpc_desc_t * desc = GET_PTR( xp ); 1749 1786 1750 1787 // get input argument "kmem_type" from client RPC descriptor … … 1791 1828 rpc.args[1] = (uint64_t)kmem_type; 1792 1829 1793 // register RPC request in remote RPC fifo (blocking function)1830 // register RPC request in remote RPC fifo 1794 1831 rpc_send( cxy , &rpc ); 1795 1832 … … 1807 1844 1808 1845 // get client cluster identifier and pointer on RPC descriptor 1809 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1810 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1846 cxy_t client_cxy = GET_CXY( xp ); 1847 rpc_desc_t * desc = GET_PTR( xp ); 1811 1848 1812 1849 // get input arguments "buf" and "kmem_type" from client RPC descriptor … … 1859 1896 rpc.args[5] = (uint64_t)size; 1860 1897 1861 // register RPC request in remote RPC fifo (blocking function)1898 // register RPC request in remote RPC fifo 1862 1899 rpc_send( cxy , &rpc ); 1863 1900 … … 1887 1924 1888 1925 // get client cluster identifier and pointer on RPC descriptor 1889 cxy_t client_cxy = (cxy_t)GET_CXY( xp );1890 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );1926 cxy_t client_cxy = GET_CXY( xp ); 1927 rpc_desc_t * desc = GET_PTR( xp ); 1891 1928 1892 1929 // get arguments from client RPC descriptor … … 1953 1990 rpc.args[1] = (uint64_t)index; 1954 1991 1955 // register RPC request in remote RPC fifo (blocking function)1992 // register RPC request in remote RPC fifo 1956 1993 rpc_send( cxy , &rpc ); 1957 1994 … … 1972 2009 1973 2010 // get client cluster identifier and pointer on RPC descriptor 1974 cxy_t cxy = (cxy_t)GET_CXY( xp );1975 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );2011 cxy_t cxy = GET_CXY( xp ); 2012 rpc_desc_t * desc = GET_PTR( xp ); 1976 2013 1977 2014 // get input arguments from client RPC descriptor … … 2028 2065 rpc.args[7] = (uint64_t)vseg_cxy; 2029 2066 2030 // register RPC request in remote RPC fifo (blocking function)2067 // register RPC request in remote RPC fifo 2031 2068 rpc_send( cxy , &rpc ); 2032 2069 … … 2047 2084 2048 2085 // get client cluster identifier and pointer on RPC descriptor 2049 cxy_t cxy = (cxy_t)GET_CXY( xp );2050 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );2086 cxy_t cxy = GET_CXY( xp ); 2087 rpc_desc_t * desc = GET_PTR( xp ); 2051 2088 2052 2089 // get input arguments from client RPC descriptor … … 2101 2138 rpc.args[0] = (uint64_t)lid; 2102 2139 2103 // register RPC request in remote RPC fifo (blocking function)2140 // register RPC request in remote RPC fifo 2104 2141 rpc_send( cxy , &rpc ); 2105 2142 … … 2117 2154 2118 2155 // get client cluster identifier and pointer on RPC descriptor 2119 cxy_t cxy = (cxy_t)GET_CXY( xp );2120 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );2156 cxy_t cxy = GET_CXY( xp ); 2157 rpc_desc_t * desc = GET_PTR( xp ); 2121 2158 2122 2159 // get input arguments from client RPC descriptor … … 2154 2191 rpc.args[0] = (uint64_t)(intptr_t)process; 2155 2192 2156 // register RPC request in remote RPC fifo (blocking function)2193 // register RPC request in remote RPC fifo 2157 2194 rpc_send( cxy , &rpc ); 2158 2195 … … 2172 2209 2173 2210 // get client cluster identifier and pointer on RPC descriptor 2174 cxy_t cxy = (cxy_t)GET_CXY( xp );2175 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );2211 cxy_t cxy = GET_CXY( xp ); 2212 rpc_desc_t * desc = GET_PTR( xp ); 2176 2213 2177 2214 // get input arguments from client RPC descriptor … … 2211 2248 rpc.args[1] = (uint64_t)detailed; 2212 2249 2213 // register RPC request in remote RPC fifo (blocking function)2250 // register RPC request in remote RPC fifo 2214 2251 rpc_send( cxy , &rpc ); 2215 2252 … … 2230 2267 2231 2268 // get client cluster identifier and pointer on RPC descriptor 2232 cxy_t cxy = (cxy_t)GET_CXY( xp );2233 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp );2269 cxy_t cxy = GET_CXY( xp ); 2270 rpc_desc_t * desc = GET_PTR( xp ); 2234 2271 2235 2272 // get input arguments from client RPC descriptor
Note: See TracChangeset
for help on using the changeset viewer.