Changeset 10e16a7 in mainline


Ignore:
Timestamp:
2006-02-04T13:51:35Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
428aabf
Parents:
c5613b7
Message:

Added scheduler queues output. The scheduler is buggy - on SMP
the cpus never get tu cpu_sleep, in slab2 test on 4 cpus everything
is on the first cpu.
The slab allocator passes tests in this configuration, but in slightly
different(more efficient) locking order it panics. TODO Find out why
does it panic.

Location:
generic
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • generic/include/proc/scheduler.h

    rc5613b7 r10e16a7  
    5555extern void before_thread_runs(void);
    5656
     57extern void sched_print_list(void);
    5758/*
    5859 * To be defined by architectures:
  • generic/src/console/cmd.c

    rc5613b7 r10e16a7  
    5252#include <main/version.h>
    5353#include <mm/slab.h>
     54#include <proc/scheduler.h>
    5455
    5556/** Data and methods for 'help' command. */
     
    245246
    246247
     248static int cmd_sched(cmd_arg_t *argv);
     249static cmd_info_t sched_info = {
     250        .name = "scheduler",
     251        .description = "List all scheduler information",
     252        .func = cmd_sched,
     253        .argc = 0
     254};
     255
    247256static int cmd_slabs(cmd_arg_t *argv);
    248257static cmd_info_t slabs_info = {
     
    298307};
    299308
    300 
     309static cmd_info_t *basic_commands[] = {
     310        &call0_info,
     311        &call1_info,
     312        &call2_info,
     313        &call3_info,
     314        &cpus_info,
     315        &desc_info,
     316        &exit_info,
     317        &halt_info,
     318        &help_info,
     319        &set4_info,
     320        &slabs_info,
     321        &symaddr_info,
     322        &sched_info,
     323        &tlb_info,
     324        &version_info,
     325        &zones_info,
     326        &zone_info,
     327        NULL
     328};
    301329
    302330
     
    315343void cmd_init(void)
    316344{
    317         cmd_initialize(&help_info);
    318         if (!cmd_register(&help_info))
    319                 panic("could not register command %s\n", help_info.name);
    320 
    321         cmd_initialize(&desc_info);
    322         if (!cmd_register(&desc_info))
    323                 panic("could not register command %s\n", desc_info.name);
    324 
    325         cmd_initialize(&exit_info);
    326         if (!cmd_register(&exit_info))
    327                 panic("could not register command %s\n", exit_info.name);
    328        
    329         cmd_initialize(&symaddr_info);
    330         if (!cmd_register(&symaddr_info))
    331                 panic("could not register command %s\n", symaddr_info.name);
    332 
    333         cmd_initialize(&call0_info);
    334         if (!cmd_register(&call0_info))
    335                 panic("could not register command %s\n", call0_info.name);
    336 
    337         cmd_initialize(&call1_info);
    338         if (!cmd_register(&call1_info))
    339                 panic("could not register command %s\n", call1_info.name);
    340 
    341         cmd_initialize(&call2_info);
    342         if (!cmd_register(&call2_info))
    343                 panic("could not register command %s\n", call2_info.name);
    344 
    345         cmd_initialize(&call3_info);
    346         if (!cmd_register(&call3_info))
    347                 panic("could not register command %s\n", call3_info.name);
    348 
    349         cmd_initialize(&set4_info);
    350         if (!cmd_register(&set4_info))
    351                 panic("could not register command %s\n", set4_info.name);
    352        
    353         cmd_initialize(&halt_info);
    354         if (!cmd_register(&halt_info))
    355                 panic("could not register command %s\n", halt_info.name);
    356 
    357         cmd_initialize(&tlb_info);
    358         if (!cmd_register(&tlb_info))
    359                 panic("could not register command %s\n", tlb_info.name);
    360 
    361         cmd_initialize(&zones_info);
    362         if (!cmd_register(&zones_info))
    363                 panic("could not register command %s\n", zones_info.name);
    364 
    365         cmd_initialize(&slabs_info);
    366         if (!cmd_register(&slabs_info))
    367                 panic("could not register command %s\n", slabs_info.name);
    368 
    369         cmd_initialize(&zone_info);
    370         if (!cmd_register(&zone_info))
    371                 panic("could not register command %s\n", zone_info.name);
    372 
    373         cmd_initialize(&cpus_info);
    374         if (!cmd_register(&cpus_info))
    375                 panic("could not register command %s\n", cpus_info.name);
    376                
    377         cmd_initialize(&version_info);
    378         if (!cmd_register(&version_info))
    379                 panic("could not register command %s\n", version_info.name);
    380                
    381                
    382 
     345        int i;
     346
     347        for (i=0;basic_commands[i]; i++) {
     348                cmd_initialize(basic_commands[i]);
     349                if (!cmd_register(basic_commands[i]))
     350                        panic("could not register command %s\n",
     351                              basic_commands[i]->name);
     352        }
    383353}
    384354
     
    482452        __address symaddr;
    483453        char *symbol;
    484         __native (*f)(__native);
     454        __native (*f)(__native,...);
    485455        __native arg1 = argv[1].intval;
    486456
     
    494464                symbol = get_symtab_entry(symaddr);
    495465                printf("Calling f(0x%x): 0x%p: %s\n", arg1, symaddr, symbol);
    496                 f =  (__native (*)(__native)) symaddr;
     466                f =  (__native (*)(__native,...)) symaddr;
    497467                printf("Result: 0x%p\n", f(arg1));
    498468        }
     
    506476        __address symaddr;
    507477        char *symbol;
    508         __native (*f)(__native,__native);
     478        __native (*f)(__native,__native,...);
    509479        __native arg1 = argv[1].intval;
    510480        __native arg2 = argv[2].intval;
     
    520490                printf("Calling f(0x%x,0x%x): 0x%p: %s\n",
    521491                       arg1, arg2, symaddr, symbol);
    522                 f =  (__native (*)(__native,__native)) symaddr;
     492                f =  (__native (*)(__native,__native,...)) symaddr;
    523493                printf("Result: 0x%p\n", f(arg1, arg2));
    524494        }
     
    532502        __address symaddr;
    533503        char *symbol;
    534         __native (*f)(__native,__native,__native);
     504        __native (*f)(__native,__native,__native,...);
    535505        __native arg1 = argv[1].intval;
    536506        __native arg2 = argv[2].intval;
     
    547517                printf("Calling f(0x%x,0x%x, 0x%x): 0x%p: %s\n",
    548518                       arg1, arg2, arg3, symaddr, symbol);
    549                 f =  (__native (*)(__native,__native,__native)) symaddr;
     519                f =  (__native (*)(__native,__native,__native,...)) symaddr;
    550520                printf("Result: 0x%p\n", f(arg1, arg2, arg3));
    551521        }
     
    628598}
    629599
     600/** Command for listings Thread information
     601 *
     602 * @param argv Ignores
     603 *
     604 * @return Always 1
     605 */
     606int cmd_sched(cmd_arg_t * argv) {
     607        sched_print_list();
     608        return 1;
     609}
     610
    630611/** Command for listing memory zones
    631612 *
  • generic/src/mm/slab.c

    rc5613b7 r10e16a7  
    7777 * magazines.
    7878 *
    79  *
     79 * TODO: For better CPU-scaling the magazine allocation strategy should
     80 * be extended. Currently, if the cache does not have magazine, it asks
     81 * for non-cpu cached magazine cache to provide one. It might be feasible
     82 * to add cpu-cached magazine cache (which would allocate it's magazines
     83 * from non-cpu-cached mag. cache). This would provide a nice per-cpu
     84 * buffer. The other possibility is to use the per-cache
     85 * 'empty-magazine-list', which decreases competing for 1 per-system
     86 * magazine cache.
     87 *
    8088 */
    8189
     
    296304 * Free all objects in magazine and free memory associated with magazine
    297305 *
    298  * Assume mag_cache[cpu].lock is locked
     306 * Assume cache->lock is held
    299307 *
    300308 * @return Number of freed pages
     
    620628       
    621629        spinlock_unlock(&cache->lock);
     630        /* We can release the cache locks now */
    622631        if (flags & SLAB_RECLAIM_ALL) {
    623632                for (i=0; i < config.cpu_count; i++)
     
    778787{
    779788        int idx;
    780 
     789       
    781790        ASSERT( size && size <= (1 << SLAB_MAX_MALLOC_W));
    782791       
  • generic/src/proc/scheduler.c

    rc5613b7 r10e16a7  
    627627
    628628#endif /* CONFIG_SMP */
     629
     630
     631/** Print information about threads & scheduler queues */
     632void sched_print_list(void)
     633{
     634        ipl_t ipl;
     635        int cpu,i;
     636        runq_t *r;
     637        thread_t *t;
     638        link_t *cur;
     639
     640        /* We are going to mess with scheduler structures,
     641         * let's not be interrupted */
     642        ipl = interrupts_disable();
     643        printf("*********** Scheduler dump ***********\n");
     644        for (cpu=0;cpu < config.cpu_count; cpu++) {
     645                if (!cpus[cpu].active)
     646                        continue;
     647                spinlock_lock(&cpus[cpu].lock);
     648                printf("cpu%d: nrdy: %d needs_relink: %d\n",
     649                       cpus[cpu].id, cpus[cpu].nrdy, cpus[cpu].needs_relink);
     650               
     651                for (i=0; i<RQ_COUNT; i++) {
     652                        r = &cpus[cpu].rq[i];
     653                        spinlock_lock(&r->lock);
     654                        if (!r->n) {
     655                                spinlock_unlock(&r->lock);
     656                                continue;
     657                        }
     658                        printf("Rq %d: ", i);
     659                        for (cur=r->rq_head.next; cur!=&r->rq_head; cur=cur->next) {
     660                                t = list_get_instance(cur, thread_t, rq_link);
     661                                printf("%d(%s) ", t->tid,
     662                                       thread_states[t->state]);
     663                        }
     664                        printf("\n");
     665                        spinlock_unlock(&r->lock);
     666                }
     667                spinlock_unlock(&cpus[cpu].lock);
     668        }
     669       
     670        interrupts_restore(ipl);
     671}
Note: See TracChangeset for help on using the changeset viewer.