Changeset 580 for trunk/kernel/kern
- Timestamp:
- Oct 8, 2018, 11:31:42 AM (6 years ago)
- Location:
- trunk/kernel/kern
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/cluster.c
r564 r580 200 200 cluster->pmgr.pref_nr = 0; 201 201 cluster->pmgr.pref_tbl[0] = XPTR( local_cxy , &process_zero ); 202 for( lpid = 1; lpid < CONFIG_MAX_PROCESS_PER_CLUSTER ; lpid++ )202 for( lpid = 0 ; lpid < CONFIG_MAX_PROCESS_PER_CLUSTER ; lpid++ ) 203 203 { 204 204 cluster->pmgr.pref_tbl[lpid] = XPTR_NULL; -
trunk/kernel/kern/kernel_init.c
r577 r580 375 375 // check channels 376 376 if( channels != 1 ) 377 printk("\n[PANIC] in %s : MMC device must be single channel\n", __FUNCTION__ ); 377 { 378 printk("\n[PANIC] in %s : MMC device must be single channel\n", 379 __FUNCTION__ ); 380 hal_core_sleep(); 381 } 378 382 379 383 // create chdev in local cluster … … 386 390 // check memory 387 391 if( chdev_ptr == NULL ) 388 printk("\n[PANIC] in %s : cannot create MMC chdev\n", __FUNCTION__ ); 392 { 393 printk("\n[PANIC] in %s : cannot create MMC chdev\n", 394 __FUNCTION__ ); 395 hal_core_sleep(); 396 } 389 397 390 398 // make MMC specific initialisation … … 427 435 // check memory 428 436 if( chdev_ptr == NULL ) 429 printk("\n[PANIC] in %s : cannot create DMA chdev\n", __FUNCTION__ ); 437 { 438 printk("\n[PANIC] in %s : cannot create DMA chdev\n", 439 __FUNCTION__ ); 440 hal_core_sleep(); 441 } 430 442 431 443 // make DMA specific initialisation … … 503 515 // check PIC device initialized 504 516 if( chdev_dir.pic == XPTR_NULL ) 505 printk("\n[PANIC] in %s : PIC device must be initialized first\n", __FUNCTION__ ); 517 { 518 printk("\n[PANIC] in %s : PIC device must be initialized first\n", 519 __FUNCTION__ ); 520 hal_core_sleep(); 521 } 506 522 507 523 // check external device functionnal type 508 524 if( (func != DEV_FUNC_IOB) && (func != DEV_FUNC_IOC) && (func != DEV_FUNC_TXT) && 509 525 (func != DEV_FUNC_NIC) && (func != DEV_FUNC_FBF) ) 510 printk("\n[PANIC] in %s : undefined peripheral type\n", __FUNCTION__ ); 526 { 527 printk("\n[PANIC] in %s : undefined peripheral type\n", 528 __FUNCTION__ ); 529 hal_core_sleep(); 530 } 511 531 512 532 // loops on channels … … 548 568 549 569 if( chdev == NULL ) 550 printk("\n[PANIC] in %s : cannot allocate chdev for external device\n", 551 __FUNCTION__ ); 570 { 571 printk("\n[PANIC] in %s : cannot allocate chdev\n", 572 __FUNCTION__ ); 573 hal_core_sleep(); 574 } 552 575 553 576 // make device type specific initialisation … … 646 669 // check PIC existence 647 670 if( found == false ) 648 printk("\n[PANIC] in %s : PIC device not found\n", __FUNCTION__ ); 671 { 672 printk("\n[PANIC] in %s : PIC device not found\n", 673 __FUNCTION__ ); 674 hal_core_sleep(); 675 } 649 676 650 677 // allocate and initialize the PIC chdev in cluster 0 … … 657 684 // check memory 658 685 if( chdev == NULL ) 659 printk("\n[PANIC] in %s : no memory for PIC chdev\n", __FUNCTION__ ); 686 { 687 printk("\n[PANIC] in %s : no memory for PIC chdev\n", 688 __FUNCTION__ ); 689 hal_core_sleep(); 690 } 660 691 661 692 // make PIC device type specific initialisation … … 723 754 else if((func == DEV_FUNC_NIC) && (is_rx != 0)) ptr = &iopic_input.nic_rx[channel]; 724 755 else if( func == DEV_FUNC_IOB ) ptr = &iopic_input.iob; 725 else printk("\n[PANIC] in %s : illegal source device for IOPIC input" ); 756 else 757 { 758 printk("\n[PANIC] in %s : illegal source device for IOPIC input\n", 759 __FUNCTION__ ); 760 hal_core_sleep(); 761 } 726 762 727 763 // set one entry in all "iopic_input" structures … … 814 850 if ( func == DEV_FUNC_MMC ) lapic_input.mmc = id; 815 851 else if( func == DEV_FUNC_DMA ) lapic_input.dma[channel] = id; 816 else printk("\n[PANIC] in %s : illegal source device for LAPIC input" ); 852 else 853 { 854 printk("\n[PANIC] in %s : illegal source device for LAPIC input\n", 855 __FUNCTION__ ); 856 hal_core_sleep(); 857 } 817 858 } 818 859 } … … 939 980 // all cores check identifiers 940 981 if( error ) 941 printk("\n[PANIC] in %s : illegal core : gid %x / cxy %x / lid %d", 942 __FUNCTION__, core_lid, core_cxy, core_lid ); 982 { 983 printk("\n[PANIC] in %s : illegal core : gid %x / cxy %x / lid %d", 984 __FUNCTION__, core_lid, core_cxy, core_lid ); 985 hal_core_sleep(); 986 } 943 987 944 988 // CP0 initializes cluster manager complex structures … … 948 992 949 993 if( error ) 950 printk("\n[PANIC] in %s : cannot initialize cluster manager in cluster %x\n", 951 __FUNCTION__, local_cxy ); 994 { 995 printk("\n[PANIC] in %s : cannot initialize cluster manager in cluster %x\n", 996 __FUNCTION__, local_cxy ); 997 hal_core_sleep(); 998 } 952 999 } 953 1000 … … 1068 1115 1069 1116 if( fatfs_ctx == NULL ) 1070 printk("\n[PANIC] in %s : cannot create FATFS context in cluster 0\n", 1071 __FUNCTION__ ); 1117 { 1118 printk("\n[PANIC] in %s : cannot create FATFS context in cluster 0\n", 1119 __FUNCTION__ ); 1120 hal_core_sleep(); 1121 } 1072 1122 1073 1123 // 2. access boot device to initialize FATFS context … … 1099 1149 &vfs_root_inode_xp ); // return 1100 1150 if( error ) 1101 printk("\n[PANIC] in %s : cannot create VFS root inode in cluster 0\n", 1102 __FUNCTION__ ); 1151 { 1152 printk("\n[PANIC] in %s : cannot create VFS root inode in cluster 0\n", 1153 __FUNCTION__ ); 1154 hal_core_sleep(); 1155 } 1103 1156 1104 1157 // 6. update the FATFS entry in vfs_context[] array … … 1109 1162 1110 1163 if( ((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster != 8 ) 1111 printk("\n[PANIC] in %s : illegal FATFS context in cluster 0\n", 1112 __FUNCTION__ ); 1164 { 1165 printk("\n[PANIC] in %s : illegal FATFS context in cluster 0\n", 1166 __FUNCTION__ ); 1167 hal_core_sleep(); 1168 } 1169 1113 1170 } 1114 1171 else … … 1116 1173 printk("\n[PANIC] in %s : unsupported VFS type in cluster 0\n", 1117 1174 __FUNCTION__ ); 1175 hal_core_sleep(); 1118 1176 } 1119 1177 … … 1153 1211 // check memory 1154 1212 if( local_fatfs_ctx == NULL ) 1155 printk("\n[PANIC] in %s : cannot create FATFS context in cluster %x\n", 1156 __FUNCTION__ , local_cxy ); 1213 { 1214 printk("\n[PANIC] in %s : cannot create FATFS context in cluster %x\n", 1215 __FUNCTION__ , local_cxy ); 1216 hal_core_sleep(); 1217 } 1157 1218 1158 1219 // 2. get local pointer on VFS context for FATFS … … 1174 1235 1175 1236 if( ((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster != 8 ) 1176 printk("\n[PANIC] in %s : illegal FATFS context in cluster %x\n", 1177 __FUNCTION__ , local_cxy ); 1237 { 1238 printk("\n[PANIC] in %s : illegal FATFS context in cluster %x\n", 1239 __FUNCTION__ , local_cxy ); 1240 hal_core_sleep(); 1241 } 1178 1242 } 1179 1243 … … 1210 1274 1211 1275 if( devfs_ctx == NULL ) 1212 printk("\n[PANIC] in %s : cannot create DEVFS context in cluster 0\n", 1213 __FUNCTION__ , local_cxy ); 1276 { 1277 printk("\n[PANIC] in %s : cannot create DEVFS context in cluster 0\n", 1278 __FUNCTION__ , local_cxy ); 1279 hal_core_sleep(); 1280 } 1214 1281 1215 1282 // 2. initialize the DEVFS entry in the vfs_context[] array -
trunk/kernel/kern/process.c
r564 r580 112 112 cxy_t chdev_cxy; 113 113 pid_t parent_pid; 114 lpid_t process_lpid; 115 lpid_t parent_lpid; 114 116 115 117 // get parent process cluster and local pointer … … 119 121 // get parent_pid 120 122 parent_pid = hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid ) ); 123 124 // get process and parent lpid 125 process_lpid = LPID_FROM_PID( pid ); 126 parent_lpid = LPID_FROM_PID( parent_pid ); 121 127 122 128 #if DEBUG_PROCESS_REFERENCE_INIT … … 150 156 151 157 // define the stdin/stdout/stderr pseudo files <=> select a TXT terminal. 152 if( (pid == 1) || (parent_pid == 1)) // INIT or KSH process 158 if( (process_lpid == 1) || // INIT process 159 (parent_lpid == 1) ) // KSH process 153 160 { 154 161 // allocate a TXT channel 155 if( p id == 1 ) txt_id = 0; // INIT156 else txt_id = process_txt_alloc(); // KSH162 if( process_lpid == 1 ) txt_id = 0; // INIT 163 else txt_id = process_txt_alloc(); // KSH 157 164 158 165 // attach process to TXT … … 1487 1494 void process_zero_create( process_t * process ) 1488 1495 { 1496 error_t error; 1497 pid_t pid; 1489 1498 1490 1499 #if DEBUG_PROCESS_ZERO_CREATE … … 1495 1504 #endif 1496 1505 1506 // get PID from local cluster manager for this kernel process 1507 error = cluster_pid_alloc( process , &pid ); 1508 1509 if( error || (LPID_FROM_PID( pid ) != 0) ) 1510 { 1511 printk("\n[PANIC] in %s : cannot get valid PID in cluster %x / PID = %x\n", 1512 __FUNCTION__ , local_cxy, pid ); 1513 hal_core_sleep(); 1514 } 1515 1497 1516 // initialize PID, REF_XP, PARENT_XP, and STATE 1498 process->pid = 0; 1517 // the kernel process_zero is its own parent_process, 1518 // reference_process, and owner_process, and cannot be killed... 1519 process->pid = pid; 1499 1520 process->ref_xp = XPTR( local_cxy , process ); 1500 1521 process->owner_xp = XPTR( local_cxy , process ); 1501 process->parent_xp = XPTR _NULL;1522 process->parent_xp = XPTR( local_cxy , process ); 1502 1523 process->term_state = 0; 1503 1524 … … 1518 1539 LOCK_PROCESS_CHILDREN ); 1519 1540 1541 // register kernel process in cluster manager local_list 1542 cluster_process_local_link( process ); 1543 1520 1544 hal_fence(); 1521 1545 … … 1686 1710 pid_t pid; 1687 1711 pid_t ppid; 1712 lpid_t lpid; 1688 1713 uint32_t state; 1689 1714 uint32_t th_nr; … … 1707 1732 process_cxy = GET_CXY( process_xp ); 1708 1733 1709 // get PIDand state1734 // get process PID, LPID, and state 1710 1735 pid = hal_remote_l32( XPTR( process_cxy , &process_ptr->pid ) ); 1736 lpid = LPID_FROM_PID( pid ); 1711 1737 state = hal_remote_l32( XPTR( process_cxy , &process_ptr->term_state ) ); 1712 1738 1713 // get PPID1739 // get process PPID 1714 1740 parent_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->parent_xp ) ); 1715 1741 parent_cxy = GET_CXY( parent_xp ); … … 1725 1751 owner_ptr = GET_PTR( owner_xp ); 1726 1752 1727 // get extended pointer on TXT_RX file descriptor attached to process 1728 txt_file_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->fd_array.array[0] ) ); 1729 1730 assert( (txt_file_xp != XPTR_NULL) , 1731 "process must be attached to one TXT terminal\n" ); 1732 1733 // get TXT_RX chdev pointers 1734 txt_chdev_xp = chdev_from_file( txt_file_xp ); 1735 txt_chdev_cxy = GET_CXY( txt_chdev_xp ); 1736 txt_chdev_ptr = GET_PTR( txt_chdev_xp ); 1737 1738 // get TXT_RX name and ownership 1739 hal_remote_strcpy( XPTR( local_cxy , txt_name ) , 1740 XPTR( txt_chdev_cxy , txt_chdev_ptr->name ) ); 1753 // get process TXT name and .elf name 1754 if( lpid ) // user process 1755 { 1756 1757 // get extended pointer on file descriptor associated to TXT_RX 1758 txt_file_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->fd_array.array[0] ) ); 1759 1760 assert( (txt_file_xp != XPTR_NULL) , 1761 "process must be attached to one TXT terminal\n" ); 1762 1763 // get TXT_RX chdev pointers 1764 txt_chdev_xp = chdev_from_file( txt_file_xp ); 1765 txt_chdev_cxy = GET_CXY( txt_chdev_xp ); 1766 txt_chdev_ptr = GET_PTR( txt_chdev_xp ); 1767 1768 // get TXT_RX name and ownership 1769 hal_remote_strcpy( XPTR( local_cxy , txt_name ) , 1770 XPTR( txt_chdev_cxy , txt_chdev_ptr->name ) ); 1741 1771 1742 txt_owner_xp = (xptr_t)hal_remote_l64( XPTR( txt_chdev_cxy, 1743 &txt_chdev_ptr->ext.txt.owner_xp ) ); 1744 1745 // get process .elf name 1746 elf_file_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->vfs_bin_xp ) ); 1747 elf_file_cxy = GET_CXY( elf_file_xp ); 1748 elf_file_ptr = (vfs_file_t *)GET_PTR( elf_file_xp ); 1749 elf_inode_ptr = (vfs_inode_t *)hal_remote_lpt( XPTR( elf_file_cxy , &elf_file_ptr->inode ) ); 1750 vfs_inode_get_name( XPTR( elf_file_cxy , elf_inode_ptr ) , elf_name ); 1772 txt_owner_xp = (xptr_t)hal_remote_l64( XPTR( txt_chdev_cxy, 1773 &txt_chdev_ptr->ext.txt.owner_xp ) ); 1774 1775 // get process .elf name 1776 elf_file_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->vfs_bin_xp ) ); 1777 elf_file_cxy = GET_CXY( elf_file_xp ); 1778 elf_file_ptr = GET_PTR( elf_file_xp ); 1779 elf_inode_ptr = hal_remote_lpt( XPTR( elf_file_cxy , &elf_file_ptr->inode ) ); 1780 vfs_inode_get_name( XPTR( elf_file_cxy , elf_inode_ptr ) , elf_name ); 1781 } 1782 else // kernel process_zero 1783 { 1784 // TXT name and .elf name are not registered in kernel process_zero 1785 strcpy( txt_name , "txt0_rx" ); 1786 txt_owner_xp = process_xp; 1787 strcpy( elf_name , "kernel.elf" ); 1788 } 1751 1789 1752 1790 // display process info -
trunk/kernel/kern/thread.c
r564 r580 1216 1216 xptr_t lock_xp; // extended pointer on lock protecting this list 1217 1217 1218 #if DEBUG_THREAD_GET_XPTR 1219 uint32_t cycle = (uint32_t)hal_get_cycles(); 1220 thread_t * this = CURRENT_THREAD; 1221 if( DEBUG_THREAD_GET_XPTR < cycle ) 1222 printk("\n[DBG] %s : thread %x in process %x enters / pid %x / trdid %x / cycle %d\n", 1223 __FUNCTION__, this->trdid, this->process->pid, pid, trdid, cycle ); 1224 #endif 1225 1218 1226 // get target cluster identifier and local thread identifier 1219 1227 target_cxy = CXY_FROM_TRDID( trdid ); … … 1235 1243 remote_queuelock_acquire( lock_xp ); 1236 1244 1245 #if( DEBUG_THREAD_GET_XPTR & 1 ) 1246 if( DEBUG_THREAD_GET_XPTR < cycle ) 1247 printk("\n[DBG] %s : scan processes in cluster %x :\n", __FUNCTION__, target_cxy ); 1248 #endif 1249 1237 1250 // scan the list of local processes in target cluster 1238 1251 xptr_t iter; … … 1243 1256 target_process_ptr = GET_PTR( target_process_xp ); 1244 1257 target_process_pid = hal_remote_l32( XPTR( target_cxy , &target_process_ptr->pid ) ); 1258 1259 #if( DEBUG_THREAD_GET_XPTR & 1 ) 1260 if( DEBUG_THREAD_GET_XPTR < cycle ) 1261 printk(" - process %x\n", target_process_pid ); 1262 #endif 1263 1245 1264 if( target_process_pid == pid ) 1246 1265 { … … 1254 1273 1255 1274 // check PID found 1256 if( found == false ) return XPTR_NULL; 1275 if( found == false ) 1276 { 1277 1278 #if( DEBUG_THREAD_GET_XPTR & 1 ) 1279 if( DEBUG_THREAD_GET_XPTR < cycle ) 1280 printk("\n[DBG] %s : pid %x not found in cluster %x\n", 1281 __FUNCTION__, pid, target_cxy ); 1282 #endif 1283 return XPTR_NULL; 1284 } 1257 1285 1258 1286 // get target thread local pointer … … 1260 1288 target_thread_ptr = (thread_t *)hal_remote_lpt( xp ); 1261 1289 1262 if( target_thread_ptr == NULL ) return XPTR_NULL; 1290 if( target_thread_ptr == NULL ) 1291 { 1292 1293 #if( DEBUG_THREAD_GET_XPTR & 1 ) 1294 if( DEBUG_THREAD_GET_XPTR < cycle ) 1295 printk("\n[DBG] %s : thread %x not registered in process %x in cluster %x\n", 1296 __FUNCTION__, trdid, pid, target_cxy ); 1297 #endif 1298 return XPTR_NULL; 1299 } 1300 1301 #if DEBUG_THREAD_GET_XPTR 1302 cycle = (uint32_t)hal_get_cycles(); 1303 if( DEBUG_THREAD_GET_XPTR < cycle ) 1304 printk("\n[DBG] %s : thread %x in process %x exit / pid %x / trdid %x / cycle %d\n", 1305 __FUNCTION__, this->trdid, this->process->pid, pid, trdid, cycle ); 1306 #endif 1263 1307 1264 1308 return XPTR( target_cxy , target_thread_ptr ); … … 1287 1331 // display error message on TXT0 1288 1332 nolock_printk("\n[PANIC] in %s / thread %x in process %x [%x] cannot yield : " 1289 " %d busylock(s) / cycle %d\n",1333 "hold %d busylock(s) / cycle %d\n", 1290 1334 func_str, thread->trdid, thread->process->pid, thread, 1291 1335 thread->busylocks, (uint32_t)hal_get_cycles() ); 1292 1336 1293 1337 #if DEBUG_BUSYLOCK 1294 if( XPTR( local_cxy , thread ) == DEBUG_BUSYLOCK_THREAD_XP ) 1295 { 1296 // get root of list of taken busylocks 1297 xptr_t root_xp = XPTR( local_cxy , &thread->busylocks_root ); 1298 xptr_t iter_xp; 1299 1300 // scan list of busylocks 1301 XLIST_FOREACH( root_xp , iter_xp ) 1302 { 1303 xptr_t lock_xp = XLIST_ELEMENT( iter_xp , busylock_t , xlist ); 1304 cxy_t lock_cxy = GET_CXY( lock_xp ); 1305 busylock_t * lock_ptr = GET_PTR( lock_xp ); 1306 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) ); 1307 nolock_printk(" - %s in cluster %x\n", lock_type_str[lock_type] , lock_cxy ); 1308 } 1338 1339 // get root of list of taken busylocks 1340 xptr_t root_xp = XPTR( local_cxy , &thread->busylocks_root ); 1341 xptr_t iter_xp; 1342 1343 // scan list of busylocks 1344 XLIST_FOREACH( root_xp , iter_xp ) 1345 { 1346 xptr_t lock_xp = XLIST_ELEMENT( iter_xp , busylock_t , xlist ); 1347 cxy_t lock_cxy = GET_CXY( lock_xp ); 1348 busylock_t * lock_ptr = GET_PTR( lock_xp ); 1349 uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) ); 1350 nolock_printk(" - %s in cluster %x\n", lock_type_str[lock_type] , lock_cxy ); 1309 1351 } 1352 1310 1353 #endif 1311 1354 … … 1318 1361 } // end thread_assert_can yield() 1319 1362 1320 #if DEBUG_BUSYLOCK 1321 1322 //////////////////////////////////////////////////// 1323 void thread_display_busylocks( uint32_t lock_type, 1324 bool_t is_acquire ) 1325 { 1326 xptr_t iter_xp; 1327 1328 // get cluster and local pointer of target thread 1329 cxy_t thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP ); 1330 thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP ); 1331 1332 // get extended pointer on root of busylocks 1333 xptr_t root_xp = XPTR( thread_cxy , &thread_ptr->busylocks_root ); 1334 1335 // get pointers on TXT0 chdev 1336 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 1337 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 1338 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 1339 1340 // get extended pointer on remote TXT0 lock 1341 xptr_t txt0_lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 1342 1343 // get TXT0 lock 1344 remote_busylock_acquire( txt0_lock_xp ); 1345 1346 if( is_acquire ) 1347 { 1348 nolock_printk("\n### thread [%x,%x] ACQUIRE lock %s / root %x / locks :\n", 1349 thread_cxy, thread_ptr, lock_type_str[lock_type], GET_PTR(root_xp) ); 1363 ////////////////////////////////////////////////// 1364 void thread_display_busylocks( xptr_t thread_xp ) 1365 { 1366 if( DEBUG_BUSYLOCK ) 1367 { 1368 xptr_t iter_xp; 1369 1370 // get cluster and local pointer of target thread 1371 cxy_t thread_cxy = GET_CXY( thread_xp ); 1372 thread_t * thread_ptr = GET_PTR( thread_xp ); 1373 1374 // get target thread TRDID and busylocks 1375 trdid_t trdid = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->trdid )); 1376 uint32_t locks = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->busylocks )); 1377 1378 // get target thread process and PID; 1379 process_t * process = hal_remote_lpt(XPTR( thread_cxy , &thread_ptr->process )); 1380 pid_t pid = hal_remote_l32(XPTR( thread_cxy , &process->pid )); 1381 1382 // get extended pointer on root of busylocks 1383 xptr_t root_xp = XPTR( thread_cxy , &thread_ptr->busylocks_root ); 1384 1385 // get pointers on TXT0 chdev 1386 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 1387 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 1388 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 1389 1390 // get extended pointer on remote TXT0 lock 1391 xptr_t txt0_lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 1392 1393 // get TXT0 lock 1394 remote_busylock_acquire( txt0_lock_xp ); 1395 1396 // display header 1397 nolock_printk("\n***** thread %x in process %x : %d busylocks at cycle %d\n", 1398 trdid, pid, locks, (uint32_t)hal_get_cycles() ); 1399 1400 // scan the xlist of busylocks when required 1401 if( locks ) 1402 { 1403 XLIST_FOREACH( root_xp , iter_xp ) 1404 { 1405 xptr_t lock_xp = XLIST_ELEMENT( iter_xp , busylock_t , xlist ); 1406 cxy_t lock_cxy = GET_CXY( lock_xp ); 1407 busylock_t * lock_ptr = GET_PTR( lock_xp ); 1408 uint32_t lock_type = hal_remote_l32(XPTR( lock_cxy , &lock_ptr->type )); 1409 nolock_printk(" - %s in cluster %x\n", lock_type_str[lock_type] , lock_cxy ); 1410 } 1411 } 1412 1413 // release TXT0 lock 1414 remote_busylock_release( txt0_lock_xp ); 1350 1415 } 1351 1416 else 1352 1417 { 1353 nolock_printk("\n### thread [%x,%x] RELEASE lock %s / root %x / locks :\n", 1354 thread_cxy, thread_ptr, lock_type_str[lock_type], GET_PTR(root_xp) ); 1355 } 1356 1357 int i; 1358 1359 XLIST_FOREACH( root_xp , iter_xp ) 1360 { 1361 xptr_t ilock_xp = XLIST_ELEMENT( iter_xp , busylock_t , xlist ); 1362 cxy_t ilock_cxy = GET_CXY( ilock_xp ); 1363 busylock_t * ilock_ptr = GET_PTR( ilock_xp ); 1364 uint32_t ilock_type = hal_remote_l32( XPTR( ilock_cxy , &ilock_ptr->type ) ); 1365 nolock_printk(" - %s in cluster %x\n", lock_type_str[ilock_type] , ilock_cxy ); 1366 } 1367 1368 // release TXT0 lock 1369 remote_busylock_release( txt0_lock_xp ); 1370 } 1371 #endif 1418 // display a warning 1419 printk("\n[WARNING] set the DEBUG_BUSYLOCK parmeter in kernel_config.h" 1420 " to use the %s function\n", __FUNCTION__ ); 1421 } 1422 } // end thread_display_busylock() -
trunk/kernel/kern/thread.h
r564 r580 467 467 468 468 /*************************************************************************************** 469 * This debug function display the list of busylocks currently owned by a thread 470 * identified by the DEBUG_BUSYLOCK_THREAD_XP parameter. 471 * It is called each time the target thread acquire or release a busylock 472 * (local or remote). It is never called when DEBUG_BUSYLOCK_THEAD_CP == 0. 473 *************************************************************************************** 474 * @ lock_type : type of acquired / released busylock. 475 * @ is_acquire : change is an acquire when true / change is a release when false. 476 **************************************************************************************/ 477 void thread_display_busylocks( uint32_t lock_type, 478 bool_t is_acquire ); 469 * This debug function display the list of busylocks (local or remote) currently owned 470 * by a thread identified by the <thread_xp> argument. 471 * WARNING : it can be called by the idbg tool, but the DEBUG_BUSYLOCK parameter 472 * must be set in the kernel_config.h file. 473 *************************************************************************************** 474 * @ thread_xp : extended pointer on target thread. 475 **************************************************************************************/ 476 void thread_display_busylocks( xptr_t thread_xp ); 479 477 480 478
Note: See TracChangeset
for help on using the changeset viewer.