Holistic analysis of task scheduling and message scheduling in … · 2020. 10. 15. · 9/8/2020...

22
Holistic analysis of task scheduling and message scheduling in automotive centralised E/E architecture Hoai Hoang Bengtsson (*), Martin Hiller(*), Fredrik Mattsson (*) and Jerker Bengtsson(**) (*): Volvo Car Corporation, Sweden (**): Saab AB, Sweden IEEE/SA Ethernet/IP@AutomotiveTechonology Day 2020 9/8/2020

Transcript of Holistic analysis of task scheduling and message scheduling in … · 2020. 10. 15. · 9/8/2020...

  • Holistic analysis of task scheduling and message scheduling in automotive centralised E/E architecture

    Hoai Hoang Bengtsson (*), Martin Hiller(*), Fredrik Mattsson (*) and Jerker Bengtsson(**)(*): Volvo Car Corporation, Sweden(**): Saab AB, Sweden

    IEEE/SA Ethernet/IP@Automotive Techonology Day 2020

    9/8/2020

  • Using Ethernet as Core Network in Centralized E/E Architecture

    Challenges

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 2

    1. How to guarantee fulfillment of real-time requirements of different application domains across the network

    2. How to minimize the interference on real-time traffic from non real-time traffic in the network

    3. CAN-Ethernet bridge strategy for the gateway

    Recap from last year presentation (IEEE/SA Ethernet/IP@Automotive Technology Day 2019) [1]

  • Lessons Learnt

    Using Time Sensitive Networking (TSN) Ethernet with suitable traffic shaping/ scheduling could:

    • provide bounded network delay, and

    • assert reservation of required bandwidth

    But...

    The centralized processing function, however, largely impacts the sense and act response times in the system

    • The end-to-end response time of any message depend on multiple factors:

    • network delay,

    • processing time, and

    • process scheduling mechanisms.

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 3

    VCU

    Device

    VIU

    Device proxy

    Device Device

    Device proxy Device proxy

    Function A Function B

  • Contribution of this work

    We have extended the network simulator developed in [1] with processor scheduling. The tool can be used to:

    • provide end-to-end delay analysis, including network delay and task response time in the processor,

    • suggest scheduling strategy to guarantee real-time performance of automotive applications, and

    • increase predictability in early design of a system

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 4

  • Design Approach

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 5

    Function Requirements

    HW Platform

    System Design

    Communication protocols & Network

    Scheduling

    Resource Allocation/ process scheduling

    Holistic analysis of the system

    Modelling and Analysis

  • Communication Protocols and Network Scheduling

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 6

    Processor

    SW-A SW-B

    VCU

    VIU-F VIU-L VIU-R VIU-T

    ECU1 ECU2 ECU3 ECU5 ECU6 ECU7 ECU8ECU4

    • Control traffic from ECUxVIUVCU: UDP protocolhas highest priority (7)

    • Infotainment traffic use AVB with priority 5 and 6 • Dianogstic traffic uses DoIP and has lowest priority• Messages are sorted in priority queues at each port of the

    switch

  • Resource Allocation and Process Scheduling

    Moving from a domain architecture to a centralizedarchitecture in automotive naturally means that

    • system central compute unit (VCU) must handle muchhigher work load

    • the VCU must handle different applications with different timing constraints

    The choice of scheduling policy makes a dramatic difference in

    • how the system behaves (in particular at overload),

    • and determines whether a designer can predict characteristics of the system at overload

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 7

    Static vs. Dynamic scheduling

    • In the dynamic scheduling approach, task priority is assigned on the fly. Thus, the system designers cannot predict which specific threads will miss their deadlines during overload conditions not suitable for time-critical applications

    • In the static scheduling approach, schedulability analysis can be performed to assure that the deadlines of critical threads will be satisfied even during overload.

    • Employing a predictable scheduling policy is especially important for safety-critical systems

  • Periodic vs. Sporadic

    Periodic events: An event with an arrival pattern that has a bounded minimum inter-arrival time with minimal jitter.

    Periodic task: a task released by a periodic event whose computation interval excluding preemption and blocking is constant.

    Pros: worst case response time is predictable, bounded delay

    Cons: waste of utilization not suitable for a centralized system where most of tasks are event-driven

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 8

    Sporadic event: An event with an arrival pattern that has a bounded minimum interarrival time with stochastic jitter

    Sporadic task: a task released by a sporadic event or a task with a stochastic computation interval.

    Pros: gain in utilization, shorter response time

    Cons: difficult to predict the worst case scenario, less predictable

  • Modelling of the VCU System Software – A Combined Approach

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 9

    P1 2P1 3P1t1

    P2 2P2t2

    P3t3

    C1

    C2

    C3

    S1

    a2 S2

    S3

    e1

    e2

    e3

    a1

    a3

    A set of sporadic tasks that are activated by events (event-driven tasks)

    ai denotes arrival time of sporadic task Siei denotes execution time of sporadic task Si

    A set of periodic tasks that are pre-loaded and activated by the system clock

    Ci denotes execution time of task 𝜏𝜏𝑖𝑖Pi denotes period of task 𝜏𝜏𝑖𝑖Utilization of all periodic task should be less than or equal to 50%

    𝑈𝑈 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 ≤ 50%

  • Assumptions

    • Each task in the system is assigned a priority

    • A sporadic task has two priority levels: normal and low (POSIX sporadic scheduling)

    • Tasks are independent

    • A periodic task is activated by system clock

    • A sporadic task is activated when its related event occurs

    • All tasks are preemptable

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 10

    Scheduling state machine

    Ready queue Runactivation termination

    preemption

    waiting

    Wait on busyresource

    Signal freeresource

    Event occurs

  • Scheduling of Sporadic Tasks

    • The sporadic scheduling policy is specified for handling tasks running within the context of a static-priority preemptive scheduler

    • In addition to a single normal priority level, the parameters of a sporadic task includes:

    • a second, lower priority for background processing,

    • a replenishment interval,

    • an execution budget, and

    • a maximum number of replenishments allowed within each replenishment interval.

    How to achieve predictably when applying sporadic scheduling?

    Sporadic scheduling manages sporadic tasks by wrapping them within a periodic framework. This is an effective technique to handle overload scenarios in static-priority preemptive schedulers.

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 11

  • Consumption and Replenishment of Execution Budgets

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 12

    Sporadic task has budget =8

    Replenishment period = 12

    8

    12

    Task is executed 4 time units, thenblocked

    The scheduler subtracts 4 unitsfrom the task budget

    First replenishment period started

    Task is executed again at time6, during time 3 units

    Second replenishment period started

    Task is executed again at time 10, during 1 time unit

    The last replenishment period

  • Modeling of the Scheduler for Single Core Processor

    YYYY.MM.DD Presentation title, Full name, Security Class: Proprietary 13

    M1Event handler generates and enqueus a scheduling event

    Event queue

    Buffer at the HW inteface M1

    A message arrives

    Task S1Task S2

    Task Sm-1Task Sm

    Task P1Task P2

    Task Pn-1Task Pn

    Scheduler • Read queued events and activate related

    sporadic task• Check system clock, activate periodic tasks• Dispatch tasks from ready queue to run

    e1

    S1

    Priority sortedready queue

    P3 P2If S1 has higher prioritythan P1 P1 will be putback into the ready queue

    Running task produces output messages to the actuators

    System clock

    P1

    Sporadic Set

    Periodic Set

    Running Task

    Ready Queue

  • Simulation Tool and Experimental Setup

    Scenario

    - Control traffic flows from sensors (S1-S3) to the VIUs (Vehicle Integration Unit), to the core network, to the processor (HPA)

    - After the data has been processed, response is transmitted over the network to the actuator (A1-A3)

    - We only consider scheduling in the processor in the VCU (HPA). Scheduling at the sender and receiver is not included in this work

    - We measure the end-to-end delaysfrom sensors to the actuators

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 14

    HPA

    SW-A SW-B

    VCU

    VIU-R VIU-F VIU-L

    S1 A1 S2 S3 A3A2

    100Mb Ethernet

    1G Ethernet

    HPA: High Performance Processor A

  • The simulator

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 15

    Create Networktopology

    Generate traffic

    Control traffic

    AVB traffic

    Best efforttraffic

    Gatewayscheduler

    (1722/TAS)SRP + CBS BE

    scheduler

    NETSIM (simulation engine)

    Plot Resutls

    Start Run network simulation (system clock stepped tick wise)

    Increment system clock

    Handle ”send” from all talkersand switch ingress ports

    Handle ”receive” from all listeners and switch egress ports

    Tick event

    Distribute current clock

    Distribute current clock

    Handle compute in the processor

    Measure Results

  • Simulation Scenario – Network Streams

    Periodic streams

    • Stream 1: S1 VIU-R SWASWB HPA

    • Stream 2: HPA SWBSWAVIU-RA1

    Period = 256µs, payload = 1171 bytes

    • Stream 3: S2VIU-F SWASWB HPA

    • Stream 4: HPA SWBSWAVIU-FA2

    Period = 512; payload =1171 bytes

    • Stream 5: S3VIU-LSWB HPA

    • Stream 6: HPA SWBVIU-L

    Period = 1ms; payload =1171 bytes

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 16

    Sporadic stream (poisson distributed)• Stream 7: S2VIU-FSWASWB HPA• Stream 8: HPA SWBSWAVIU-FA2• Stream 9: S3VIU-LSWB HPA• Stream 10: HPA SWBVIU-LA3

    HPA

    SW-A SW-B

    VCU

    VIU-R VIU-F VIU-L

    S1 A1 S2 S3 A3A2

    Mb Eth t

  • Simulation Scenario – Task Set

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 17

    Task # Periodic/Sporadic

    Prio normal Prio_low Period/replenish period Excution time Budget

    1 periodic 11 - 300 20

    2 periodic 9 - 1300 50

    3 periodic 7 - 3000 100

    4 Sporadic 10 1 600 200 100

    5 Sporadic 8 1 400 100 50

  • Simulation Results

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 18

  • Simulation Results

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 19

  • Simulation Results

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 20

  • Simulation Results

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 21

  • Summary

    • We have presented a holistic approach for modeling and analysis of network and processor perfomance in automotive systems

    • The tool has capability to calculate response times of sporadic and periodic events/ tasks in automotive real-time systems

    9/8/2020 Holistic Analysis of Messages & Tasks Scheduling in Automotive 22

    • We will extend the processor model to capture multicore scheduling

    Reference[1] Hoai Hoang Bengtsson, Martin Hiller and Samuel Sigfridsson, TSN Ethernet as core network in the centralized architecture, challenges and possiblesolutions, ”Ethernet/IP@Automotive Technology Day 2019, Detroit, 2019.

    Holistic analysis of task scheduling and message scheduling in automotive centralised E/E architecture Using Ethernet as Core Network in Centralized E/E ArchitectureLessons LearntContribution of this workDesign ApproachCommunication Protocols and Network SchedulingResource Allocation and Process SchedulingPeriodic vs. Sporadic Modelling of the VCU System Software – A Combined ApproachAssumptionsScheduling of Sporadic TasksConsumption and Replenishment of Execution BudgetsModeling of the Scheduler for Single Core ProcessorSimulation Tool and Experimental SetupThe simulatorSimulation Scenario – Network StreamsSimulation Scenario – Task SetSimulation ResultsSimulation ResultsSimulation ResultsSimulation ResultsSummary