Changeset 624 for trunk/kernel
- Timestamp:
- Mar 12, 2019, 1:37:38 PM (6 years ago)
- Location:
- trunk/kernel
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/devfs.c
r623 r624 263 263 if( chdev_cxy != local_cxy ) 264 264 { 265 printk("\ d[PANIC] in %s : illegal DMA chdev in cluster %x\n",265 printk("\n[PANIC] in %s : illegal DMA chdev in cluster %x\n", 266 266 __FUNCTION__, local_cxy ); 267 267 hal_core_sleep(); -
trunk/kernel/kern/kernel_init.c
r623 r624 97 97 process_t process_zero CONFIG_CACHE_LINE_ALIGNED; 98 98 99 // This variable defines extended pointers on the distributed chdevs99 // This variable defines a set of extended pointers on the distributed chdevs 100 100 __attribute__((section(".kdata"))) 101 101 chdev_directory_t chdev_dir CONFIG_CACHE_LINE_ALIGNED; … … 125 125 vfs_ctx_t fs_context[FS_TYPES_NR] CONFIG_CACHE_LINE_ALIGNED; 126 126 127 // kernel_init is the entry point defined in hal/tsar_mips32/kernel.ld128 // It is used by the bootloader to tranfer control to kernel.129 extern void kernel_init( boot_info_t * info );130 131 127 // This array is used for debug, and describes the kernel locks usage, 132 128 // It must be kept consistent with the defines in kernel_config.h file. 129 __attribute__((section(".kdata"))) 133 130 char * lock_type_str[] = 134 131 { … … 229 226 230 227 // intrumentation variables : cumulated costs per syscall type in cluster 228 229 #if CONFIG_INSTRUMENTATION_SYSCALLS 230 __attribute__((section(".kdata"))) 231 231 uint32_t syscalls_cumul_cost[SYSCALLS_NR]; 232 232 233 // intrumentation variables : number of syscalls per syscal type in cluster 233 __attribute__((section(".kdata"))) 234 234 uint32_t syscalls_occurences[SYSCALLS_NR]; 235 #endif 235 236 236 237 /////////////////////////////////////////////////////////////////////////////////////////// … … 978 979 #if DEBUG_KERNEL_INIT 979 980 if( (core_lid == 0) & (local_cxy == 0) ) 980 printk("\n[%s] :exit barrier 1 : TXT0 initialized / cycle %d\n",981 printk("\n[%s] exit barrier 1 : TXT0 initialized / cycle %d\n", 981 982 __FUNCTION__, (uint32_t)hal_get_cycles() ); 982 983 #endif … … 1011 1012 #if DEBUG_KERNEL_INIT 1012 1013 if( (core_lid == 0) & (local_cxy == 0) ) 1013 printk("\n[%s] :exit barrier 2 : cluster manager initialized / cycle %d\n",1014 printk("\n[%s] exit barrier 2 : cluster manager initialized / cycle %d\n", 1014 1015 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1015 1016 #endif 1016 1017 1017 1018 ///////////////////////////////////////////////////////////////////////////////// 1018 // STEP 3 : core[0] initializes the process_zero descriptor, 1019 // STEP 3 : all cores initialize the idle thread descriptor. 1020 // core[0] initializes the process_zero descriptor, 1019 1021 // including the kernel VMM (both GPT and VSL) 1020 1022 ///////////////////////////////////////////////////////////////////////////////// … … 1024 1026 core = &cluster->core_tbl[core_lid]; 1025 1027 1028 // all cores update the register(s) defining the kernel 1029 // entry points for interrupts, exceptions and syscalls, 1030 // this must be done before VFS initialisation, because 1031 // kernel_init() uses RPCs requiring IPIs... 1032 hal_set_kentry(); 1033 1034 // all cores initialize the idle thread descriptor 1035 thread_idle_init( thread, 1036 THREAD_IDLE, 1037 &thread_idle_func, 1038 NULL, 1039 core_lid ); 1040 1026 1041 // core[0] initializes the process_zero descriptor, 1027 1042 if( core_lid == 0 ) process_zero_create( &process_zero , info ); … … 1035 1050 #if DEBUG_KERNEL_INIT 1036 1051 if( (core_lid == 0) & (local_cxy == 0) ) 1037 printk("\n[%s] :exit barrier 3 : kernel processs initialized / cycle %d\n",1052 printk("\n[%s] exit barrier 3 : kernel processs initialized / cycle %d\n", 1038 1053 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1039 1054 #endif … … 1058 1073 #if DEBUG_KERNEL_INIT 1059 1074 if( (core_lid == 0) & (local_cxy == 0) ) 1060 printk("\n[%s] :exit barrier 4 : MMU and IOPIC initialized / cycle %d\n",1075 printk("\n[%s] exit barrier 4 : MMU and IOPIC initialized / cycle %d\n", 1061 1076 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1062 1077 #endif … … 1091 1106 #if DEBUG_KERNEL_INIT 1092 1107 if( (core_lid == 0) & (local_cxy == 0) ) 1093 printk("\n[%s] : exit barrier 5 : allchdevs initialised / cycle %d\n",1108 printk("\n[%s] exit barrier 5 : chdevs initialised / cycle %d\n", 1094 1109 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1095 1110 #endif … … 1101 1116 1102 1117 ///////////////////////////////////////////////////////////////////////////////// 1103 // STEP 6 : All cores enable IPI (Inter Procesor Interrupt),1104 // Alh cores initialize IDLE thread.1105 // Onlycore[0] in cluster[0] creates the VFS root inode.1118 // STEP 6 : all cores enable IPI (Inter Procesor Interrupt), 1119 // all cores unblock the idle thread, and register it in scheduler. 1120 // core[0] in cluster[0] creates the VFS root inode. 1106 1121 // It access the boot device to initialize the file system context. 1107 1122 ///////////////////////////////////////////////////////////////////////////////// … … 1111 1126 hal_enable_irq( &status ); 1112 1127 1113 // all cores initialize the idle thread descriptor 1114 thread_idle_init( thread, 1115 THREAD_IDLE, 1116 &thread_idle_func, 1117 NULL, 1118 core_lid ); 1119 1120 // all cores unblock idle thread, and register it in scheduler 1128 // all cores unblock the idle thread, and register it in scheduler 1121 1129 thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_GLOBAL ); 1122 1130 core->scheduler.idle = thread; … … 1171 1179 cxy_t vfs_root_cxy = GET_CXY( vfs_root_inode_xp ); 1172 1180 vfs_inode_t * vfs_root_ptr = GET_PTR( vfs_root_inode_xp ); 1173 hal_remote_s32( XPTR( vfs_root_cxy , &vfs_root_ptr-> extend), INODE_TYPE_DIR );1181 hal_remote_s32( XPTR( vfs_root_cxy , &vfs_root_ptr->type ), INODE_TYPE_DIR ); 1174 1182 hal_remote_spt( XPTR( vfs_root_cxy , &vfs_root_ptr->extend ), 1175 1183 (void*)(intptr_t)root_dir_cluster ); … … 1208 1216 #if DEBUG_KERNEL_INIT 1209 1217 if( (core_lid == 0) & (local_cxy == 0) ) 1210 printk("\n[%s] :exit barrier 6 : VFS root (%x,%x) in cluster 0 / cycle %d\n",1218 printk("\n[%s] exit barrier 6 : VFS root (%x,%x) in cluster 0 / cycle %d\n", 1211 1219 __FUNCTION__, GET_CXY(process_zero.vfs_root_xp), 1212 1220 GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() ); … … 1278 1286 #if DEBUG_KERNEL_INIT 1279 1287 if( (core_lid == 0) & (local_cxy == 1) ) 1280 printk("\n[%s] :exit barrier 7 : VFS root (%x,%x) in cluster 1 / cycle %d\n",1288 printk("\n[%s] exit barrier 7 : VFS root (%x,%x) in cluster 1 / cycle %d\n", 1281 1289 __FUNCTION__, GET_CXY(process_zero.vfs_root_xp), 1282 1290 GET_PTR(process_zero.vfs_root_xp), (uint32_t)hal_get_cycles() ); … … 1328 1336 #if DEBUG_KERNEL_INIT 1329 1337 if( (core_lid == 0) & (local_cxy == 0) ) 1330 printk("\n[%s] :exit barrier 8 : DEVFS root initialized in cluster 0 / cycle %d\n",1338 printk("\n[%s] exit barrier 8 : DEVFS root initialized in cluster 0 / cycle %d\n", 1331 1339 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1332 1340 #endif 1333 1341 1334 1342 ///////////////////////////////////////////////////////////////////////////////// 1335 // STEP 9 : All core[0]s complete in parallel theDEVFS initialization.1343 // STEP 9 : In all clusters in parallel, core[0] completes DEVFS initialization. 1336 1344 // Each core[0] get the "dev" and "external" extended pointers from 1337 // values stored in cluster 0. 1338 // Then each core[0] in cluster(i) creates the DEVFS "internal" directory, 1339 // and creates the pseudo-files for all chdevs in cluster (i). 1345 // values stored in cluster(0), creates the DEVFS "internal" directory, 1346 // and creates the pseudo-files for all chdevs in local cluster. 1340 1347 ///////////////////////////////////////////////////////////////////////////////// 1341 1348 … … 1365 1372 #if DEBUG_KERNEL_INIT 1366 1373 if( (core_lid == 0) & (local_cxy == 0) ) 1367 printk("\n[%s] :exit barrier 9 : DEVFS initialized in cluster 0 / cycle %d\n",1374 printk("\n[%s] exit barrier 9 : DEVFS initialized in cluster 0 / cycle %d\n", 1368 1375 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1369 1376 #endif … … 1384 1391 process_init_create(); 1385 1392 } 1393 1394 #if DEBUG_KERNEL_INIT 1395 if( (core_lid == 0) & (local_cxy == 0) ) 1396 printk("\n[%s] exit barrier 10 : process_init created in cluster 0 / cycle %d\n", 1397 __FUNCTION__, (uint32_t)hal_get_cycles() ); 1398 #endif 1386 1399 1387 1400 #if (DEBUG_KERNEL_INIT & 1) … … 1444 1457 #endif 1445 1458 1446 // each core updates the register(s) definig the kernel1447 // entry points for interrupts, exceptions and syscalls...1448 hal_set_kentry();1449 1450 1459 // each core activates its private TICK IRQ 1451 1460 dev_pic_enable_timer( CONFIG_SCHED_TICK_MS_PERIOD ); -
trunk/kernel/kern/process.c
r623 r624 1209 1209 1210 1210 // check th_nr value 1211 assert( (count > 0) , "process th_nr cannot be 0 \n" );1211 assert( (count > 0) , "process th_nr cannot be 0" ); 1212 1212 1213 1213 // remove thread from th_tbl[] … … 1249 1249 // check parent process is the reference process 1250 1250 assert( (parent_process_xp == ref_xp ) , 1251 "parent process must be the reference process \n" );1251 "parent process must be the reference process" ); 1252 1252 1253 1253 #if DEBUG_PROCESS_MAKE_FORK … … 1352 1352 // check main thread LTID 1353 1353 assert( (LTID_FROM_TRDID(thread->trdid) == 0) , 1354 "main thread must have LTID == 0 \n" );1354 "main thread must have LTID == 0" ); 1355 1355 1356 1356 #if( DEBUG_PROCESS_MAKE_FORK & 1 ) … … 1552 1552 #endif 1553 1553 1554 // get pointer on VMM 1555 vmm_t * vmm = &process->vmm; 1556 1554 1557 // get PID from local cluster manager for this kernel process 1555 1558 error = cluster_pid_alloc( process , &pid ); … … 1571 1574 process->term_state = 0; 1572 1575 1573 // initialise kernel GPT and VSL, depending on architecture 1574 hal_vmm_kernel_init( info ); 1576 // initilise VSL as empty 1577 vmm->vsegs_nr = 0; 1578 xlist_root_init( XPTR( local_cxy , &vmm->vsegs_root ) ); 1579 remote_rwlock_init( XPTR( local_cxy , &vmm->vsegs_lock ) , LOCK_VMM_VSL ); 1580 1581 // initialise GPT as empty 1582 error = hal_gpt_create( &vmm->gpt ); 1583 1584 if( error ) 1585 { 1586 printk("\n[PANIC] in %s : cannot create empty GPT\n", __FUNCTION__ ); 1587 hal_core_sleep(); 1588 } 1589 1590 // initialize GPT lock 1591 remote_rwlock_init( XPTR( local_cxy , &vmm->gpt_lock ) , LOCK_VMM_GPT ); 1592 1593 // create kernel vsegs in GPT and VSL, as required by the hardware architecture 1594 error = hal_vmm_kernel_init( info ); 1595 1596 if( error ) 1597 { 1598 printk("\n[PANIC] in %s : cannot create kernel vsegs in VMM\n", __FUNCTION__ ); 1599 hal_core_sleep(); 1600 } 1575 1601 1576 1602 // reset th_tbl[] array and associated fields … … 1629 1655 // check memory allocator 1630 1656 assert( (process != NULL), 1631 "no memory for process descriptor in cluster %x \n", local_cxy );1657 "no memory for process descriptor in cluster %x", local_cxy ); 1632 1658 1633 1659 // set the CWD and VFS_ROOT fields in process descriptor … … 1640 1666 // check PID allocator 1641 1667 assert( (error == 0), 1642 "cannot allocate PID in cluster %x \n", local_cxy );1668 "cannot allocate PID in cluster %x", local_cxy ); 1643 1669 1644 1670 // check PID value 1645 1671 assert( (pid == 1) , 1646 "process INIT must be first process in cluster 0 \n" );1672 "process INIT must be first process in cluster 0" ); 1647 1673 1648 1674 // initialize process descriptor / parent is local process_zero … … 1669 1695 1670 1696 assert( (error == 0), 1671 "failed to open file <%s> \n", CONFIG_PROCESS_INIT_PATH );1697 "failed to open file <%s>", CONFIG_PROCESS_INIT_PATH ); 1672 1698 1673 1699 #if(DEBUG_PROCESS_INIT_CREATE & 1) … … 1682 1708 1683 1709 assert( (error == 0), 1684 "cannot access .elf file <%s> \n", CONFIG_PROCESS_INIT_PATH );1710 "cannot access .elf file <%s>", CONFIG_PROCESS_INIT_PATH ); 1685 1711 1686 1712 #if(DEBUG_PROCESS_INIT_CREATE & 1) … … 1726 1752 1727 1753 assert( (error == 0), 1728 "cannot create main thread for <%s> \n", CONFIG_PROCESS_INIT_PATH );1754 "cannot create main thread for <%s>", CONFIG_PROCESS_INIT_PATH ); 1729 1755 1730 1756 assert( (thread->trdid == 0), 1731 "main thread must have index 0 for <%s> \n", CONFIG_PROCESS_INIT_PATH );1757 "main thread must have index 0 for <%s>", CONFIG_PROCESS_INIT_PATH ); 1732 1758 1733 1759 #if(DEBUG_PROCESS_INIT_CREATE & 1) … … 1816 1842 1817 1843 assert( (txt_file_xp != XPTR_NULL) , 1818 "process must be attached to one TXT terminal \n" );1844 "process must be attached to one TXT terminal" ); 1819 1845 1820 1846 // get TXT_RX chdev pointers … … 2012 2038 // check owner cluster 2013 2039 assert( (process_cxy == CXY_FROM_PID( process_pid )) , 2014 "process descriptor not in owner cluster \n" );2040 "process descriptor not in owner cluster" ); 2015 2041 2016 2042 // get extended pointer on stdin pseudo file … … 2067 2093 // check owner cluster 2068 2094 assert( (process_cxy == CXY_FROM_PID( process_pid )) , 2069 "process descriptor not in owner cluster \n" );2095 "process descriptor not in owner cluster" ); 2070 2096 2071 2097 // get extended pointer on stdin pseudo file … … 2198 2224 pid_t process_pid = hal_remote_l32( XPTR( process_cxy , &process_ptr->pid ) ); 2199 2225 assert( (process_cxy == CXY_FROM_PID( process_pid )) , 2200 "process descriptor not in owner cluster \n" );2226 "process descriptor not in owner cluster" ); 2201 2227 2202 2228 // get extended pointer on stdin pseudo file -
trunk/kernel/kern/rpc.c
r623 r624 81 81 &rpc_vmm_create_vseg_server, // 27 82 82 &rpc_vmm_set_cow_server, // 28 83 &rpc_ vmm_display_server, // 2983 &rpc_hal_vmm_display_server, // 29 84 84 }; 85 85 … … 2729 2729 2730 2730 ///////////////////////////////////////////// 2731 void rpc_ vmm_display_client( cxy_t cxy,2731 void rpc_hal_vmm_display_client( cxy_t cxy, 2732 2732 process_t * process, 2733 2733 bool_t detailed ) … … 2765 2765 2766 2766 //////////////////////////////////////// 2767 void rpc_ vmm_display_server( xptr_t xp )2767 void rpc_hal_vmm_display_server( xptr_t xp ) 2768 2768 { 2769 2769 #if DEBUG_RPC_VMM_DISPLAY … … 2787 2787 2788 2788 // call local kernel function 2789 vmm_display( process , detailed );2789 hal_vmm_display( process , detailed ); 2790 2790 2791 2791 #if DEBUG_RPC_VMM_DISPLAY -
trunk/kernel/kern/rpc.h
r623 r624 683 683 * @ detailed : [in] detailed display if true. 684 684 **********************************************************************************/ 685 void rpc_ vmm_display_client( cxy_t cxy,685 void rpc_hal_vmm_display_client( cxy_t cxy, 686 686 struct process_s * process, 687 687 bool_t detailed ); 688 688 689 void rpc_ vmm_display_server( xptr_t xp );689 void rpc_hal_vmm_display_server( xptr_t xp ); 690 690 691 691 -
trunk/kernel/kern/scheduler.c
r619 r624 488 488 489 489 #if (DEBUG_SCHED_YIELD & 0x1) 490 if( sched->trace ) 490 // if( sched->trace ) 491 if( (uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD ) 491 492 sched_display( lid ); 492 493 #endif … … 541 542 542 543 #if DEBUG_SCHED_YIELD 543 if( sched->trace ) 544 // if( sched->trace ) 545 if( (uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD ) 544 546 printk("\n[%s] core[%x,%d] / cause = %s\n" 545 547 " thread %x (%s) (%x,%x) => thread %x (%s) (%x,%x) / cycle %d\n", … … 558 560 559 561 #if (DEBUG_SCHED_YIELD & 1) 560 if( sched->trace ) 562 // if( sched->trace ) 563 if(uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD ) 561 564 printk("\n[%s] core[%x,%d] / cause = %s\n" 562 565 " thread %x (%s) (%x,%x) continue / cycle %d\n", … … 601 604 602 605 nolock_printk("\n***** threads on core[%x,%d] / current %x / rpc_threads %d / cycle %d\n", 603 local_cxy , core->lid, sched->current, LOCAL_CLUSTER->rpc_threads[lid],606 local_cxy , lid, sched->current, LOCAL_CLUSTER->rpc_threads[lid], 604 607 (uint32_t)hal_get_cycles() ); 605 608 -
trunk/kernel/kern/thread.c
r623 r624 389 389 printk("\n[%s] CPU & FPU contexts created\n", 390 390 __FUNCTION__, thread->trdid ); 391 vmm_display( process , true );391 hal_vmm_display( process , true ); 392 392 #endif 393 393 … … 689 689 printk("\n[%s] thread[%x,%x] set CPU context & jump to user code / cycle %d\n", 690 690 __FUNCTION__, process->pid, thread->trdid, cycle ); 691 vmm_display( process , true );691 hal_vmm_display( process , true ); 692 692 #endif 693 693 … … 1352 1352 "hold %d busylock(s) / cycle %d\n", 1353 1353 func_str, thread->process->pid, thread->trdid, 1354 thread->busylocks , (uint32_t)hal_get_cycles() );1354 thread->busylocks - 1, (uint32_t)hal_get_cycles() ); 1355 1355 1356 1356 #if DEBUG_BUSYLOCK -
trunk/kernel/kernel_config.h
r623 r624 40 40 41 41 #define DEBUG_BUSYLOCK 0 42 #define DEBUG_BUSYLOCK_THREAD_XP 0x0ULL // selected thread xptr 42 #define DEBUG_BUSYLOCK_PID 0x10001 // thread pid (when detailed debug) 43 #define DEBUG_BUSYLOCK_TRDID 0x10000 // thread trdid (when detailed debug) 43 44 44 45 #define DEBUG_CHDEV_CMD_RX 0 … … 84 85 #define DEBUG_FATFS_MOVE_PAGE 0 85 86 #define DEBUG_FATFS_NEW_DENTRY 0 86 #define DEBUG_FATFS_RELEASE_INODE 187 #define DEBUG_FATFS_RELEASE_INODE 0 87 88 #define DEBUG_FATFS_REMOVE_DENTRY 0 88 89 #define DEBUG_FATFS_SYNC_FAT 0 … … 91 92 #define DEBUG_FATFS_UPDATE_DENTRY 0 92 93 94 #define DEBUG_HAL_EXCEPTIONS 0 93 95 #define DEBUG_HAL_GPT_SET_PTE 0 94 96 #define DEBUG_HAL_GPT_COPY 0 95 97 #define DEBUG_HAL_GPT_CREATE 0 96 98 #define DEBUG_HAL_GPT_DESTROY 0 97 #define DEBUG_HAL_USPACE 0 99 #define DEBUG_HAL_IOC_RX 0 100 #define DEBUG_HAL_IOC_TX 0 101 #define DEBUG_HAL_IRQS 0 98 102 #define DEBUG_HAL_KENTRY 0 99 #define DEBUG_HAL_EXCEPTIONS 0100 #define DEBUG_HAL_IRQS 0101 103 #define DEBUG_HAL_TXT_RX 0 102 104 #define DEBUG_HAL_TXT_TX 0 103 #define DEBUG_HAL_ IOC_RX0104 #define DEBUG_HAL_ IOC_TX0105 #define DEBUG_HAL_USPACE 0 106 #define DEBUG_HAL_VMM 0 105 107 106 108 #define DEBUG_KCM 0 … … 162 164 163 165 #define DEBUG_SCHED_HANDLE_SIGNALS 2 164 #define DEBUG_SCHED_YIELD 2 // must be activated by the trace() syscall166 #define DEBUG_SCHED_YIELD 0 165 167 #define DEBUG_SCHED_RPC_ACTIVATE 0 166 168 … … 236 238 #define DEBUG_VFS_OPENDIR 0 237 239 #define DEBUG_VFS_STAT 0 238 #define DEBUG_VFS_UNLINK 1240 #define DEBUG_VFS_UNLINK 0 239 241 240 242 #define DEBUG_VMM_CREATE_VSEG 0 … … 407 409 408 410 //////////////////////////////////////////////////////////////////////////////////////////// 409 // 411 // 32 bits USER SPACE SEGMENTATION / all values are numbers of pages 410 412 //////////////////////////////////////////////////////////////////////////////////////////// 411 413 412 414 #define CONFIG_VMM_VSPACE_SIZE 0x100000 // virtual space : 4 Gbytes 413 415 414 #define CONFIG_VMM_ KENTRY_BASE 0x000004 // UTILS zone base : 16 Kbytes416 #define CONFIG_VMM_UTILS_BASE 0x000200 // UTILS zone base : 2 Mbytes 415 417 #define CONFIG_VMM_ELF_BASE 0x000400 // ELF zone base : 4 Mbytes 416 418 #define CONFIG_VMM_HEAP_BASE 0x002000 // HEAP zone base : 32 Mbytes 417 419 #define CONFIG_VMM_STACK_BASE 0x0C0000 // STACK zone base : 3 Gbytes 418 420 419 #define CONFIG_VMM_KENTRY_SIZE 0x000004 // kentry vseg size : 16 Kbytes420 421 #define CONFIG_VMM_ARGS_SIZE 0x000004 // args vseg size : 16 Kbytes 421 422 #define CONFIG_VMM_ENVS_SIZE 0x000008 // envs vseg size : 32 Kbytes -
trunk/kernel/libk/busylock.c
r600 r624 2 2 * busylock.c - local kernel-busy waiting lock implementation. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 76 76 77 77 #if DEBUG_BUSYLOCK 78 if( (lock->type != LOCK_CHDEV_TXT0) && 79 ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) ) 78 if( lock->type != LOCK_CHDEV_TXT0 ) 80 79 { 80 // update thread list of busylocks 81 81 xptr_t root_xp = XPTR( local_cxy , &this->busylocks_root ); 82 83 // update thread list of busylocks84 82 xlist_add_last( root_xp , XPTR( local_cxy , &lock->xlist ) ); 85 83 } 86 84 #endif 87 85 88 #if( DEBUG_BUSYLOCK & & DEBUG_BUSYLOCK_THREAD_XP)86 #if( DEBUG_BUSYLOCK & 1 ) 89 87 if( (lock->type != LOCK_CHDEV_TXT0) && 90 (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) ) 88 (this->process->pid == DEBUG_BUSYLOCK_PID) && 89 (this->trdid == DEBUG_BUSYLOCK_TRDID) ) 91 90 { 92 // get cluster and local pointer of target thread93 cxy_t thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );94 thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );95 96 // display message on kernel TXT097 91 printk("\n[%s] thread[%x,%x] ACQUIRE lock %s\n", 98 92 __FUNCTION__, this->process->pid, this->trdid, lock_type_str[lock->type] ); … … 120 114 121 115 #if DEBUG_BUSYLOCK 122 if( (lock->type != LOCK_CHDEV_TXT0) && 123 ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) ) 116 if( lock->type != LOCK_CHDEV_TXT0 ) 124 117 { 125 118 // remove lock from thread list of busylocks … … 128 121 #endif 129 122 130 #if( DEBUG_BUSYLOCK & & DEBUG_BUSYLOCK_THREAD_XP)123 #if( DEBUG_BUSYLOCK & 1 ) 131 124 if( (lock->type != LOCK_CHDEV_TXT0) && 132 (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) ) 125 (this->process->pid == DEBUG_BUSYLOCK_PID) && 126 (this->trdid == DEBUG_BUSYLOCK_TRDID) ) 133 127 { 134 // get cluster and local pointer of target thread135 cxy_t thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );136 thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );137 138 // display message on kernel TXT0139 128 printk("\n[%s] thread[%x,%x] RELEASE lock %s\n", 140 129 __FUNCTION__, this->process->pid, this->trdid, lock_type_str[lock->type] ); -
trunk/kernel/libk/busylock.h
r623 r624 2 2 * busylock.h: local kernel busy-waiting lock definition. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 34 34 * a shared object located in a given cluster, made by thread(s) running in same cluster. 35 35 * It uses a busy waiting policy when the lock is taken by another thread, and should 36 * be used to execute very short actions, such as accessing basic allocators ,or higher36 * be used to execute very short actions, such as accessing basic allocators or higher 37 37 * level synchronisation objects (barriers, queuelocks, or rwlocks). 38 * WARNING: a thread cannot yield when it is owning a busylock.39 38 * 40 39 * - To acquire the lock, we use a ticket policy to avoid starvation: the calling thread … … 42 41 * value until current == ticket. 43 42 * 44 * - To release the lock, the owner thread increments the "current" value, 45 * decrements its busylocks counter. 43 * - To release the lock, the owner thread increments the "current" value. 46 44 * 47 * - When a thread takes a busylock, it enters a critical section: the busylock_acquire()45 * - When a thread takes a busylock, it enters a critical section: the acquire() 48 46 * function disables the IRQs, takes the lock, increments the thread busylocks counter, 49 * andsave the SR in lock descriptor and returns.47 * save the SR in lock descriptor and returns. 50 48 * 51 * - The busylock_release() function releases the lock, decrements the thread busylock52 * counter, restores the SR to exit the critical section, and returns 49 * - The release() function releases the lock, decrements the thread busylock 50 * counter, restores the SR to exit the critical section, and returns. 53 51 * 54 * - If a thread owning a busylock (local or remote) tries to deschedule, the scheduler 55 * signals a kernel panic. 52 * WARNING: a thread cannot yield when it is holding a busylock (local or remote). 53 * 54 * This rule is checked by all functions containing a thread_yield() AND by the scheduler, 55 * thanks to the busylocks counter stored in the calling thread descriptor. 56 * 1) all functions call "thread_assert_can_yield()" before calling "thread_yield()". 57 * 2) The scheduler checks that the calling thread does not hold any busylock. 58 * In case of violation the core goes to sleep after a [PANIC] message on TXT0. 56 59 ******************************************************************************************/ 57 60 58 61 /******************************************************************************************* 59 62 * This structure defines a busylock. 60 * The < type> and <xlist> fields are used for debug.61 * The typedefines the lock usage as detailed in the kernel_config.h file.63 * The <xlist> field is only used when DEBUG_BUSYLOCK is set. 64 * The <type> field defines the lock usage as detailed in the kernel_config.h file. 62 65 ******************************************************************************************/ 63 66 -
trunk/kernel/libk/remote_busylock.c
r619 r624 2 2 * remote_busylock.c - remote kernel busy-waiting lock implementation. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 87 87 #if DEBUG_BUSYLOCK 88 88 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) ); 89 if( (type != LOCK_CHDEV_TXT0) && 90 ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) ) 89 if( type != LOCK_CHDEV_TXT0 ) 91 90 { 91 // update thread list of busyslocks 92 92 xptr_t root_xp = XPTR( local_cxy , &this->busylocks_root ); 93 94 // update thread list of busyslocks95 93 xlist_add_last( root_xp , XPTR( lock_cxy , &lock_ptr->xlist ) ); 96 94 } 97 95 #endif 98 96 99 #if( DEBUG_BUSYLOCK & & DEBUG_BUSYLOCK_THREAD_XP)97 #if( DEBUG_BUSYLOCK & 1 ) 100 98 if( (type != LOCK_CHDEV_TXT0) && 101 (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) ) 99 (this->process->pid == DEBUG_BUSYLOCK_PID) && 100 (this->trdid == DEBUG_BUSYLOCK_TRDID) ) 102 101 { 103 102 printk("\n[%s] thread[%x,%x] ACQUIRE lock %s\n", … … 131 130 #if DEBUG_BUSYLOCK 132 131 uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) ); 133 if( (type != LOCK_CHDEV_TXT0) && 134 (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) && 135 ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) ) 132 if( type != LOCK_CHDEV_TXT0 ) 136 133 { 137 134 // remove lock from thread list of busyslocks … … 140 137 #endif 141 138 142 #if (DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP)139 #if( DEBUG_BUSYLOCK & 1 ) 143 140 if( (type != LOCK_CHDEV_TXT0) && 144 (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) ) 141 (this->process->pid == DEBUG_BUSYLOCK_PID) && 142 (this->trdid == DEBUG_BUSYLOCK_TRDID) ) 145 143 { 146 144 printk("\n[%s] thread[%x,%x] RELEASE lock %s\n", -
trunk/kernel/libk/remote_busylock.h
r619 r624 2 2 * remote_busylock.h: remote kernel busy-waiting lock definition. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 37 37 * higher level synchronisation objects, such as remote_queuelock and remote_rwlock. 38 38 * 39 * WARNING: a thread cannot yield when it is owning a busylock (local or remote).40 *41 39 * - To acquire the lock, we use a ticket policy to avoid starvation: the calling thread 42 40 * makes an atomic increment on a "ticket" allocator, and keep polling the "current" 43 41 * value until current == ticket. 44 42 * 45 * - To release the lock, the owner thread increments the "current" value, 46 * decrements its busylocks counter. 43 * - To release the lock, the owner thread increments the "current" value. 47 44 * 48 * - When a thread takes a busylock, it enters a critical section: the busylock_acquire()45 * - When a thread takes a busylock, it enters a critical section: the acquire() 49 46 * function disables the IRQs, takes the lock, increments the thread busylocks counter, 50 * 47 * save the SR in the lock descriptor and returns. 51 48 * 52 * - The busylock_release() function decrements the thread busylock counter,53 * restores the SR to exit the critical section, and returns49 * - The release() function releases the lock, decrements the thread busylock 50 * counter, restores the SR to exit the critical section, and returns. 54 51 * 55 * - If a thread owning a busylock (local or remote) tries to deschedule, the scheduler 56 * signals a kernel panic. 52 * WARNING: a thread cannot yield when it is holding a busylock (local or remote). 53 * 54 * This rule is checked by all functions containing a thread_yield() AND by the scheduler, 55 * thanks to the busylocks counter stored in the calling thread descriptor. 56 * 1) all functions call "thread_assert_can_yield()" before calling "thread_yield()". 57 * 2) The scheduler checks that the calling thread does not hold any busylock. 58 * In case of violation the core goes to sleep after a [PANIC] message on TXT0. 57 59 ******************************************************************************************/ 58 60 -
trunk/kernel/mm/mapper.c
r623 r624 440 440 ppm_page_do_dirty( page_xp ); 441 441 hal_copy_from_uspace( map_ptr , buf_ptr , page_count ); 442 443 putb(" in mapper_move_user()" , map_ptr , page_count );444 445 442 } 446 443 -
trunk/kernel/mm/vmm.c
r623 r624 76 76 vmm_t * vmm = &process->vmm; 77 77 78 // initialize local list of vsegs78 // initialize VSL (empty) 79 79 vmm->vsegs_nr = 0; 80 80 xlist_root_init( XPTR( local_cxy , &vmm->vsegs_root ) ); 81 81 remote_rwlock_init( XPTR( local_cxy , &vmm->vsegs_lock ) , LOCK_VMM_VSL ); 82 82 83 assert( ((CONFIG_VMM_KENTRY_SIZE + CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE) 84 <= CONFIG_VMM_ELF_BASE) , "UTILS zone too small\n" ); 85 86 assert( (CONFIG_THREADS_MAX_PER_CLUSTER <= 32) , 87 "no more than 32 threads per cluster for a single process\n"); 83 assert( ((CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE) <= 84 (CONFIG_VMM_ELF_BASE - CONFIG_VMM_UTILS_BASE)) , 85 "UTILS zone too small\n" ); 88 86 89 87 assert( ((CONFIG_VMM_STACK_SIZE * CONFIG_THREADS_MAX_PER_CLUSTER) <= … … 92 90 93 91 // register args vseg in VSL 94 base = (CONFIG_VMM_KENTRY_BASE + 95 CONFIG_VMM_KENTRY_SIZE ) << CONFIG_PPM_PAGE_SHIFT; 92 base = CONFIG_VMM_UTILS_BASE << CONFIG_PPM_PAGE_SHIFT; 96 93 size = CONFIG_VMM_ARGS_SIZE << CONFIG_PPM_PAGE_SHIFT; 97 94 … … 114 111 115 112 // register the envs vseg in VSL 116 base = (CONFIG_VMM_KENTRY_BASE + 117 CONFIG_VMM_KENTRY_SIZE + 118 CONFIG_VMM_ARGS_SIZE ) << CONFIG_PPM_PAGE_SHIFT; 113 base = (CONFIG_VMM_UTILS_BASE + CONFIG_VMM_ARGS_SIZE) << CONFIG_PPM_PAGE_SHIFT; 119 114 size = CONFIG_VMM_ENVS_SIZE << CONFIG_PPM_PAGE_SHIFT; 120 115 … … 148 143 remote_rwlock_init( XPTR( local_cxy , &vmm->gpt_lock ) , LOCK_VMM_GPT ); 149 144 150 // update process VMM with kernel vsegs 145 // update process VMM with kernel vsegs as required by the hardware architecture 151 146 error = hal_vmm_kernel_update( process ); 152 147 … … 185 180 } // end vmm_init() 186 181 187 //////////////////////////////////////188 void vmm_display( process_t * process,189 bool_t mapping )190 {191 vmm_t * vmm = &process->vmm;192 gpt_t * gpt = &vmm->gpt;193 194 printk("\n***** VSL and GPT(%x) for process %x in cluster %x\n\n",195 process->vmm.gpt.ptr , process->pid , local_cxy );196 197 // get lock protecting the VSL and the GPT198 remote_rwlock_rd_acquire( XPTR( local_cxy , &vmm->vsegs_lock ) );199 remote_rwlock_rd_acquire( XPTR( local_cxy , &vmm->gpt_lock ) );200 201 // scan the list of vsegs202 xptr_t root_xp = XPTR( local_cxy , &vmm->vsegs_root );203 xptr_t iter_xp;204 xptr_t vseg_xp;205 vseg_t * vseg;206 XLIST_FOREACH( root_xp , iter_xp )207 {208 vseg_xp = XLIST_ELEMENT( iter_xp , vseg_t , xlist );209 vseg = GET_PTR( vseg_xp );210 211 printk(" - %s : base = %X / size = %X / npages = %d\n",212 vseg_type_str( vseg->type ) , vseg->min , vseg->max - vseg->min , vseg->vpn_size );213 214 if( mapping )215 {216 vpn_t vpn;217 ppn_t ppn;218 uint32_t attr;219 vpn_t base = vseg->vpn_base;220 vpn_t size = vseg->vpn_size;221 for( vpn = base ; vpn < (base+size) ; vpn++ )222 {223 hal_gpt_get_pte( XPTR( local_cxy , gpt ) , vpn , &attr , &ppn );224 if( attr & GPT_MAPPED )225 {226 printk(" . vpn = %X / attr = %X / ppn = %X\n", vpn , attr , ppn );227 }228 }229 }230 }231 232 // release the locks233 remote_rwlock_rd_release( XPTR( local_cxy , &vmm->vsegs_lock ) );234 remote_rwlock_rd_release( XPTR( local_cxy , &vmm->gpt_lock ) );235 236 } // vmm_display()237 182 238 183 ////////////////////////////////////////// … … 248 193 // update vseg descriptor 249 194 vseg->vmm = vmm; 195 196 // increment vsegs number 197 vmm->vsegs_nr++; 250 198 251 199 // add vseg in vmm list … … 735 683 736 684 // copy base addresses from parent VMM to child VMM 737 child_vmm->kent_vpn_base = (vpn_t)hal_remote_lpt(XPTR(parent_cxy, &parent_vmm->kent_vpn_base));738 685 child_vmm->args_vpn_base = (vpn_t)hal_remote_lpt(XPTR(parent_cxy, &parent_vmm->args_vpn_base)); 739 686 child_vmm->envs_vpn_base = (vpn_t)hal_remote_lpt(XPTR(parent_cxy, &parent_vmm->envs_vpn_base)); … … 773 720 #if (DEBUG_VMM_DESTROY & 1 ) 774 721 if( DEBUG_VMM_DESTROY < cycle ) 775 vmm_display( process , true );722 hal_vmm_display( process , true ); 776 723 #endif 777 724 … … 785 732 // (don't use a FOREACH for item deletion in xlist) 786 733 787 uint32_t count = 0; 788 789 while( !xlist_is_empty( root_xp ) && (count < 10 ) ) 734 while( !xlist_is_empty( root_xp ) ) 790 735 { 791 736 // get pointer on first vseg in VSL … … 801 746 __FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size ); 802 747 #endif 803 804 count++;805 748 806 749 } … … 1093 1036 // check collisions 1094 1037 vseg = vmm_check_conflict( process , vpn_base , vpn_size ); 1038 1095 1039 if( vseg != NULL ) 1096 1040 { … … 1162 1106 xptr_t lock_xp; // extended pointer on lock protecting forks counter 1163 1107 uint32_t forks; // actual number of pendinf forks 1164 uint32_t type;// vseg type1108 uint32_t vseg_type; // vseg type 1165 1109 1166 1110 #if DEBUG_VMM_DELETE_VSEG … … 1197 1141 1198 1142 // get relevant vseg infos 1199 type= vseg->type;1200 vpn_min = vseg->vpn_base;1201 vpn_max = vpn_min + vseg->vpn_size;1143 vseg_type = vseg->type; 1144 vpn_min = vseg->vpn_base; 1145 vpn_max = vpn_min + vseg->vpn_size; 1202 1146 1203 1147 // loop to invalidate all vseg PTEs in GPT 1204 1148 for( vpn = vpn_min ; vpn < vpn_max ; vpn++ ) 1205 1149 { 1206 // get GPT entry1150 // get ppn and attr from GPT entry 1207 1151 hal_gpt_get_pte( XPTR( local_cxy , gpt ) , vpn , &attr , &ppn ); 1208 1152 … … 1217 1161 hal_gpt_reset_pte( gpt , vpn ); 1218 1162 1219 // the allocated page is not released to KMEMfor kernel vseg1220 if( ( type != VSEG_TYPE_KCODE) &&1221 ( type != VSEG_TYPE_KDATA) &&1222 ( type != VSEG_TYPE_KDEV ) )1163 // the allocated page is not released to for kernel vseg 1164 if( (vseg_type != VSEG_TYPE_KCODE) && 1165 (vseg_type != VSEG_TYPE_KDATA) && 1166 (vseg_type != VSEG_TYPE_KDEV ) ) 1223 1167 { 1224 1225 // FIXME This code must be completely re-written, as the actual release must depend on1226 // - the vseg type1227 // - the reference cluster1228 // - the page refcount and/or the forks counter1229 1230 1168 // get extended pointer on physical page descriptor 1231 1169 page_xp = ppm_ppn2page( ppn ); … … 1233 1171 page_ptr = GET_PTR( page_xp ); 1234 1172 1173 // FIXME This code must be re-written, as the actual release depends on vseg type, 1174 // the reference cluster, the page refcount and/or the forks counter... 1175 1235 1176 // get extended pointers on forks and lock fields 1236 1177 forks_xp = XPTR( page_cxy , &page_ptr->forks ); … … 1245 1186 if( forks ) // decrement pending forks counter 1246 1187 { 1188 // update forks counter 1247 1189 hal_remote_atomic_add( forks_xp , -1 ); 1190 1191 // release the lock protecting the page 1192 remote_busylock_release( lock_xp ); 1248 1193 } 1249 1194 else // release physical page to relevant cluster 1250 1195 { 1196 // release the lock protecting the page 1197 remote_busylock_release( lock_xp ); 1198 1199 // release the page to kmem 1251 1200 if( page_cxy == local_cxy ) // local cluster 1252 1201 { … … 1266 1215 } 1267 1216 1268 // release the lock protecting the page1269 remote_busylock_release( lock_xp );1270 1217 } 1271 1218 } -
trunk/kernel/mm/vmm.h
r623 r624 121 121 uint32_t pgfault_nr; /*! page fault counter (instrumentation) */ 122 122 123 vpn_t kent_vpn_base; /*! kentry vseg first page */124 123 vpn_t args_vpn_base; /*! args vseg first page */ 125 vpn_t envs_vpn_base; /*! envs zonefirst page */126 vpn_t heap_vpn_base; /*! envs zonefirst page */127 vpn_t code_vpn_base; /*! code zonefirst page */128 vpn_t data_vpn_base; /*! datazone first page */124 vpn_t envs_vpn_base; /*! envs vseg first page */ 125 vpn_t code_vpn_base; /*! code vseg first page */ 126 vpn_t data_vpn_base; /*! data vseg first page */ 127 vpn_t heap_vpn_base; /*! heap zone first page */ 129 128 130 129 intptr_t entry_point; /*! main thread entry point */ … … 157 156 * @ mapping : detailed mapping if true. 158 157 ********************************************************************************************/ 159 void vmm_display( struct process_s * process,158 void hal_vmm_display( struct process_s * process, 160 159 bool_t mapping ); 161 160 -
trunk/kernel/syscalls/sys_barrier.c
r619 r624 74 74 printk("\n[ERROR] in %s : unmapped barrier %x / thread %x / process %x\n", 75 75 __FUNCTION__ , vaddr , this->trdid , process->pid ); 76 vmm_display( process , false );76 hal_vmm_display( process , false ); 77 77 #endif 78 78 this->errno = error; … … 95 95 printk("\n[ERROR] in %s : unmapped barrier attributes %x / thread %x / process %x\n", 96 96 __FUNCTION__ , attr , this->trdid , process->pid ); 97 vmm_display( process , false );97 hal_vmm_display( process , false ); 98 98 #endif 99 99 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_condvar.c
r566 r624 2 2 * sys_condvar.c - Access a POSIX condvar. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_special.h> 26 #include <hal_vmm.h> 26 27 #include <errno.h> 27 28 #include <thread.h> … … 75 76 printk("\n[ERROR] in %s : unmapped condvar %x / thread %x / process %x\n", 76 77 __FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid ); 77 vmm_display( process , false );78 hal_vmm_display( process , false ); 78 79 #endif 79 80 this->errno = error; -
trunk/kernel/syscalls/sys_display.c
r623 r624 2 2 * sys_display.c - display the current state of a kernel structure on TXT0 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018, 2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 26 27 #include <errno.h> 27 28 #include <vmm.h> … … 167 168 if( cxy == local_cxy ) 168 169 { 169 vmm_display( process , true );170 hal_vmm_display( process , true ); 170 171 } 171 172 else 172 173 { 173 rpc_ vmm_display_client( cxy , process , true );174 rpc_hal_vmm_display_client( cxy , process , true ); 174 175 } 175 176 -
trunk/kernel/syscalls/sys_get_config.c
r566 r624 66 66 printk("\n[ERROR] in %s : x_size buffer unmapped / thread %x / process %x\n", 67 67 __FUNCTION__ , (intptr_t)x_size , this->trdid , process->pid ); 68 vmm_display( process , false );68 hal_vmm_display( process , false ); 69 69 #endif 70 70 this->errno = EINVAL; … … 81 81 printk("\n[ERROR] in %s : y_size buffer unmapped / thread %x / process %x\n", 82 82 __FUNCTION__ , (intptr_t)y_size , this->trdid , process->pid ); 83 vmm_display( process , false );83 hal_vmm_display( process , false ); 84 84 #endif 85 85 this->errno = EINVAL; … … 96 96 printk("\n[ERROR] in %s : ncores buffer unmapped / thread %x / process %x\n", 97 97 __FUNCTION__ , (intptr_t)ncores , this->trdid , process->pid ); 98 vmm_display( process , false );98 hal_vmm_display( process , false ); 99 99 #endif 100 100 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_get_core.c
r506 r624 55 55 printk("\n[ERROR] in %s : cxy buffer unmapped %x / thread %x / process %x\n", 56 56 __FUNCTION__ , (intptr_t)cxy , this->trdid , process->pid ); 57 vmm_display( process , false );57 hal_vmm_display( process , false ); 58 58 #endif 59 59 this->errno = EFAULT; … … 70 70 printk("\n[ERROR] in %s : lid buffer unmapped %x / thread %x / process %x\n", 71 71 __FUNCTION__ , (intptr_t)lid , this->trdid , process->pid ); 72 vmm_display( process , false );72 hal_vmm_display( process , false ); 73 73 #endif 74 74 this->errno = EFAULT; -
trunk/kernel/syscalls/sys_get_cycle.c
r506 r624 53 53 printk("\n[ERROR] in %s : user buffer unmapped %x / thread %x / process %x\n", 54 54 __FUNCTION__ , (intptr_t)cycle , this->trdid , process->pid ); 55 vmm_display( process , false );55 hal_vmm_display( process , false ); 56 56 #endif 57 57 this->errno = EFAULT; -
trunk/kernel/syscalls/sys_is_fg.c
r566 r624 67 67 printk("\n[ERROR] in %s : unmapped owner buffer %x / thread %x in process %x\n", 68 68 __FUNCTION__ , (intptr_t)is_fg, this->trdid, process->pid ); 69 vmm_display( process , false );69 hal_vmm_display( process , false ); 70 70 #endif 71 71 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_kill.c
r594 r624 74 74 tm_start = hal_get_cycles(); 75 75 if( DEBUG_SYS_KILL < tm_start ) 76 printk("\n[%s] thread[%x,%x] enter / process %x / %s/ cycle %d\n",77 __FUNCTION__, this->process->pid, this->trdid, pid,78 sig_type_str(sig_id), (uint32_t)tm_start );76 printk("\n[%s] thread[%x,%x] enter : %s to process %x / cycle %d\n", 77 __FUNCTION__, this->process->pid, this->trdid, 78 sig_type_str(sig_id), pid, (uint32_t)tm_start ); 79 79 #endif 80 80 … … 86 86 #if (DEBUG_SYS_KILL & 1) 87 87 if( DEBUG_SYS_KILL < tm_start ) 88 printk("\n[%s] thread[%x,%x] get owner process %x incluster %x\n",88 printk("\n[%s] thread[%x,%x] get target process descriptor %x in owner cluster %x\n", 89 89 __FUNCTION__ , this->process->pid, this->trdid, owner_ptr, owner_cxy ); 90 90 #endif … … 108 108 #if (DEBUG_SYS_KILL & 1) 109 109 if( DEBUG_SYS_KILL < tm_start ) 110 printk("\n[% x] thread[%x,%x] get parent process%x in cluster %x\n",110 printk("\n[%s] thread[%x,%x] get parent process descriptor %x in cluster %x\n", 111 111 __FUNCTION__ , this->process->pid, this->trdid, parent_ptr, parent_cxy ); 112 112 #endif … … 128 128 process_sigaction( pid , BLOCK_ALL_THREADS ); 129 129 130 #if (DEBUG_SYS_KILL & 1) 131 if( DEBUG_SYS_KILL < tm_start ) 132 printk("\n[%s] thread[%x,%x] blocked all threads of process %x\n", 133 __FUNCTION__ , this->process->pid, this->trdid, pid ); 134 #endif 130 135 // atomically update owner process termination state 131 136 hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) , … … 136 141 137 142 // calling thread deschedules when it is itself a target thread 138 if( this->process->pid == pid ) sched_yield("block itself"); 143 if( this->process->pid == pid ) 144 { 145 146 #if (DEBUG_SYS_KILL & 1) 147 if( DEBUG_SYS_KILL < tm_start ) 148 printk("\n[%s] thread[%x,%x] is a target thread => deschedule\n", 149 __FUNCTION__ , this->process->pid, this->trdid ); 150 #endif 151 sched_yield("block itself"); 152 } 139 153 140 154 break; -
trunk/kernel/syscalls/sys_mmap.c
r623 r624 70 70 printk("\n[ERROR] in %s : thread[%x,%x] / mmap attributes unmapped %x\n", 71 71 __FUNCTION__ , process->pid, this->trdid, (intptr_t)attr ); 72 vmm_display( process , false );72 hal_vmm_display( process , false ); 73 73 #endif 74 74 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_munmap.c
r623 r624 67 67 printk("\n[ERROR] in %s : thread[%x,%x] / user buffer unmapped %x\n", 68 68 __FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr ); 69 vmm_display( process , false );69 hal_vmm_display( process , false ); 70 70 #endif 71 71 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_mutex.c
r566 r624 74 74 printk("\n[ERROR] in %s : mutex unmapped %x / thread %x / process %x\n", 75 75 __FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid ); 76 vmm_display( process , false );76 hal_vmm_display( process , false ); 77 77 #endif 78 78 this->errno = error; -
trunk/kernel/syscalls/sys_opendir.c
r614 r624 66 66 printk("\n[ERROR] in %s / thread[%x,%x] : DIR buffer %x unmapped\n", 67 67 __FUNCTION__ , process->pid , this->trdid, dirp ); 68 vmm_display( process , false );68 hal_vmm_display( process , false ); 69 69 #endif 70 70 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_read.c
r610 r624 107 107 printk("\n[ERROR] in %s : thread[%x,%x] user buffer unmapped %x\n", 108 108 __FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr ); 109 vmm_display( process , false );109 hal_vmm_display( process , false ); 110 110 #endif 111 111 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_readdir.c
r612 r624 69 69 printk("\n[ERROR] in %s / thread[%x,%x] : user buffer %x unmapped\n", 70 70 __FUNCTION__ , process->pid , this->trdid, buffer ); 71 vmm_display( process , false );71 hal_vmm_display( process , false ); 72 72 #endif 73 73 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_sem.c
r566 r624 2 2 * sys_sem.c - Acces a POSIX unamed semaphore. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 26 27 #include <shared_semaphore.h> 27 28 #include <errno.h> … … 74 75 printk("\n[ERROR] in %s : unmapped semaphore pointer %x / thread %x in process %x / cycle %d\n", 75 76 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() ); 76 vmm_display( process , false );77 hal_vmm_display( process , false ); 77 78 #endif 78 79 this->errno = EINVAL; … … 112 113 printk("\n[ERROR] in %s GETVALUE: unmapped buffer %x / thread %x in process %x / cycle %d\n", 113 114 __FUNCTION__ , (intptr_t)current_value, this->trdid, process->pid, (uint32_t)hal_get_cycles() ); 114 vmm_display( process , false );115 hal_vmm_display( process , false ); 115 116 #endif 116 117 this->errno = EINVAL; … … 154 155 printk("\n[ERROR] in %s WAIT: semaphore %x not found / thread %x in process %x / cycle %d\n", 155 156 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() ); 156 vmm_display( process , true );157 hal_vmm_display( process , true ); 157 158 #endif 158 159 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_stat.c
r610 r624 2 2 * sys_stat.c - kernel function implementing the "stat" syscall. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 26 27 #include <hal_special.h> 27 28 #include <errno.h> … … 61 62 printk("\n[ERROR] in %s / thread[%x,%x] : stat structure %x unmapped\n", 62 63 __FUNCTION__ , process->pid , this->trdid, u_stat ); 63 vmm_display( process , false );64 hal_vmm_display( process , false ); 64 65 #endif 65 66 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_thread_create.c
r619 r624 2 2 * sys_thread_create.c - creates a new user thread 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 25 25 #include <hal_kernel_types.h> 26 26 #include <hal_uspace.h> 27 #include <hal_vmm.h> 27 28 #include <printk.h> 28 29 #include <errno.h> … … 82 83 printk("\n[ERROR] in %s : thread[%x,%x] / trdid buffer %x unmapped %x\n", 83 84 __FUNCTION__, process->pid, parent->trdid, (intptr_t)trdid_ptr ); 84 vmm_display( process , false );85 hal_vmm_display( process , false ); 85 86 #endif 86 87 parent->errno = EINVAL; … … 99 100 printk("\n[ERROR] in %s : thread[%x,%x] / user_attr buffer unmapped %x\n", 100 101 __FUNCTION__, process->pid, parent->trdid, (intptr_t)user_attr ); 101 vmm_display( process , false );102 hal_vmm_display( process , false ); 102 103 #endif 103 104 parent->errno = EINVAL; … … 117 118 printk("\n[ERROR] in %s : thread[%x,%x] / start_func unmapped %x\n", 118 119 __FUNCTION__, process->pid, parent->trdid, (intptr_t)start_func ); 119 vmm_display( process , false );120 hal_vmm_display( process , false ); 120 121 #endif 121 122 parent->errno = EINVAL; … … 134 135 printk("\n[ERROR] in %s : thread[%x,%x] / start_args buffer unmapped %x\n", 135 136 __FUNCTION__, process->pid, parent->trdid, (intptr_t)start_args ); 136 vmm_display( process , false );137 hal_vmm_display( process , false ); 137 138 #endif 138 139 parent->errno = EINVAL; -
trunk/kernel/syscalls/sys_timeofday.c
r506 r624 2 2 * sys_timeofday.c - Get current time 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 26 27 #include <thread.h> 27 28 #include <printk.h> … … 70 71 printk("\n[ERROR] in %s : user buffer tz unmapped / thread %x / process %x\n", 71 72 __FUNCTION__ , (intptr_t)tz , this->trdid , process->pid ); 72 vmm_display( process , false );73 hal_vmm_display( process , false ); 73 74 #endif 74 75 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_wait.c
r566 r624 25 25 #include <hal_uspace.h> 26 26 #include <hal_irqmask.h> 27 #include <hal_vmm.h> 27 28 #include <remote_queuelock.h> 28 29 #include <core.h> … … 68 69 printk("\n[ERROR] in %s : status buffer %x unmapped for thread %x in process %x\n", 69 70 __FUNCTION__ , (intptr_t)status, this->trdid , process->pid ); 70 vmm_display( process , false );71 hal_vmm_display( process , false ); 71 72 #endif 72 73 this->errno = EINVAL; -
trunk/kernel/syscalls/sys_write.c
r623 r624 24 24 #include <kernel_config.h> 25 25 #include <hal_kernel_types.h> 26 #include <hal_vmm.h> 26 27 #include <hal_uspace.h> 27 28 #include <hal_irqmask.h> … … 106 107 printk("\n[ERROR] in %s : thread[%x,%x] user buffer unmapped %x\n", 107 108 __FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr ); 108 vmm_display( process , false );109 hal_vmm_display( process , false ); 109 110 #endif 110 111 this->errno = EINVAL;
Note: See TracChangeset
for help on using the changeset viewer.