Changeset 634


Ignore:
Timestamp:
May 29, 2019, 3:26:44 PM (7 weeks ago)
Author:
alain
Message:

Fix a bug in hal_irqmask.c

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/core/hal_irqmask.c

    r632 r634  
    5353                 "mfc0   $1,     $12                 \n"   /* s1    <= c0_sr        */
    5454                 "or     %0,     $0,     $1          \n"   /* old   <= $1           */
    55                  "ori    $1,     $1,     0x1         \n"   /* set IE bit in $1      */
     55                 "ori    $1,     $1,     0xFF01      \n"   /* set IE bit in $1      */
    5656                 "mtc0   $1,     $12                 \n"   /* c0_sr <= $1           */
    5757         ".set at                            \n"
  • trunk/kernel/fs/vfs.c

    r633 r634  
    23412341    gid_t     gid  = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->gid  ) );
    23422342
    2343     // FIXME : me must use mode
     2343    // TODO : me must use mode
    23442344    if( (uid == client_uid) || (gid == client_gid) ) return false;
    23452345    else                                             return true;
  • trunk/kernel/kernel_config.h

    r633 r634  
    22 * kernel_config.h - global kernel configuration arguments
    33 *
    4  * Authors  Mohamed Lamine Karaoui (2015)
    5  *          Alain Greiner (2016,2017,2018,2019)
     4 * Authors        Alain Greiner (2016,2017,2018,2019)
    65 *
    76 * Copyright (c)  UPMC Sorbonne Universites
     
    6665
    6766#define DEBUG_DEVFS_GLOBAL_INIT           0
    68 #define DEBUG_DEVFS_LOCAL_INIT              1
     67#define DEBUG_DEVFS_LOCAL_INIT            0
    6968#define DEBUG_DEVFS_MOVE                  0
    7069
     
    112111#define DEBUG_KMEM                        0
    113112
    114 #define DEBUG_KERNEL_INIT                   1
     113#define DEBUG_KERNEL_INIT                 0
    115114
    116115#define DEBUG_MAPPER_GET_PAGE             0
     
    124123#define DEBUG_PPM_ALLOC_PAGES             0
    125124#define DEBUG_PPM_FREE_PAGES              0
     125#define DEBUG_PPM_REMOTE_ALLOC_PAGES      0
     126#define DEBUG_PPM_REMOTE_FREE_PAGES       0
    126127   
    127128#define DEBUG_PROCESS_COPY_INIT           0
     
    141142#define DEBUG_QUEUELOCK_CXY               0
    142143
    143 #define DEBUG_RPC_CLIENT_GENERIC             2
    144 #define DEBUG_RPC_SERVER_GENERIC             2
     144#define DEBUG_RPC_CLIENT_GENERIC          0
     145#define DEBUG_RPC_SERVER_GENERIC          0
    145146
    146147#define DEBUG_RPC_KCM_ALLOC               0
     
    152153#define DEBUG_RPC_THREAD_USER_CREATE      0
    153154#define DEBUG_RPC_THREAD_KERNEL_CREATE    0
    154 #define DEBUG_RPC_VFS_DENTRY_CREATE          2
     155#define DEBUG_RPC_VFS_DENTRY_CREATE       0
    155156#define DEBUG_RPC_VFS_DENTRY_DESTROY      0
    156157#define DEBUG_RPC_VFS_DEVICE_GET_DENTRY   0
     
    228229#define DEBUG_USER_DIR                    0
    229230
    230 #define DEBUG_VFS_ADD_CHILD                  1
     231#define DEBUG_VFS_ADD_CHILD               0
    231232#define DEBUG_VFS_ADD_SPECIAL             0
    232233#define DEBUG_VFS_CHDIR                   0
     
    253254#define DEBUG_VMM_DESTROY                 0
    254255#define DEBUG_VMM_FORK_COPY               0
    255 #define DEBUG_VMM_GET_ONE_PPN                2
     256#define DEBUG_VMM_GET_ONE_PPN             0
    256257#define DEBUG_VMM_GET_PTE                 0
    257 #define DEBUG_VMM_HANDLE_PAGE_FAULT          2
     258#define DEBUG_VMM_HANDLE_PAGE_FAULT       19000000
    258259#define DEBUG_VMM_HANDLE_COW              0
    259260#define DEBUG_VMM_MMAP_ALLOC              0
    260 #define DEBUG_VMM_PAGE_ALLOCATE              2
     261#define DEBUG_VMM_PAGE_ALLOCATE           0
    261262#define DEBUG_VMM_REMOVE_VSEG             0
    262263#define DEBUG_VMM_RESIZE_VSEG             0
  • trunk/kernel/mm/page.c

    r632 r634  
    6161                             uint32_t   value )
    6262{
    63         hal_atomic_and( (uint32_t *)&page->flags , ~((uint32_t)value) );
     63        hal_atomic_and( (uint32_t *)&page->flags , ~value );
    6464}
    6565
     
    111111    page_t * page_ptr = GET_PTR( page_xp );
    112112
    113         hal_remote_atomic_and( XPTR( page_cxy , &page_ptr->flags ) , value );
     113        hal_remote_atomic_and( XPTR( page_cxy , &page_ptr->flags ) , ~value );
    114114}
    115115
  • trunk/kernel/mm/ppm.c

    r632 r634  
    4242
    4343////////////////////////////////////////////////////////////////////////////////////////
     44//         global variables
     45////////////////////////////////////////////////////////////////////////////////////////
     46
     47extern chdev_directory_t    chdev_dir;          // allocated in kernel_init.c
     48
     49////////////////////////////////////////////////////////////////////////////////////////
    4450//     functions to  translate [ page <-> base <-> ppn ]
    4551////////////////////////////////////////////////////////////////////////////////////////
    46 
    4752
    4853/////////////////////////////////////////////
     
    212217if( DEBUG_PPM_ALLOC_PAGES < cycle )
    213218printk("\n[%s] thread[%x,%x] enter for %d page(s) in cluster %x / cycle %d\n",
    214 __FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle );
     219__FUNCTION__, this->process->pid, this->trdid, 1<<order, local_cxy, cycle );
    215220#endif
    216221
     
    266271if( DEBUG_PPM_ALLOC_PAGES < cycle )
    267272printk("\n[%s] thread[%x,%x] cannot allocate %d page(s) in cluster %x / cycle %d\n",
    268 __FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle );
     273__FUNCTION__, this->process->pid, this->trdid, 1<<order, local_cxy, cycle );
    269274#endif
    270275
     
    307312printk("\n[%s] thread[%x,%x] exit for %d page(s) in cluster %x / ppn = %x / cycle %d\n",
    308313__FUNCTION__, this->process->pid, this->trdid,
    309 1<<order, ppm_page2ppn(XPTR( local_cxy , found_block )), cxy, cycle );
     3141<<order, ppm_page2ppn(XPTR( local_cxy , found_block )), local_cxy, cycle );
    310315#endif
    311316
     
    377382    page_t   * found_block;
    378383
    379 #if DEBUG_PPM_ALLOC_PAGES
     384#if DEBUG_PPM_REMOTE_ALLOC_PAGES
    380385thread_t * this  = CURRENT_THREAD;
    381386uint32_t   cycle = (uint32_t)hal_get_cycles();
    382 if( DEBUG_PPM_ALLOC_PAGES < cycle )
     387if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle )
    383388printk("\n[%s] thread[%x,%x] enter for %d small page(s) in cluster %x / cycle %d\n",
    384389__FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle );
    385390#endif
    386391
    387 #if(DEBUG_PPM_ALLOC_PAGES & 0x1)
    388 if( DEBUG_PPM_ALLOC_PAGES < cycle )
     392#if(DEBUG_PPM_REMOTE_ALLOC_PAGES & 0x1)
     393if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle )
    389394ppm_remote_display( cxy );
    390395#endif
     
    436441                remote_busylock_release( lock_xp );
    437442
    438 #if DEBUG_PPM_ALLOC_PAGES
     443#if DEBUG_REMOTE_PPM_ALLOC_PAGES
    439444cycle = (uint32_t)hal_get_cycles();
    440 if( DEBUG_PPM_ALLOC_PAGES < cycle )
     445if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle )
    441446printk("\n[%s] thread[%x,%x] cannot allocate %d page(s) in cluster %x / cycle %d\n",
    442447__FUNCTION__, this->process->pid, this->trdid, 1<<order, cxy, cycle );
     
    468473        }
    469474
    470         // update refcount, flags and order fields in found block remote page descriptor
     475        // update refcount, flags and order fields in found block
    471476        page_remote_clear_flag( XPTR( cxy , found_block ), PG_FREE );
    472477        page_remote_refcount_up( XPTR( cxy , found_block ) );
     
    479484    dqdt_increment_pages( cxy , order );
    480485
    481 #if DEBUG_PPM_ALLOC_PAGES
     486#if DEBUG_PPM_REMOTE_ALLOC_PAGES
    482487cycle = (uint32_t)hal_get_cycles();
    483 if( DEBUG_PPM_ALLOC_PAGES < cycle )
     488if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle )
    484489printk("\n[%s] thread[%x,%x] exit for %d page(s) / ppn = %x in cluster %x / cycle %d\n",
    485490__FUNCTION__, this->process->pid, this->trdid,
     
    487492#endif
    488493
    489 #if(DEBUG_PPM_ALLOC_PAGES & 0x1)
    490 if( DEBUG_PPM_ALLOC_PAGES < cycle )
     494#if(DEBUG_PPM_REMOTE_ALLOC_PAGES & 0x1)
     495if( DEBUG_PPM_REMOTE_ALLOC_PAGES < cycle )
    491496ppm_remote_display( cxy );
    492497#endif
     
    509514        uint32_t   current_order;    // current (merged) block order
    510515
    511 #if DEBUG_PPM_FREE_PAGES
     516#if DEBUG_PPM_REMOTE_FREE_PAGES
    512517thread_t * this  = CURRENT_THREAD;
    513518uint32_t   cycle = (uint32_t)hal_get_cycles();
    514 if( DEBUG_PPM_FREE_PAGES < cycle )
    515 printk("\n[%s] thread[%x,%x] enter for %d page(s) in cluster %x / ppn %x / cycle %d\n",
     519if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle )
     520printk("\n[%s] thread[%x,%x] enter for %d page(s) / cxy %x / ppn %x / cycle %d\n",
    516521__FUNCTION__, this->process->pid, this->trdid,
    5175221<<page->order, cxy, ppm_page2ppn(XPTR(cxy , page)), cycle );
    518523#endif
    519524
    520 #if(DEBUG_PPM_FREE_PAGES & 0x1)
    521 if( DEBUG_PPM_FREE_PAGES < cycle )
     525#if(DEBUG_PPM_REMOTE_FREE_PAGES & 0x1)
     526if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle )
    522527ppm_remote_display( cxy );
    523528#endif
     
    594599    dqdt_decrement_pages( cxy , page->order );
    595600
    596 #if DEBUG_PPM_FREE_PAGES
     601#if DEBUG_PPM_REMOTE_FREE_PAGES
    597602cycle = (uint32_t)hal_get_cycles();
    598 if( DEBUG_PPM_FREE_PAGES < cycle )
     603if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle )
    599604printk("\n[%s] thread[%x,%x] exit for %d page(s) in cluster %x / ppn %x / cycle %d\n",
    600605__FUNCTION__, this->process->pid, this->trdid,
     
    602607#endif
    603608
    604 #if(DEBUG_PPM_FREE_PAGES & 0x1)
    605 if( DEBUG_PPM_FREE_PAGES < cycle )
     609#if(DEBUG_PPM_REMOTE_FREE_PAGES & 0x1)
     610if( DEBUG_PPM_REMOTE_FREE_PAGES < cycle )
    606611ppm_remote_display( cxy );
    607612#endif
     
    614619        uint32_t       order;
    615620        list_entry_t * iter;
    616         page_t       * page;
     621    xptr_t         page_xp;
    617622
    618623    ppm_t * ppm = &LOCAL_CLUSTER->ppm;
    619624
    620625    // build extended pointer on lock protecting remote PPM
    621     xptr_t lock_xp = XPTR( cxy , &ppm->free_lock );
    622 
    623         // get lock protecting free lists in remote cluster
    624         remote_busylock_acquire( lock_xp );
    625 
    626         printk("\n***** PPM in cluster %x / %d pages\n", local_cxy , ppm->pages_nr );
     626    xptr_t ppm_lock_xp = XPTR( cxy , &ppm->free_lock );
     627
     628    // get pointers on TXT0 chdev
     629    xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
     630    cxy_t     txt0_cxy = GET_CXY( txt0_xp );
     631    chdev_t * txt0_ptr = GET_PTR( txt0_xp );
     632
     633    // build extended pointer on remote TXT0 lock
     634    xptr_t  txt_lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
     635
     636        // get PPM lock
     637        remote_busylock_acquire( ppm_lock_xp );
     638
     639    // get TXT0 lock
     640    remote_busylock_acquire( txt_lock_xp );
     641
     642        nolock_printk("\n***** PPM in cluster %x / %d pages\n", local_cxy , ppm->pages_nr );
    627643
    628644        for( order = 0 ; order < CONFIG_PPM_MAX_ORDER ; order++ )
     
    630646        // get number of free pages for free_list[order] in remote cluster
    631647        uint32_t n = hal_remote_l32( XPTR( cxy , &ppm->free_pages_nr[order] ) );
    632                 printk("- order = %d / free_pages = %d\t: ", order , n );
     648
     649                nolock_printk("- order = %d / n = %d\t: ", order , n );
    633650
    634651                LIST_REMOTE_FOREACH( cxy , &ppm->free_pages_root[order] , iter )
    635652                {
    636                         page = LIST_ELEMENT( iter , page_t , list );
    637                         printk("%x," , page - ppm->pages_tbl );
     653            // build extended pointer on page descriptor
     654            page_xp = XPTR( cxy , LIST_ELEMENT( iter , page_t , list ) );
     655
     656            // display PPN
     657                        nolock_printk("%x," , ppm_page2ppn( page_xp ) );
    638658                }
    639659
    640                 printk("\n");
    641         }
    642 
    643         // release lock protecting free lists in remote cluster
    644         remote_busylock_release( lock_xp );
     660                nolock_printk("\n");
     661        }
     662
     663        // release TXT0 lock
     664        remote_busylock_release( txt_lock_xp );
     665
     666        // release PPM lock
     667        remote_busylock_release( ppm_lock_xp );
    645668}
    646669
  • trunk/kernel/mm/vmm.c

    r633 r634  
    19061906
    19071907#if DEBUG_VMM_HANDLE_PAGE_FAULT
    1908 if( vpn == 0x40b )
     1908if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    19091909printk("\n[%s] thread[%x,%x] enter for vpn %x / cycle %d\n",
    19101910__FUNCTION__, this->process->pid, this->trdid, vpn, start_cycle );
     
    19121912
    19131913#if (DEBUG_VMM_HANDLE_PAGE_FAULT & 1)
     1914if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    19141915hal_vmm_display( this->process , false );
    19151916#endif
     
    19281929
    19291930#if DEBUG_VMM_HANDLE_PAGE_FAULT
    1930 uint32_t cycle = (uint32_t)hal_get_cycles();
    1931 if( vpn == 0x40b )
    1932 printk("\n[%s] thread[%x,%x] found vseg %s / cycle %d\n",
    1933 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(vseg->type), cycle );
     1931if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
     1932printk("\n[%s] thread[%x,%x] found vseg %s\n",
     1933__FUNCTION__, this->process->pid, this->trdid, vseg_type_str(vseg->type) );
    19341934#endif
    19351935
     
    19511951
    19521952#if DEBUG_VMM_HANDLE_PAGE_FAULT
    1953 cycle = (uint32_t)hal_get_cycles();
    1954 if( vpn == 0x40b )
     1953if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    19551954printk("\n[%s] thread[%x,%x] locked vpn %x in cluster %x / cycle %d\n",
    1956 __FUNCTION__, this->process->pid, this->trdid, vpn, local_cxy, cycle );
     1955__FUNCTION__, this->process->pid, this->trdid, vpn, local_cxy );
    19571956#endif
    19581957
     
    19721971
    19731972#if DEBUG_VMM_HANDLE_PAGE_FAULT
    1974 if( vpn == 0x40b )
    1975 printk("\n[%s] thread[%x,%x] : access local gpt : local_cxy %x / ref_cxy %x / type %s\n",
     1973if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
     1974printk("\n[%s] thread[%x,%x] access local gpt : cxy %x / ref_cxy %x / type %s\n",
    19761975__FUNCTION__, this->process->pid, this->trdid, local_cxy, ref_cxy, vseg_type_str(vseg->type) );
    19771976#endif
     
    20092008
    20102009#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2011 if( vpn == 0x40b )
     2010if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    20122011printk("\n[%s] thread[%x,%x] handled local pgfault / ppn %x / attr %x / cycle %d\n",
    20132012__FUNCTION__, this->process->pid, this->trdid, ppn, attr, end_cycle );
     
    20282027
    20292028#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2030 if( vpn == 0x40b )
    2031 printk("\n[%s] thread[%x,%x] access ref gpt : local_cxy %x / ref_cxy %x / type %s\n",
     2029if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
     2030printk("\n[%s] thread[%x,%x] access ref gpt : cxy %x / ref_cxy %x / type %s\n",
    20322031__FUNCTION__, this->process->pid, this->trdid, local_cxy, ref_cxy, vseg_type_str(vseg->type) );
    20332032#endif
     
    20522051
    20532052#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2054 if( vpn == 0x40b )
     2053if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    20552054printk("\n[%s] thread[%x,%x] get pte from ref gpt / attr %x / ppn %x\n",
    20562055__FUNCTION__, this->process->pid, this->trdid, ref_attr, ref_ppn );
     
    20672066
    20682067#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2069 if( vpn == 0x40b )
     2068if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    20702069printk("\n[%s] thread[%x,%x] updated local gpt for a false pgfault\n",
    20712070__FUNCTION__, this->process->pid, this->trdid );
     
    20762075                             
    20772076#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2078 if( vpn == 0x40b )
     2077if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    20792078printk("\n[%s] thread[%x,%x] unlock the ref gpt after a false pgfault\n",
    20802079__FUNCTION__, this->process->pid, this->trdid );
     
    20862085
    20872086#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2088 if( vpn == 0x40b )
     2087if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    20892088printk("\n[%s] thread[%x,%x] handled false pgfault / ppn %x / attr %x / cycle %d\n",
    20902089__FUNCTION__, this->process->pid, this->trdid, ref_ppn, ref_attr, end_cycle );
     
    21222121
    21232122#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2124 if( vpn == 0x40b )
     2123if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    21252124printk("\n[%s] thread[%x,%x] build a new PTE for a true pgfault\n",
    21262125__FUNCTION__, this->process->pid, this->trdid );
     
    21342133
    21352134#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2136 if( vpn == 0x40b )
     2135if( (start_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    21372136printk("\n[%s] thread[%x,%x] set new PTE in ref gpt for a true page fault\n",
    21382137__FUNCTION__, this->process->pid, this->trdid );
     
    21512150
    21522151#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2153 if( vpn == 0x40b )
     2152if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    21542153printk("\n[%s] thread[%x,%x] handled global pgfault / ppn %x / attr %x / cycle %d\n",
    21552154__FUNCTION__, this->process->pid, this->trdid, ppn, attr, end_cycle );
     
    21742173
    21752174#if DEBUG_VMM_HANDLE_PAGE_FAULT
    2176 if( vpn == 0x40b )
     2175if( (end_cycle > DEBUG_VMM_HANDLE_PAGE_FAULT) && (vpn == vpn) )
    21772176printk("\n[%s] handled by another thread / vpn %x / ppn %x / attr %x / cycle %d\n",
    21782177__FUNCTION__, vpn, ppn, attr, end_cycle );
  • trunk/params-hard.mk

    r633 r634  
    11# Parameters definition for the ALMOS-MKH Makefile
    22
    3 ARCH      = /users/enseig/alain/soc/tsar/trunk/platforms/tsar_generic_iob
     3ARCH      = /Users/alain/soc/tsar-trunk-svn-2013/platforms/tsar_generic_iob
    44X_SIZE    = 1
    55Y_SIZE    = 2
  • trunk/params-soft.mk

    r633 r634  
    11
    22# define absolute path to almos-mkh directory
    3 ALMOSMKH_DIR = /users/enseig/alain/soc/almos-mkh/trunk
     3ALMOSMKH_DIR = /Users/alain/soc/almos-mkh/
    44
    55# Select the libc
Note: See TracChangeset for help on using the changeset viewer.