Changeset 619 for trunk/kernel/kern
- Timestamp:
- Feb 12, 2019, 1:15:47 PM (6 years ago)
- Location:
- trunk/kernel/kern
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/chdev.c
r601 r619 168 168 169 169 #if (DEBUG_CHDEV_CMD_RX || DEBUG_CHDEV_CMD_TX) 170 bool_t is_rx = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->is_rx ) ); 170 bool_t is_rx = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->is_rx ) ); 171 trdid_t server_trdid = hal_remote_l32( XPTR( chdev_cxy , &server_ptr->trdid ) ); 172 process_t * process_ptr = hal_remote_lpt( XPTR( chdev_cxy , &server_ptr->process ) ); 173 pid_t server_pid = hal_remote_l32( XPTR( chdev_cxy , &process_ptr->pid ) ); 171 174 #endif 172 175 … … 175 178 if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) ) 176 179 printk("\n[%s] client[%x,%x] enter for RX / server[%x,%x] / cycle %d\n", 177 __FUNCTION__, this->process->pid, this->trdid, 178 server_ptr->process->pid, server_ptr->trdid, rx_cycle ); 180 __FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid, rx_cycle ); 179 181 #endif 180 182 … … 183 185 if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) ) 184 186 printk("\n[%s] client[%x,%x] enter for TX / server[%x,%x] / cycle %d\n", 185 __FUNCTION__, this->process->pid, this->trdid, 186 server_ptr->process->pid, server_ptr->trdid, tx_cycle ); 187 __FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid, tx_cycle ); 187 188 #endif 188 189 … … 241 242 if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) ) 242 243 printk("\n[%s] TX server thread[%x,%x] unblocked\n", 243 __FUNCTION__, server_p tr->process->pid, server_ptr->trdid );244 __FUNCTION__, server_pid, server_trdid ); 244 245 #endif 245 246 … … 247 248 if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) ) 248 249 printk("\n[%s] RX server thread[%x,%x] unblocked\n", 249 __FUNCTION__, server_p tr->process->pid, server_ptr->trdid );250 __FUNCTION__, server_pid, server_trdid ); 250 251 #endif 251 252 … … 273 274 if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) ) 274 275 printk("\n[%s] client thread[%x,%x] sent IPI to TX server thread[%x,%x]\n", 275 __FUNCTION__, this->process->pid, this->trdid, server_p tr->process->pid, server_ptr->trdid );276 __FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid ); 276 277 #endif 277 278 … … 279 280 if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) ) 280 281 printk("\n[%s] client thread[%x,%x] sent IPI to RX server thread[%x,%x]\n", 281 __FUNCTION__, this->process->pid, this->trdid, server_p tr->process->pid, server_ptr->trdid );282 __FUNCTION__, this->process->pid, this->trdid, server_pid, server_trdid ); 282 283 #endif 283 284 … … 317 318 } // end chdev_register_command() 318 319 319 ///////////////////////////////////////// //////320 void chdev_se quencial_server( chdev_t * chdev )320 ///////////////////////////////////////// 321 void chdev_server_func( chdev_t * chdev ) 321 322 { 322 323 xptr_t client_xp; // extended pointer on waiting thread … … 340 341 { 341 342 342 #if DEBUG_CHDEV_SERVER_RX343 #if( DEBUG_CHDEV_SERVER_RX || DEBUG_CHDEV_SERVER_TX ) 343 344 uint32_t rx_cycle = (uint32_t)hal_get_cycles(); 344 345 if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) ) 345 printk("\n[%s] thread[%x,%x] start RX/ cycle %d\n",346 __FUNCTION__ , server->process->pid, server->trdid, rx_cycle );346 printk("\n[%s] DEV thread[%x,%x] check TXT_RX channel %d / cycle %d\n", 347 __FUNCTION__ , server->process->pid, server->trdid, chdev->channel, rx_cycle ); 347 348 #endif 348 349 … … 350 351 uint32_t tx_cycle = (uint32_t)hal_get_cycles(); 351 352 if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) ) 352 printk("\n[%s] thread[%x,%x] start TX/ cycle %d\n",353 __FUNCTION__ , server->process->pid, server->trdid, tx_cycle );353 printk("\n[%s] thread[%x,%x] check TXT_TX channel %d / cycle %d\n", 354 __FUNCTION__ , server->process->pid, server->trdid, chdev->channel, tx_cycle ); 354 355 #endif 355 356 … … 397 398 client_ptr = GET_PTR( client_xp ); 398 399 399 #if( D DEBUG_CHDEV_SERVER_TX || DEBUG_CHDEV_SERVER_RX )400 #if( DEBUG_CHDEV_SERVER_TX || DEBUG_CHDEV_SERVER_RX ) 400 401 process_t * process = hal_remote_lpt( XPTR( client_cxy , &client_ptr->process ) ); 401 402 pid_t client_pid = hal_remote_l32( XPTR( client_cxy , &process->pid ) ); 402 process_tclient_trdid = hal_remote_l32( XPTR( client_cxy , &client_ptr->trdid ) );403 trdid_t client_trdid = hal_remote_l32( XPTR( client_cxy , &client_ptr->trdid ) ); 403 404 #endif 404 405 … … 407 408 if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) ) 408 409 printk("\n[%s] thread[%x,%x] for RX get client thread[%x,%x] / cycle %d\n", 409 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );410 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, rx_cycle ); 410 411 #endif 411 412 … … 414 415 if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) ) 415 416 printk("\n[%s] thread[%x,%x] for TX get client thread[%x,%x] / cycle %d\n", 416 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );417 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, tx_cycle ); 417 418 #endif 418 419 … … 445 446 if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) ) 446 447 printk("\n[%s] thread[%x,%x] completes RX for client thread[%x,%x] / cycle %d\n", 447 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );448 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, rx_cycle ); 448 449 #endif 449 450 … … 452 453 if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) ) 453 454 printk("\n[%s] thread[%x,%x] completes TX for client thread[%x,%x] / cycle %d\n", 454 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle );455 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, tX_cycle ); 455 456 #endif 456 457 … … 465 466 } 466 467 } // end while 467 } // end chdev_se quencial_server()468 } // end chdev_server_func() 468 469 469 470 //////////////////////////////////////// -
trunk/kernel/kern/chdev.h
r564 r619 240 240 * @ chdev : local pointer on device descriptor. 241 241 *****************************************************************************************/ 242 void chdev_se quencial_server( chdev_t * chdev );242 void chdev_server_func( chdev_t * chdev ); 243 243 244 244 /****************************************************************************************** -
trunk/kernel/kern/kernel_init.c
r614 r619 154 154 "CONDVAR_STATE", // 17 155 155 "SEM_STATE", // 18 156 "RPOCESS_CWD", // 19 157 158 "unused_20", // 20 156 "PROCESS_CWD", // 19 157 "BARRIER_STATE", // 20 159 158 160 159 "CLUSTER_PREFTBL", // 21 -
trunk/kernel/kern/process.c
r618 r619 528 528 process_t * process_ptr; // local pointer on process copy 529 529 reg_t save_sr; // for critical section 530 rpc_desc_t rpc; // shared RPC descriptor531 530 thread_t * client; // pointer on client thread 532 531 xptr_t client_xp; // extended pointer on client thread 533 532 process_t * local; // pointer on process copy in local cluster 534 533 uint32_t remote_nr; // number of remote process copies 534 rpc_desc_t rpc; // shared RPC descriptor 535 uint32_t responses; // shared RPC responses counter 535 536 536 537 client = CURRENT_THREAD; … … 579 580 thread_block( client_xp , THREAD_BLOCKED_RPC ); 580 581 582 // initialize RPC responses counter 583 responses = 0; 584 581 585 // initialize shared RPC descriptor 582 rpc.responses = 0; 586 // can be shared, because no out arguments 587 rpc.rsp = &responses; 583 588 rpc.blocking = false; 584 589 rpc.index = RPC_PROCESS_SIGACTION; … … 608 613 remote_nr++; 609 614 610 // atomically increment responses counter611 hal_atomic_add( (void *)&rpc.responses , 1 );615 // atomically increment RPC responses counter 616 hal_atomic_add( &responses , 1 ); 612 617 613 618 #if DEBUG_PROCESS_SIGACTION … … 617 622 #endif 618 623 // call RPC in target cluster 619 rpc_ process_sigaction_client( process_cxy , &rpc );624 rpc_send( process_cxy , &rpc ); 620 625 } 621 626 } // end list of copies … … 685 690 686 691 // check target process is an user process 687 assert( (LPID_FROM_PID( process->pid ) != 0 ), "target process must be an user process" ); 692 assert( (LPID_FROM_PID( process->pid ) != 0 ), 693 "process %x is not an user process\n", process->pid ); 688 694 689 695 // get target process owner cluster … … 773 779 774 780 // check target process is an user process 775 assert( (LPID_FROM_PID( process->pid ) != 0), "process %x not an user process", process->pid ); 781 assert( (LPID_FROM_PID( process->pid ) != 0), 782 "process %x is not an user process\n", process->pid ); 776 783 777 784 // get lock protecting process th_tbl[] … … 831 838 832 839 // check target process is an user process 833 assert( ( process->pid!= 0 ),834 " target process must be an user process");840 assert( ( LPID_FROM_PID( process->pid ) != 0 ), 841 "process %x is not an user process\n", process->pid ); 835 842 836 843 // get lock protecting process th_tbl[] -
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 -
trunk/kernel/kern/rpc.h
r614 r619 69 69 RPC_THREAD_KERNEL_CREATE = 7, 70 70 RPC_UNDEFINED_8 = 8, 71 RPC_PROCESS_SIGACTION = 9, // non blocking71 RPC_PROCESS_SIGACTION = 9, 72 72 73 73 RPC_VFS_INODE_CREATE = 10, … … 88 88 RPC_UNDEFINED_24 = 24, 89 89 RPC_MAPPER_HANDLE_MISS = 25, 90 RPC_VMM_DELETE_VSEG = 26, // non blocking90 RPC_VMM_DELETE_VSEG = 26, 91 91 RPC_VMM_CREATE_VSEG = 27, 92 92 RPC_VMM_SET_COW = 28, … … 105 105 106 106 /*********************************************************************************** 107 * This structure defines the RPC descriptor 107 * This structure defines the RPC descriptor (100 bytes on a 32bits core) 108 108 **********************************************************************************/ 109 109 110 110 typedef struct rpc_desc_s 111 111 { 112 rpc_index_t index; /*! index of requested RPC service 113 volatile uint32_t responses; /*! number of expected responses*/114 struct thread_s * thread; /*! local pointer on client thread 115 uint32_t lid; /*! index of core running the calling thread*/116 bool_t blocking; /*! blocking RPC when true*/117 uint64_t args[10]; /*! input/output arguments buffer 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) */ 118 118 } 119 119 rpc_desc_t; … … 161 161 * - it block on IDLE and deschedule otherwise. 162 162 **********************************************************************************/ 163 void rpc_ thread_func( void );163 void rpc_server_func( void ); 164 164 165 165 /*********************************************************************************** … … 309 309 310 310 /*********************************************************************************** 311 * [9] The non blocking RPC_PROCESS_SIGACTION allows any client thread running in 312 * any cluster to send parallel RPC requests to one or several servers (that can be 313 * local or remote), to execute a given sigaction, defined by the <action_type> 314 * argument[1], for a given process identified by the <pid> argument[0]. 315 * 316 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel 317 * to several servers. The RPC descriptor, containing the <action_type> and <pid> 318 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must 319 * be allocated and initialised by the calling function itself. 320 * Each RPC server thread atomically decrements the <response> field in this 321 * shared RPC descriptor. The last server thread unblock the client thread, 322 * that blocked only after sending all parallel RPC requests to all servers. 311 * [9] The RPC_PROCESS_SIGACTION allows any client thread to request to any cluster 312 * execute a given sigaction, defined by the <action_type> for a given process, 313 * identified by the <pid> argument. 323 314 *********************************************************************************** 324 315 * @ cxy : server cluster identifier. 325 * @ rpc : pointer on shared RPC descriptor initialized by the client thread. 326 **********************************************************************************/ 327 void rpc_process_sigaction_client( cxy_t cxy, 328 struct rpc_desc_s * rpc ); 316 * @ pid : [in] target process identifier. 317 * @ action : [in] sigaction index. 318 **********************************************************************************/ 319 void rpc_process_sigaction_client( cxy_t cxy, 320 pid_t pid, 321 uint32_t action ); 329 322 330 323 void rpc_process_sigaction_server( xptr_t xp ); … … 596 589 597 590 /*********************************************************************************** 598 * [26] The non blocking RPC_VMM_DELETE_VSEG allows any client thread running in 599 * any cluster to send parallel RPC requests to one or several clusters (that can be 600 * local or remote), to delete from a given VMM, identified by the <pid> argument[0] 601 * a given vseg, identified by the <vaddr> argument[1]. 602 * 603 * WARNING : It is implemented as a NON BLOCKING RPC, that can be sent in parallel 604 * to several servers. The RPC descriptor, containing the <pid> and <vaddr> 605 * arguments, as well as the RPC <index>, <blocked>, and <response> fields, must 606 * be allocated and initialised by the calling function itself. 607 * Each RPC server thread atomically decrements the the <response> field in this 608 * shared RPC descriptor. The last server thread unblock the client thread, 609 * that blocked only after sending all paralle RPC requests to all servers. 591 * [26] The RPC_VMM_DELETE_VSEG allows any client thread to request a remote 592 * cluster to delete from a given VMM, identified by the <pid> argument 593 * a given vseg, identified by the <vaddr> argument. 610 594 *********************************************************************************** 611 595 * @ cxy : server cluster identifier. 612 * @ rpc : pointer on shared RPC descriptor initialized by the client thread. 613 **********************************************************************************/ 614 void rpc_vmm_delete_vseg_client( cxy_t cxy, 615 struct rpc_desc_s * rpc ); 596 * @ pid : [in] target process identifier. 597 * @ vaddr : [in] vseg base address. 598 **********************************************************************************/ 599 void rpc_vmm_delete_vseg_client( cxy_t cxy, 600 pid_t pid, 601 intptr_t vaddr ); 616 602 617 603 void rpc_vmm_delete_vseg_server( xptr_t xp ); -
trunk/kernel/kern/scheduler.c
r614 r619 29 29 #include <printk.h> 30 30 #include <list.h> 31 #include <rpc.h> 31 32 #include <core.h> 32 33 #include <thread.h> … … 146 147 //////////////////////////////////////////////////////////////////////////////////////////// 147 148 // This static function is the only function that can actually delete a thread, 148 // and the associated process descriptor, if required.149 // It is private, because it is called by the sched_yield() public function.149 // (and the associated process descriptor if required). 150 // It is private, because it is only called by the sched_yield() public function. 150 151 // It scan all threads attached to a given scheduler, and executes the relevant 151 152 // actions for two types of pending requests: … … 376 377 error = thread_kernel_create( &thread, 377 378 THREAD_RPC, 378 &rpc_ thread_func,379 &rpc_server_func, 379 380 NULL, 380 381 lid ); -
trunk/kernel/kern/thread.c
r611 r619 1378 1378 } // end thread_assert_can yield() 1379 1379 1380 ////////////////////////////////////////////////// 1381 void thread_display_busylocks( xptr_t thread_xp )1382 { 1383 // get cluster and local pointer of target thread 1380 ////////////////////////////////////////////////////// 1381 void thread_display_busylocks( xptr_t thread_xp, 1382 const char * string ) 1383 { 1384 1384 cxy_t thread_cxy = GET_CXY( thread_xp ); 1385 1385 thread_t * thread_ptr = GET_PTR( thread_xp ); … … 1389 1389 xptr_t iter_xp; 1390 1390 1391 // get target thread TRDID and busylocks 1392 trdid_t trdid = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->trdid )); 1393 uint32_t locks = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->busylocks )); 1394 1395 // get target thread process and PID; 1396 process_t * process = hal_remote_lpt(XPTR( thread_cxy , &thread_ptr->process )); 1397 pid_t pid = hal_remote_l32(XPTR( thread_cxy , &process->pid )); 1391 // get relevant info from target trhead descriptor 1392 uint32_t locks = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->busylocks ) ); 1393 trdid_t trdid = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) ); 1394 process_t * process = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->process ) ); 1395 pid_t pid = hal_remote_l32( XPTR( thread_cxy , &process->pid ) ); 1398 1396 1399 1397 // get extended pointer on root of busylocks 1400 xptr_t 1398 xptr_t root_xp = XPTR( thread_cxy , &thread_ptr->busylocks_root ); 1401 1399 1402 1400 // get pointers on TXT0 chdev … … 1412 1410 1413 1411 // display header 1414 nolock_printk("\n***** thread %x in process %x : %d busylocks at cycle %d\n",1415 trdid, pid, locks, (uint32_t)hal_get_cycles());1412 nolock_printk("\n***** thread[%x,%x] in <%s> : %d busylocks *****\n", 1413 pid, trdid, string, locks ); 1416 1414 1417 1415 // scan the xlist of busylocks when required … … 1436 1434 1437 1435 // display a warning 1438 printk("\n[WARNING] set the DEBUG_BUSYLOCK par meter in kernel_config.h"1439 " to display busylocks for thread %x/%x\n", thread_cxy, thread_ptr);1436 printk("\n[WARNING] set the DEBUG_BUSYLOCK parameter in kernel_config.h" 1437 " to display busylocks for thread(%x,%x)\n", pid, trdid ); 1440 1438 1441 1439 } // end thread_display_busylock() -
trunk/kernel/kern/thread.h
r610 r619 143 143 typedef struct thread_s 144 144 { 145 void * cpu_context; /*! pointer on CPU context switch*/146 void * fpu_context; /*! pointer on FPU context switch*/145 void * cpu_context; /*! CPU context used by sched_yield */ 146 void * fpu_context; /*! FPU context used by sched_yield */ 147 147 void * uzone_current; /*! used by hal_do_syscall & hal_do_except */ 148 148 void * uzone_previous; /*! used by hal_do_syscall & hal_do_except */ … … 465 465 466 466 /*************************************************************************************** 467 * This debug function display the list of busylocks (local or remote) currently owned468 * by a thread identified by the <thread_xp> argument.469 * WARNING : it can be called by the idbg tool, but the DEBUG_BUSYLOCK parameter470 * must be set in the kernel_config.h file.467 * This debug function display the list of busylocks (local or remote) 468 * currently owned by a the thread identified by the <thead_xp> argument. 469 * The <string> argument is printed in header (can be the calling function name). 470 * WARNING : the DEBUG_BUSYLOCK parameter must be set in the kernel_config.h file. 471 471 *************************************************************************************** 472 472 * @ thread_xp : extended pointer on target thread. 473 **************************************************************************************/ 474 void thread_display_busylocks( xptr_t thread_xp ); 473 * @ string : defines the calling context. 474 **************************************************************************************/ 475 void thread_display_busylocks( xptr_t thread_xp, 476 const char * string ); 475 477 476 478
Note: See TracChangeset
for help on using the changeset viewer.