Reservation-Based Scheduling for IRQ Threads Luca Abeni, Nicola - - PowerPoint PPT Presentation

reservation based scheduling for irq threads
SMART_READER_LITE
LIVE PREVIEW

Reservation-Based Scheduling for IRQ Threads Luca Abeni, Nicola - - PowerPoint PPT Presentation

Reservation-Based Scheduling for IRQ Threads Luca Abeni, Nicola Manica, Luigi Palopoli luca.abeni@unitn.it, nicola.manica@gmail.com, palopoli@dit.unitn.it University of Trento, Trento - Italy Reservation-Based Scheduling for IRQ Threads


slide-1
SLIDE 1

Reservation-Based Scheduling for IRQ Threads

Luca Abeni, Nicola Manica, Luigi Palopoli

luca.abeni@unitn.it, nicola.manica@gmail.com, palopoli@dit.unitn.it

University of Trento, Trento - Italy

Reservation-Based Scheduling for IRQ Threads – p.1/20

slide-2
SLIDE 2

Overview of the Talk

Introduction: problem definition Effects of interrupt handling in vanilla Linux Effects of interrupt handling on Preempt-RT Some problems are solved... ...But some problems are still there! We’ve got to look beyond fixed priorities... Reservation-based scheduling How do CPU reservations apply to IRQ threads? Do they allow to control the impact of interrupt handlers Do they allow to control the hw devices throughput?

Reservation-Based Scheduling for IRQ Threads – p.2/20

slide-3
SLIDE 3

Introduction

Real-Time theory traditionally addressed problems related to CPU allocation. . .

. . .But some real-time applications also need other

resources to execute Example: some time-sensitive applications need to access some hardware device respecting some temporal constraints Correct CPU scheduling is useless if the hardware device is not properly served Giving CPU time to an application is not enough if device drivers cannot execute Sometimes, device drivers can steal CPU time to applications

Reservation-Based Scheduling for IRQ Threads – p.3/20

slide-4
SLIDE 4

Interrupt Handling

Traditional kernels: ISRs and Bottom Halves Have always priority over real-time applications Can preempt real-time tasks Can steal time to real-time tasks RT kernels: interrupts served in dedicated threads Linux → Preempt-RT patch: transforms ISRs and bottom halves in threads Interrupt threads can have lower priorities than real-time tasks If real-time tasks do not need to interact with hardware devices (they do not depend on the interrupt threads), the problem is solved! Problem: how to schedule the IRQ threads?

Reservation-Based Scheduling for IRQ Threads – p.4/20

slide-5
SLIDE 5

Example - What to test

Effects of device handling on real-time tasks Real-time performance: response time (affected by the kernel latency) Highest priority task: worst case response time = WCET + latency Hardware device: network card high throughput device controlling the workload is easy Someone already mentioned problems with high network load and small packets... Interesting things happen when the system is

  • verloaded

Reservation-Based Scheduling for IRQ Threads – p.5/20

slide-6
SLIDE 6

Example - Experimental Setup

Periodic real-time task, scheduled with high priority A task with period 50ms and execution time around

20ms is used

The task is scheduled with the highest real-time priority → expected response time: around 20ms A non real-time task receiving a lot of traffic from the network can increase the response time of the real-time task!!! The netperf program is used The netperf server is run as non real-time → it should not affect the real-time performance

Reservation-Based Scheduling for IRQ Threads – p.6/20

slide-7
SLIDE 7

Example - Results

When using 192-bytes long UDP packets, the response time of the periodic task goes to more than 100ms!!!

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 20000 40000 60000 80000 100000 120000 140000 160000 P{r < t} t (us) Response Times CDF Standard kernel, packet size 192

Reservation-Based Scheduling for IRQ Threads – p.7/20

slide-8
SLIDE 8

Solution: Preempt-RT

The Preempt-RT patch transforms Linux in a real-time

  • kernel. It addresses the mentioned problem by

transforming ISRs and bottom halves in threads If an IRQ thread is scheduled with a lower priority than a real-time task, then the real-time task’s response time is not affected Fixes the problem, but... Fixed priority scheduling is not flexible enough! Let’s see!

Reservation-Based Scheduling for IRQ Threads – p.8/20

slide-9
SLIDE 9

Priority to the Real-Time Task

Low response times, low throughput (48Mbps)

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 18000 18500 19000 19500 20000 20500 P{r < t} t (us) Response Times CDF Standard kernel, packet size 192

Reservation-Based Scheduling for IRQ Threads – p.9/20

slide-10
SLIDE 10

Priority to the IRQ Thread

High throughput (74Mbps), high response times

0.1 0.2 0.3 0.4 0.5 0.6 100000 200000 300000 400000 500000 600000 700000 800000 P{r < t} t (us) Response Times CDF Standard kernel, packet size 192

