Ignore:
Timestamp:
Apr 4, 2018, 2:49:02 PM (4 years ago)
Author:
alain
Message:

Fix a bug in scheduler related to RPC blocking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/chdev.c

    r437 r438  
    3939extern chdev_directory_t    chdev_dir;   // allocated in kernel_init.c
    4040
    41 #if (CONFIG_DEBUG_SYS_READ & 1)
     41#if (DEBUG_SYS_READ & 1)
    4242extern uint32_t enter_chdev_cmd_read;
    4343extern uint32_t exit_chdev_cmd_read;
     
    4646#endif
    4747
    48 #if (CONFIG_DEBUG_SYS_WRITE & 1)
     48#if (DEBUG_SYS_WRITE & 1)
    4949extern uint32_t enter_chdev_cmd_write;
    5050extern uint32_t exit_chdev_cmd_write;
     
    130130    uint32_t   save_sr;       // for critical section
    131131
    132 #if (CONFIG_DEBUG_SYS_READ & 1)
     132#if (DEBUG_SYS_READ & 1)
    133133enter_chdev_cmd_read = (uint32_t)hal_get_cycles();
    134134#endif
    135135
    136 #if (CONFIG_DEBUG_SYS_WRITE & 1)
     136#if (DEBUG_SYS_WRITE & 1)
    137137enter_chdev_cmd_write = (uint32_t)hal_get_cycles();
    138138#endif
     
    144144    chdev_t * chdev_ptr = (chdev_t *)GET_PTR( chdev_xp );
    145145
    146 #if (CONFIG_DEBUG_CHDEV_CMD_RX || CONFIG_DEBUG_CHDEV_CMD_TX)
     146#if (DEBUG_CHDEV_CMD_RX || DEBUG_CHDEV_CMD_TX)
    147147bool_t is_rx = hal_remote_lw( XPTR( chdev_cxy , &chdev_ptr->is_rx ) );
    148148#endif
    149149   
    150 #if CONFIG_DEBUG_CHDEV_CMD_RX
     150#if DEBUG_CHDEV_CMD_RX
    151151uint32_t rx_cycle = (uint32_t)hal_get_cycles();
    152 if( (is_rx) && (CONFIG_DEBUG_CHDEV_CMD_RX < rx_cycle) )
     152if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) )
    153153printk("\n[DBG] %s : client_thread %x (%s) enter for RX / cycle %d\n",
    154154__FUNCTION__, this, thread_type_str(this->type) , rx_cycle );
    155155#endif
    156156
    157 #if CONFIG_DEBUG_CHDEV_CMD_TX
     157#if DEBUG_CHDEV_CMD_TX
    158158uint32_t tx_cycle = (uint32_t)hal_get_cycles();
    159 if( (is_rx == 0) && (CONFIG_DEBUG_CHDEV_CMD_TX < tx_cycle) )
     159if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) )
    160160printk("\n[DBG] %s : client_thread %x (%s) enter for TX / cycle %d\n",
    161161__FUNCTION__, this, thread_type_str(this->type) , tx_cycle );
     
    207207    hal_restore_irq( save_sr );
    208208
    209 #if CONFIG_DEBUG_CHDEV_CMD_RX
     209#if DEBUG_CHDEV_CMD_RX
    210210rx_cycle = (uint32_t)hal_get_cycles();
    211 if( (is_rx) && (CONFIG_DEBUG_CHDEV_CMD_RX < rx_cycle) )
     211if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) )
    212212printk("\n[DBG] %s : client_thread %x (%s) exit for RX / cycle %d\n",
    213213__FUNCTION__, this, thread_type_str(this->type) , rx_cycle );
    214214#endif
    215215
    216 #if CONFIG_DEBUG_CHDEV_CMD_TX
     216#if DEBUG_CHDEV_CMD_TX
    217217tx_cycle = (uint32_t)hal_get_cycles();
    218 if( (is_rx == 0) && (CONFIG_DEBUG_CHDEV_CMD_TX < tx_cycle) )
     218if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) )
    219219printk("\n[DBG] %s : client_thread %x (%s) exit for TX / cycle %d\n",
    220220__FUNCTION__, this, thread_type_str(this->type) , tx_cycle );
    221221#endif
    222222
    223 #if (CONFIG_DEBUG_SYS_READ & 1)
     223#if (DEBUG_SYS_READ & 1)
    224224exit_chdev_cmd_read = (uint32_t)hal_get_cycles();
    225225#endif
    226226
    227 #if (CONFIG_DEBUG_SYS_WRITE & 1)
     227#if (DEBUG_SYS_WRITE & 1)
    228228exit_chdev_cmd_write = (uint32_t)hal_get_cycles();
    229229#endif
     
    275275            client_ptr = (thread_t *)GET_PTR( client_xp );
    276276
    277 #if CONFIG_DEBUG_CHDEV_SERVER_RX
     277#if DEBUG_CHDEV_SERVER_RX
    278278uint32_t rx_cycle = (uint32_t)hal_get_cycles();
    279 if( (chdev->is_rx) && (CONFIG_DEBUG_CHDEV_SERVER_RX < rx_cycle) )
     279if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) )
    280280printk("\n[DBG] %s : server_thread %x start RX / client %x / cycle %d\n",
    281281__FUNCTION__ , server , client_ptr , rx_cycle );
    282282#endif
    283283
    284 #if CONFIG_DEBUG_CHDEV_SERVER_TX
     284#if DEBUG_CHDEV_SERVER_TX
    285285uint32_t tx_cycle = (uint32_t)hal_get_cycles();
    286 if( (chdev->is_rx == 0) && (CONFIG_DEBUG_CHDEV_SERVER_TX < tx_cycle) )
     286if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) )
    287287printk("\n[DBG] %s : server_thread %x start TX / client %x / cycle %d\n",
    288288__FUNCTION__ , server , client_ptr , tx_cycle );
    289289#endif
    290290
    291 #if (CONFIG_DEBUG_SYS_READ & 1)
     291#if (DEBUG_SYS_READ & 1)
    292292enter_chdev_server_read = (uint32_t)hal_get_cycles();
    293293#endif
    294294
    295 #if (CONFIG_DEBUG_SYS_WRITE & 1)
     295#if (DEBUG_SYS_WRITE & 1)
    296296enter_chdev_server_write = (uint32_t)hal_get_cycles();
    297297#endif
     
    308308            thread_unblock( client_xp , THREAD_BLOCKED_IO );
    309309
    310 #if CONFIG_DEBUG_CHDEV_SERVER_RX
     310#if DEBUG_CHDEV_SERVER_RX
    311311rx_cycle = (uint32_t)hal_get_cycles();
    312 if( (chdev->is_rx) && (CONFIG_DEBUG_CHDEV_SERVER_RX < rx_cycle) )
     312if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) )
    313313printk("\n[DBG] %s : server_thread %x completes RX / client %x / cycle %d\n",
    314314__FUNCTION__ , server , client_ptr , rx_cycle );
    315315#endif
    316316
    317 #if CONFIG_DEBUG_CHDEV_SERVER_TX
     317#if DEBUG_CHDEV_SERVER_TX
    318318tx_cycle = (uint32_t)hal_get_cycles();
    319 if( (chdev->is_rx == 0) && (CONFIG_DEBUG_CHDEV_SERVER_TX < tx_cycle) )
     319if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) )
    320320printk("\n[DBG] %s : server_thread %x completes TX / client %x / cycle %d\n",
    321321__FUNCTION__ , server , client_ptr , tx_cycle );
    322322#endif
    323323
    324 #if (CONFIG_DEBUG_SYS_READ & 1)
     324#if (DEBUG_SYS_READ & 1)
    325325exit_chdev_server_read = (uint32_t)hal_get_cycles();
    326326#endif
    327327
    328 #if (CONFIG_DEBUG_SYS_WRITE & 1)
     328#if (DEBUG_SYS_WRITE & 1)
    329329exit_chdev_server_write = (uint32_t)hal_get_cycles();
    330330#endif
Note: See TracChangeset for help on using the changeset viewer.