Ignore:
Timestamp:
Jun 26, 2019, 11:42:37 AM (15 months ago)
Author:
alain
Message:

This version is a major evolution: The physical memory allocators,
defined in the kmem.c, ppm.c, and kcm.c files have been modified
to support remote accesses. The RPCs that were previously user
to allocate physical memory in a remote cluster have been removed.
This has been done to cure a dead-lock in case of concurrent page-faults.

This version 2.2 has been tested on a (4 clusters / 2 cores per cluster)
TSAR architecture, for both the "sort" and the "fft" applications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/user_dir.c

    r633 r635  
    9393    uint32_t        attr;              // attributes for all GPT entries
    9494    uint32_t        dirents_per_page;  // number of dirent descriptors per page
    95     xptr_t          page_xp;           // extended pointer on page descriptor 
    9695    page_t        * page;              // local pointer on page descriptor
    97     xptr_t          base_xp;           // extended pointer on physical page base
    9896    struct dirent * base;              // local pointer on physical page base
    9997    uint32_t        total_dirents;     // total number of dirents in dirent array
     
    126124
    127125// check dirent size
    128 assert( ( sizeof(struct dirent) == 64), "sizeof(dirent) != 64\n");
     126assert( ( sizeof(struct dirent) == 64), "sizeof(dirent) must be 64\n");
    129127
    130128    // compute number of dirent per page
     
    135133
    136134    // allocate memory for a local user_dir descriptor
    137     req.type  = KMEM_DIR;
    138     req.flags = AF_ZERO;
     135    req.type  = KMEM_KCM;
     136    req.order = bits_log2( sizeof(user_dir_t) );
     137    req.flags = AF_ZERO | AF_KERNEL;
    139138    dir       = kmem_alloc( &req );
    140139
     
    146145    }
    147146
    148     // Build an initialize the dirent array as a list of physical pages.
     147    // Build an initialize the dirent array as a list of pages.
    149148    // For each iteration in this while loop:
    150149    // - allocate one physical 4 Kbytes (64 dirent slots)
     
    163162    {
    164163        // allocate one physical page
    165         req.type  = KMEM_PAGE;
    166         req.size = 0;
     164        req.type  = KMEM_PPM;
     165        req.order = 0;
    167166        req.flags = AF_ZERO;
    168         page      = kmem_alloc( &req );
    169 
    170         if( page == NULL )
     167        base      = kmem_alloc( &req );
     168
     169        if( base == NULL )
    171170        {
    172171            printk("\n[ERROR] in %s : cannot allocate page in cluster %x\n",
     
    174173            goto user_dir_create_failure;
    175174        }
    176 
    177         // get pointer on page base (array of dirents)
    178         page_xp  = XPTR( local_cxy , page );
    179         base_xp  = ppm_page2base( page_xp );
    180         base     = GET_PTR( base_xp );
    181175
    182176        // call the relevant FS specific function to copy up to 64 dirents in page
     
    198192        total_dirents += entries;
    199193
     194        // get page descriptor pointer from base
     195        page = GET_PTR( ppm_base2page( XPTR( local_cxy , base ) ) );
     196
    200197        // register page in temporary list
    201198        list_add_last( &root , &page->list );
     
    303300
    304301            // release the user_dir descriptor
    305             req.type = KMEM_DIR;
     302            req.type = KMEM_KCM;
    306303            req.ptr  = dir;
    307304            kmem_free( &req );
     
    364361
    365362    // release local user_dir_t structure
    366     req.type = KMEM_DIR;
     363    req.type = KMEM_KCM;
    367364    req.ptr  = dir;
    368365    kmem_free( &req );
     
    372369    {
    373370        page = LIST_FIRST( &root , page_t , list );
    374         req.type  = KMEM_PAGE;
    375         req.ptr   = page;
     371
     372        // get base from page descriptor pointer
     373        base = GET_PTR( ppm_page2base( XPTR( local_cxy , page ) ) );
     374 
     375        req.type  = KMEM_PPM;
     376        req.ptr   = base;
    376377        kmem_free( &req );
    377378    }
     
    492493    // release local user_dir_t structure
    493494    kmem_req_t  req;
    494     req.type = KMEM_DIR;
     495    req.type = KMEM_KCM;
    495496    req.ptr  = dir;
    496497    kmem_free( &req );
Note: See TracChangeset for help on using the changeset viewer.