Changeset 33314eb in rtems


Ignore:
Timestamp:
Jul 23, 2020, 6:42:59 AM (3 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
9de8d61
Parents:
1fab972
git-author:
Sebastian Huber <sebastian.huber@…> (07/23/20 06:42:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/23/20 06:56:06)
Message:

bsps/clock: Fix fast idle clock tick support

If we interrupt a thread dispatch critical section (thread dispatch
disable level != ISR nest level), then we should not do the fast idle
mode since this may delay an ongoing system call forever.

Location:
bsps
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bsps/powerpc/shared/clock/clock-ppc-dec.c

    r1fab972 r33314eb  
    9999{
    100100  #if (CLOCK_DRIVER_USE_FAST_IDLE == 1)
    101     rtems_interrupt_level level;
    102     uint32_t tb;
     101    rtems_interrupt_level  level;
     102    uint32_t               tb;
     103    Per_CPU_Control       *cpu_self;
    103104
    104105    rtems_interrupt_disable(level);
     
    106107    tb = ppc_time_base();
    107108    rtems_timecounter_tick();
    108 
    109     while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle ) {
     109    cpu_self = _Per_CPU_Get();
     110
     111    while (
     112      cpu_self->thread_dispatch_disable_level == cpu_self->isr_nest_level
     113        && cpu_self->heir == cpu_self->executing
     114        && cpu_self->executing->is_idle
     115    ) {
    110116      tb += Clock_Decrementer_value;
    111117      ppc_set_time_base( tb );
  • bsps/shared/dev/clock/clockimpl.h

    r1fab972 r33314eb  
    144144  #if CLOCK_DRIVER_USE_FAST_IDLE
    145145    {
    146       struct timecounter *tc = _Timecounter;
    147       uint64_t us_per_tick = rtems_configuration_get_microseconds_per_tick();
    148       uint32_t interval = (uint32_t)
    149         ((tc->tc_frequency * us_per_tick) / 1000000);
    150 
    151146      Clock_driver_timecounter_tick();
    152147
    153148      if (_SMP_Get_processor_maximum() == 1) {
     149        struct timecounter *tc;
     150        uint64_t            us_per_tick;
     151        uint32_t            interval;
     152        Per_CPU_Control    *cpu_self;
     153
     154        cpu_self = _Per_CPU_Get();
     155        tc = _Timecounter;
     156        us_per_tick = rtems_configuration_get_microseconds_per_tick();
     157        interval = (uint32_t) ((tc->tc_frequency * us_per_tick) / 1000000);
     158
    154159        while (
    155           _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle
     160          cpu_self->thread_dispatch_disable_level == cpu_self->isr_nest_level
     161            && cpu_self->heir == cpu_self->executing
     162            && cpu_self->executing->is_idle
    156163        ) {
    157164          ISR_lock_Context lock_context;
Note: See TracChangeset for help on using the changeset viewer.