Changeset 407 for trunk/kernel/kern/rpc.c
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r406 r407 76 76 &rpc_mapper_move_buffer_server, // 24 77 77 &rpc_mapper_get_page_server, // 25 78 &rpc_ undefined,// 2679 &rpc_ undefined,// 2778 &rpc_vmm_create_vseg_server, // 26 79 &rpc_sched_display_server, // 27 80 80 &rpc_undefined, // 28 81 81 &rpc_undefined, // 29 … … 97 97 page_t ** page ) // out 98 98 { 99 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",99 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 100 100 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 101 101 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 115 115 116 116 // get output arguments from RPC descriptor 117 *page 118 119 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",117 *page = (page_t *)(intptr_t)rpc.args[1]; 118 119 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 120 120 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 121 121 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 125 125 void rpc_pmem_get_pages_server( xptr_t xp ) 126 126 { 127 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",127 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 128 128 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 129 129 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 142 142 hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); 143 143 144 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",144 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 145 145 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 146 146 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 157 157 pid_t * pid ) // out 158 158 { 159 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",159 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 160 160 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 161 161 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 178 178 *error = (error_t)rpc.args[2]; 179 179 180 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",180 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 181 181 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 182 182 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 190 190 pid_t pid; // output : process identifier 191 191 192 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",192 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 193 193 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 194 194 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 209 209 hal_remote_sw( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)pid ); 210 210 211 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",211 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 212 212 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 213 213 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 224 224 error_t * error ) // out 225 225 { 226 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",226 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 227 227 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 228 228 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 244 244 *error = (error_t)rpc.args[1]; 245 245 246 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",246 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 247 247 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 248 248 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 256 256 error_t error; // local error error status 257 257 258 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",258 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 259 259 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 260 260 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 278 278 hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); 279 279 280 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",280 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 281 281 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 282 282 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 291 291 void rpc_process_kill_client( process_t * process ) 292 292 { 293 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",293 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 294 294 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 295 295 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 325 325 } 326 326 327 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",327 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 328 328 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 329 329 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 336 336 process_t * process; 337 337 338 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",338 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 339 339 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 340 340 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 360 360 } 361 361 362 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",362 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 363 363 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 364 364 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 379 379 error_t * error ) // out 380 380 { 381 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",381 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 382 382 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 383 383 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 387 387 // initialise RPC descriptor header 388 388 rpc_desc_t rpc; 389 rpc.index = RPC_THREAD_USER_CREATE;390 rpc.response = 1;389 rpc.index = RPC_THREAD_USER_CREATE; 390 rpc.response = 1; 391 391 392 392 // set input arguments in RPC descriptor … … 403 403 *error = (error_t)rpc.args[5]; 404 404 405 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",405 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 406 406 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 407 407 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 421 421 error_t error; 422 422 423 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",423 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 424 424 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 425 425 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 442 442 sizeof(pthread_attr_t) ); 443 443 444 assert( (attr_copy.cxy == local_cxy) , __FUNCTION__ , "bad target cluster\n" );445 446 444 // call kernel function 447 445 error = thread_user_create( pid, … … 453 451 // set output arguments 454 452 thread_xp = XPTR( local_cxy , thread_ptr ); 455 hal_remote_swd( XPTR( client_cxy , &desc->args[ 1] ) , (uint64_t)error);456 hal_remote_swd( XPTR( client_cxy , &desc->args[ 2] ) , (uint64_t)thread_xp);457 458 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",453 hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)thread_xp ); 454 hal_remote_swd( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error ); 455 456 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 459 457 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 460 458 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 473 471 error_t * error ) // out 474 472 { 475 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",473 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 476 474 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 477 475 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 496 494 *error = (error_t)rpc.args[4]; 497 495 498 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",496 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 499 497 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 500 498 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 509 507 error_t error; 510 508 511 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",509 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 512 510 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 513 511 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 533 531 hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)thread_xp ); 534 532 535 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",533 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 536 534 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 537 535 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 547 545 uint32_t sig_id ) // in 548 546 { 549 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",547 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 550 548 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 551 549 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 565 563 rpc_send_sync( cxy , &rpc ); 566 564 567 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",565 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 568 566 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 569 567 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 576 574 uint32_t sig_id; // signal index 577 575 578 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",576 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 579 577 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 580 578 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 591 589 signal_rise( process , sig_id ); 592 590 593 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",591 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 594 592 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 595 593 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 613 611 error_t * error ) // out 614 612 { 615 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",613 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 616 614 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 617 615 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 641 639 *error = (error_t)rpc.args[9]; 642 640 643 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",641 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 644 642 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 645 643 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 660 658 error_t error; 661 659 662 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",660 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 663 661 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 664 662 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 693 691 hal_remote_swd( XPTR( client_cxy , &desc->args[9] ) , (uint64_t)error ); 694 692 695 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",693 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 696 694 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 697 695 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 706 704 struct vfs_inode_s * inode ) 707 705 { 708 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",706 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 709 707 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 710 708 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 723 721 rpc_send_sync( cxy , &rpc ); 724 722 725 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",723 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 726 724 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 727 725 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 733 731 vfs_inode_t * inode; 734 732 735 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",733 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 736 734 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 737 735 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 747 745 vfs_inode_destroy( inode ); 748 746 749 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",747 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 750 748 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 751 749 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 764 762 error_t * error ) // out 765 763 { 766 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",764 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 767 765 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 768 766 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 787 785 *error = (error_t)rpc.args[4]; 788 786 789 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",787 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 790 788 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 791 789 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 803 801 char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; 804 802 805 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",803 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 806 804 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 807 805 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 829 827 hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); 830 828 831 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",829 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 832 830 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 833 831 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 843 841 vfs_dentry_t * dentry ) 844 842 { 845 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",843 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 846 844 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 847 845 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 860 858 rpc_send_sync( cxy , &rpc ); 861 859 862 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",860 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 863 861 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 864 862 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 870 868 vfs_dentry_t * dentry; 871 869 872 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",870 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 873 871 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 874 872 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 884 882 vfs_dentry_destroy( dentry ); 885 883 886 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",884 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 887 885 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 888 886 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 901 899 error_t * error ) // out 902 900 { 903 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",901 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 904 902 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 905 903 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 923 921 *error = (error_t)rpc.args[3]; 924 922 925 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",923 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 926 924 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 927 925 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 936 934 error_t error; 937 935 938 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",936 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 939 937 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 940 938 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 957 955 hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 958 956 959 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",957 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 960 958 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 961 959 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 970 968 vfs_file_t * file ) 971 969 { 972 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",970 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 973 971 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 974 972 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 987 985 rpc_send_sync( cxy , &rpc ); 988 986 989 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",987 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 990 988 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 991 989 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 997 995 vfs_file_t * file; 998 996 999 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",997 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1000 998 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1001 999 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1011 1009 vfs_file_destroy( file ); 1012 1010 1013 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1011 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1014 1012 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1015 1013 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1027 1025 error_t * error ) // out 1028 1026 { 1029 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1027 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1030 1028 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1031 1029 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1049 1047 *error = (error_t)rpc.args[3]; 1050 1048 1051 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1049 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1052 1050 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1053 1051 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1064 1062 char name_copy[CONFIG_VFS_MAX_NAME_LENGTH]; 1065 1063 1066 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1064 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1067 1065 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1068 1066 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1087 1085 hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1088 1086 1089 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1087 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1090 1088 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1091 1089 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1101 1099 error_t * error ) // out 1102 1100 { 1103 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1101 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1104 1102 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1105 1103 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1121 1119 *error = (error_t)rpc.args[1]; 1122 1120 1123 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1121 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1124 1122 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1125 1123 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1132 1130 vfs_inode_t * inode; 1133 1131 1134 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1132 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1135 1133 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1136 1134 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1149 1147 hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error ); 1150 1148 1151 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1149 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1152 1150 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1153 1151 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1162 1160 mapper_t * mapper, // in 1163 1161 uint32_t first, // in 1164 uint32_t page,// in1162 uint32_t index, // in 1165 1163 uint32_t * cluster, // out 1166 1164 error_t * error ) // out 1167 1165 { 1168 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1166 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1169 1167 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1170 1168 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1180 1178 rpc.args[0] = (uint64_t)(intptr_t)mapper; 1181 1179 rpc.args[1] = (uint64_t)first; 1182 rpc.args[2] = (uint64_t) page;1180 rpc.args[2] = (uint64_t)index; 1183 1181 1184 1182 // register RPC request in remote RPC fifo … … 1189 1187 *error = (error_t)rpc.args[4]; 1190 1188 1191 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1189 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1192 1190 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1193 1191 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1199 1197 mapper_t * mapper; 1200 1198 uint32_t first; 1201 uint32_t page;1199 uint32_t index; 1202 1200 uint32_t cluster; 1203 1201 error_t error; 1204 1202 1205 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1203 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1206 1204 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1207 1205 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1214 1212 mapper = (mapper_t *)(intptr_t)hal_remote_lpt( XPTR( client_cxy , &desc->args[0] ) ); 1215 1213 first = (uint32_t) hal_remote_lw ( XPTR( client_cxy , &desc->args[1] ) ); 1216 page= (uint32_t) hal_remote_lw ( XPTR( client_cxy , &desc->args[2] ) );1214 index = (uint32_t) hal_remote_lw ( XPTR( client_cxy , &desc->args[2] ) ); 1217 1215 1218 1216 // call the kernel function 1219 error = fatfs_get_cluster( mapper , first , page, &cluster );1217 error = fatfs_get_cluster( mapper , first , index , &cluster ); 1220 1218 1221 1219 // set output argument … … 1223 1221 hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error ); 1224 1222 1225 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1223 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1226 1224 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1227 1225 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1239 1237 error_t * error ) // out 1240 1238 { 1241 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1239 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1242 1240 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1243 1241 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1261 1259 *error = (error_t)rpc.args[3]; 1262 1260 1263 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1261 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1264 1262 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1265 1263 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1275 1273 error_t error; 1276 1274 1277 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1275 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1278 1276 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1279 1277 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1295 1293 hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1296 1294 1297 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1295 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1298 1296 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1299 1297 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1309 1307 process_t * process, // in 1310 1308 vpn_t vpn, // in 1309 bool_t cow, // in 1311 1310 uint32_t * attr, // out 1312 1311 ppn_t * ppn, // out 1313 1312 error_t * error ) // out 1314 1313 { 1315 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1314 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1316 1315 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1317 1316 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1327 1326 rpc.args[0] = (uint64_t)(intptr_t)process; 1328 1327 rpc.args[1] = (uint64_t)vpn; 1328 rpc.args[2] = (uint64_t)cow; 1329 1329 1330 1330 // register RPC request in remote RPC fifo (blocking function) … … 1332 1332 1333 1333 // get output argument from rpc descriptor 1334 *attr = (uint32_t)rpc.args[ 2];1335 *ppn = (ppn_t)rpc.args[ 3];1336 *error = (error_t)rpc.args[ 4];1337 1338 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1334 *attr = (uint32_t)rpc.args[3]; 1335 *ppn = (ppn_t)rpc.args[4]; 1336 *error = (error_t)rpc.args[5]; 1337 1338 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1339 1339 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1340 1340 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1346 1346 process_t * process; 1347 1347 vpn_t vpn; 1348 bool_t cow; 1348 1349 uint32_t attr; 1349 1350 ppn_t ppn; 1350 1351 error_t error; 1351 1352 1352 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1353 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1353 1354 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1354 1355 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1361 1362 process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) ); 1362 1363 vpn = (vpn_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) ); 1364 cow = (bool_t) hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) ); 1363 1365 1364 1366 // call local kernel function 1365 error = vmm_get_pte( process , vpn , &attr , &ppn );1367 error = vmm_get_pte( process , vpn , cow , &attr , &ppn ); 1366 1368 1367 1369 // set output argument "attr" & "ppn" to client RPC descriptor 1368 hal_remote_swd( XPTR( client_cxy , &desc->args[ 2] ) , (uint64_t)attr );1369 hal_remote_swd( XPTR( client_cxy , &desc->args[ 3] ) , (uint64_t)ppn );1370 hal_remote_swd( XPTR( client_cxy , &desc->args[ 4] ) , (uint64_t)error );1371 1372 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1370 hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)attr ); 1371 hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)ppn ); 1372 hal_remote_swd( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error ); 1373 1374 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1373 1375 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1374 1376 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1384 1386 xptr_t * buf_xp ) // out 1385 1387 { 1386 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1388 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1387 1389 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1388 1390 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1404 1406 *buf_xp = (xptr_t)rpc.args[1]; 1405 1407 1406 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1408 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1407 1409 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1408 1410 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1412 1414 void rpc_kcm_alloc_server( xptr_t xp ) 1413 1415 { 1414 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1416 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1415 1417 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1416 1418 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1433 1435 hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp ); 1434 1436 1435 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1437 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1436 1438 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1437 1439 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1447 1449 uint32_t kmem_type ) // in 1448 1450 { 1449 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1451 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1450 1452 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1451 1453 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1465 1467 rpc_send_sync( cxy , &rpc ); 1466 1468 1467 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1469 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1468 1470 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1469 1471 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1473 1475 void rpc_kcm_free_server( xptr_t xp ) 1474 1476 { 1475 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1477 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1476 1478 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1477 1479 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1491 1493 kmem_free( &req ); 1492 1494 1493 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1495 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1494 1496 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1495 1497 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1510 1512 error_t * error ) // out 1511 1513 { 1512 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1514 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1513 1515 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1514 1516 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1535 1537 *error = (error_t)rpc.args[6]; 1536 1538 1537 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1539 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1538 1540 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1539 1541 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1552 1554 error_t error; 1553 1555 1554 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1556 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1555 1557 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1556 1558 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1592 1594 hal_remote_swd( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error ); 1593 1595 1594 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1596 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1595 1597 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1596 1598 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1607 1609 page_t ** page ) // out 1608 1610 { 1609 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1611 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1610 1612 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1611 1613 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1628 1630 *page = (page_t *)(intptr_t)rpc.args[2]; 1629 1631 1630 rpc_dmsg("\n[D MSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",1632 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1631 1633 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1632 1634 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1636 1638 void rpc_mapper_get_page_server( xptr_t xp ) 1637 1639 { 1638 rpc_dmsg("\n[D MSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",1640 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1639 1641 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1640 1642 CURRENT_THREAD->core->lid , hal_time_stamp() ); … … 1654 1656 hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page ); 1655 1657 1656 rpc_dmsg("\n[DMSG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1657 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1658 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1659 } 1660 1658 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1659 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1660 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1661 } 1662 1663 ///////////////////////////////////////////////////////////////////////////////////////// 1664 // [26] Marshaling functions attached to RPC_VMM_CREATE_VSEG 1665 ///////////////////////////////////////////////////////////////////////////////////////// 1666 1667 //////////////////////////////////////////////////////// 1668 void rpc_vmm_create_vseg_client( cxy_t cxy, 1669 struct process_s * process, 1670 vseg_type_t type, 1671 intptr_t base, 1672 uint32_t size, 1673 uint32_t file_offset, 1674 uint32_t file_size, 1675 xptr_t mapper_xp, 1676 cxy_t vseg_cxy, 1677 struct vseg_s ** vseg ) 1678 { 1679 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1680 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1681 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1682 1683 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 1684 1685 // initialise RPC descriptor header 1686 rpc_desc_t rpc; 1687 rpc.index = RPC_VMM_CREATE_VSEG; 1688 rpc.response = 1; 1689 1690 // set input arguments in RPC descriptor 1691 rpc.args[0] = (uint64_t)(intptr_t)process; 1692 rpc.args[1] = (uint64_t)type; 1693 rpc.args[2] = (uint64_t)base; 1694 rpc.args[3] = (uint64_t)size; 1695 rpc.args[4] = (uint64_t)file_offset; 1696 rpc.args[5] = (uint64_t)file_size; 1697 rpc.args[6] = (uint64_t)mapper_xp; 1698 rpc.args[7] = (uint64_t)vseg_cxy; 1699 1700 // register RPC request in remote RPC fifo (blocking function) 1701 rpc_send_sync( cxy , &rpc ); 1702 1703 // get output values from RPC descriptor 1704 *vseg = (vseg_t *)(intptr_t)rpc.args[8]; 1705 1706 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1707 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1708 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1709 } 1710 1711 //////////////////////////////////////////// 1712 void rpc_vmm_create_vseg_server( xptr_t xp ) 1713 { 1714 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1715 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1716 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1717 1718 // get client cluster identifier and pointer on RPC descriptor 1719 cxy_t cxy = (cxy_t)GET_CXY( xp ); 1720 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp ); 1721 1722 // get input arguments from client RPC descriptor 1723 process_t * process = (process_t *)(intptr_t)hal_remote_lwd( XPTR(cxy , &desc->args[0])); 1724 vseg_type_t type = (vseg_type_t)(uint32_t)hal_remote_lwd( XPTR(cxy , &desc->args[1])); 1725 intptr_t base = (intptr_t) hal_remote_lwd( XPTR(cxy , &desc->args[2])); 1726 uint32_t size = (uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[3])); 1727 uint32_t file_offset = (uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[4])); 1728 uint32_t file_size = (uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[5])); 1729 xptr_t mapper_xp = (xptr_t) hal_remote_lwd( XPTR(cxy , &desc->args[6])); 1730 cxy_t vseg_cxy = (cxy_t)(uint32_t) hal_remote_lwd( XPTR(cxy , &desc->args[7])); 1731 1732 // call local kernel function 1733 vseg_t * vseg = vmm_create_vseg( process, 1734 type, 1735 base, 1736 size, 1737 file_offset, 1738 file_size, 1739 mapper_xp, 1740 vseg_cxy ); 1741 1742 // set output arguments into client RPC descriptor 1743 hal_remote_swd( XPTR( cxy , &desc->args[8] ) , (uint64_t)(intptr_t)vseg ); 1744 1745 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1746 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1747 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1748 } 1749 1750 ///////////////////////////////////////////////////////////////////////////////////////// 1751 // [27] Marshaling functions attached to RPC_SCHED_DISPLAY 1752 ///////////////////////////////////////////////////////////////////////////////////////// 1753 1754 //////////////////////////////////////////////////////// 1755 void rpc_sched_display_client( cxy_t cxy, 1756 lid_t lid) 1757 { 1758 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1759 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1760 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1761 1762 assert( (cxy != local_cxy) , __FUNCTION__ , "target cluster is not remote\n"); 1763 1764 // initialise RPC descriptor header 1765 rpc_desc_t rpc; 1766 rpc.index = RPC_SCHED_DISPLAY; 1767 rpc.response = 1; 1768 1769 // set input arguments in RPC descriptor 1770 rpc.args[0] = (uint64_t)lid; 1771 1772 // register RPC request in remote RPC fifo (blocking function) 1773 rpc_send_sync( cxy , &rpc ); 1774 1775 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1776 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1777 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1778 } 1779 1780 ////////////////////////////////////////// 1781 void rpc_sched_display_server( xptr_t xp ) 1782 { 1783 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1784 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1785 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1786 1787 // get client cluster identifier and pointer on RPC descriptor 1788 cxy_t cxy = (cxy_t)GET_CXY( xp ); 1789 rpc_desc_t * desc = (rpc_desc_t *)GET_PTR( xp ); 1790 1791 // get input arguments from client RPC descriptor 1792 lid_t lid = (lid_t)hal_remote_lw( XPTR(cxy , &desc->args[0])); 1793 1794 // call local kernel function 1795 sched_display( lid ); 1796 1797 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n", 1798 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy, 1799 CURRENT_THREAD->core->lid , hal_time_stamp() ); 1800 } 1661 1801 1662 1802 /***************************************************************************************/ … … 1668 1808 rpc_desc_t * rpc ) 1669 1809 { 1670 uint32_t cores;1671 1810 error_t error; 1672 bool_t first; 1673 reg_t sr_save; 1674 1675 rpc_dmsg("\n[DMSG] %s : enter / client_cxy = %x / server_cxy = %x / cycle %d\n", 1676 __FUNCTION__ , local_cxy , server_cxy , hal_time_stamp() ); 1677 1678 // allocate and initialise an extended pointer on the RPC descriptor 1811 1812 thread_t * this = CURRENT_THREAD; 1813 core_t * core = this->core; 1814 1815 // register client thread pointer and core lid in RPC descriptor 1816 rpc->thread = this; 1817 rpc->lid = core->lid; 1818 1819 // build an extended pointer on the RPC descriptor 1679 1820 xptr_t desc_xp = XPTR( local_cxy , rpc ); 1680 1821 1681 1822 // get local pointer on rpc_fifo in remote cluster, with the 1682 // assumption that rpc_fifo pddresses are identical in all clusters1683 r pc_fifo_t * rf= &LOCAL_CLUSTER->rpc_fifo;1823 // assumption that local pointers are identical in all clusters 1824 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 1684 1825 1685 1826 // try to post an item in remote fifo … … 1687 1828 do 1688 1829 { 1689 error = remote_fifo_put_item( XPTR( server_cxy , &rf->fifo ), 1690 (uint64_t )desc_xp, 1691 &first ); 1830 error = remote_fifo_put_item( XPTR( server_cxy , rpc_fifo ), 1831 (uint64_t )desc_xp ); 1692 1832 if ( error ) 1693 1833 { … … 1695 1835 __FUNCTION__ , local_cxy , server_cxy ); 1696 1836 1697 if( thread_can_yield() ) sched_yield( NULL);1837 if( thread_can_yield() ) sched_yield(); 1698 1838 } 1699 1839 } 1700 1840 while( error ); 1701 1841 1702 rpc_dmsg("\n[DMSG] %s : RPC %l registered / server_cxy = %x / cycle %d\n", 1703 __FUNCTION__ , desc_xp , server_cxy , hal_time_stamp() ); 1842 hal_fence(); 1704 1843 1705 // send IPI to remote CP0, if this is the first RPC in remote FIFO, 1706 // and there is no CPU is in kernel mode in server cluster. 1707 if( first ) 1708 { 1709 // get number of cores in kernel mode in server cluster 1710 cores = hal_remote_lw( XPTR( server_cxy , &LOCAL_CLUSTER->cores_in_kernel ) ); 1711 1712 if( cores == 0 ) // no core in kernel mode in server 1713 { 1714 dev_pic_send_ipi( server_cxy , 0 ); 1715 1716 rpc_dmsg("\n[DMSG] %s : IPI sent / client_cxy = %x / server_cxy = %x\n", 1717 __FUNCTION__, local_cxy , server_cxy ); 1718 } 1719 } 1720 1721 // enable IRQs to allow incoming RPC and avoid deadlock 1722 hal_enable_irq( &sr_save ); 1723 1724 // the server thread poll the response slot until RPC completed 1725 // TODO this could be replaced by a descheduling policy... [AG] 1726 while( rpc->response ) asm volatile( "nop" ); 1727 1728 // restore IRQs 1729 hal_restore_irq( sr_save ); 1730 1731 rpc_dmsg("\n[DMSG] %s : completed / client_cxy = %x / server_cxy = %x / cycle %d\n", 1732 __FUNCTION__ , local_cxy , server_cxy , hal_time_stamp() ); 1733 1844 // send IPI to the remote core corresponding to the client core 1845 dev_pic_send_ipi( server_cxy , core->lid ); 1846 1847 // wait RPC completion: 1848 // - busy waiting policy during kernel_init, or if threads cannot yield 1849 // - block and deschedule in all other cases 1850 1851 if( (this->type == THREAD_IDLE) || (thread_can_yield() == false) ) // busy waiting 1852 { 1853 1854 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s busy waiting after registering RPC\n" 1855 " rpc = %d / server = %x / cycle %d\n", 1856 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) , 1857 rpc->index , server_cxy , hal_time_stamp() ); 1858 1859 while( rpc->response ) hal_fixed_delay( 100 ); 1860 1861 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s exit after RPC completion\n", 1862 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) ); 1863 1864 } 1865 else // block & deschedule 1866 { 1867 1868 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s deschedule after registering RPC\n" 1869 " rpc = %d / server = %x / cycle %d\n", 1870 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) , 1871 rpc->index , server_cxy , hal_time_stamp() ); 1872 1873 thread_block( this , THREAD_BLOCKED_RPC ); 1874 sched_yield(); 1875 1876 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %s resumes after RPC completion\n", 1877 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , thread_type_str(this->type) ); 1878 1879 } 1880 1881 // check response available 1882 assert( (rpc->response == 0) , __FUNCTION__, "illegal RPC response\n" ); 1883 1884 // acknowledge the IPI sent by the server 1885 dev_pic_ack_ipi(); 1886 1734 1887 } // end rpc_send_sync() 1735 1888 … … 1740 1893 /***************************************************************************************/ 1741 1894 1742 /////////////////////////////////////////// 1743 void rpc_fifo_init( rpc_fifo_t * rpc_fifo ) 1744 { 1745 rpc_fifo->count = 0; 1746 rpc_fifo->owner = 0; 1747 local_fifo_init( &rpc_fifo->fifo ); 1748 } 1749 1750 ///////////////////////////////////////////// 1751 void rpc_execute_all( rpc_fifo_t * rpc_fifo ) 1752 { 1753 xptr_t xp; // extended pointer on RPC descriptor 1754 uint32_t count; // handled RPC request counter 1755 thread_t * this; // pointer on this RPC thread 1756 core_t * core; // pointer on core running this thread 1757 rpc_desc_t * desc; // pointer on RPC descriptor 1758 uint32_t index; // RPC index 1759 cxy_t client_cxy; // client cluster identifier 1760 error_t error; 1761 1762 this = CURRENT_THREAD; 1763 core = this->core; 1764 count = 0; 1765 1766 rpc_dmsg("\n[DMSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1767 __FUNCTION__, this->trdid, local_cxy, core->lid , hal_time_stamp() ); 1895 //////////////// 1896 void rpc_check() 1897 { 1898 error_t error; 1899 thread_t * thread; 1900 uint32_t sr_save; 1901 1902 bool_t found = false; 1903 thread_t * this = CURRENT_THREAD; 1904 core_t * core = this->core; 1905 scheduler_t * sched = &core->scheduler; 1906 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 1907 1908 grpc_dmsg("\n[DBG] %s : core[%x,%d] / interrupted thread %s / cycle %d\n", 1909 __FUNCTION__, local_cxy, core->lid, thread_type_str(this->type), hal_time_stamp() ); 1910 1911 // interrupted thread not preemptable during RPC chek 1912 hal_disable_irq( &sr_save ); 1913 1914 // check RPC FIFO not empty and no RPC thread handling it 1915 if( (rpc_fifo->owner == 0) && (local_fifo_is_empty(rpc_fifo) == false) ) 1916 { 1917 // search one non blocked RPC thread 1918 list_entry_t * iter; 1919 LIST_FOREACH( &sched->k_root , iter ) 1920 { 1921 thread = LIST_ELEMENT( iter , thread_t , sched_list ); 1922 if( (thread->type == THREAD_RPC) && (thread->blocked == 0 ) ) 1923 { 1924 found = true; 1925 break; 1926 } 1927 } 1928 1929 // create new RPC thread if not found 1930 if( found == false ) 1931 { 1932 error = thread_kernel_create( &thread, 1933 THREAD_RPC, 1934 &rpc_thread_func, 1935 NULL, 1936 this->core->lid ); 1937 if( error ) 1938 { 1939 printk("\n[WARNING] in %s : no memory for new RPC thread in cluster %x\n", 1940 __FUNCTION__ , local_cxy ); 1941 } 1942 else 1943 { 1944 // unblock created RPC thread 1945 thread->blocked = 0; 1946 1947 // update core descriptor counter 1948 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 ); 1949 1950 grpc_dmsg("\n[DBG] %s : core [%x,%d] creates a new RPC thread %x / cycle %d\n", 1951 __FUNCTION__ , local_cxy , core->lid , thread->trdid , hal_time_stamp() ); 1952 1953 } 1954 } 1955 } 1956 1957 grpc_dmsg("\n[DBG] %s : core[%x,%d] / interrupted thread %s deschedules / cycle %d\n", 1958 __FUNCTION__, local_cxy, core->lid, thread_type_str(this->type), hal_time_stamp() ); 1959 1960 // interrupted thread deschedule always 1961 sched_yield(); 1962 1963 grpc_dmsg("\n[DBG] %s : core[%x,%d] / interrupted thread %s resume / cycle %d\n", 1964 __FUNCTION__, local_cxy, core->lid, thread_type_str(this->type), hal_time_stamp() ); 1965 1966 // interrupted thread restore IRQs after resume 1967 hal_restore_irq( sr_save ); 1968 1969 } // end rpc_check() 1970 1971 1972 ////////////////////// 1973 void rpc_thread_func() 1974 { 1975 uint32_t count; // handled RPC requests counter 1976 error_t empty; // local RPC fifo state 1977 xptr_t desc_xp; // extended pointer on RPC request 1978 cxy_t desc_cxy; // RPC request cluster (client) 1979 rpc_desc_t * desc_ptr; // RPC request local pointer 1980 uint32_t index; // RPC request index 1981 uint32_t responses; // number of responses received by client 1982 thread_t * thread_ptr; // local pointer on client thread 1983 lid_t core_lid; // local index of client core 1768 1984 1769 // handle up to CONFIG_RPC_PENDING_MAX requests before exit 1770 do 1771 { 1772 error = local_fifo_get_item( &rpc_fifo->fifo, (uint64_t *)&xp ); 1773 1774 if ( error == 0 ) // One RPC request successfully extracted from RPC_FIFO 1985 // makes RPC thread not preemptable 1986 hal_disable_irq( NULL ); 1987 1988 thread_t * this = CURRENT_THREAD; 1989 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 1990 1991 // two embedded loops: 1992 // - external loop : "infinite" RPC thread 1993 // - internal loop : handle up to CONFIG_RPC_PENDING_MAX RPC requests 1994 1995 while(1) // external loop 1996 { 1997 // try to take RPC_FIFO ownership 1998 if( hal_atomic_test_set( &rpc_fifo->owner , this->trdid ) ) 1775 1999 { 1776 // get client cluster identifier and pointer on RPC descriptor 1777 client_cxy = (cxy_t)GET_CXY( xp ); 1778 desc = (rpc_desc_t *)GET_PTR( xp ); 1779 1780 // get rpc index from RPC descriptor 1781 index = hal_remote_lw( XPTR( client_cxy , &desc->index ) ); 1782 1783 rpc_dmsg("\n[DMSG] %s : thread %x on core [%x,%d] / rpc = %d\n", 1784 __FUNCTION__ , this->trdid , core->lid , local_cxy , index ); 1785 1786 // call the relevant server function 1787 rpc_server[index]( xp ); 1788 1789 // increment handled RPC counter 1790 count++; 1791 1792 // notify RPC completion as required 1793 hal_remote_atomic_add( XPTR( client_cxy , &desc->response ) , -1 ); 1794 } 2000 // initializes RPC requests counter 2001 count = 0; 2002 2003 // acknowledge local IPI 2004 dev_pic_ack_ipi(); 2005 2006 // exit internal loop in three cases: 2007 // - RPC fifo is empty 2008 // - ownership has been lost (because descheduling) 2009 // - max number of RPCs is reached 2010 while( 1 ) // internal loop 2011 { 2012 empty = local_fifo_get_item( rpc_fifo , (uint64_t *)&desc_xp ); 2013 2014 if ( empty == 0 ) // one RPC request found 2015 { 2016 // get client cluster and pointer on RPC descriptor 2017 desc_cxy = (cxy_t)GET_CXY( desc_xp ); 2018 desc_ptr = (rpc_desc_t *)GET_PTR( desc_xp ); 2019 2020 // get rpc index from RPC descriptor 2021 index = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->index ) ); 2022 2023 grpc_dmsg("\n[DBG] %s : core[%x,%d] / RPC thread %x / starts rpc %d / cycle %d\n", 2024 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , index , hal_time_stamp() ); 2025 2026 // call the relevant server function 2027 rpc_server[index]( desc_xp ); 2028 2029 grpc_dmsg("\n[DBG] %s : core[%x,%d] / RPC thread %x / completes rpc %d / cycle %d\n", 2030 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , index , hal_time_stamp() ); 2031 2032 // increment handled RPC counter 2033 count++; 2034 2035 // decrement response counter in RPC descriptor 2036 responses = hal_remote_atomic_add(XPTR( desc_cxy, &desc_ptr->response ), -1); 2037 2038 // unblock client thread and send IPI to client core if last response 2039 if( responses == 1 ) 2040 { 2041 // get pointer on client thread and unblock it 2042 thread_ptr = (thread_t *)hal_remote_lpt(XPTR(desc_cxy,&desc_ptr->thread)); 2043 thread_unblock( XPTR(desc_cxy,thread_ptr) , THREAD_BLOCKED_RPC ); 2044 2045 hal_fence(); 2046 2047 // get client core lid and send IPI 2048 core_lid = hal_remote_lw(XPTR(desc_cxy, &desc_ptr->lid)); 2049 dev_pic_send_ipi( desc_cxy , core_lid ); 2050 } 2051 } 1795 2052 1796 // exit loop in three cases: 1797 // - fifo is empty 1798 // - look has been released (because descheduling) 1799 // - max number of RPCs has been reached 1800 if( error || 1801 (rpc_fifo->owner != this->trdid) || 1802 (count > CONFIG_RPC_PENDING_MAX) ) break; 1803 } 1804 while( 1 ); 1805 1806 // update RPC_FIFO global counter 1807 rpc_fifo->count += count; 1808 1809 } // end rpc_execute_all() 2053 // chek exit condition 2054 if( local_fifo_is_empty( rpc_fifo ) || 2055 (rpc_fifo->owner != this->trdid) || 2056 (count >= CONFIG_RPC_PENDING_MAX) ) break; 2057 } // end internal loop 2058 2059 // release rpc_fifo ownership if not lost 2060 if( rpc_fifo->owner == this->trdid ) rpc_fifo->owner = 0; 2061 } 2062 2063 // sucide if too many RPC threads in cluster 2064 if( LOCAL_CLUSTER->rpc_threads >= CONFIG_RPC_THREADS_MAX ) 2065 { 2066 2067 grpc_dmsg("\n[DBG] %s : core[%x,%d] (RPC thread %x) suicide at cycle %d\n", 2068 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 2069 2070 // update RPC threads counter 2071 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , -1 ); 2072 2073 // suicide 2074 thread_exit(); 2075 } 2076 2077 grpc_dmsg("\n[DBG] %s : core[%x,%d] (RPC thread %x) deschedules / cycle %d\n", 2078 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 2079 2080 // deschedule without blocking 2081 sched_yield(); 2082 2083 grpc_dmsg("\n[DBG] %s : core[%x,%d] (RPC thread %x) resumes / cycle %d\n", 2084 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 2085 2086 } // end external loop 2087 2088 } // end rpc_thread_func() 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 /* deprecated [AG] 29/09/2017 1810 2099 1811 2100 //////////////////////////////////////////////////// 1812 error_t rpc_activate_thread( r pc_fifo_t * rpc_fifo )2101 error_t rpc_activate_thread( remote_fifo_t * rpc_fifo ) 1813 2102 { 1814 2103 core_t * core; … … 1827 2116 1828 2117 assert( (this->trdid == rpc_fifo->owner) , __FUNCTION__ , 1829 2118 "calling thread is not RPC_FIFO owner\n" ); 1830 2119 1831 2120 // makes the calling thread not preemptable … … 1833 2122 hal_disable_irq( &sr_save ); 1834 2123 1835 // search a free RPC thread (must be in THREAD_BLOCKED_IDLE state) 2124 grpc_dmsg("\n[DBG] %s : core[%x,%d] enter at cycle %d\n", 2125 __FUNCTION__ , local_cxy , core->lid , hal_time_stamp() ); 2126 2127 // search one non blocked RPC thread 1836 2128 list_entry_t * iter; 1837 2129 LIST_FOREACH( &sched->k_root , iter ) 1838 2130 { 1839 2131 thread = LIST_ELEMENT( iter , thread_t , sched_list ); 1840 if( (thread->type == THREAD_RPC) && (thread->blocked == THREAD_BLOCKED_IDLE) )2132 if( (thread->type == THREAD_RPC) && (thread->blocked == 0 ) ) 1841 2133 { 1842 2134 found = true; … … 1845 2137 } 1846 2138 1847 if( found ) // activate this idleRPC thread2139 if( found == false ) // create new RPC thread 1848 2140 { 1849 // unblock it1850 thread->blocked = 0;1851 1852 rpc_dmsg("\n[DMSG] %s : activate RPC thread %x on core [%x,%d] / cycle %d\n",1853 __FUNCTION__ , thread , core->gid , local_cxy , hal_time_stamp() );1854 }1855 else // create a new RPC thread1856 {1857 // create new thread1858 2141 error = thread_kernel_create( &thread, 1859 2142 THREAD_RPC, … … 1869 2152 } 1870 2153 1871 // unblock newthread2154 // unblock thread 1872 2155 thread->blocked = 0; 1873 2156 … … 1875 2158 hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , 1 ); 1876 2159 1877 rpc_dmsg("\n[DMSG] %s : create RPC thread %x on core [%x,%d] / cycle %d\n", 1878 __FUNCTION__ , thread->trdid, local_cxy, core->lid, hal_time_stamp() ); 2160 grpc_dmsg("\n[DBG] %s : core [%x,%d] creates RPC thread %x at cycle %d\n", 2161 __FUNCTION__ , local_cxy , core->lid , thread->trdid , hal_time_stamp() ); 2162 1879 2163 } 1880 1881 // update owner in rpc_fifo 2164 else // create a new RPC thread 2165 { 2166 2167 grpc_dmsg("\n[DBG] %s : core[%x,%d] activates RPC thread %x at cycle %d\n", 2168 __FUNCTION__ , local_cxy , core->lid , thread->trdid , hal_time_stamp() ); 2169 2170 } 2171 2172 // update rpc_fifo owner 1882 2173 rpc_fifo->owner = thread->trdid; 1883 2174 1884 // current thread switch to RPC thread1885 sched_yield( thread);2175 // current thread deschedule 2176 sched_yield(); 1886 2177 1887 2178 // restore IRQs for the calling thread … … 1893 2184 } // end rpc_activate_thread() 1894 2185 1895 //////////////// //1896 bool_trpc_check()2186 //////////////// 2187 void rpc_check() 1897 2188 { 1898 2189 thread_t * this = CURRENT_THREAD; 1899 r pc_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo;2190 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 1900 2191 error_t error; 1901 2192 1902 rpc_dmsg("\n[DMSG] %s : enter / thread %x / cluster %x /cycle %d\n",1903 __FUNCTION__ , this->trdid , local_cxy, hal_time_stamp() );2193 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %x / enter at cycle %d\n", 2194 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , hal_time_stamp() ); 1904 2195 1905 2196 // calling thread does nothing if light lock already taken or FIFO empty 1906 2197 if( (rpc_fifo->owner != 0) || (local_fifo_is_empty( &rpc_fifo->fifo )) ) 1907 2198 { 1908 rpc_dmsg("\n[DMSG] %s : exit do nothing / thread %x / cluster %x / cycle %d\n", 1909 __FUNCTION__ , this->trdid , local_cxy , hal_time_stamp() ); 1910 1911 return false; 2199 2200 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %x / exit do nothing at cycle %d\n", 2201 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , hal_time_stamp() ); 2202 2203 return; 1912 2204 } 1913 2205 … … 1922 2214 1923 2215 printk("\n[ERROR] in %s : no memory to create a RPC thread for core %d" 1924 1925 2216 " in cluster %x => do nothing\n", 2217 __FUNCTION__ , CURRENT_CORE->lid , local_cxy ); 1926 2218 } 1927 2219 1928 rpc_dmsg("\n[DMSG] %s : exit after RPC thread activation / " 1929 "thread %x / cluster %x / cycle %d\n", 1930 __FUNCTION__ , this->trdid , local_cxy , hal_time_stamp() ); 1931 1932 return true; 2220 return; 1933 2221 } 1934 2222 else // light lock taken by another thread 1935 2223 { 1936 rpc_dmsg("\n[DMSG] %s : exit do nothing / thread %x / cluster %x / cycle %d\n", 1937 __FUNCTION__ , this->trdid , local_cxy , hal_time_stamp() ); 1938 1939 return false; 2224 2225 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %x / exit do nothing at cycle %d\n", 2226 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , hal_time_stamp() ); 2227 2228 return; 1940 2229 } 1941 2230 } // end rpc_check() … … 1949 2238 1950 2239 thread_t * this = CURRENT_THREAD; 1951 rpc_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 1952 1953 rpc_dmsg("\n[DMSG] %s : enter / thread %x on core[%x,%d] / cycle %d\n", 1954 __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() ); 1955 1956 // this infinite loop is not preemptable 1957 // the RPC thread deschedule only when the RPC_FIFO is empty 2240 remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo; 2241 1958 2242 while(1) 1959 2243 { 1960 2244 // check fifo ownership (ownership should be given by rpc_activate() 1961 if( this->trdid != rpc_fifo->owner ) 1962 { 1963 panic("thread %x on core[%x,%d] not owner of RPC_FIFO", 1964 this->trdid, local_cxy, this->core->lid ); 1965 } 2245 assert( (this->trdid == rpc_fifo->owner) , __FUNCTION__ , 2246 "thread %x on core[%x,%d] not owner of RPC_FIFO / owner = %x\n", 2247 this->trdid, local_cxy, this->core->lid , rpc_fifo->owner ); 1966 2248 1967 2249 // executes pending RPC(s) 1968 2250 rpc_execute_all( rpc_fifo ); 1969 2251 1970 // release rpc_fifo ownership (can be lost during RPC execution) 2252 // release rpc_fifo ownership if required 2253 // (this ownership can be lost during RPC execution) 1971 2254 if( rpc_fifo->owner == this->trdid ) rpc_fifo->owner = 0; 1972 2255 1973 1974 // block and deschedule or sucide 1975 if( LOCAL_CLUSTER->rpc_threads >= CONFIG_RPC_THREADS_MAX ) 2256 // deschedule or sucide 2257 if( LOCAL_CLUSTER->rpc_threads >= CONFIG_RPC_THREADS_MAX ) // suicide 1976 2258 { 1977 rpc_dmsg("\n[DMSG] %s : RPC thread %x on core[%x,%d] suicide / cycle %d\n", 1978 __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() ); 2259 2260 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %x / suicide at cycle %d\n", 2261 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 1979 2262 1980 2263 // update core descriptor counter … … 1984 2267 thread_exit(); 1985 2268 } 1986 else 2269 else // deschedule 1987 2270 { 1988 rpc_dmsg("\n[DMSG] %s : RPC thread %x on core[%x,%d] blocks / cycle %d\n", 1989 __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() ); 1990 1991 thread_block( this , THREAD_BLOCKED_IDLE ); 1992 sched_yield( NULL ); 1993 1994 rpc_dmsg("\n[DMSG] %s : RPC thread %x wake up on core[%x,%d] / cycle %d\n", 1995 __FUNCTION__, this->trdid, local_cxy, this->core->lid, hal_time_stamp() ); 2271 2272 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %x / deschedule at cycle %d\n", 2273 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 2274 2275 sched_yield(); 2276 2277 grpc_dmsg("\n[DBG] %s : core[%x,%d] / thread %x / wake up at cycle %d\n", 2278 __FUNCTION__, local_cxy, this->core->lid, this->trdid, hal_time_stamp() ); 2279 1996 2280 } 1997 2281 } // end while 1998 2282 } // end rpc_thread_func() 1999 2283 2284 */ 2285 2286
Note: See TracChangeset
for help on using the changeset viewer.