summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coretodset.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-12-21 14:31:55 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-02-02 15:01:20 +0100
commit89c0313938aea0618a624b7230ed29cebe723d75 (patch)
tree05272eb7673abc783d329269d575eb208c0716d9 /cpukit/score/src/coretodset.c
parentsmptests/smpopenmp01: New test (diff)
downloadrtems-89c0313938aea0618a624b7230ed29cebe723d75.tar.bz2
score: Optimize watchdog tickle
Avoid unnecessary lock acquire/release operations. Get realtime via timecounter only if necessary. Update #3264.
Diffstat (limited to 'cpukit/score/src/coretodset.c')
-rw-r--r--cpukit/score/src/coretodset.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c
index fa6407cfaf..787c263643 100644
--- a/cpukit/score/src/coretodset.c
+++ b/cpukit/score/src/coretodset.c
@@ -41,9 +41,29 @@ void _TOD_Set(
cpu_count = _SMP_Get_processor_count();
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
- Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
+ Per_CPU_Control *cpu;
+ Watchdog_Header *header;
+ ISR_lock_Context lock_context;
+ Watchdog_Control *first;
- _Watchdog_Per_CPU_tickle_realtime( cpu, tod_as_ticks );
+ cpu = _Per_CPU_Get_by_index( cpu_index );
+ header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ];
+
+ _ISR_lock_ISR_disable_and_acquire( &cpu->Watchdog.Lock, &lock_context );
+
+ first = _Watchdog_Header_first( header );
+
+ if ( first != NULL ) {
+ _Watchdog_Tickle(
+ header,
+ first,
+ tod_as_ticks,
+ &cpu->Watchdog.Lock,
+ &lock_context
+ );
+ }
+
+ _ISR_lock_Release_and_ISR_enable( &cpu->Watchdog.Lock, &lock_context );
}
_TOD.is_set = true;