Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (4 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

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

    r279 r407  
    2828#include <kernel_config.h>
    2929#include <hal_types.h>
     30#include <printk.h>
    3031#include <errno.h>
    3132#include <hal_remote.h>
    3233
    3334/************************************************************************************
    34  * This structure defines a generic, single reader, multiple writers
    35  * remote FIFO, that is used by the RPCs for inter cluster communications.
    36  * The accesses are implemented using a lock-free algorithm, as it uses a ticket
    37  * based mechanism to handle concurrent access between multiple writers.
    38  * Each FIF0 slot can contain one 64 bits integer.
    39  * In case of FIFO full, the writer deschedule without blocking, to retry later.
    40  *
    41  * WARNING : the number of slots is statically defined by the global
    42  * configuration parameter CONFIG_REMOTE_FIFO_SLOTS for all fifos. requiring
    43  * Each FIFO requires 8 + (12 * CONFIG_REMOTE_FIFO_SLOTS) bytes.
     35 * This structure defines a generic, single reader, multiple writers FIFO,
     36 * that is used for - RPC based - inter cluster communications.
     37 * Each FIF0 slot can contain one 64 bits integer (or one extended pointer).
     38 * The number of slots is defined by the CONFIG_REMOTE_FIFO_SLOTS parameter.
     39 * - The write accesses are implemented using a lock-free algorithm, as it uses
     40 *   a ticket based mechanism to handle concurrent access between multiple writers.
     41 *   In case of FIFO full, the writer deschedule without blocking, to retry later.
     42 * - The reader must take the try_lock implemented by the "owner" field, using
     43 *   an atomic_add(). The TRDID is a good owner identifier, because all
     44 *   RPC threads in a given cluster belong to the same kernel process,
     45 *   and RPC threads cannot have local index LTID = 0.
     46*
     47 * WARNING : Each FIFO requires 12 + (12 * CONFIG_REMOTE_FIFO_SLOTS) bytes.
    4448 ***********************************************************************************/
    4549
    4650typedef struct remote_fifo_s
    4751{
     52    uint32_t           owner;                            /*! owner thread trdid    */
    4853        volatile uint32_t  wr_id;                            /*! write slot index      */
    4954        volatile uint32_t  rd_id;                            /*! read  slot index      */
     
    6368/************************************************************************************
    6469 * This non blocking function tries to get one item from the local fifo.
    65  * The reader must get exclusive access before calling this function. 
     70 * The reader must get exclusive access for read before calling this function. 
    6671 * The read slot index is incremented.
    6772 ************************************************************************************
     
    7580/************************************************************************************
    7681 * This blocking function puts one item to a remote fifo identified
    77  * by an extended pointer.
    78  * This function gets a write ticket using a remote_atomic_increment on the
    79  * write slot. Then, it waits until the slot is empty, using a descheduling
    80  * policy without blocking.
     82 * by an extended pointer. It gets a write ticket on the slot to be written,
     83 * using a remote_atomic_add() on the write slot index. Then, it waits until
     84 * the slot is empty, using a descheduling policy without blocking if required.
     85 * It implements a watchdog, returning when the item has been successfully
     86 * registered, or after CONFIG_REMOTE_FIFO_MAX_ITERATIONS failures.   
    8187 ************************************************************************************
    8288 * @ fifo    : extended pointer to the fifo in remote cluster.
    8389 * @ item    : item to be stored.
    84  * @ first   : [out] true if first item registered in remote fifo.
    8590 * @ return  0 on success / EBUSY if a contention has been detected.
    8691 ***********************************************************************************/
    8792error_t remote_fifo_put_item( xptr_t     fifo,
    88                               uint64_t   item,
    89                               bool_t   * first );
     93                              uint64_t   item );
    9094
    9195/************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.