Subversion Repositories HelenOS

Rev

Rev 2071 | Rev 2089 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2071 Rev 2087
Line 358... Line 358...
358
     * Therefore the scheduler() function continues in
358
     * Therefore the scheduler() function continues in
359
     * scheduler_separated_stack().
359
     * scheduler_separated_stack().
360
     */
360
     */
361
    context_save(&CPU->saved_context);
361
    context_save(&CPU->saved_context);
362
    context_set(&CPU->saved_context, FADDR(scheduler_separated_stack),
362
    context_set(&CPU->saved_context, FADDR(scheduler_separated_stack),
363
        (uintptr_t) CPU->stack, CPU_STACK_SIZE);
363
        (uintptr_t) CPU->stack, CPU_STACK_SIZE);
364
    context_restore(&CPU->saved_context);
364
    context_restore(&CPU->saved_context);
365
    /* not reached */
365
    /* not reached */
366
}
366
}
367
 
367
 
368
/** Scheduler stack switch wrapper
368
/** Scheduler stack switch wrapper
Line 498... Line 498...
498
    spinlock_lock(&THREAD->lock);  
498
    spinlock_lock(&THREAD->lock);  
499
    THREAD->state = Running;
499
    THREAD->state = Running;
500
 
500
 
501
#ifdef SCHEDULER_VERBOSE
501
#ifdef SCHEDULER_VERBOSE
502
    printf("cpu%d: tid %d (priority=%d, ticks=%lld, nrdy=%ld)\n",
502
    printf("cpu%d: tid %d (priority=%d, ticks=%lld, nrdy=%ld)\n",
503
        CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks,
503
        CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks,
504
        atomic_get(&CPU->nrdy));
504
        atomic_get(&CPU->nrdy));
505
#endif  
505
#endif  
506
 
506
 
507
    /*
507
    /*
508
     * Some architectures provide late kernel PA2KA(identity)
508
     * Some architectures provide late kernel PA2KA(identity)
509
     * mapping in a page fault handler. However, the page fault
509
     * mapping in a page fault handler. However, the page fault
Line 633... Line 633...
633
                 * Ready t on local CPU
633
                 * Ready t on local CPU
634
                 */
634
                 */
635
                spinlock_lock(&t->lock);
635
                spinlock_lock(&t->lock);
636
#ifdef KCPULB_VERBOSE
636
#ifdef KCPULB_VERBOSE
637
                printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, "
637
                printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, "
638
                    "avg=%nd\n", CPU->id, t->tid, CPU->id,
638
                    "avg=%nd\n", CPU->id, t->tid, CPU->id,
639
                    atomic_get(&CPU->nrdy),
639
                    atomic_get(&CPU->nrdy),
640
                    atomic_get(&nrdy) / config.cpu_active);
640
                    atomic_get(&nrdy) / config.cpu_active);
641
#endif
641
#endif
642
                t->flags |= THREAD_FLAG_STOLEN;
642
                t->flags |= THREAD_FLAG_STOLEN;
643
                t->state = Entering;
643
                t->state = Entering;
644
                spinlock_unlock(&t->lock);
644
                spinlock_unlock(&t->lock);
645
   
645
   
Line 701... Line 701...
701
        if (!cpus[cpu].active)
701
        if (!cpus[cpu].active)
702
            continue;
702
            continue;
703
 
703
 
704
        spinlock_lock(&cpus[cpu].lock);
704
        spinlock_lock(&cpus[cpu].lock);
705
        printf("cpu%d: address=%p, nrdy=%ld, needs_relink=%ld\n",
705
        printf("cpu%d: address=%p, nrdy=%ld, needs_relink=%ld\n",
706
            cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
706
            cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
707
            cpus[cpu].needs_relink);
707
            cpus[cpu].needs_relink);
708
       
708
       
709
        for (i = 0; i < RQ_COUNT; i++) {
709
        for (i = 0; i < RQ_COUNT; i++) {
710
            r = &cpus[cpu].rq[i];
710
            r = &cpus[cpu].rq[i];
711
            spinlock_lock(&r->lock);
711
            spinlock_lock(&r->lock);
712
            if (!r->n) {
712
            if (!r->n) {
Line 716... Line 716...
716
            printf("\trq[%d]: ", i);
716
            printf("\trq[%d]: ", i);
717
            for (cur = r->rq_head.next; cur != &r->rq_head;
717
            for (cur = r->rq_head.next; cur != &r->rq_head;
718
                cur = cur->next) {
718
                cur = cur->next) {
719
                t = list_get_instance(cur, thread_t, rq_link);
719
                t = list_get_instance(cur, thread_t, rq_link);
720
                printf("%d(%s) ", t->tid,
720
                printf("%d(%s) ", t->tid,
721
                    thread_states[t->state]);
721
                    thread_states[t->state]);
722
            }
722
            }
723
            printf("\n");
723
            printf("\n");
724
            spinlock_unlock(&r->lock);
724
            spinlock_unlock(&r->lock);
725
        }
725
        }
726
        spinlock_unlock(&cpus[cpu].lock);
726
        spinlock_unlock(&cpus[cpu].lock);