summaryrefslogtreecommitdiffstats
path: root/bsps/shared/dev/clock
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-23 08:42:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-23 08:56:06 +0200
commit33314eb60acc23e4a98c9f037631b6f35513d511 (patch)
treea8c2de7e0af2e160de11390785e416ae382d2b3e /bsps/shared/dev/clock
parentscore: Improve _Thread_Start() description (diff)
downloadrtems-33314eb60acc23e4a98c9f037631b6f35513d511.tar.bz2
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.
Diffstat (limited to 'bsps/shared/dev/clock')
-rw-r--r--bsps/shared/dev/clock/clockimpl.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/bsps/shared/dev/clock/clockimpl.h b/bsps/shared/dev/clock/clockimpl.h
index f3b2565c56..dad71307f4 100644
--- a/bsps/shared/dev/clock/clockimpl.h
+++ b/bsps/shared/dev/clock/clockimpl.h
@@ -143,16 +143,23 @@ rtems_isr Clock_isr(
#if CLOCK_DRIVER_USE_FAST_IDLE
{
- struct timecounter *tc = _Timecounter;
- uint64_t us_per_tick = rtems_configuration_get_microseconds_per_tick();
- uint32_t interval = (uint32_t)
- ((tc->tc_frequency * us_per_tick) / 1000000);
-
Clock_driver_timecounter_tick();
if (_SMP_Get_processor_maximum() == 1) {
+ struct timecounter *tc;
+ uint64_t us_per_tick;
+ uint32_t interval;
+ Per_CPU_Control *cpu_self;
+
+ cpu_self = _Per_CPU_Get();
+ tc = _Timecounter;
+ us_per_tick = rtems_configuration_get_microseconds_per_tick();
+ interval = (uint32_t) ((tc->tc_frequency * us_per_tick) / 1000000);
+
while (
- _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle
+ cpu_self->thread_dispatch_disable_level == cpu_self->isr_nest_level
+ && cpu_self->heir == cpu_self->executing
+ && cpu_self->executing->is_idle
) {
ISR_lock_Context lock_context;