Changeset 637 for trunk/kernel/devices


Ignore:
Timestamp:
Jul 18, 2019, 2:06:55 PM (5 years ago)
Author:
alain
Message:

Introduce the non-standard pthread_parallel_create() system call
and re-write the <fft> and <sort> applications to improve the
intrinsic paralelism in applications.

Location:
trunk/kernel/devices
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_dma.c

    r619 r637  
    22 * dev_dma.c - DMA (Interrupt Controler Unit) generic device API implementation.
    33 *
    4  * Authors   Alain Greiner  (2016,2017,2018)
     4 * Authors   Alain Greiner  (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    6161    error_t    error;
    6262
     63    lid_t lid = cluster_select_local_core( local_cxy );
     64
    6365    error = thread_kernel_create( &new_thread,
    6466                                  THREAD_DEV,
    6567                                  &chdev_server_func,
    6668                                  dma,
    67                                   cluster_select_local_core() );
     69                                  lid );
    6870    if( error )
    6971    {
  • trunk/kernel/devices/dev_ioc.c

    r626 r637  
    6767
    6868    // select a core to execute the IOC server thread
    69     lid_t lid = cluster_select_local_core();
     69    lid_t lid = cluster_select_local_core( local_cxy );
    7070
    7171    // bind the IOC IRQ to the selected core
  • trunk/kernel/devices/dev_nic.c

    r619 r637  
    22 * dev_nic.c - NIC (Network Controler) generic device API implementation.
    33 *
    4  * Author  Alain Greiner    (2016,2017,2018)
     4 * Author  Alain Greiner    (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    5858
    5959    // select a core to execute the NIC server thread
    60     lid_t lid = cluster_select_local_core();
     60    lid_t lid = cluster_select_local_core( local_cxy );
    6161
    6262    // bind the NIC IRQ to the selected core
  • trunk/kernel/devices/dev_txt.c

    r626 r637  
    9595    {
    9696        // select a core to execute the server thread
    97         lid_t lid = cluster_select_local_core();
     97        lid_t lid = cluster_select_local_core( local_cxy );
    9898
    9999        // The unique IRQ from cluster 00's MTTY must be bound to a RX chdev
     
    131131        thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    132132    }
    133 }
     133}  // end dev_txt_init()
    134134
    135135//////////////////////////////////////////////////////////////////////////////////
     
    166166    // return I/O operation status from calling thread descriptor
    167167    return this->txt_cmd.error;
    168 }
     168
     169}  // end dev_txt_access()
    169170
    170171/////////////////////////////////////////
     
    173174                       uint32_t   count )
    174175{
     176    error_t error;
    175177
    176178#if (DEBUG_SYS_WRITE & 1)
     
    182184uint32_t   cycle = (uint32_t)hal_get_cycles();
    183185if( DEBUG_DEV_TXT_TX < cycle )
    184 printk("\n[%s] thread[%x,%x] enters / cycle %d\n",
    185 __FUNCTION__, this->process->pid, this->trdid, cycle );
    186 #endif
    187 
    188     // get extended pointer on TXT[0] chdev
     186printk("\n[%s] thread[%x,%x] enters for <%s> / cycle %d\n",
     187__FUNCTION__, this->process->pid, this->trdid, buffer, cycle );
     188#endif
     189
     190    // If we use MTTY (vci_multi_tty), we do a synchronous write on TXT[0]
     191    // If we use TTY  (vci_tty_tsar), we do a standard asynchronous write
     192    // TODO this is not very clean ... [AG]
     193
     194    // get pointers on chdev
    189195    xptr_t dev_xp = chdev_dir.txt_tx[0];
    190 
    191     assert( (dev_xp != XPTR_NULL) , __FUNCTION__ ,
    192     "undefined TXT0 chdev descriptor" );
    193 
    194     // get TXTO chdev cluster and local pointer
    195     cxy_t    dev_cxy  = GET_CXY( dev_xp );
    196     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    197 
    198     // If we use MTTYs (vci_multi_tty), we perform only sync writes
    199     // Otherwise, we use vci_tty_tsar so we can use async writes
     196    cxy_t     dev_cxy = GET_CXY( dev_xp );
     197    chdev_t * dev_ptr = GET_PTR( dev_xp );
    200198
    201199    if( dev_ptr->impl == IMPL_TXT_MTY )
     
    211209        args.channel = channel;
    212210
    213         // call driver function
     211        // call directly the driver function
    214212        aux( &args );
    215213
    216         return 0;
    217     }
    218 
     214        error = 0;
     215    }
    219216    else
    220217    {
    221         return dev_txt_access( TXT_WRITE , channel , buffer , count );
     218        // register command in chdev queue for an asynchronous access
     219        error = dev_txt_access( TXT_WRITE , channel , buffer , count );
     220
     221        if( error )
     222        {
     223            printk("\n[ERROR] in %s : cannot write string %s / cycle %d\n",
     224            __FUNCTION__, buffer, (uint32_t)hal_get_cycles() );
     225        }
    222226    }
    223227
     
    225229cycle = (uint32_t)hal_get_cycles();
    226230if( DEBUG_DEV_TXT_TX < cycle )
    227 printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
     231printk("\n[%s] thread[%x,%x] exit /  cycle %d\n",
    228232__FUNCTION__, this->process->pid, this->trdid, cycle );
    229233#endif
     
    233237#endif
    234238
    235 }
     239    return error;
     240
     241}  // end dev_txt_write()
    236242
    237243/////////////////////////////////////////
     
    239245                      char     * buffer )
    240246{
     247    error_t error;
    241248
    242249#if (DEBUG_SYS_READ & 1)
     
    252259#endif
    253260
    254     return dev_txt_access( TXT_READ , channel , buffer , 1 );
     261    // register command in chdev queue for an asynchronous access
     262    error = dev_txt_access( TXT_READ , channel , buffer , 1 );
     263
     264    if( error )
     265    {
     266        printk("\n[ERROR] in %s : cannot get character / cycle %d\n",
     267        __FUNCTION__, (uint32_t)hal_get_cycles() );
     268    }
    255269
    256270#if DEBUG_DEV_TXT_RX
    257271cycle = (uint32_t)hal_get_cycles();
    258272if( DEBUG_DEV_TXT_RX < cycle )
    259 printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
    260 __FUNCTION__, this->process->pid, this->trdid, cycle );
     273printk("\n[%s] thread[%x,%x] get character <%c> / cycle %d\n",
     274__FUNCTION__, this->process->pid, this->trdid, *buffer, cycle );
    261275#endif
    262276
     
    265279#endif
    266280
    267 }
     281    return error;
     282
     283}  // end dev_txt_read()
    268284
    269285////////////////////////////////////////////////
  • trunk/kernel/devices/dev_txt.h

    r626 r637  
    124124 * device and the driver specific data structures when required.
    125125 * It creates the associated server thread and allocates a WTI from local ICU.
    126  * It must de executed by a local thread.
     126 * It must be executed by a thread running in cluster containing the chdev descriptor.
    127127 ******************************************************************************************
    128128 * @ chdev     : local pointer on TXT device descriptor.
     
    134134 * by the "channel" argument. The corresponding request is actually registered in the
    135135 * chdev requests queue, and the calling thread is descheduled, blocked until
    136  * transfer completion.
    137  * It must be called in the client cluster.
     136 * transfer completion. It can be called by any thread running in any cluster.
    138137 ******************************************************************************************
    139138 * @ channel   : TXT channel index.
     
    148147 * by the "channel" argument. The corresponding request is actually registered in the
    149148 * chdev requests queue, and the calling thread is descheduled, blocked until
    150  * transfer completion.
    151  * It must be called in the client cluster.
     149 * transfer completion. It can be called by any thread running in any cluster.
    152150 ******************************************************************************************
    153151 * @ channel   : TXT channel index.
     
    166164 * interfering with another possible TXT access to another terminal.
    167165 * As it is used for debug, the command arguments <buffer> and <count> are registerd
    168  * in a specific "txt_syc_args_t" structure passed to the driver "aux" function.
     166 * in a specific "txt_sync_args_t" structure passed to the driver "aux" function.
    169167 ****************************************************************************************
    170168 * @ buffer    : local pointer on source buffer containing the string.
Note: See TracChangeset for help on using the changeset viewer.