30
Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Embed Size (px)

Citation preview

Page 1: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Thomas Gleixner – linutronixLinux in Automation 2004 – Uni Hannover

Page 2: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Was ist das ?

LInux Based Enhanced RealTime Operating System

Modifikation des Linux-Kernels zur Erlangung der Echtzeitfähigkeit

basierend auf dem KURT Projekt (Kansas University Realtime) unter der Leitung von Prof. Douglas Niehaus

Page 3: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Warum ?

● Performance

● Speicherbedarf

● Portierbarkeit

● Dual Kernel ist für viele User schwierig zu

handhaben

Page 4: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Designvorgaben

● Quality of Service

● Instrumentierbarkeit

● Unterstützung für vernetzte Systeme

● Modularität

● Portierbarkeit

Page 5: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Quality of Service

“As fast as specified

rather than

as fast as possible”Zitat Douglas Niehaus

Page 6: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Funktionalität

● Microsekunden Timer

● Instrumentierung für Kernel / Userspace

● Modularer Echtzeitscheduler

● Interrupthandling unter Schedulerkontrolle

● Userspace Realtime

Page 7: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

µsec Timer

● Driftkompensation

● Synchronisation von vernetzen Systemen

● Schlanke Implementation auf reiner 32 bit

Arithmetik

● Busyloops für kurze Delays entfallen

Page 8: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

µsec Timer

Voraussetzungen● Frei laufender Timer oder Time Stamp

Counter. Emulation des x86 TSC für 16 und

32 bit Timer

● One-shot programmierbarer Timer

Page 9: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Instrumentierung

● DSKI (Data Stream Kernel Interface)

● DSUI (Data Stream Userspace Interface)

● Alle relevanten Codeteile sind instrumentiert

● Eventaufzeichnung selektierbar

● Netzwerksupport für Embedded Systeme

Page 10: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Instrumentierung

● Eventspeicher wird in XML umgewandelt

● Python basierte Auswertung

Page 11: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

RT - Scheduler

● Erweiterung der Linux Task Struktur. Dadurch Userspace Realtime zum Nulltarif

● RT-Scheduler entscheidet vor dem eigentlichen Linux-Scheduler

● Groupscheduling

● Modular ladbare Scheduling Algorithmen

● Watchdog Funktion

Page 12: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

RT - Scheduler

Schedule()

RT-Scheduler

SchedulerModul

SchedulerModul

SchedulerModul

RT ?

Taskswitch

Linux scheduler

Ja

Nein

Page 13: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Groupscheduling

● Bilden von Prozessgruppen

● Scheduling der Prozessgruppen

● Scheduling der Prozesse in den Gruppen

Page 14: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Groupscheduling

Beispiel

Timeslice

P4, P5P6, P7P1, P2, P3

Group 1 Group 2 Group 3

P8, P9

EDF Priority RR

Page 15: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Groupscheduling

Implementierte Algorithmen

● Priority

● Priority mit Quantum

● Early Deadline First

● Round Robin

● Explicit Plan

● Periodic

Page 16: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Groupscheduling

System Decision Function (SDF)

● Scheduling von Systemereignissen

● Scheduling von Interrupthandlern

● Scheduling von Tasklets

Page 17: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Interrupthandling

● CLI/STI durch Softwareflag ersetzt

● Interrupts sind auf Hardwareebene fast

immer enabled

● Support für Per IRQ locking

● Softwarepriorisierung von Interrupts

● Interrupts unter Schedulerkontrolle (SDF)

Page 18: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Interrupthandling

IRQ Entry

RT

IRQ ?

CLI ?RT

cont

ext ?

Notification

N N N

J J

IRQ handler

IRQ Exit

Lock

ed ? J

Can ru

n ?

(SDF)

N

N

J

J

Page 19: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Interrupthandling

IRQ1, IRQ5IRQ11

RT IRQ Group

Priority

IRQ1, IRQ5IRQ11

Linux IRQ Group

EDF

Bottom Halfs,Tasklets

Linux SDF Group

Sequential

Interrupthandling im Scheduler (SDF)

Page 20: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Userspace Realtime

● Standard Userspace Programmierung● Posix-Threads● Realtime Verhalten kann innerhalb des Programms oder von aussen beinflusst werden

● Debugging von Realtime Anwendungen mit GDB

● Userspace Devicedriver Support

Page 21: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Userspace Realtime

Standard IPC Mechanismen

● Signale● Semaphoren● Fifos● Pipes● Shared Memory

Page 22: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Userspace Realtime

Restriktionen

● Blockierende Systemcalls (Disk-I/O)

Page 23: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Performance

P3 1,4Ghz, 100% load

Page 24: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Performance

P3 1,4Ghz, 100% load

Page 25: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Performance

P3 1,4Ghz, 100% load

Page 26: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Performance

P3 1,4Ghz, 100% load

Page 27: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Performance

Load 2.4.22 RTS IRQH

0% 180µs 44µs 24µs

12ms 58µs 24µs

74ms 276µs 44µs

100%(1)

100% +IRQ(2)

Maximum Signal propagation delay

Celeron 333MHz (1) 100% Userspace load(2) 50% Userspace 50% System load (ping -f, serial communication 115200 Bd)

Page 28: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Portierbarkeit

Es müssen nur der Timer und die Interrupt Entry Funktion portiert werden

● ARM7 ca. 120 Zeilen Code + 100 Zeilen Makros

● PPC405 ca. 200 Zeilen Code + 100 Zeilen Makros

Page 29: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Status

Funktion X86 ARM PPC

µsec Timer X

DSKI / DSUI X X X

Scheduler X X X

Interrupt Handling X WIP WIP

System Decision F. WIP WIP WIP

X (1) X (1)

(1) Nicht alle Derivate implementiertWIP = Work In Progress

Page 30: Thomas Gleixner – linutronix Linux in Automation 2004 – Uni Hannover

Verwendung

Verwendung● Telekommunikation (ATM-Switching)● ACE/TAO wird von Chris Gill auf LibeRTOS betrieben.

Hierbei ist vor allem die Integration der ACE Scheduling Funktionalität in die Groupscheduling Funktion von LibeRTOS ein vorrangiges Ziel.

● Video/Audio Streaming, HD-Recording● Messtechnik, Datenerfassung / aufbereitung