Changeset 636 for trunk/kernel/libk


Ignore:
Timestamp:
Jul 1, 2019, 9:34:16 AM (5 years ago)
Author:
alain
Message:

Fix a bug in list_remote_add_first() and list_remote_add_last() functions,
used by the physical memory allocator, that corrupted the PPM state.

Location:
trunk/kernel/libk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/list.h

    r635 r636  
    33 *
    44 * Authors Ghassan Almaless  (2008,2009,2010,2011,2012)
    5  *         Alain Greiner     (2016,2017,2018i,2019)
     5 *         Alain Greiner     (2016,2017,2018,2019)
    66 *
    77 * Copyright (c) UPMC Sorbonne Universites
     
    314314 * item(s) from the traversed list.     
    315315 ***************************************************************************
    316  * @ cxy     : remote cluster identifier
    317  * @ root    : pointer on the root list_entry
    318  * @ iter    : pointer on the current list_entry
    319  **************************************************************************/
    320 
    321 #define LIST_REMOTE_FOREACH( cxy , root , iter )               \
    322 for( (iter) = hal_remote_lpt( XPTR( cxy , &(root)->next ) ) ;  \
    323      (iter) != (root) ;                         \
    324      (iter) = hal_remote_lpt( XPTR( cxy , &(iter)->next ) ) )
     316 * @ cxy     : remote cluster identifier.
     317 * @ root    : pointer on the root list_entry.
     318 * @ iter    : pointer on the current list_entry.
     319 **************************************************************************/
     320
     321#define LIST_REMOTE_FOREACH( cxy , root , iter )                 \
     322for( (iter) = hal_remote_lpt( XPTR( (cxy) , &(root)->next ) ) ;  \
     323     (iter) != (root) ;                                                      \
     324     (iter) = hal_remote_lpt( XPTR( (cxy) , &(iter)->next ) ) )
    325325       
     326/***************************************************************************
     327 * This macro can be used by a thread running in any cluster to access
     328 * a remote local list. It traverse the list in backward order.
     329 * WARNING : same as the forward traversal
     330 ***************************************************************************
     331 * @ cxy       : remote cluster identifier.
     332 * @ root      : pointer on the root list_entry.
     333 * @ iter      : pointer on the current list_entry.
     334 **************************************************************************/
     335
     336#define LIST_REMOTE_FOREACH_BACKWARD( cxy , root , iter )       \
     337for( (iter) = hal_remote_lpt( XPTR( (cxy) , &(root)->pred ) ) ; \
     338     (iter) != (root) ;                                         \
     339     (iter) = hal_remote_lpt( XPTR( (cxy) , &(iter)->pred ) ) )
     340
    326341/***************************************************************************
    327342 * This function can be called by a thread running in any cluster to access
     
    350365                                          list_entry_t * entry )
    351366{
    352     list_entry_t * first;    // local pointer on current first entry
    353     list_entry_t * next;     // local pointer on current first->next entry
    354  
    355         first  = hal_remote_lpt( XPTR( cxy , &root->next ) );
    356     next   = hal_remote_lpt( XPTR( cxy , &first->next ) );
     367    list_entry_t * next = hal_remote_lpt( XPTR( cxy , &root->next ) );
    357368       
    358         hal_remote_spt( XPTR( cxy , &entry->next ) , first );
     369        hal_remote_spt( XPTR( cxy , &entry->next ) , next );
    359370        hal_remote_spt( XPTR( cxy , &entry->pred ) , root );
    360371 
     
    375386                                         list_entry_t * entry )
    376387{
    377     list_entry_t * last;     // local pointer on current last entry
    378     list_entry_t * pred;     // local pointer on current last->pred entry
    379  
    380         last   = hal_remote_lpt( XPTR( cxy , &root->pred ) );
    381     pred   = hal_remote_lpt( XPTR( cxy , &last->pred ) );
     388    list_entry_t * pred = hal_remote_lpt( XPTR( cxy , &root->pred ) );
    382389       
    383390        hal_remote_spt( XPTR( cxy , &entry->next ) , root );
     
    409416
    410417
    411 
    412418#endif  /* _LIST_H_ */
  • trunk/kernel/libk/xlist.h

    r610 r636  
    11/*
    2     // check calling thread can yield
    3     thread_assert_can_yield( this , __FUNCTION__ );
    4 
    52 * xlist.h - Double Circular Linked lists, using extended pointers.
    63 *
    7  * Author : Alain Greiner (2016,2017,2018)
     4 * Author : Alain Greiner (2016,2017,2018,2019)
    85 *
    96 * Copyright (c) UPMC Sorbonne Universites
Note: See TracChangeset for help on using the changeset viewer.