source: trunk/kernel/kern/scheduler.c @ 582

Last change on this file since 582 was 582, checked in by alain, 3 years ago

New DQDT implementation supporting missing clusters
thanks to the cluster_info[x][y] array.

File size: 22.7 KB
RevLine 
[1]1/*
2 * scheduler.c - Core scheduler implementation.
3 *
[564]4 * Author    Alain Greiner (2016,2017,2018)
[1]5 *
6 * Copyright (c)  UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH. is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH. is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH.; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
[14]24#include <kernel_config.h>
[457]25#include <hal_kernel_types.h>
[407]26#include <hal_switch.h>
[1]27#include <hal_irqmask.h>
28#include <hal_context.h>
29#include <printk.h>
30#include <list.h>
31#include <core.h>
32#include <thread.h>
[296]33#include <chdev.h>
[1]34#include <scheduler.h>
35
[443]36
[296]37///////////////////////////////////////////////////////////////////////////////////////////
[564]38//         global variables
[296]39///////////////////////////////////////////////////////////////////////////////////////////
[1]40
[564]41extern chdev_directory_t    chdev_dir;          // allocated in kernel_init.c
[296]42
[564]43///////////////////////////////////////////////////////////////////////////////////////////
44//         private functions
45///////////////////////////////////////////////////////////////////////////////////////////
[443]46
[1]47
[564]48////////////////////////////////////////////////////////////////////////////////////////////
49// This static function does NOT modify the scheduler state.
50// It just select a thread in the list of attached threads, implementing the following
51// three steps policy:
52// 1) It scan the list of kernel threads, from the next thread after the last executed one,
53//    and returns the first runnable found : not IDLE, not blocked, client queue not empty.
54//    It can be the current thread.
55// 2) If no kernel thread found, it scan the list of user thread, from the next thread after
56//    the last executed one, and returns the first runable found : not blocked.
57//    It can be the current thread.
58// 3) If no runable thread found, it returns the idle thread.
59////////////////////////////////////////////////////////////////////////////////////////////
60// @ sched   : local pointer on scheduler.
61// @ returns pointer on selected thread descriptor
62////////////////////////////////////////////////////////////////////////////////////////////
[408]63thread_t * sched_select( scheduler_t * sched )
[1]64{
[408]65    thread_t     * thread;
66    list_entry_t * current;
67    list_entry_t * last;
[437]68    list_entry_t * root;
69    bool_t         done;
[450]70    uint32_t       count;
[1]71
[437]72    // first : scan the kernel threads list if not empty
[279]73    if( list_is_empty( &sched->k_root ) == false )
[1]74    {
[437]75        root    = &sched->k_root;
[279]76        last    = sched->k_last;
[450]77        done    = false;
78        count   = 0;
[437]79        current = last;
80
81        while( done == false )
[279]82        {
[450]83
[564]84// check kernel threads list
85assert( (count < sched->k_threads_nr),
86"bad kernel threads list" );
87
[279]88            // get next entry in kernel list
[437]89            current = current->next;
[1]90
[437]91            // check exit condition
92            if( current == last ) done = true;
93
[279]94            // skip the root that does not contain a thread
[437]95            if( current == root ) continue;
[450]96            else                  count++;
[1]97
[279]98            // get thread pointer for this entry
99            thread = LIST_ELEMENT( current , thread_t , sched_list );
[1]100
[450]101            // select kernel thread if non blocked and non THREAD_IDLE
[564]102            if( (thread->blocked == 0)  && (thread->type != THREAD_IDLE) ) return thread;
103
[437]104        } // end loop on kernel threads
[450]105    } // end kernel threads
[437]106
107    // second : scan the user threads list if not empty
[279]108    if( list_is_empty( &sched->u_root ) == false )
[1]109    {
[437]110        root    = &sched->u_root;
[279]111        last    = sched->u_last;
[450]112        done    = false;
113        count   = 0;
[437]114        current = last;
115
116        while( done == false )
[279]117        {
[450]118
[564]119// check user threads list
120assert( (count < sched->u_threads_nr),
121"bad user threads list" );
122
[279]123            // get next entry in user list
[437]124            current = current->next;
[1]125
[437]126            // check exit condition
127            if( current == last ) done = true;
128
[279]129            // skip the root that does not contain a thread
[437]130            if( current == root ) continue;
[450]131            else                  count++;
[1]132
[279]133            // get thread pointer for this entry
134            thread = LIST_ELEMENT( current , thread_t , sched_list );
[1]135
[450]136            // select thread if non blocked
[564]137            if( thread->blocked == 0 )  return thread;
138
[437]139        } // end loop on user threads
[450]140    } // end user threads
[1]141
[437]142    // third : return idle thread if no other runnable thread
[1]143    return sched->idle;
144
[296]145}  // end sched_select()
[1]146
[564]147////////////////////////////////////////////////////////////////////////////////////////////
148// This static function is the only function that can remove a thread from the scheduler.
149// It is private, because it is called by the sched_yield() public function.
150// It scan all threads attached to a given scheduler, and executes the relevant
151// actions for pending requests:
152// - REQ_ACK : it checks that target thread is blocked, decrements the response counter
153//   to acknowledge the client thread, and reset the pending request.
154// - REQ_DELETE : it detach the target thread from parent if attached, detach it from
155//   the process, remove it from scheduler, release memory allocated to thread descriptor,
156//   and destroy the process descriptor it the target thread was the last thread.
157////////////////////////////////////////////////////////////////////////////////////////////
158// @ core    : local pointer on the core descriptor.
159////////////////////////////////////////////////////////////////////////////////////////////
160static void sched_handle_signals( core_t * core )
[1]161{
[437]162
[1]163    list_entry_t * iter;
[440]164    list_entry_t * root;
[1]165    thread_t     * thread;
[428]166    process_t    * process;
[564]167    scheduler_t  * sched;
168    bool_t         last;
[409]169
[440]170    // get pointer on scheduler
[564]171    sched = &core->scheduler;
[1]172
[440]173    // get pointer on user threads root
174    root = &sched->u_root;
175
176    // We use a while to scan the user threads, to control the iterator increment,
[564]177    // because some threads will be destroyed, and we want not use a LIST_FOREACH()
[440]178
179    // initialise list iterator
180    iter = root->next;
181
[416]182    // scan all user threads
[440]183    while( iter != root )
[1]184    {
[440]185        // get pointer on thread
[1]186        thread = LIST_ELEMENT( iter , thread_t , sched_list );
187
[440]188        // increment iterator
189        iter = iter->next;
190
[416]191        // handle REQ_ACK
192        if( thread->flags & THREAD_FLAG_REQ_ACK )
[408]193        {
[564]194
195// check thread blocked
196assert( (thread->blocked & THREAD_BLOCKED_GLOBAL) , 
197"thread not blocked" );
[416]198 
199            // decrement response counter
200            hal_atomic_add( thread->ack_rsp_count , -1 );
[408]201
[416]202            // reset REQ_ACK in thread descriptor
203            thread_reset_req_ack( thread );
[408]204        }
[416]205
[564]206        // handle REQ_DELETE only if target thread != calling thread
207        if( (thread->flags & THREAD_FLAG_REQ_DELETE) && (thread != CURRENT_THREAD) )
[416]208        {
[428]209            // get thread process descriptor
210            process = thread->process;
[416]211
212                // release FPU if required
213                if( thread->core->fpu_owner == thread )  thread->core->fpu_owner = NULL;
214
[564]215            // take lock protecting sheduler state
216            busylock_acquire( &sched->lock );
217
218            // update scheduler state
[428]219            uint32_t threads_nr = sched->u_threads_nr;
220            sched->u_threads_nr = threads_nr - 1;
[416]221            list_unlink( &thread->sched_list );
[450]222            if( sched->u_last == &thread->sched_list )
223            {
224                if( threads_nr == 1 ) 
225                {
226                    sched->u_last = NULL;
227                }
228                else if( sched->u_root.next == &thread->sched_list )
229                {
230                    sched->u_last = sched->u_root.pred;
231                }
232                else
233                {
234                    sched->u_last = sched->u_root.next;
235                }
236            }
[416]237
[564]238            // release lock protecting scheduler state
239            busylock_release( &sched->lock );
240
[450]241            // delete thread descriptor
[564]242            last = thread_destroy( thread );
[416]243
[438]244#if DEBUG_SCHED_HANDLE_SIGNALS
[440]245uint32_t cycle = (uint32_t)hal_get_cycles();
[438]246if( DEBUG_SCHED_HANDLE_SIGNALS < cycle )
[445]247printk("\n[DBG] %s : thread %x in process %x on core[%x,%d] deleted / cycle %d\n",
[443]248__FUNCTION__ , thread->trdid , process->pid , local_cxy , thread->core->lid , cycle );
[433]249#endif
[416]250            // destroy process descriptor if no more threads
[564]251            if( last ) 
[428]252            {
253                // delete process   
254                process_destroy( process );
255
[438]256#if DEBUG_SCHED_HANDLE_SIGNALS
[433]257cycle = (uint32_t)hal_get_cycles();
[438]258if( DEBUG_SCHED_HANDLE_SIGNALS < cycle )
[443]259printk("\n[DBG] %s : process %x in cluster %x deleted / cycle %d\n",
260__FUNCTION__ , process->pid , local_cxy , cycle );
[433]261#endif
[428]262            }
[416]263        }
[1]264    }
[564]265} // end sched_handle_signals()
[1]266
[564]267////////////////////////////////////////////////////////////////////////////////////////////
268// This static function is called by the sched_yield function when the RFC_FIFO
269// associated to the core is not empty.
270// It checks if it exists an idle (blocked) RPC thread for this core, and unblock
271// it if found. It creates a new RPC thread if no idle RPC thread is found.
272////////////////////////////////////////////////////////////////////////////////////////////
273// @ sched   : local pointer on scheduler.
274////////////////////////////////////////////////////////////////////////////////////////////
[582]275static void sched_rpc_activate( scheduler_t * sched )
[564]276{
277    error_t         error;
278    thread_t      * thread; 
279    list_entry_t  * iter;
280    lid_t           lid = CURRENT_THREAD->core->lid;
281    bool_t          found = false;
282
283    // search one IDLE RPC thread associated to the selected core   
284    LIST_FOREACH( &sched->k_root , iter )
285    {
286        thread = LIST_ELEMENT( iter , thread_t , sched_list );
287        if( (thread->type == THREAD_RPC) && (thread->blocked == THREAD_BLOCKED_IDLE ) ) 
288        {
289            // exit loop
290            found = true;
291            break;
292        }
293    }
294
295    if( found == false )     // create new RPC thread     
296    {
297        error = thread_kernel_create( &thread,
298                                      THREAD_RPC, 
299                                              &rpc_thread_func, 
300                                      NULL,
301                                          lid );
302        // check memory
303        if ( error )
304        {
305            printk("\n[WARNING] in %s : no memory to create a RPC thread in cluster %x\n",
306            __FUNCTION__, local_cxy );
307        }
308        else
309        {
310            // unblock created RPC thread
311            thread->blocked = 0;
312
313            // update RPC threads counter 
314            hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[lid] , 1 );
315
316#if DEBUG_SCHED_RPC_ACTIVATE
317uint32_t cycle = (uint32_t)hal_get_cycles();
318if( DEBUG_SCHED_RPC_ACTIVATE < cycle ) 
319printk("\n[DBG] %s : new RPC thread %x created for core[%x,%d] / cycle %d\n",
320__FUNCTION__, thread->trdid, local_cxy, lid, cycle );
321#endif
322        }
323    }
324    else                 // RPC thread found => unblock it
325    {
326        // unblock found RPC thread
327        thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_IDLE );
328
329#if DEBUG_SCHED_RPC_ACTIVATE
330uint32_t cycle = (uint32_t)hal_get_cycles();
331if( DEBUG_SCHED_RPC_ACTIVATE < cycle ) 
332printk("\n[DBG] %s : idle RPC thread %x unblocked for core[%x,%d] / cycle %d\n",
333__FUNCTION__, thread->trdid, local_cxy, lid, cycle );
334#endif
335
336    }
337
338} // end sched_rpc_activate()
339
340
341
342///////////////////////////////////////////////////////////////////////////////////////////
343//         public functions
344///////////////////////////////////////////////////////////////////////////////////////////
345
346////////////////////////////////
347void sched_init( core_t * core )
348{
349    scheduler_t * sched = &core->scheduler;
350
351    sched->u_threads_nr   = 0;
352    sched->k_threads_nr   = 0;
353
354    sched->current        = CURRENT_THREAD;
355    sched->idle           = NULL;               // initialized in kernel_init()
356    sched->u_last         = NULL;               // initialized in sched_register_thread()
357    sched->k_last         = NULL;               // initialized in sched_register_thread()
358
359    // initialise threads lists
360    list_root_init( &sched->u_root );
361    list_root_init( &sched->k_root );
362
363    // init lock
364    busylock_init( &sched->lock , LOCK_SCHED_STATE );
365
366    sched->req_ack_pending = false;             // no pending request
367    sched->trace           = false;             // context switches trace desactivated
368
369}  // end sched_init()
370
371////////////////////////////////////////////
372void sched_register_thread( core_t   * core,
373                            thread_t * thread )
374{
375    scheduler_t * sched = &core->scheduler;
376    thread_type_t type  = thread->type;
377
378    // take lock protecting sheduler state
379    busylock_acquire( &sched->lock );
380
381    if( type == THREAD_USER )
382    {
383        list_add_last( &sched->u_root , &thread->sched_list );
384        sched->u_threads_nr++;
385        if( sched->u_last == NULL ) sched->u_last = &thread->sched_list;
386    }
387    else // kernel thread
388    {
389        list_add_last( &sched->k_root , &thread->sched_list );
390        sched->k_threads_nr++;
391        if( sched->k_last == NULL ) sched->k_last = &thread->sched_list; 
392    }
393
[1]394    // release lock
[564]395    busylock_release( &sched->lock );
[1]396
[564]397}  // end sched_register_thread()
[416]398
[564]399//////////////////////////////////////
[470]400void sched_yield( const char * cause )
[1]401{
[564]402    thread_t      * next;
403    thread_t      * current = CURRENT_THREAD;
404    core_t        * core    = current->core;
405    lid_t           lid     = core->lid;
406    scheduler_t   * sched   = &core->scheduler;
407    remote_fifo_t * fifo    = &LOCAL_CLUSTER->rpc_fifo[lid]; 
[407]408 
[438]409#if (DEBUG_SCHED_YIELD & 0x1)
[564]410if( sched->trace ) sched_display( lid );
[407]411#endif
[1]412
[581]413// This assert should never be false, as this check must be
414// done before by any function that can possibly deschedule...
[564]415assert( (current->busylocks == 0),
[581]416"unexpected descheduling of thread holding %d busylocks = %d\n", current->busylocks ); 
[1]417
[564]418    // activate or create an RPC thread if RPC_FIFO non empty
419    if( remote_fifo_is_empty( fifo ) == false )  sched_rpc_activate( sched );
[408]420
[564]421    // disable IRQs / save SR in current thread descriptor
422    hal_disable_irq( &current->save_sr );
423
424    // take lock protecting sheduler state
425    busylock_acquire( &sched->lock );
426   
427    // select next thread
[408]428    next = sched_select( sched );
[1]429
[564]430// check next thread kernel_stack overflow
431assert( (next->signature == THREAD_SIGNATURE),
432"kernel stack overflow for thread %x on core[%x,%d] \n", next, local_cxy, lid );
[436]433
[564]434// check next thread attached to same core as the calling thread
435assert( (next->core == current->core),
436"next core %x != current core %x\n", next->core, current->core );
[296]437
[564]438// check next thread not blocked when type != IDLE
439assert( ((next->blocked == 0) || (next->type == THREAD_IDLE)) ,
440"next thread %x (%s) is blocked on core[%x,%d]\n", 
441next->trdid , thread_type_str(next->type) , local_cxy , lid );
[296]442
443    // switch contexts and update scheduler state if next != current
444        if( next != current )
[1]445    {
[296]446        // update scheduler
[408]447        sched->current = next;
448        if( next->type == THREAD_USER ) sched->u_last = &next->sched_list;
449        else                            sched->k_last = &next->sched_list;
[1]450
[407]451        // handle FPU ownership
[306]452            if( next->type == THREAD_USER )
[296]453        {
[407]454                if( next == current->core->fpu_owner )  hal_fpu_enable();
455                else                                    hal_fpu_disable();
[296]456        }
[1]457
[564]458        // release lock protecting scheduler state
459        busylock_release( &sched->lock );
460
461#if DEBUG_SCHED_YIELD
462if( sched->trace )
463printk("\n[DBG] %s : core[%x,%d] / cause = %s\n"
464"      thread %x (%s) (%x,%x) => thread %x (%s) (%x,%x) / cycle %d\n",
465__FUNCTION__, local_cxy, lid, cause, 
466current, thread_type_str(current->type), current->process->pid, current->trdid,next ,
467thread_type_str(next->type) , next->process->pid , next->trdid , (uint32_t)hal_get_cycles() );
468#endif
469
[435]470        // switch CPU from current thread context to new thread context
[407]471        hal_do_cpu_switch( current->cpu_context, next->cpu_context );
[296]472    }
473    else
474    {
[564]475        // release lock protecting scheduler state
476        busylock_release( &sched->lock );
[407]477
[443]478#if DEBUG_SCHED_YIELD
479if( sched->trace )
[435]480printk("\n[DBG] %s : core[%x,%d] / cause = %s\n"
481"      thread %x (%s) (%x,%x) continue / cycle %d\n",
[564]482__FUNCTION__, local_cxy, lid, cause, current, thread_type_str(current->type),
[443]483current->process->pid, current->trdid, (uint32_t)hal_get_cycles() );
[428]484#endif
[407]485
[296]486    }
[408]487
[416]488    // handle pending requests for all threads executing on this core.
[433]489    sched_handle_signals( core );
[409]490
[435]491    // exit critical section / restore SR from current thread descriptor
492    hal_restore_irq( CURRENT_THREAD->save_sr );
[408]493
[1]494}  // end sched_yield()
495
[407]496
497///////////////////////////////
498void sched_display( lid_t lid )
[1]499{
[296]500    list_entry_t * iter;
501    thread_t     * thread;
[1]502
[564]503// check lid
504assert( (lid < LOCAL_CLUSTER->cores_nr), 
505"illegal core index %d\n", lid);
[407]506
507    core_t       * core    = &LOCAL_CLUSTER->core_tbl[lid];
[296]508    scheduler_t  * sched   = &core->scheduler;
509   
510    // get pointers on TXT0 chdev
[407]511    xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
[296]512    cxy_t     txt0_cxy = GET_CXY( txt0_xp );
513    chdev_t * txt0_ptr = GET_PTR( txt0_xp );
[1]514
[564]515    // get extended pointer on remote TXT0 lock
[296]516    xptr_t  lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
[1]517
[564]518    // get TXT0 lock
519    remote_busylock_acquire( lock_xp );
[296]520
[437]521    nolock_printk("\n***** threads on core[%x,%d] / current %x / cycle %d\n",
[443]522    local_cxy , core->lid, sched->current, (uint32_t)hal_get_cycles() );
[296]523
524    // display kernel threads
525    LIST_FOREACH( &sched->k_root , iter )
[1]526    {
[296]527        thread = LIST_ELEMENT( iter , thread_t , sched_list );
[408]528        if (thread->type == THREAD_DEV) 
529        {
[416]530            nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X / %s\n",
[408]531            thread_type_str( thread->type ), thread->process->pid, thread->trdid,
[416]532            thread, thread->blocked, thread->flags, thread->chdev->name );
[408]533        }
534        else
535        {
[437]536            nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
[408]537            thread_type_str( thread->type ), thread->process->pid, thread->trdid,
[437]538            thread, thread->blocked, thread->flags );
[408]539        }
[1]540    }
541
[296]542    // display user threads
543    LIST_FOREACH( &sched->u_root , iter )
[1]544    {
[296]545        thread = LIST_ELEMENT( iter , thread_t , sched_list );
[416]546        nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
[408]547        thread_type_str( thread->type ), thread->process->pid, thread->trdid,
[416]548        thread, thread->blocked, thread->flags );
[1]549    }
550
[296]551    // release TXT0 lock
[564]552    remote_busylock_release( lock_xp );
[1]553
[296]554}  // end sched_display()
[1]555
[450]556/////////////////////////////////////
557void sched_remote_display( cxy_t cxy,
558                           lid_t lid )
559{
560    thread_t     * thread;
561
[564]562// check cxy
563assert( (cluster_is_undefined( cxy ) == false),
564"illegal cluster %x\n", cxy );
[450]565
[564]566// check lid
567assert( (lid < hal_remote_l32( XPTR( cxy , &LOCAL_CLUSTER->cores_nr ) ) ),
568"illegal core index %d\n", lid );
[450]569
570    // get local pointer on target scheduler
571    core_t      * core  = &LOCAL_CLUSTER->core_tbl[lid];
572    scheduler_t * sched = &core->scheduler;
573
574    // get local pointer on current thread in target scheduler
575    thread_t * current = hal_remote_lpt( XPTR( cxy, &sched->current ) );
576
577    // get local pointer on the first kernel and user threads list_entry
578    list_entry_t * k_entry = hal_remote_lpt( XPTR( cxy , &sched->k_root.next ) );
579    list_entry_t * u_entry = hal_remote_lpt( XPTR( cxy , &sched->u_root.next ) );
580   
581    // get pointers on TXT0 chdev
582    xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
583    cxy_t     txt0_cxy = GET_CXY( txt0_xp );
584    chdev_t * txt0_ptr = GET_PTR( txt0_xp );
585
586    // get extended pointer on remote TXT0 chdev lock
587    xptr_t  lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
588
[564]589    // get TXT0 lock
590    remote_busylock_acquire( lock_xp );
[450]591
592    // display header
593    nolock_printk("\n***** threads on core[%x,%d] / current %x / cycle %d\n",
594    cxy , lid, current, (uint32_t)hal_get_cycles() );
595
596    // display kernel threads
597    while( k_entry != &sched->k_root )
598    {
599        // get local pointer on kernel_thread
600        thread = LIST_ELEMENT( k_entry , thread_t , sched_list );
601
602        // get relevant thead info
[564]603        thread_type_t type    = hal_remote_l32 ( XPTR( cxy , &thread->type ) );
604        trdid_t       trdid   = hal_remote_l32 ( XPTR( cxy , &thread->trdid ) );
605        uint32_t      blocked = hal_remote_l32 ( XPTR( cxy , &thread->blocked ) );
606        uint32_t      flags   = hal_remote_l32 ( XPTR( cxy , &thread->flags ) );
[450]607        process_t *   process = hal_remote_lpt( XPTR( cxy , &thread->process ) );
[564]608        pid_t         pid     = hal_remote_l32 ( XPTR( cxy , &process->pid ) );
[450]609
610        // display thread info
611        if (type == THREAD_DEV) 
612        {
613            char      name[16];
614            chdev_t * chdev = hal_remote_lpt( XPTR( cxy , &thread->chdev ) );
615            hal_remote_strcpy( XPTR( local_cxy , name ), XPTR( cxy , &chdev->name ) );
616
617            nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X / %s\n",
618            thread_type_str( type ), pid, trdid, thread, blocked, flags, name );
619        }
620        else
621        {
622            nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
623            thread_type_str( type ), pid, trdid, thread, blocked, flags );
624        }
625
626        // get next remote kernel thread list_entry
627        k_entry = hal_remote_lpt( XPTR( cxy , &k_entry->next ) );
628    }
629
630    // display user threads
631    while( u_entry != &sched->u_root )
632    {
633        // get local pointer on user_thread
634        thread = LIST_ELEMENT( u_entry , thread_t , sched_list );
635
636        // get relevant thead info
[564]637        thread_type_t type    = hal_remote_l32 ( XPTR( cxy , &thread->type ) );
638        trdid_t       trdid   = hal_remote_l32 ( XPTR( cxy , &thread->trdid ) );
639        uint32_t      blocked = hal_remote_l32 ( XPTR( cxy , &thread->blocked ) );
640        uint32_t      flags   = hal_remote_l32 ( XPTR( cxy , &thread->flags ) );
[450]641        process_t *   process = hal_remote_lpt( XPTR( cxy , &thread->process ) );
[564]642        pid_t         pid     = hal_remote_l32 ( XPTR( cxy , &process->pid ) );
[450]643
644        nolock_printk(" - %s / pid %X / trdid %X / desc %X / block %X / flags %X\n",
645        thread_type_str( type ), pid, trdid, thread, blocked, flags );
646
647        // get next user thread list_entry
648        u_entry = hal_remote_lpt( XPTR( cxy , &u_entry->next ) );
649    }
650
651    // release TXT0 lock
[564]652    remote_busylock_release( lock_xp );
[450]653
654}  // end sched_remote_display()
655
[564]656
Note: See TracBrowser for help on using the repository browser.