Ignore:
Timestamp:
May 17, 2018, 3:25:12 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
a83ffa4
Parents:
e9a7e90b
Message:

Added assert for set_timer for duration < 1us && != 0.
Preemption now always calls timer with at least 50us durations.
Fixed verifies in nodebug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/preemption.c

    re9a7e90b rb1a4300  
    9191        //Loop throught every thing expired
    9292        while( node = get_expired( alarms, currtime ) ) {
     93                // __cfaabi_dbg_print_buffer_decl( " KERNEL: preemption tick.\n" );
    9394
    9495                // Check if this is a kernel
     
    103104                Duration period = node->period;
    104105                if( period > 0 ) {
     106                        // __cfaabi_dbg_print_buffer_local( " KERNEL: alarm period is %lu.\n", period.tv );
    105107                        node->alarm = currtime + period;    // Alarm is periodic, add currtime to it (used cached current time)
    106108                        insert( alarms, node );             // Reinsert the node for the next time it triggers
     
    112114
    113115        // If there are still alarms pending, reset the timer
    114         if( alarms->head ) { __kernel_set_timer( alarms->head->alarm - currtime ); }
     116        if( alarms->head ) {
     117                __cfaabi_dbg_print_buffer_decl( " KERNEL: @%lu(%lu) resetting alarm to %lu.\n", currtime.tv, __kernel_get_time().tv, (alarms->head->alarm - currtime).tv);
     118                Duration delta = alarms->head->alarm - currtime;
     119                Duration caped = max(delta, 50`us);
     120                // itimerval tim  = { caped };
     121                // __cfaabi_dbg_print_buffer_local( "    Values are %lu, %lu, %lu %lu.\n", delta.tv, caped.tv, tim.it_value.tv_sec, tim.it_value.tv_usec);
     122
     123                __kernel_set_timer( caped );
     124        }
    115125}
    116126
     
    335345        if( !preemption_ready() ) { return; }
    336346
    337         __cfaabi_dbg_print_buffer_decl( " KERNEL: preempting core %p (%p).\n", kernelTLS.this_processor, kernelTLS.this_thread );
     347        __cfaabi_dbg_print_buffer_decl( " KERNEL: preempting core %p (%p @ %p).\n", kernelTLS.this_processor, kernelTLS.this_thread, (void *)(cxt->uc_mcontext.CFA_REG_IP) );
    338348
    339349        // Sync flag : prevent recursive calls to the signal handler
     
    377387                                case EAGAIN :
    378388                                case EINTR :
     389                                        {__cfaabi_dbg_print_buffer_decl( " KERNEL: Spurious wakeup %d.\n", err );}
    379390                                        continue;
    380391                        case EINVAL :
Note: See TracChangeset for help on using the changeset viewer.