Changeset 438 for trunk/kernel/kern/rpc.c
- Timestamp:
- Apr 4, 2018, 2:49:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r437 r438 43 43 44 44 ///////////////////////////////////////////////////////////////////////////////////////// 45 // Debug macros for marshalling functions46 /////////////////////////////////////////////////////////////////////////////////////////47 48 #if CONFIG_DEBUG_RPC_MARSHALING49 50 #define RPC_DEBUG_ENTER \51 uint32_t cycle = (uint32_t)hal_get_cycles(); \52 if( cycle > CONFIG_DEBUG_RPC_MARSHALING ) \53 printk("\n[DBG] %s : enter thread %x on core[%x,%d] / cycle %d\n", \54 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );55 56 #define RPC_DEBUG_EXIT \57 cycle = (uint32_t)hal_get_cycles(); \58 if( cycle > CONFIG_DEBUG_RPC_MARSHALING ) \59 printk("\n[DBG] %s : exit thread %x on core[%x,%d] / cycle %d\n", \60 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );61 62 #else63 64 #define RPC_DEBUG_ENTER65 66 #define RPC_DEBUG_EXIT67 68 #endif69 70 /////////////////////////////////////////////////////////////////////////////////////////71 45 // array of function pointers (must be consistent with enum in rpc.h) 72 46 ///////////////////////////////////////////////////////////////////////////////////////// … … 122 96 rpc_desc_t * rpc ) 123 97 { 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 98 lid_t server_core_lid; 99 lid_t client_core_lid; 100 volatile error_t full; 101 thread_t * this; 102 cluster_t * cluster; 103 104 #if DEBUG_RPC_CLIENT_GENERIC 129 105 uint32_t cycle = (uint32_t)hal_get_cycles(); 130 if( CONFIG_DEBUG_RPC_SEND< cycle )106 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 131 107 printk("\n[DBG] %s : thread %x in cluster %x enter for rpc[%d] / rpc_ptr %x / cycle %d\n", 132 108 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, rpc, cycle ); 133 109 #endif 134 110 135 // register client thread pointer and core lid in RPC descriptor 111 full = 0; 112 this = CURRENT_THREAD; 113 cluster = LOCAL_CLUSTER; 114 client_core_lid = this->core->lid; 115 116 // select a server_core index: 117 // use client core index if possible / core 0 otherwise 118 if( client_core_lid < hal_remote_lw( XPTR( server_cxy , &cluster->cores_nr ) ) ) 119 { 120 server_core_lid = client_core_lid; 121 } 122 else 123 { 124 server_core_lid = 0; 125 } 126 127 // register client_thread pointer and client_core lid in RPC descriptor 136 128 rpc->thread = this; 137 rpc->lid = c ore->lid;138 139 // build anextended pointer on the RPC descriptor129 rpc->lid = client_core_lid; 130 131 // build extended pointer on the RPC descriptor 140 132 xptr_t desc_xp = XPTR( local_cxy , rpc ); 141 133 … … 160 152 hal_fence(); 161 153 162 // send IPI to the remote core corresponding to the clientcore163 dev_pic_send_ipi( server_cxy , core->lid );154 // send IPI to the selected server core 155 dev_pic_send_ipi( server_cxy , server_core_lid ); 164 156 165 157 // wait RPC completion before returning if blocking RPC … … 171 163 { 172 164 173 #if CONFIG_DEBUG_RPC_SEND174 cycle = (uint32_t)hal_get_cycles(); 175 if( CONFIG_DEBUG_RPC_SEND< cycle )165 #if DEBUG_RPC_CLIENT_GENERIC 166 cycle = (uint32_t)hal_get_cycles(); 167 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 176 168 printk("\n[DBG] %s : thread %x in cluster %x busy waiting / rpc[%d] / cycle %d\n", 177 169 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle ); 178 170 #endif 179 171 180 while( rpc->response ) hal_fixed_delay( 100 );172 while( rpc->responses ) hal_fixed_delay( 100 ); 181 173 182 #if CONFIG_DEBUG_RPC_SEND183 cycle = (uint32_t)hal_get_cycles(); 184 if( CONFIG_DEBUG_RPC_SEND< cycle )185 printk("\n[DBG] %s : thread % in cluster %x resume/ rpc[%d] / cycle %d\n",174 #if DEBUG_RPC_CLIENT_GENERIC 175 cycle = (uint32_t)hal_get_cycles(); 176 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 177 printk("\n[DBG] %s : thread %x in cluster %x resumes / rpc[%d] / cycle %d\n", 186 178 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle ); 187 179 #endif … … 190 182 { 191 183 192 #if CONFIG_DEBUG_RPC_SEND193 cycle = (uint32_t)hal_get_cycles(); 194 if( CONFIG_DEBUG_RPC_SEND< cycle )195 printk("\n[DBG] %s : thread %x in cluster %x deschedule/ rpc[%d] / cycle %d\n",184 #if DEBUG_RPC_CLIENT_GENERIC 185 cycle = (uint32_t)hal_get_cycles(); 186 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 187 printk("\n[DBG] %s : thread %x in cluster %x blocks & deschedules / rpc[%d] / cycle %d\n", 196 188 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle ); 197 189 #endif … … 199 191 sched_yield("blocked on RPC"); 200 192 201 #if CONFIG_DEBUG_RPC_SEND202 cycle = (uint32_t)hal_get_cycles(); 203 if( CONFIG_DEBUG_RPC_SEND< cycle )204 printk("\n[DBG] %s : thread % in cluster %x resume/ rpcr[%d] / cycle %d\n",193 #if DEBUG_RPC_CLIENT_GENERIC 194 cycle = (uint32_t)hal_get_cycles(); 195 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 196 printk("\n[DBG] %s : thread %x in cluster %x resumes / rpcr[%d] / cycle %d\n", 205 197 __FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle ); 206 198 #endif … … 208 200 209 201 // check response available 210 assert( (rpc->response == 0) , __FUNCTION__, "illegal RPC response\n" ); 211 212 // acknowledge the IPI sent by the server 213 dev_pic_ack_ipi(); 202 assert( (rpc->responses == 0) , __FUNCTION__, "illegal RPC response\n" ); 214 203 } 215 else 204 else // non blocking RPC 216 205 { 217 206 218 #if CONFIG_DEBUG_RPC_SEND219 cycle = (uint32_t)hal_get_cycles(); 220 if( CONFIG_DEBUG_RPC_SEND< cycle )207 #if DEBUG_RPC_CLIENT_GENERIC 208 cycle = (uint32_t)hal_get_cycles(); 209 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 221 210 printk("\n[DBG] %s : non blocking rpc[%d] => thread %x return / cycle %d\n", 222 211 __FUNCTION__, rpc->index, CURRENT_THREAD, cycle ); … … 244 233 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 245 234 246 #if CONFIG_DEBUG_RPC_SERVER235 #if DEBUG_RPC_SERVER_GENERIC 247 236 uint32_t cycle = (uint32_t)hal_get_cycles(); 248 if( CONFIG_DEBUG_RPC_SERVER< cycle )237 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 249 238 printk("\n[DBG] %s : thread %x interrupted in cluster %x / cycle %d\n", 250 239 __FUNCTION__, this, local_cxy, cycle ); … … 254 243 hal_disable_irq( &sr_save ); 255 244 256 // check RPC FIFO not empty and no RPC thread handling it245 // activate (or create) RPC thread if RPC FIFO not empty 257 246 if( (rpc_fifo->owner == 0) && (local_fifo_is_empty(rpc_fifo) == false) ) 258 247 { 259 // search one non blocked RPC thread 248 249 #if DEBUG_RPC_SERVER_GENERIC 250 cycle = (uint32_t)hal_get_cycles(); 251 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 252 printk("\n[DBG] %s : RPC FIFO non empty in cluster %x / cycle %d\n", 253 __FUNCTION__, local_cxy, cycle ); 254 #endif 255 256 // search one IDLE RPC thread 260 257 list_entry_t * iter; 261 258 LIST_FOREACH( &sched->k_root , iter ) 262 259 { 263 260 thread = LIST_ELEMENT( iter , thread_t , sched_list ); 264 if( (thread->type == THREAD_RPC) && (thread->blocked == 0) )261 if( (thread->type == THREAD_RPC) && (thread->blocked == THREAD_BLOCKED_IDLE ) ) 265 262 { 263 // unblock found RPC thread 264 thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_IDLE ); 265 266 // exit loop 266 267 found = true; 267 268 break; … … 279 280 if( error ) 280 281 { 281 printk("\n[WARNING] in %s : no memory for new RPC thread in cluster %x\n",282 __FUNCTION__, local_cxy );282 assert( false , __FUNCTION__ , 283 "no memory to allocate a new RPC thread in cluster %x", local_cxy ); 283 284 } 284 else 285 { 286 // unblock created RPC thread 287 thread->blocked = 0; 288 289 // update core descriptor counter 290 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 ); 291 292 #if CONFIG_DEBUG_RPC_SERVER 293 cycle = (uint32_t)hal_get_cycles(); 294 if( CONFIG_DEBUG_RPC_SERVER < cycle ) 285 286 // unblock created RPC thread 287 thread->blocked = 0; 288 289 // update core descriptor counter 290 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 ); 291 292 #if DEBUG_RPC_SERVER_GENERIC 293 cycle = (uint32_t)hal_get_cycles(); 294 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 295 295 printk("\n[DBG] %s : create a new RPC thread %x in cluster %x / cycle %d\n", 296 296 __FUNCTION__, thread, local_cxy, cycle ); 297 297 #endif 298 }299 298 } 300 299 } 301 300 302 #if CONFIG_DEBUG_RPC_SERVER303 cycle = (uint32_t)hal_get_cycles(); 304 if( CONFIG_DEBUG_RPC_SERVER< cycle )301 #if DEBUG_RPC_SERVER_GENERIC 302 cycle = (uint32_t)hal_get_cycles(); 303 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 305 304 printk("\n[DBG] %s : interrupted thread %x deschedules in cluster %x / cycle %d\n", 306 305 __FUNCTION__, this, local_cxy, cycle ); 307 306 #endif 308 307 309 // interrupted thread deschedule always308 // interrupted thread always deschedule 310 309 sched_yield("IPI received"); 311 310 312 #if CONFIG_DEBUG_RPC_SERVER313 cycle = (uint32_t)hal_get_cycles(); 314 if( CONFIG_DEBUG_RPC_SERVER< cycle )311 #if DEBUG_RPC_SERVER_GENERIC 312 cycle = (uint32_t)hal_get_cycles(); 313 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 315 314 printk("\n[DBG] %s : interrupted thread %x resumes in cluster %x / cycle %d\n", 316 315 __FUNCTION__, this, local_cxy, cycle ); … … 346 345 // - internal loop : handle up to CONFIG_RPC_PENDING_MAX RPC requests 347 346 348 while(1) // externalloop347 while(1) // infinite loop 349 348 { 350 349 // try to take RPC_FIFO ownership … … 352 351 { 353 352 354 #if CONFIG_DEBUG_RPC_SERVER353 #if DEBUG_RPC_SERVER_GENERIC 355 354 uint32_t cycle = (uint32_t)hal_get_cycles(); 356 if( CONFIG_DEBUG_RPC_SERVER< cycle )355 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 357 356 printk("\n[DBG] %s : RPC thread %x in cluster %x takes RPC fifo ownership / cycle %d\n", 358 357 __FUNCTION__, this, local_cxy, cycle ); … … 360 359 // initializes RPC requests counter 361 360 count = 0; 362 363 // acknowledge local IPI364 dev_pic_ack_ipi();365 361 366 362 // exit internal loop in three cases: … … 381 377 blocking = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->blocking ) ); 382 378 383 #if CONFIG_DEBUG_RPC_SERVER384 cycle = (uint32_t)hal_get_cycles(); 385 if( CONFIG_DEBUG_RPC_SERVER< cycle )386 printk("\n[DBG] %s : RPC thread %x in cluster %x got rpc[%d] / rpc_ ptr %x / cycle %d\n",387 __FUNCTION__, this, local_cxy, index, desc_ ptr, cycle);379 #if DEBUG_RPC_SERVER_GENERIC 380 cycle = (uint32_t)hal_get_cycles(); 381 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 382 printk("\n[DBG] %s : RPC thread %x in cluster %x got rpc[%d] / rpc_cxy %x / rpc_ptr %x\n", 383 __FUNCTION__, this, local_cxy, index, desc_cxy, desc_ptr ); 388 384 #endif 389 385 // call the relevant server function 390 386 rpc_server[index]( desc_xp ); 391 387 392 #if CONFIG_DEBUG_RPC_SERVER393 cycle = (uint32_t)hal_get_cycles(); 394 if( CONFIG_DEBUG_RPC_SERVER< cycle )388 #if DEBUG_RPC_SERVER_GENERIC 389 cycle = (uint32_t)hal_get_cycles(); 390 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 395 391 printk("\n[DBG] %s : RPC thread %x in cluster %x completes rpc[%d] / rpc_ptr %x / cycle %d\n", 396 __FUNCTION__, this, local_cxy, index, cycle );392 __FUNCTION__, this, local_cxy, index, desc_ptr, cycle ); 397 393 #endif 398 394 // increment handled RPCs counter … … 403 399 { 404 400 // decrement responses counter in RPC descriptor 405 hal_remote_atomic_add(XPTR( desc_cxy, &desc_ptr->response ), -1); 401 hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 ); 402 403 // get client thread pointer and client core lid from RPC descriptor 404 thread_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) ); 405 core_lid = hal_remote_lw ( XPTR( desc_cxy , &desc_ptr->lid ) ); 406 406 407 407 // unblock client thread 408 thread_ptr = (thread_t *)hal_remote_lpt(XPTR(desc_cxy,&desc_ptr->thread)); 409 thread_unblock( XPTR(desc_cxy,thread_ptr) , THREAD_BLOCKED_RPC ); 408 thread_unblock( XPTR( desc_cxy , thread_ptr ) , THREAD_BLOCKED_RPC ); 410 409 411 410 hal_fence(); 412 411 413 // get client core lid and send IPI 414 core_lid = hal_remote_lw(XPTR(desc_cxy, &desc_ptr->lid)); 412 #if DEBUG_RPC_SERVER_GENERIC 413 cycle = (uint32_t)hal_get_cycles(); 414 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 415 printk("\n[DBG] %s : RPC thread %x (cluster %x) unblocked client thread %x (cluster %x)\n", 416 __FUNCTION__, this, local_cxy, thread_ptr, desc_cxy, cycle ); 417 #endif 418 // send IPI to client core 415 419 dev_pic_send_ipi( desc_cxy , core_lid ); 416 420 } … … 432 436 { 433 437 434 #if CONFIG_DEBUG_RPC_SERVER438 #if DEBUG_RPC_SERVER_GENERIC 435 439 uint32_t cycle = (uint32_t)hal_get_cycles(); 436 if( CONFIG_DEBUG_RPC_SERVER< cycle )440 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 437 441 printk("\n[DBG] %s : RPC thread %x in cluster %x suicides / cycle %d\n", 438 442 __FUNCTION__, this, local_cxy, cycle ); … … 447 451 } 448 452 449 #if CONFIG_DEBUG_RPC_SERVER453 #if DEBUG_RPC_SERVER_GENERIC 450 454 uint32_t cycle = (uint32_t)hal_get_cycles(); 451 if( CONFIG_DEBUG_RPC_SERVER< cycle )455 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 452 456 printk("\n[DBG] %s : RPC thread %x in cluster %x deschedules / cycle %d\n", 453 457 __FUNCTION__, this, local_cxy, cycle ); 454 458 #endif 455 459 456 // deschedule without blocking 460 // Block and deschedule 461 thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_IDLE ); 457 462 sched_yield("RPC fifo empty or too much work"); 458 463 459 #if CONFIG_DEBUG_RPC_SERVER460 cycle = (uint32_t)hal_get_cycles(); 461 if( CONFIG_DEBUG_RPC_SERVER< cycle )464 #if DEBUG_RPC_SERVER_GENERIC 465 cycle = (uint32_t)hal_get_cycles(); 466 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 462 467 printk("\n[DBG] %s : RPC thread %x in cluster %x resumes / cycle %d\n", 463 468 __FUNCTION__, this, local_cxy, cycle ); 464 469 #endif 465 470 466 } // end externalloop471 } // end infinite loop 467 472 468 473 } // end rpc_thread_func() … … 478 483 page_t ** page ) // out 479 484 { 480 481 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 482 483 // initialise RPC descriptor header 484 rpc_desc_t rpc; 485 rpc.index = RPC_PMEM_GET_PAGES; 486 rpc.response = 1; 487 rpc.blocking = true; 485 #if DEBUG_RPC_PMEM_GET_PAGES 486 uint32_t cycle = (uint32_t)hal_get_cycles(); 487 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 488 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 489 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 490 #endif 491 492 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 493 494 // initialise RPC descriptor header 495 rpc_desc_t rpc; 496 rpc.index = RPC_PMEM_GET_PAGES; 497 rpc.blocking = true; 498 rpc.responses = 1; 488 499 489 500 // set input arguments in RPC descriptor … … 496 507 *page = (page_t *)(intptr_t)rpc.args[1]; 497 508 509 #if DEBUG_RPC_PMEM_GET_PAGES 510 cycle = (uint32_t)hal_get_cycles(); 511 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 512 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 513 __FUNCTION__ , CURRENT_THREAD , cycle ); 514 #endif 498 515 } 499 516 … … 501 518 void rpc_pmem_get_pages_server( xptr_t xp ) 502 519 { 520 #if DEBUG_RPC_PMEM_GET_PAGES 521 uint32_t cycle = (uint32_t)hal_get_cycles(); 522 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 523 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 524 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 525 #endif 503 526 504 527 // get client cluster identifier and pointer on RPC descriptor … … 515 538 hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); 516 539 540 #if DEBUG_RPC_PMEM_GET_PAGES 541 cycle = (uint32_t)hal_get_cycles(); 542 if( cycle > DEBUG_RPC_PMEM_GET_PAGES ) 543 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 544 __FUNCTION__ , CURRENT_THREAD , cycle ); 545 #endif 517 546 } 518 547 … … 525 554 page_t * page ) // out 526 555 { 556 #if DEBUG_RPC_PMEM_RELEASE_PAGES 557 uint32_t cycle = (uint32_t)hal_get_cycles(); 558 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 559 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 560 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 561 #endif 527 562 528 563 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); … … 531 566 rpc_desc_t rpc; 532 567 rpc.index = RPC_PMEM_RELEASE_PAGES; 533 rpc. response = 1;534 rpc. blocking = true;568 rpc.blocking = true; 569 rpc.responses = 1; 535 570 536 571 // set input arguments in RPC descriptor … … 540 575 rpc_send( cxy , &rpc ); 541 576 577 #if DEBUG_RPC_PMEM_RELEASE_PAGES 578 cycle = (uint32_t)hal_get_cycles(); 579 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 580 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 581 __FUNCTION__ , CURRENT_THREAD , cycle ); 582 #endif 542 583 } 543 584 … … 545 586 void rpc_pmem_release_pages_server( xptr_t xp ) 546 587 { 588 #if DEBUG_RPC_PMEM_RELEASE_PAGES 589 uint32_t cycle = (uint32_t)hal_get_cycles(); 590 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 591 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 592 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 593 #endif 547 594 548 595 // get client cluster identifier and pointer on RPC descriptor … … 559 606 kmem_free( &req ); 560 607 608 #if DEBUG_RPC_PMEM_RELEASE_PAGES 609 cycle = (uint32_t)hal_get_cycles(); 610 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES ) 611 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 612 __FUNCTION__ , CURRENT_THREAD , cycle ); 613 #endif 561 614 } 562 615 … … 577 630 error_t * error ) // out 578 631 { 632 #if DEBUG_RPC_PROCESS_MAKE_FORK 633 uint32_t cycle = (uint32_t)hal_get_cycles(); 634 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) 635 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 636 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 637 #endif 638 579 639 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 580 640 … … 582 642 rpc_desc_t rpc; 583 643 rpc.index = RPC_PROCESS_MAKE_FORK; 584 rpc. response = 1;585 rpc. blocking = true;644 rpc.blocking = true; 645 rpc.responses = 1; 586 646 587 647 // set input arguments in RPC descriptor … … 597 657 *error = (error_t)rpc.args[4]; 598 658 659 #if DEBUG_RPC_PROCESS_MAKE_FORK 660 cycle = (uint32_t)hal_get_cycles(); 661 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) 662 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 663 __FUNCTION__ , CURRENT_THREAD , cycle ); 664 #endif 599 665 } 600 666 … … 602 668 void rpc_process_make_fork_server( xptr_t xp ) 603 669 { 670 #if DEBUG_RPC_PROCESS_MAKE_FORK 671 uint32_t cycle = (uint32_t)hal_get_cycles(); 672 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) 673 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 674 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 675 #endif 604 676 605 677 xptr_t ref_process_xp; // extended pointer on reference parent process … … 628 700 hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); 629 701 702 #if DEBUG_RPC_PROCESS_MAKE_FORK 703 cycle = (uint32_t)hal_get_cycles(); 704 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK ) 705 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 706 __FUNCTION__ , CURRENT_THREAD , cycle ); 707 #endif 630 708 } 631 709 … … 656 734 rpc_desc_t rpc; 657 735 rpc.index = RPC_THREAD_USER_CREATE; 658 rpc. response = 1;659 rpc. blocking = true;736 rpc.blocking = true; 737 rpc.responses = 1; 660 738 661 739 // set input arguments in RPC descriptor … … 690 768 // get client cluster identifier and pointer on RPC descriptor 691 769 cxy_t client_cxy = GET_CXY( xp ); 692 rpc_desc_t * desc = GET_PTR( xp );770 rpc_desc_t * desc = GET_PTR( xp ); 693 771 694 772 // get pointer on attributes structure in client cluster from RPC descriptor … … 736 814 rpc_desc_t rpc; 737 815 rpc.index = RPC_THREAD_KERNEL_CREATE; 738 rpc. response = 1;739 rpc. blocking = true;816 rpc.blocking = true; 817 rpc.responses = 1; 740 818 741 819 // set input arguments in RPC descriptor … … 763 841 // get client cluster identifier and pointer on RPC descriptor 764 842 cxy_t client_cxy = GET_CXY( xp ); 765 rpc_desc_t * desc = GET_PTR( xp );843 rpc_desc_t * desc = GET_PTR( xp ); 766 844 767 845 // get attributes from RPC descriptor … … 797 875 { 798 876 799 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)877 #if DEBUG_RPC_PROCESS_SIGACTION 800 878 uint32_t cycle = (uint32_t)hal_get_cycles(); 801 879 uint32_t action = rpc->args[0]; 802 880 pid_t pid = rpc->args[1]; 803 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )881 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 804 882 printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n", 805 883 __FUNCTION__ , process_action_str( action ) , pid , cxy , cycle ); … … 813 891 rpc_send( cxy , rpc ); 814 892 815 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)816 cycle = (uint32_t)hal_get_cycles(); 817 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )893 #if DEBUG_RPC_PROCESS_SIGACTION 894 cycle = (uint32_t)hal_get_cycles(); 895 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 818 896 printk("\n[DBG] %s : exit after requesting to %s process %x in cluster %x / cycle %d\n", 819 897 __FUNCTION__ , process_action_str( action ) , pid , cxy , cycle ); … … 842 920 pid = (pid_t) hal_remote_lwd( XPTR(client_cxy , &rpc->args[1]) ); 843 921 844 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)922 #if DEBUG_RPC_PROCESS_SIGACTION 845 923 uint32_t cycle = (uint32_t)hal_get_cycles(); 846 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )924 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 847 925 printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n", 848 926 __FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle ); … … 858 936 859 937 // build extended pointer on response counter in RPC 860 count_xp = XPTR( client_cxy , &rpc->response );938 count_xp = XPTR( client_cxy , &rpc->responses ); 861 939 862 940 // decrement the responses counter in RPC descriptor, … … 872 950 } 873 951 874 #if (CONFIG_DEBUG_PROCESS_SIGACTION & 1)875 cycle = (uint32_t)hal_get_cycles(); 876 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )952 #if DEBUG_RPC_PROCESS_SIGACTION 953 cycle = (uint32_t)hal_get_cycles(); 954 if( DEBUG_RPC_PROCESS_SIGACTION < cycle ) 877 955 printk("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n", 878 956 __FUNCTION__ , process_action_str( action ) , pid , local_cxy , cycle ); … … 903 981 rpc_desc_t rpc; 904 982 rpc.index = RPC_VFS_INODE_CREATE; 905 rpc. response = 1;906 rpc. blocking = true;983 rpc.blocking = true; 984 rpc.responses = 1; 907 985 908 986 // set input arguments in RPC descriptor … … 983 1061 rpc_desc_t rpc; 984 1062 rpc.index = RPC_VFS_INODE_DESTROY; 985 rpc. response = 1;986 rpc. blocking = true;1063 rpc.blocking = true; 1064 rpc.responses = 1; 987 1065 988 1066 // set input arguments in RPC descriptor … … 1023 1101 error_t * error ) // out 1024 1102 { 1025 RPC_DEBUG_ENTER 1103 #if DEBUG_RPC_VFS_DENTRY_CREATE 1104 uint32_t cycle = (uint32_t)hal_get_cycles(); 1105 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1106 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 1107 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 1108 #endif 1026 1109 1027 1110 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); … … 1030 1113 rpc_desc_t rpc; 1031 1114 rpc.index = RPC_VFS_DENTRY_CREATE; 1032 rpc. response = 1;1033 rpc. blocking = true;1115 rpc.blocking = true; 1116 rpc.responses = 1; 1034 1117 1035 1118 // set input arguments in RPC descriptor … … 1045 1128 *error = (error_t)rpc.args[4]; 1046 1129 1047 RPC_DEBUG_EXIT 1130 #if DEBUG_RPC_VFS_DENTRY_CREATE 1131 cycle = (uint32_t)hal_get_cycles(); 1132 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1133 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 1134 __FUNCTION__ , CURRENT_THREAD , cycle ); 1135 #endif 1048 1136 } 1049 1137 … … 1051 1139 void rpc_vfs_dentry_create_server( xptr_t xp ) 1052 1140 { 1141 #if DEBUG_RPC_VFS_DENTRY_CREATE 1142 uint32_t cycle = (uint32_t)hal_get_cycles(); 1143 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1144 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 1145 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 1146 #endif 1147 1053 1148 uint32_t type; 1054 1149 char * name; … … 1056 1151 xptr_t dentry_xp; 1057 1152 error_t error; 1058 1059 RPC_DEBUG_ENTER1060 1061 1153 char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; 1062 1154 … … 1083 1175 hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); 1084 1176 1085 RPC_DEBUG_EXIT 1177 #if DEBUG_RPC_VFS_DENTRY_CREATE 1178 cycle = (uint32_t)hal_get_cycles(); 1179 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE ) 1180 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 1181 __FUNCTION__ , CURRENT_THREAD , cycle ); 1182 #endif 1086 1183 } 1087 1184 … … 1100 1197 rpc_desc_t rpc; 1101 1198 rpc.index = RPC_VFS_DENTRY_DESTROY; 1102 rpc. response = 1;1103 rpc. blocking = true;1199 rpc.blocking = true; 1200 rpc.responses = 1; 1104 1201 1105 1202 // set input arguments in RPC descriptor … … 1140 1237 error_t * error ) // out 1141 1238 { 1239 #if DEBUG_RPC_VFS_FILE_CREATE 1240 uint32_t cycle = (uint32_t)hal_get_cycles(); 1241 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1242 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 1243 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 1244 #endif 1245 1142 1246 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 1143 1247 … … 1145 1249 rpc_desc_t rpc; 1146 1250 rpc.index = RPC_VFS_FILE_CREATE; 1147 rpc. response = 1;1148 rpc. blocking = true;1251 rpc.blocking = true; 1252 rpc.responses = 1; 1149 1253 1150 1254 // set input arguments in RPC descriptor … … 1159 1263 *error = (error_t)rpc.args[3]; 1160 1264 1265 #if DEBUG_RPC_VFS_FILE_CREATE 1266 cycle = (uint32_t)hal_get_cycles(); 1267 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1268 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 1269 __FUNCTION__ , CURRENT_THREAD , cycle ); 1270 #endif 1161 1271 } 1162 1272 … … 1164 1274 void rpc_vfs_file_create_server( xptr_t xp ) 1165 1275 { 1276 #if DEBUG_RPC_VFS_FILE_CREATE 1277 uint32_t cycle = (uint32_t)hal_get_cycles(); 1278 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1279 printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n", 1280 __FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle ); 1281 #endif 1282 1166 1283 uint32_t file_attr; 1167 1284 vfs_inode_t * inode; … … 1186 1303 hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1187 1304 1305 #if DEBUG_RPC_VFS_FILE_CREATE 1306 cycle = (uint32_t)hal_get_cycles(); 1307 if( cycle > DEBUG_RPC_VFS_FILE_CREATE ) 1308 printk("\n[DBG] %s : thread %x exit / cycle %d\n", 1309 __FUNCTION__ , CURRENT_THREAD , cycle ); 1310 #endif 1188 1311 } 1189 1312 … … 1201 1324 rpc_desc_t rpc; 1202 1325 rpc.index = RPC_VFS_FILE_DESTROY; 1203 rpc. response = 1;1204 rpc. blocking = true;1326 rpc.blocking = true; 1327 rpc.responses = 1; 1205 1328 1206 1329 // set input arguments in RPC descriptor … … 1245 1368 rpc_desc_t rpc; 1246 1369 rpc.index = RPC_VFS_INODE_LOAD; 1247 rpc. response = 1;1248 rpc. blocking = true;1370 rpc.blocking = true; 1371 rpc.responses = 1; 1249 1372 1250 1373 // set input arguments in RPC descriptor … … 1306 1429 rpc_desc_t rpc; 1307 1430 rpc.index = RPC_VFS_MAPPER_LOAD_ALL; 1308 rpc. response = 1;1309 rpc. blocking = true;1431 rpc.blocking = true; 1432 rpc.responses = 1; 1310 1433 1311 1434 // set input arguments in RPC descriptor … … 1358 1481 rpc_desc_t rpc; 1359 1482 rpc.index = RPC_FATFS_GET_CLUSTER; 1360 rpc. response = 1;1361 rpc. blocking = true;1483 rpc.blocking = true; 1484 rpc.responses = 1; 1362 1485 1363 1486 // set input arguments in RPC descriptor … … 1386 1509 // get client cluster identifier and pointer on RPC descriptor 1387 1510 cxy_t client_cxy = GET_CXY( xp ); 1388 rpc_desc_t * desc = GET_PTR( xp );1511 rpc_desc_t * desc = GET_PTR( xp ); 1389 1512 1390 1513 // get input arguments … … 1418 1541 rpc_desc_t rpc; 1419 1542 rpc.index = RPC_VMM_GET_VSEG; 1420 rpc. response = 1;1421 rpc. blocking = true;1543 rpc.blocking = true; 1544 rpc.responses = 1; 1422 1545 1423 1546 // set input arguments in RPC descriptor … … 1480 1603 rpc_desc_t rpc; 1481 1604 rpc.index = RPC_VMM_GET_PTE; 1482 rpc. response = 1;1483 rpc. blocking = true;1605 rpc.blocking = true; 1606 rpc.responses = 1; 1484 1607 1485 1608 // set input arguments in RPC descriptor … … 1541 1664 rpc_desc_t rpc; 1542 1665 rpc.index = RPC_THREAD_USER_CREATE; 1543 rpc. response = 1;1544 rpc. blocking = true;1666 rpc.blocking = true; 1667 rpc.responses = 1; 1545 1668 1546 1669 // set input arguments in RPC descriptor … … 1560 1683 // get client cluster identifier and pointer on RPC descriptor 1561 1684 cxy_t client_cxy = GET_CXY( xp ); 1562 rpc_desc_t * desc = GET_PTR( xp );1685 rpc_desc_t * desc = GET_PTR( xp ); 1563 1686 1564 1687 // get input argument "kmem_type" from client RPC descriptor … … 1591 1714 rpc_desc_t rpc; 1592 1715 rpc.index = RPC_THREAD_USER_CREATE; 1593 rpc. response = 1;1594 rpc. blocking = true;1716 rpc.blocking = true; 1717 rpc.responses = 1; 1595 1718 1596 1719 // set input arguments in RPC descriptor … … 1608 1731 // get client cluster identifier and pointer on RPC descriptor 1609 1732 cxy_t client_cxy = GET_CXY( xp ); 1610 rpc_desc_t * desc = GET_PTR( xp );1733 rpc_desc_t * desc = GET_PTR( xp ); 1611 1734 1612 1735 // get input arguments "buf" and "kmem_type" from client RPC descriptor … … 1641 1764 rpc_desc_t rpc; 1642 1765 rpc.index = RPC_MAPPER_MOVE_BUFFER; 1643 rpc. response = 1;1644 rpc. blocking = true;1766 rpc.blocking = true; 1767 rpc.responses = 1; 1645 1768 1646 1769 // set input arguments in RPC descriptor … … 1725 1848 rpc_desc_t rpc; 1726 1849 rpc.index = RPC_MAPPER_GET_PAGE; 1727 rpc. response = 1;1728 rpc. blocking = true;1850 rpc.blocking = true; 1851 rpc.responses = 1; 1729 1852 1730 1853 // set input arguments in RPC descriptor … … 1780 1903 rpc_desc_t rpc; 1781 1904 rpc.index = RPC_VMM_CREATE_VSEG; 1782 rpc. response = 1;1783 rpc. blocking = true;1905 rpc.blocking = true; 1906 rpc.responses = 1; 1784 1907 1785 1908 // set input arguments in RPC descriptor … … 1846 1969 rpc_desc_t rpc; 1847 1970 rpc.index = RPC_SCHED_DISPLAY; 1848 rpc. response = 1;1849 rpc. blocking = true;1971 rpc.blocking = true; 1972 rpc.responses = 1; 1850 1973 1851 1974 // set input arguments in RPC descriptor … … 1885 2008 rpc_desc_t rpc; 1886 2009 rpc.index = RPC_VMM_SET_COW; 1887 rpc. response = 1;1888 rpc. blocking = true;2010 rpc.blocking = true; 2011 rpc.responses = 1; 1889 2012 1890 2013 // set input arguments in RPC descriptor … … 1927 2050 rpc_desc_t rpc; 1928 2051 rpc.index = RPC_VMM_DISPLAY; 1929 rpc. response = 1;1930 rpc. blocking = true;2052 rpc.blocking = true; 2053 rpc.responses = 1; 1931 2054 1932 2055 // set input arguments in RPC descriptor
Note: See TracChangeset
for help on using the changeset viewer.