Changeset 583 for trunk/kernel/kern/rpc.c
- Timestamp:
- Nov 1, 2018, 12:10:42 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r581 r583 72 72 73 73 &rpc_vmm_get_vseg_server, // 20 74 &rpc_vmm_g et_pte_server,// 2174 &rpc_vmm_global_update_pte_server, // 21 75 75 &rpc_kcm_alloc_server, // 22 76 76 &rpc_kcm_free_server, // 23 … … 108 108 109 109 "GET_VSEG", // 20 110 "G ET_PTE", // 21110 "GLOBAL_UPDATE_PTE", // 21 111 111 "KCM_ALLOC", // 22 112 112 "KCM_FREE", // 23 … … 126 126 127 127 /***************************************************************************************/ 128 /************ Generic function s supporting RPCs : client side**************************/128 /************ Generic function supporting RPCs : client side ***************************/ 129 129 /***************************************************************************************/ 130 130 … … 145 145 // RPCs executed by the IDLE thread during kernel_init do not deschedule 146 146 if( this->type != THREAD_IDLE ) thread_assert_can_yield( this , __FUNCTION__ ); 147 148 #if DEBUG_RPC_CLIENT_GENERIC149 uint32_t cycle = (uint32_t)hal_get_cycles();150 if( DEBUG_RPC_CLIENT_GENERIC < cycle )151 printk("\n[DBG] %s : thread %x in process %x enter for rpc %s / server_cxy %x / cycle %d\n",152 __FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], server_cxy, cycle );153 #endif154 147 155 148 // select a server_core : use client core index if possible / core 0 otherwise … … 163 156 } 164 157 165 // register client_thread pointer and client_core lidin RPC descriptor158 // register client_thread and client_core in RPC descriptor 166 159 rpc->thread = this; 167 160 rpc->lid = client_core_lid; … … 193 186 194 187 #if DEBUG_RPC_CLIENT_GENERIC 195 cycle = (uint32_t)hal_get_cycles();188 uint32_t cycle = (uint32_t)hal_get_cycles(); 196 189 uint32_t items = remote_fifo_items( rpc_fifo_xp ); 197 190 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 198 printk("\n[DBG] %s : thread %x in process %x / rpc %s / items %d / cycle %d\n", 199 __FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], items, cycle ); 191 printk("\n[DBG] %s : thread %x in process %x / rpc %s / server[%x,%d] / items %d / cycle %d\n", 192 __FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], 193 server_cxy, server_core_lid, items, cycle ); 200 194 #endif 201 195 … … 1752 1746 1753 1747 ///////////////////////////////////////////////////////////////////////////////////////// 1754 // [21] Marshaling functions attached to RPC_VMM_GET_PTE (blocking) 1755 ///////////////////////////////////////////////////////////////////////////////////////// 1756 1757 //////////////////////////////////////////// 1758 void rpc_vmm_get_pte_client( cxy_t cxy, 1759 process_t * process, // in 1760 vpn_t vpn, // in 1761 bool_t cow, // in 1762 uint32_t * attr, // out 1763 ppn_t * ppn, // out 1764 error_t * error ) // out 1765 { 1766 #if DEBUG_RPC_VMM_GET_PTE 1767 thread_t * this = CURRENT_THREAD; 1768 uint32_t cycle = (uint32_t)hal_get_cycles(); 1769 if( cycle > DEBUG_RPC_VMM_GET_PTE ) 1748 // [21] Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE (blocking) 1749 ///////////////////////////////////////////////////////////////////////////////////////// 1750 1751 /////////////////////////////////////////////////////// 1752 void rpc_vmm_global_update_pte_client( cxy_t cxy, 1753 process_t * process, // in 1754 vpn_t vpn, // in 1755 uint32_t attr, // in 1756 ppn_t ppn ) // in 1757 { 1758 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 1759 thread_t * this = CURRENT_THREAD; 1760 uint32_t cycle = (uint32_t)hal_get_cycles(); 1761 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 1770 1762 printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n", 1771 1763 __FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle ); … … 1776 1768 // initialise RPC descriptor header 1777 1769 rpc_desc_t rpc; 1778 rpc.index = RPC_VMM_G ET_PTE;1770 rpc.index = RPC_VMM_GLOBAL_UPDATE_PTE; 1779 1771 rpc.blocking = true; 1780 1772 rpc.responses = 1; … … 1783 1775 rpc.args[0] = (uint64_t)(intptr_t)process; 1784 1776 rpc.args[1] = (uint64_t)vpn; 1785 rpc.args[2] = (uint64_t)cow; 1777 rpc.args[2] = (uint64_t)attr; 1778 rpc.args[3] = (uint64_t)ppn; 1786 1779 1787 1780 // register RPC request in remote RPC fifo 1788 1781 rpc_send( cxy , &rpc ); 1789 1782 1790 // get output argument from rpc descriptor 1791 *attr = (uint32_t)rpc.args[3]; 1792 *ppn = (ppn_t)rpc.args[4]; 1793 *error = (error_t)rpc.args[5]; 1794 1795 #if DEBUG_RPC_VMM_GET_PTE 1796 cycle = (uint32_t)hal_get_cycles(); 1797 if( cycle > DEBUG_RPC_VMM_GET_PTE ) 1798 printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n", 1799 __FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle ); 1800 #endif 1801 } 1802 1803 //////////////////////////////////////// 1804 void rpc_vmm_get_pte_server( xptr_t xp ) 1805 { 1806 #if DEBUG_RPC_VMM_GET_PTE 1807 thread_t * this = CURRENT_THREAD; 1808 uint32_t cycle = (uint32_t)hal_get_cycles(); 1809 if( cycle > DEBUG_RPC_VMM_GET_PTE ) 1783 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 1784 cycle = (uint32_t)hal_get_cycles(); 1785 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 1786 printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n", 1787 __FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle ); 1788 #endif 1789 } 1790 1791 ////////////////////////////////////////////////// 1792 void rpc_vmm_global_update_pte_server( xptr_t xp ) 1793 { 1794 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 1795 thread_t * this = CURRENT_THREAD; 1796 uint32_t cycle = (uint32_t)hal_get_cycles(); 1797 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 1810 1798 printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n", 1811 1799 __FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle ); … … 1814 1802 process_t * process; 1815 1803 vpn_t vpn; 1816 bool_t cow;1817 1804 uint32_t attr; 1818 1805 ppn_t ppn; 1819 error_t error;1820 1806 1821 1807 // get client cluster identifier and pointer on RPC descriptor … … 1826 1812 process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) ); 1827 1813 vpn = (vpn_t) hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) ); 1828 cow = (bool_t) hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); 1814 attr = (uint32_t) hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) ); 1815 ppn = (ppn_t) hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) ); 1829 1816 1830 1817 // call local kernel function 1831 error = vmm_get_pte( process , vpn , cow , &attr , &ppn ); 1832 1833 // set output argument "attr" & "ppn" to client RPC descriptor 1834 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)attr ); 1835 hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)ppn ); 1836 hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error ); 1837 1838 #if DEBUG_RPC_VMM_GET_PTE 1839 cycle = (uint32_t)hal_get_cycles(); 1840 if( cycle > DEBUG_RPC_VMM_GET_PTE ) 1818 vmm_global_update_pte( process , vpn , attr , ppn ); 1819 1820 #if DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE 1821 cycle = (uint32_t)hal_get_cycles(); 1822 if( cycle > DEBUG_RPC_VMM_GLOBAL_UPDATE_PTE ) 1841 1823 printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n", 1842 1824 __FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
Note: See TracChangeset
for help on using the changeset viewer.