Reservation-Based Scheduling for IRQ Threads – p.10/20

slide-11
SLIDE 11

Throughput/Latency Trade-Offs

Problem: fixed priority scheduling is not flexible enough It only allows to say things like “the real-time task is more important than the device driver” or “the device driver is more important than the real-time task” How to schedule the IRQ handlers? We might want to say things like “give x% of the CPU time to the device driver”, or similar Resource Reservations!

Reservation-Based Scheduling for IRQ Threads – p.11/20

slide-12
SLIDE 12

Resource Reservations

Resource Reservations → temporal protection Every task is allowed to use a resource for an amount of time Qs every period T s Accounting and Enforcement CPU scheduling → CPU Reservations (implemented in Resource Kernels) Traditional implementations → aperiodic servers Deferrable Server... Here, the Constant Bandwidth Server (CBS) is used

Reservation-Based Scheduling for IRQ Threads – p.12/20

slide-13
SLIDE 13

The Constant Bandwidth Server

The CBS is used, but every reservation-based scheduler can be used Reservations based on RM, EDF , whatever... Basic Ideas: budget → decreases when the served task executes server deadline → assigned to served task job arrival (wakeup) → check if the last server deadline can be used budget exhausted → deadline postponed Server parameters:

Qi: maximum server budget T s

i : server period (soft relative deadline)

Reservation-Based Scheduling for IRQ Threads – p.13/20

slide-14
SLIDE 14

Reservation-Based Scheduling

Two scheduling parameters (Qs, T s)

Qs/T s is the fraction of CPU time reserved to a task T s is the ”granularity” of the allocation

Serving an IRQ thread with a (Qs, T s) reservation: Reducing Qs/T s, the impact of interrupt handling on real-time tasks can be reduced...

T s allows to control the “device’s responsiveness”

We have some theoretical analysis

Reservation-Based Scheduling for IRQ Threads – p.14/20

slide-15
SLIDE 15

Reservations and IRQ threads

Example: RSV1 = (4, 10) for the periodic task,

RSV2 = (4, 10) for the hard IRQ, RSV3 = (1.5, 10) for the

netperf server Throughput: 74Mbps Worst-Case Response Time: 46ms

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 32000 34000 36000 38000 40000 42000 44000 46000 P{r < t} t (us) Response Times CDF Standard kernel, packet size 192 Reservation-Based Scheduling for IRQ Threads – p.15/20

slide-16
SLIDE 16

Latency / Throughput Trade-Offs

Example: The response time can be reduced by using

RSV1 = (5, 10), RSV2 = (2, 10), RSV3 = (1, 10)

Throughput: 65Mbps; Worst-Case Response Time:

36ms

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 24000 26000 28000 30000 32000 34000 36000 P{r < t} t (us) Response Times CDF Standard kernel, packet size 192 Reservation-Based Scheduling for IRQ Threads – p.16/20

slide-17
SLIDE 17

Controlling the Throughput

Example: The CBS parameters (Qs, T s) can be used to control the network throughput Non-overloaded system (larger UDP packets):

10 20 30 40 50 60 70 80 90 100 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 Throughput (Mbps) Reserved fraction of CPU Q / T Network Throughput

Reservation-Based Scheduling for IRQ Threads – p.17/20

slide-18
SLIDE 18

Controlling the Network Latency - 1

Up to now we considered: Latency / Response Time for the real-time task Network throughput What about network latency? The server period T s can be used to control the response time for network packets Tested by looking at the ping RTT RTT as a function of the CBS parameters

Reservation-Based Scheduling for IRQ Threads – p.18/20

slide-19
SLIDE 19

Controlling the Network Latency - 2

min avg max mdev Qs T s RTT RTT RTT RTT 1ms 3ms

0.062 0.109 16.498 0.289

2ms 6ms

0.057 0.105 36.504 0.368

3ms 9ms

0.058 0.103 38.684 0.379

4ms 12ms

0.058 0.101 50.991 0.428

5ms 15ms

0.059 0.102 50.928 0.453

6ms 18ms

0.058 0.103 52.814 0.507

7ms 21ms

0.059 0.104 79.782 0.566 Average and minimum RTT values do not depend on

T s...

But worst case values do!!!

Reservation-Based Scheduling for IRQ Threads – p.19/20

slide-20
SLIDE 20

Conclusions

Device drivers (interrupt handlers) can affect the schedulability of real-time tasks Real-time systems allow to schedule interrupt handlers Problem: how to schedule the IRQ threads? Fixed priorities are not flexible enough Low latencies → low device throughput High device throughput → high latencies Reservation-based scheduling allows to find trade-offs between latencies and throughput!!! Also allows to control the device throughput / response times

Reservation-Based Scheduling for IRQ Threads – p.20/20