Ignore:
Timestamp:
Jun 29, 2017, 6:22:27 PM (7 years ago)
Author:
alain
Message:

Introducing a nolock_printk() function used by kernel_init.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/kernel_init.c

    r101 r103  
    641641// To comply with the multi-kernels paradigm, it accesses only local cluster memory, using
    642642// only information contained in the local boot_info_t structure, set by the bootloader.
     643// Only CP0 in cluster 0 print the log messages.
    643644///////////////////////////////////////////////////////////////////////////////////////////
    644645// @ info    : pointer on the local boot-info structure.
     
    654655    error_t      error;
    655656
    656     // all cores get core identifiers
     657    // all cores get and check core identifiers
    657658    error = get_core_identifiers( info,
    658659                                  &core_lid,
     
    668669    // each core registers this thread pointer in hardware register
    669670    hal_set_current_thread( thread );
    670 
    671 #ifdef __HAL_x86_64__
    672         return;
    673 #endif
    674671
    675672    // CP0 in I/O cluster initialises TXT0 chdev descriptor
     
    683680    /////////////////////////////////////////////////////////////////////////////////
    684681
    685     kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 0 at cycle %d\n",
    686                __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
     682    if( (core_lid ==  0) && (local_cxy == info->io_cxy) )
     683    {
     684        kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 0 at cycle %d\n",
     685                   __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
     686    }
    687687
    688688    // all cores check core identifiers
    689689    if( error )
    690690    {
    691         printk("\n[PANIC] in %s : illegal core identifiers"
     691        nolock_printk("\n[PANIC] in %s : illegal core identifiers"
    692692               " gid = %x / cxy = %x / lid = %d\n",
    693693               __FUNCTION__ , core_lid , core_cxy , core_lid );
     
    702702        if( error )
    703703        {
    704             printk("\n[PANIC] in %s : cannot initialise cluster manager in cluster %x",
     704            nolock_printk("\n[PANIC] in %s : cannot initialise cluster manager in cluster %x",
    705705                   __FUNCTION__ , local_cxy );
    706706            hal_core_sleep();
     
    715715    /////////////////////////////////////////////////////////////////////////////////
    716716
    717     kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 1 at cycle %d\n",
    718                __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
     717    if( (core_lid ==  0) && (local_cxy == info->io_cxy) )
     718    {
     719        kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 1 at cycle %d\n",
     720                   __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
     721    }
    719722
    720723    // all cores get pointer on local cluster manager and on core descriptor
     
    744747            if( wti_id != lid )
    745748            {
    746                 printk("\n[PANIC] in %s : WTI index for IPI = %d / core_lid = %d",
    747                        __FUNCTION__ , wti_id , lid );
     749                nolock_printk("\n[PANIC] in %s : WTI index for IPI = %d / core_lid = %d",
     750                              __FUNCTION__ , wti_id , lid );
    748751                hal_core_sleep();
    749752            }
     
    766769    /////////////////////////////////////////////////////////////////////////////////
    767770
    768     kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 2 at cycle %d\n",
    769                __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
    770 
     771    if( (core_lid ==  0) && (local_cxy == info->io_cxy) )
     772    {
     773        kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 2 at cycle %d\n",
     774                   __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
     775    }
    771776
    772777    error = thread_kernel_init( thread,
     
    777782    if( error )
    778783    {
    779         printk("\n[PANIC] in %s : core[%x][%d] cannot initialize idle thread\n",
    780                __FUNCTION__ , local_cxy , core_lid );
     784        nolock_printk("\n[PANIC] in %s : core[%x][%d] cannot initialize idle thread\n",
     785                      __FUNCTION__ , local_cxy , core_lid );
    781786        hal_core_sleep();
    782787    }
    783     else
    784     {
    785         // register idle thread in scheduler
    786         core->scheduler.idle = thread;
    787 
    788         // activate the idle thread
    789         thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_GLOBAL );
    790 
     788
     789    // register idle thread in scheduler
     790    core->scheduler.idle = thread;
     791
     792    // activate the idle thread
     793    thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_GLOBAL );
     794
     795    if( (core_lid ==  0) && (local_cxy == info->io_cxy) )
     796    {
    791797        kinit_dmsg("\n[INFO] %s : core[%x][%d] created idle thread %x at cycle %d\n",
    792798                   __FUNCTION__ , core_cxy , core_lid , thread , hal_get_cycles());
     
    805811        else
    806812        {
    807             printk("\n[PANIC] in %s : root FS must be FATFS\n", __FUNCTION__ );
     813            nolock_printk("\n[PANIC] in %s : root FS must be FATFS\n", __FUNCTION__ );
    808814            hal_core_sleep();
    809815        }
     
    811817        if( root_inode_xp == XPTR_NULL )
    812818        {
    813             printk("\n[PANIC] in %s : core[%x][%d] cannot initialize file system\n",
     819            nolock_printk("\n[PANIC] in %s : core[%x][%d] cannot initialize file system\n",
    814820                   __FUNCTION__ , local_cxy , core_lid );
    815821            hal_core_sleep();
     
    882888    /////////////////////////////////////////////////////////////////////////////////
    883889
    884     kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 3 at cycle %d\n",
    885                __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
     890    if( (core_lid ==  0) && (local_cxy == info->io_cxy) )
     891    {
     892        kinit_dmsg("\n[INFO] %s : core[%x][%d] exit barrier 3 at cycle %d\n",
     893                   __FUNCTION__ , core_cxy , core_lid , hal_get_cycles() );
     894    }
    886895
    887896    // each core activates its private PTI IRQ
     
    895904    dev_icu_get_masks( core_lid , &hwi_mask , &wti_mask , &pti_mask );
    896905
    897     thread_dmsg("\n[INFO] %s : core[%x][%d] activates scheduler at cycle %d\n"
     906    thread_dmsg("\n[INFO] %s : core[%x][%d] complete kernel init at cycle %d\n"
    898907                "   hwi_mask = %x / wti_mask = %x / pti_mask = %x\n",
    899908                    __FUNCTION__ , local_cxy , core_lid , hal_get_cycles() ,
Note: See TracChangeset for help on using the changeset viewer.