lightweight semantics-preserving communication for real...
TRANSCRIPT
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 1
Lightweight Semantics-Preserving Communication for Real-Time Automotive Software
Eugene Yip Erjola Lalo Gerald Lüttgen Andreas Sailer
International Symposium on Embedded Multicore/Many-core Systems-on-Chip (MCSoC)
4 October 2019
tomorrow's software technologies tomorrow's software technologies
Research support was partially provided by the Bayerische Forschungsstiftung under grant no. AZ-1257-16
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 2
Automotive Applications on Multi-Cores
• Real-time and safety-critical software– Correct outputs required at correct times!– AUTomotive Open System ARchitecture (AUTOSAR) for designing
software applications, later implemented as tasks
• Multi-core challenge– Need to deploy legacy single-core applications on multi-cores, alongside
modern applications– Maintain system’s timing behaviour when exploring deployment options– Time predictable and deterministic communication needed
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 3
Logical Execution Time (LET) Model
• Automotive industry tackling the multi-core challenge with LET[C. M. Kirsch and A. Sokolova. The Logical Execution Time Paradigm. Advances in Real-Time Systems. Springer, 2012]
– Timing contract between system designers, control engineers, and software developers
• Time-predictable and deterministic execution behaviour– Implementor’s responsibility to preserve the LET timing model– Invariant to platform changes
• Buffering needed for task communication
Period
LET start
LET end
Execution only within the LET
LET
0 1 2 3 4 5 6
ta
tb
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 4
Real-Time Buffering Protocols
• Point-to-Point (PTP) protocol used in automotive LET systems[Resmerita et al. Efficient Realization of Logical Execution Times in Legacy Embedded Software. 2017]
– Statically managed, relies on high-priority LET drivers, memory inefficient, and high bus traffic at LET boundaries
• Dynamic Buffering Protocol (DBP) for synchronous programs[Sofronis et al. A Memory-Optimal Buffering Protocol for Preservation of Synchronous Semantics under Preemptive Scheduling. 2006]
– Tasks assumed to execute and communicate in zero time– Dynamically managed, semantics preserving, memory optimal,
relies on fixed-priority scheduling, and suited to single-core
• Contributions: Lightweight buffering protocol for LET systems– Extend DBP: LET semantics, multiple writers, amenable to multi-cores– Reduce: Buffer sizes, run-time overheads, and frequency of buffer writes
t1
t11
0 1 2 3
2 3
t21
0 1.2 2.4 3.6 4.8 6
2 3 4 5
t31
0 1.5 3 4.5 6
2 4 5
t41
0 2 4 6
3 5
t51
0 6
Buf
fer e
lem
ents
001
2
??
0
?
Time (ms)
4 5
1
4 5 6
54 6
3
12
3
4
5
6
0 ? ?
next
prev
Buffer s contents:Writer s pointers:
Readers: t2,t3,t4,t5
Buffer s state at 0 ms after all tasks have been activated
0 1 ?
next
prev
Buffer s contents:Writer s pointers:
Readers: t4,t5
Buffer s state at 0.8 ms during t4
2 1 ?
next
prev
Buffer s contents:Writer s pointers:
Readers: t5
Buffer s state at 2 ms after t1 and t4 have been actrivated t4
t2
t2 t3 t4
t1
t3 t4
t1
t11
0 1 2 3
2 3
t21
0 1.2 2.4 3.6 4.8 6
2 3 4 5
t31
0 1.5 3 4.5 6
2 4 5
t41
0 2 4 6
3 5
t51
0 6
Buf
fer e
lem
ents
001
2
??
0
?
Time (ms)
4 5
1
4 5 6
54 6
3
12
3
4
5
6
0 ? ?
next
prev
Buffer s contents:Writer s pointers:
Readers: t2,t3,t4,t5
Buffer s state at 0 ms after all tasks have been activated
0 1 ?
next
prev
Buffer s contents:Writer s pointers:
Readers: t4,t5
Buffer s state at 0.8 ms during t4
2 1 ?
next
prev
Buffer s contents:Writer s pointers:
Readers: t5
Buffer s state at 2 ms after t1 and t4 have been actrivated t4
t2
t2 t3 t4
t1
t3 t4
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 5
Main Assumptions
• LET task set, i.e., grouping of functions into schedulable entities, is given
• Tasks do not make local copies of signals
Period
LET ≤ Period
0 1 2 3 4 5 6ms
ty
tz
tx
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 6
Static Buffering Protocol
• SBP analyses each signal separately over one hyper-period– Least common multiple of task periods– One buffer per signal, and initial value is in element e0
– Buffer elements reserved for the entire LET– Buffering actions saved in a buffering schedule
0 1 2 3 4 5 6ms
ta
tb
tc
Buf
fer
Elem
ents e0
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 7
Static Buffering Protocol
• Time 0ms1. Readers tb and tc start: Read initial value. Occupy element e0
2. Writer ta starts: Buffer is full. Occupy new element e1
• Time 0.5ms1. Reader tb ends: Release e0 (but still occupied by tc)2. Writer ta ends: Write value to e1 and release e1
0 1 2 3 4 5
ta
tb
tc
Buf
fer
Elem
ents e0
e1
Readers before writers
6ms
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 8
Static Buffering Protocol
• Time 1ms– Writer ta starts: Reuse e1
• Time 1.5ms– Writer ta ends: Write value to e1 and release e1
0 1 2 3 4 5
ta
tb
tc
Buf
fer
Elem
ents e0
e1
6ms
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 9
Static Buffering Protocol
• Time 2ms1. Reader tc ends: Release e0 (now unoccupied)2. Reader tb starts: Read latest value. Occupy e1
3. Writer ta starts: Reuse e0
• Time 2.5ms1. Reader tb ends: Release e1
2. Writer ta ends: Write value to e0 and release e0
0 1 2 3 4 5
ta
tb
tc
Buf
fer
Elem
ents e0
e1
Ends before starts
6ms
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 10
Static Buffering Protocol
• Fast forward to time 4ms1. Reader tb starts: Read latest value. Occupy e1
2. Writer ta starts: Buffer is full. Occupy new e2
• Fast forward to time 6ms– Last writer instance needed to initialise the signal for the next hyper-period– Routine needed to copy e2 into e0
0 1 2 3 4 5
ta
tb
tc
Buf
fer
Elem
ents e0
e1e2
6ms
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 11
Evaluation
• Evaluated the memory consumption and execution overhead of SBP against traditional PTP protocol– PTP: Created drivers for reads/writes at LET boundaries– SBP: Replaced signal accesses with buffer (array) accesses– Hardware model was AURIX TC27x automotive tri-core processor– Simulation results using the Timing-Architects Tool Suite
[https://www.vector.com/int/en/products/products-a-z/software/ta-tool-suite]
• Automotive benchmarks– Synthetic models parameterised from actual automotive applications– Industrial model of an engine management system from Bosch
[Hamann et al. WATERS Industrial Challenge 2017.]
– 10’s of tasks, 1000’s of signals, 10,000’s of accesses– Stack/local variables of a task allocated to their core’s local memory
– Signals and global buffers allocated to the global memory
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 12
Evaluation
• Auxiliary memory is freed upon task termination
• SBP is a good compromise between memory and overhead– Must also consider implementation effort– PTP: Create and schedule LET drivers– SBP: Modify source code for buffered accesses.
Regenerate the buffering schedule on design change
Protocol Buffer Memory (plus auxiliary memory)
Execution Overhead
PTP Highest
(no auxiliary memory needed)
Highest
• Scheduling of LET drivers• Serialisation of drivers and bus
contention at LET boundaries
SBP 40% (70%) of PTP
• Buffer indexes
20% of PTP
• Updating of buffer indexes
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 13
Conclusions
• SBP: Extended DBP to comply with LET semantics, and to support multiple writers on multi-cores
• SBP is a good compromise between buffer memory and execution overhead compared to PTP– Source code has to be modified
• SBP can be improved by suppressing unnecessary writes– Requires intermediate output values to be stored locally, and data age
constraints on inputs– Heuristic for finding a subset of writes that satisfy the readers– 20% the buffer memory of PTP, but 50% the execution overhead of PTP
© 2019 E. Yip, E. Lalo, G. Lüttgen, A. Sailer Lightweight Semantics-Preserving Communication for Real-Time Automotive Software – 14
Thank you!
Questions?