Changes in / [33f3cfb:c7806122]
- Files:
-
- 30 added
- 25 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/Makefile.am
r33f3cfb rc7806122 88 88 inst_thread_headers_nosrc = \ 89 89 bits/random.hfa \ 90 concurrency/clib/cfathread.h \ 90 91 concurrency/invoke.h \ 91 92 concurrency/kernel/fwd.hfa … … 103 104 concurrency/alarm.cfa \ 104 105 concurrency/alarm.hfa \ 106 concurrency/clib/cfathread.cfa \ 105 107 concurrency/CtxSwitch-@ARCHITECTURE@.S \ 106 108 concurrency/invoke.c \ -
libcfa/src/concurrency/io/setup.cfa
r33f3cfb rc7806122 147 147 static void * iopoll_loop( __attribute__((unused)) void * args ) { 148 148 __processor_id_t id; 149 id.full_proc = false; 149 150 id.id = doregister(&id); 150 151 __cfaabi_dbg_print_safe( "Kernel : IO poller thread starting\n" ); -
libcfa/src/concurrency/kernel.cfa
r33f3cfb rc7806122 237 237 $coroutine * proc_cor = get_coroutine(this->runner); 238 238 239 // Update global state240 kernelTLS.this_thread = thrd_dst;241 242 239 // set state of processor coroutine to inactive 243 240 verify(proc_cor->state == Active); … … 253 250 thrd_dst->unpark_stale = true; 254 251 ) 252 // Update global state 253 kernelTLS.this_thread = thrd_dst; 255 254 256 255 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); … … 259 258 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor 260 259 260 261 261 // set context switch to the thread that the processor is executing 262 262 verify( thrd_dst->context.SP ); … … 269 269 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 270 270 271 // Reset global state 272 kernelTLS.this_thread = 0p; 271 273 272 274 // We just finished running a thread, there are a few things that could have happened. … … 313 315 // Just before returning to the processor, set the processor coroutine to active 314 316 proc_cor->state = Active; 315 kernelTLS.this_thread = 0p;316 317 317 318 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); … … 521 522 disable_interrupts(); 522 523 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 523 bool ret =post( this->idle );524 post( this->idle ); 524 525 enable_interrupts( __cfaabi_dbg_ctx ); 525 526 } -
libcfa/src/concurrency/kernel.hfa
r33f3cfb rc7806122 48 48 // Processor id, required for scheduling threads 49 49 struct __processor_id_t { 50 unsigned id; 50 unsigned id:24; 51 bool full_proc:1; 51 52 52 53 #if !defined(__CFA_NO_STATISTICS__) -
libcfa/src/concurrency/kernel/startup.cfa
r33f3cfb rc7806122 471 471 this.cltr = &_cltr; 472 472 id = -1u; 473 full_proc = true; 473 474 destroyer = 0p; 474 475 do_terminate = false; -
libcfa/src/concurrency/preemption.cfa
r33f3cfb rc7806122 411 411 static void * alarm_loop( __attribute__((unused)) void * args ) { 412 412 __processor_id_t id; 413 id.full_proc = false; 413 414 id.id = doregister(&id); 414 415 -
libcfa/src/parseargs.cfa
r33f3cfb rc7806122 25 25 #include "limits.hfa" 26 26 27 extern int cfa_args_argc ;28 extern char ** cfa_args_argv ;29 extern char ** cfa_args_envp ;27 extern int cfa_args_argc __attribute__((weak)); 28 extern char ** cfa_args_argv __attribute__((weak)); 29 extern char ** cfa_args_envp __attribute__((weak)); 30 30 31 31 static void usage(char * cmd, cfa_option options[], size_t opt_count, const char * usage, FILE * out) __attribute__ ((noreturn)); 32 32 33 33 void parse_args( cfa_option options[], size_t opt_count, const char * usage, char ** & left ) { 34 parse_args(cfa_args_argc, cfa_args_argv, options, opt_count, usage, left ); 34 if( 0p != &cfa_args_argc ) { 35 parse_args(cfa_args_argc, cfa_args_argv, options, opt_count, usage, left ); 36 } 37 else { 38 char * temp = ""; 39 parse_args(0, &temp, options, opt_count, usage, left ); 40 } 35 41 } 36 42 -
tools/gdb/utils-gdb.py
r33f3cfb rc7806122 44 44 STACK = [] 45 45 46 # A global variable to keep all system task name47 SysTask_Name = ["uLocalDebuggerReader", "uLocalDebugger", "uProcessorTask", "uBootTask", "uSystemTask",48 "uProcessorTask", "uPthread", "uProfiler"]49 50 46 not_supported_error_msg = "Not a supported command for this language" 51 47 … … 101 97 return cluster_root 102 98 99 def get_sched_lock(): 100 """ 101 Return: gdb.Value of __scheduler_lock 102 """ 103 lock = gdb.parse_and_eval('_X16__scheduler_lockPS20__scheduler_RWLock_t_1') 104 if lock.address == 0x0: 105 print('No scheduler lock, program terminated') 106 return lock 107 108 def all_clusters(): 109 if not is_cforall(): 110 return None 111 112 cluster_root = get_cluster_root() 113 if cluster_root.address == 0x0: 114 return 115 116 curr = cluster_root 117 ret = [curr] 118 119 while True: 120 curr = curr['_X4nodeS26__cluster____dbg_node_cltr_1']['_X4nextPS7cluster_1'] 121 if curr == cluster_root: 122 break 123 124 ret.append(curr) 125 126 return ret 127 128 def all_processors(): 129 if not is_cforall(): 130 return None 131 132 cfa_t = get_cfa_types() 133 134 # get processors from registration to the RWlock 135 lock = get_sched_lock() 136 137 #get number of elements 138 count = lock['_X5readyVj_1'] 139 140 #find all the procs 141 raw_procs = [lock['_X4dataPS21__scheduler_lock_id_t_1'][i]['_X6handleVPS16__processor_id_t_1'] for i in range(count)] 142 143 # pre cast full procs 144 procs = [p.cast(cfa_t.processor_ptr) for p in raw_procs if p['_X9full_procb_1']] 145 146 # sort procs by clusters 147 return sorted(procs, key=lambda p: p['_X4cltrPS7cluster_1']) 148 149 def tls_for_pthread(pthrd): 150 prev = gdb.selected_thread() 151 inf = gdb.selected_inferior() 152 153 thrd = inf.thread_from_thread_handle( pthrd ) 154 thrd.switch() 155 tls = gdb.parse_and_eval('&_X9kernelTLSS16KernelThreadData_1') 156 157 prev.switch() 158 return tls 159 160 def tls_for_proc(proc): 161 return tls_for_pthread(proc['_X13kernel_threadm_1']) 162 163 def thread_for_pthread(pthrd): 164 return tls_for_pthread(pthrd)['_X11this_threadVPS7$thread_1'] 165 166 def thread_for_proc(proc): 167 return tls_for_proc(proc)['_X11this_threadVPS7$thread_1'] 168 169 170 103 171 def find_curr_thread(): 104 172 # btstr = gdb.execute('bt', to_string = True).splitlines() … … 108 176 # return btstr[0].split('this=',1)[1].split(',')[0].split(')')[0] 109 177 return None 110 111 def all_clusters():112 if not is_cforall():113 return None114 115 cluster_root = get_cluster_root()116 if cluster_root.address == 0x0:117 return118 119 curr = cluster_root120 ret = [curr]121 122 while True:123 curr = curr['_X4nodeS26__cluster____dbg_node_cltr_1']['_X4nextPS7cluster_1']124 if curr == cluster_root:125 break126 127 ret.append(curr)128 129 return ret130 131 178 132 179 def lookup_cluster(name = None): … … 239 286 """Cforall: Display currently known processors 240 287 Usage: 241 info processors : print out all the processors in the Main Cluster 242 info processors all : print out all processors in all clusters 288 info processors : print out all the processors 243 289 info processors <cluster_name> : print out all processors in a given cluster 244 290 """ … … 247 293 super(Processors, self).__init__('info processors', gdb.COMMAND_USER) 248 294 249 def print_processor(self, name, status, pending, address): 250 print('{:>20} {:>11} {:>13} {:>20}'.format(name, status, pending, address)) 251 252 def iterate_procs(self, root, active): 253 if root == 0x0: 254 return 255 256 cfa_t = get_cfa_types() 257 curr = root 258 259 while True: 260 processor = curr 261 should_stop = processor['_X12do_terminateVb_1'] 295 def print_processor(self, processor): 296 should_stop = processor['_X12do_terminateVb_1'] 297 if not should_stop: 298 midle = processor['_X6$linksS7$dlinks_S9processor__1']['_X4nextS9$mgd_link_Y13__tE_generic___1']['_X4elemPY13__tE_generic__1'] != 0x0 299 end = processor['_X6$linksS7$dlinks_S9processor__1']['_X4nextS9$mgd_link_Y13__tE_generic___1']['_X10terminatorPv_1'] != 0x0 300 301 status = 'Idle' if midle or end else 'Active' 302 else: 262 303 stop_count = processor['_X10terminatedS9semaphore_1']['_X5counti_1'] 263 if not should_stop: 264 status = 'Active' if active else 'Idle' 265 else: 266 status_str = 'Last Thread' if stop_count >= 0 else 'Terminating' 267 status = '{}({},{})'.format(status_str, should_stop, stop_count) 268 269 self.print_processor(processor['_X4namePKc_1'].string(), 270 status, str(processor['_X18pending_preemptionb_1']), str(processor) 271 ) 272 273 curr = curr['_X4nodeS28__processor____dbg_node_proc_1']['_X4nextPS9processor_1'] 274 275 if curr == root or curr == 0x0: 276 break 304 status_str = 'Last Thread' if stop_count >= 0 else 'Terminating' 305 status = '{}({},{})'.format(status_str, should_stop, stop_count) 306 307 print('{:>20} {:>11} {:<7} {:<}'.format( 308 processor['_X4namePKc_1'].string(), 309 status, 310 str(processor['_X18pending_preemptionb_1']), 311 str(processor) 312 )) 313 tls = tls_for_proc( processor ) 314 thrd = tls['_X11this_threadVPS7$thread_1'] 315 if thrd != 0x0: 316 tname = '{} {}'.format(thrd['self_cor']['name'].string(), str(thrd)) 317 else: 318 tname = None 319 320 print('{:>20} {}'.format('Thread', tname)) 321 print('{:>20} {}'.format('TLS', tls)) 277 322 278 323 #entry point from gdb … … 282 327 283 328 if not arg: 284 clusters = [lookup_cluster(None)]285 elif arg == "all":286 329 clusters = all_clusters() 287 330 else: … … 292 335 return 293 336 294 cfa_t = get_cfa_types() 295 for cluster in clusters: 296 print('Cluster: "{}"({})'.format(cluster['_X4namePKc_1'].string(), cluster.cast(cfa_t.cluster_ptr))) 297 298 active_root = cluster.cast(cfa_t.cluster_ptr) \ 299 ['_X5procsS8__dllist_S9processor__1'] \ 300 ['_X4headPY15__TYPE_generic__1'] \ 301 .cast(cfa_t.processor_ptr) 302 303 idle_root = cluster.cast(cfa_t.cluster_ptr) \ 304 ['_X5idlesS8__dllist_S9processor__1'] \ 305 ['_X4headPY15__TYPE_generic__1'] \ 306 .cast(cfa_t.processor_ptr) 307 308 if idle_root != 0x0 or active_root != 0x0: 309 self.print_processor('Name', 'Status', 'Pending Yield', 'Address') 310 self.iterate_procs(active_root, True) 311 self.iterate_procs(idle_root, False) 312 else: 313 print("No processors on cluster") 337 procs = all_processors() 338 339 print('{:>20} {:>11} {:<7} {}'.format('Processor', '', 'Pending', 'Object')) 340 print('{:>20} {:>11} {:<7} {}'.format('Name', 'Status', 'Yield', 'Address')) 341 cl = None 342 for p in procs: 343 # if this is a different cluster print it 344 if cl != p['_X4cltrPS7cluster_1']: 345 if cl: 346 print() 347 cl = p['_X4cltrPS7cluster_1'] 348 print('Cluster {}'.format(cl['_X4namePKc_1'].string())) 349 350 # print the processor information 351 self.print_processor(p) 314 352 315 353 print()
Note: See TracChangeset
for help on using the changeset viewer.