154
On Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin Locks Alexander Wieder and Björn Brandenburg MPI-SWS RTSS 2013 12/04/2013 Vancouver, Canada

Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Embed Size (px)

Citation preview

Page 1: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

On Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered,

and Priority-Ordered Spin Locks

Alexander Wieder and Björn BrandenburgMPI-SWS

RTSS 201312/04/2013

Vancouver, Canada

Page 2: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

OS-specification widely used for embedded applications

AUTOSAR:

Resources accessed from multiple cores:

AUTOSAR mandates spin locks.

Motivation:

Page 3: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

But AUTOSAR does not specify spin lock type!

OS-specification widely used for embedded applications

AUTOSAR:

Motivation:

Resources accessed from multiple cores:

AUTOSAR mandates spin locks.

Page 4: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

But AUTOSAR does not specify spin lock type!

OS-specification widely used for embedded applications

AUTOSAR:

Motivation:

Resources accessed from multiple cores:

AUTOSAR mandates spin locks.

Which type should be used?

Page 5: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

Spin Lock TypesVariety of reasonable choices:

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Page 6: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Variety of reasonable choices:

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

Spin Lock Types

FIFO-ordered(MSRP)

simple implementation(test&set)

low architecture requirements

safe for unknown lock types

support forlocking priorities

analysis-friendly

Page 7: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

Spin Lock TypesVariety of reasonable choices:

PreemptableSpinning

Non-PreemptableSpinning

FIFO-ordered(MSRP)

No blocking analysis available

for most types!

Page 8: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ContributionsBlocking analysis

for 8 types of spin locks

Page 9: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ContributionsBlocking analysis

for 8 types of spin locks

7/8 spin lock types:first blocking analysis

Page 10: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ContributionsBlocking analysis

for 8 types of spin locks

7/8 spin lock types:first blocking analysis

Asymptoticallyless pessimistic

than prior approaches

Page 11: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ContributionsBlocking analysis

for 8 types of spin locks

Suggest AUTOSAR API changes based on evaluation results

7/8 spin lock types:first blocking analysis

Asymptoticallyless pessimistic

than prior approaches

Page 12: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Novel Spin Lock AnalysisKey Technique:

Blocking Analysismodeled as

Integer Linear Program (ILP)

Page 13: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Novel Spin Lock AnalysisKey Technique:

Blocking Analysismodeled as

Integer Linear Program (ILP)

Worst-case blocking bounds determined by ILP solver

Page 14: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Page 15: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Page 16: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

• sporadic tasks:

• constrained deadlines:

•partitioned fixed-priority scheduling

Task Model

Ti : (ei, di, pi)

di pi

Page 17: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Basic Spin Lock Analysis

Spin locks busy-wait while waiting for contended resource.

Page 18: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Basic Spin Lock Analysis

Straight-forward analysis approach:• treat spin-time as execution time• apply response-time analysis

Spin locks busy-wait while waiting for contended resource.

Page 19: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

FIFO-Ordered Spin Locks

[1] P. Gai, G. Lipari, and M. Di Natale, “Minimizing memory utilization of real-time task sets in single and multi-processor systems-on-a-chip,” in RTSS’01. IEEE, 2001.

Multiprocessor Stack Resource Policy (MSRP) [1]

Page 20: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

FIFO-Ordered Spin Locks

[1] P. Gai, G. Lipari, and M. Di Natale, “Minimizing memory utilization of real-time task sets in single and multi-processor systems-on-a-chip,” in RTSS’01. IEEE, 2001.

Multiprocessor Stack Resource Policy (MSRP) [1]

The MSRP uses non-preemptable

FIFO-ordered spin locksfor resources shared across processors.

Page 21: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

FIFO-Ordered Spin Locksclassic MSRP analysis

response-timeanalysis

inflate execution time

⌧ 0

Page 22: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

FIFO-Ordered Spin Locksclassic MSRP analysis

response-timeanalysis

inflate execution time

⌧ 0

inflatedexecution times

Page 23: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

FIFO-Ordered Spin Locksclassic MSRP analysis

response-timeanalysis

inflate execution time

⌧ 0

inflatedexecution times

Ri = e0i +X

h<i

⇠Ri

ph

⇡· e0h

Page 24: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

FIFO-Ordered Spin Locksclassic MSRP analysis

response-timeanalysis

inflate execution time

⌧ 0

inflatedexecution times

Ri = e0i +X

h<i

⇠Ri

ph

⇡· e0h

Page 25: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2t

Executing Critical SectionSpinning

Pending but not scheduled

Execution-Time Inflation in Classic MSRP Analysis

Page 26: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Execution-Time Inflation in Classic MSRP Analysis

T1

T2

T3

P1

P2t

Executing Critical SectionSpinning

Pending but not scheduled

T1 busy-waiting for shared resource

Page 27: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2t

Executing Critical SectionSpinning

Pending but not scheduled

T2’s job pending, but not executing

Execution-Time Inflation in Classic MSRP Analysis

Page 28: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2t

Executing Critical SectionSpinning

Pending but not scheduled

T2’s job completes

Execution-Time Inflation in Classic MSRP Analysis

Page 29: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

Consider T1‘s request

Execution-Time Inflation in Classic MSRP Analysis

Page 30: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

Consider T1‘s request

T1’s requestcould be blocked by

T3’s request

Execution-Time Inflation in Classic MSRP Analysis

Page 31: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

T1’s job busy-waits

Execution-Time Inflation in Classic MSRP Analysis

Page 32: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

Execution time inflation:Spin time treated as

execution time

Execution-Time Inflation in Classic MSRP Analysis

Page 33: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

Execution time inflation:Spin time treated as

execution time

Execution-Time Inflation in Classic MSRP Analysis

Page 34: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

original execution time

Execution-Time Inflation in Classic MSRP Analysis

Page 35: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

inflated execution time

original execution time

Execution-Time Inflation in Classic MSRP Analysis

Page 36: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

Execution time inflated forall jobs!

Execution-Time Inflation in Classic MSRP Analysis

Page 37: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

T1

T3

P1

P2t

Execution time inflated forall jobs!

Execution-Time Inflation in Classic MSRP Analysis

Page 38: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Original Schedule

T1

T2

T3

P1

P2t

Executing Critical SectionSpinning

Pending but not scheduled

T2’s job completes

Page 39: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

Schedule with Inflated Execution Times

T1

T3

P1

P2tDeadline

Miss

T2

Page 40: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Pending but not scheduled

Executing Critical SectionSpinning

Schedule with Inflated Execution Times

T1

T3

P1

P2tDeadline

MissImpossible in a real schedule!

T2

Page 41: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2t

Executing Critical SectionSpinning

Pending but not scheduled

At most one can be blocked!

Original Schedule

Page 42: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

All prior analyses rely on execution time inflation!

Inflation is Inherently Pessimistic

Page 43: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

All prior analyses rely on execution time inflation!

We show thatexecution time inflation

is an inherent source of pessimism

in blocking analysis.

Inflation is Inherently Pessimistic

Page 44: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Inflation is Inherently Pessimistic

TheoremAny blocking analysis relying on the

inflation of job execution costs can be pessimistic by a factor of .⌦(� · n)

Page 45: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Inflation is Inherently Pessimistic

TheoremAny blocking analysis relying on the

inflation of job execution costs can be pessimistic by a factor of .⌦(� · n)

maximal ratio of shortest and longest

task period

number of tasks

Page 46: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Inflation is Inherently Pessimistic

TheoremAny blocking analysis relying on the

inflation of job execution costs can be pessimistic by a factor of .⌦(� · n)

Details and proof in paper

Page 47: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Page 48: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

ILP formulationExplicit blocking terms

Page 49: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

ILP formulationExplicit blocking terms

Page 50: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ILP-Based Blocking Analysis of Spin Locks

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Page 51: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ILP-Based Blocking Analysis of Spin Locks

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Blocking Analysismodeled as

Integer Linear Program (ILP)

Key technique for inflation-free blocking analysis:

Worst-case blocking bounds determined by ILP solver

Page 52: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

Page 53: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

Page 54: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Assign blocking variables:

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

Page 55: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Assign blocking variables:

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Page 56: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Blocking Variables

0 X 1

X : Fraction of critical section length contributing to T1’s blocking

Page 57: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Blocking Variables

Request does not contribute

to T1’s blocking.

Request contributes

to T1’s blocking.

0 X 1

X = 0

X = 1

X : Fraction of critical section length contributing to T1’s blocking

Page 58: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Blocking Variables

Request does not contribute

to T1’s blocking.

Request contributes

to T1’s blocking.

0 X 1

X = 0

X = 1

X : Fraction of critical section length contributing to T1’s blocking

Analysis accountsat most once

for each request

Page 59: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Blocking Variables

Request does not contribute

to T1’s blocking.

Request contributes

to T1’s blocking.

0 X 1

X = 0

X = 1

X : Fraction of critical section length contributing to T1’s blocking

Analysis accountsat most once

for each request

No double counting!

Page 60: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Impose constraints:

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Page 61: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

ObservationEach request can be blocked by

at most one request for the same resource from each other processor.

Impose constraints:

Page 62: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Impose constraints:

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Page 63: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Impose constraints:

Page 64: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Impose constraints:

constraints to rule out

impossible schedules

Page 65: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

ILP Generation for FIFO-Ordered Spin Locks

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Impose constraints:

constraints to rule out

impossible schedules

ILP Constraints

• simple• composable

Page 66: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Generate Integer Linear Program:

ILP for Worst-Case Blocking

Page 67: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Generate Integer Linear Program:

worst-case blocking≃

maximal blocking

ILP for Worst-Case Blocking

Page 68: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Generate Integer Linear Program:

X2,1,1 · L2,1,1 +X2,1,2 · L2,1,2 +X2,1,3 · L2,1,3

+X3,1,1 · L3,1,1 +X3,1,2 · L3,1,2

maximize

subject to

ILP for Worst-Case Blocking

Page 69: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Generate Integer Linear Program:maximize

subject to

ILP for Worst-Case Blocking

X2,1,1 · L2,1,1 +X2,1,2 · L2,1,2 +X2,1,3 · L2,1,3

+X3,1,1 · L3,1,1 +X3,1,2 · L3,1,2

maximal critical section length

Page 70: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Generate Integer Linear Program:

X2,1,1 · L2,1,1 +X2,1,2 · L2,1,2 +X2,1,3 · L2,1,3

+X3,1,1 · L3,1,1 +X3,1,2 · L3,1,2

maximize

subject to

ILP for Worst-Case Blocking

Worst-case blocking bound determined by ILP solver.

Page 71: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit Accounting for Blocking

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Ri = ei + bi +X

h<i

⇠Ri

ph

⇡· eh

Page 72: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit Accounting for Blocking

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Ri = ei + bi +X

h<i

⇠Ri

ph

⇡· eh

worst-case blocking bound determined by

ILP-solver

Page 73: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit Accounting for Blocking

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Ri = ei + bi +X

h<i

⇠Ri

ph

⇡· eh

uninflatedexecution costs

worst-case blocking bound determined by

ILP-solver

Page 74: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Explicit blocking termsILP formulation

Page 75: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Explicit blocking termsILP formulation

Page 76: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit blocking termsILP formulation

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Page 77: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

So far we only talked about the MSRP...

Page 78: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

So far we only talked about the MSRP...

...but there’s more.

Page 79: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

Spin Lock Types

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Page 80: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

Spin Lock Types

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Prior analyses do not generalize

to other spin lock types without strong progress guarantees.

Page 81: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Prior Analyses Rely on Strong Progress Guarantees

FIFO-Ordering is analysis-friendly:

Each request can be blocked by at most one request for the same

resource from each other processor.

Page 82: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

FIFO-Ordering is analysis-friendly:

Each request can be blocked by at most one request for the same

resource from each other processor.

Prior analyses rely on strong progress guarantees provided by FIFO-ordering.

Prior Analyses Rely on Strong Progress Guarantees

Page 83: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Each request can be blocked byall other requests

for the same resource.

Unordered spin locks:

Prior Analyses Rely on Strong Progress Guarantees

Page 84: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit blocking termsILP formulation

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Page 85: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit blocking termsILP formulation

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.Wait-time bounds

Composable constraints

Page 86: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit blocking termsILP formulation

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.Wait-time bounds

Composable constraints

Page 87: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Analysis ofUnordered Spin Locks

Page 88: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Analysis ofUnordered Spin Locks

Can all of these really block T1’s request?

Page 89: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Analysis ofUnordered Spin Locks

Can all of these really block T1’s request?

Observation:Two requests can only interfere if they were

pending at the same time.

Page 90: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Observation:Two requests can only interfere if they were

pending at the same time.

Analysis ofUnordered Spin Locks

Page 91: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Per-Request Wait-Time Bounds

How many remote request can be pending while T1’s request is

pending?

Page 92: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Bound wait time of T1’s request. [1]

How many remote request can be pending while T1’s request is

pending?

[1] K. Lakshmanan, D. Niz, and R. Rajkumar, “Coordinated task scheduling, allocation and synchronization on multiprocessors,” in RTSS’09, 2009.

Per-Request Wait-Time Bounds

Page 93: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Bounding the Wait Time of Requests

Page 94: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

T2’s response time

Bounding the Wait Time of Requests

Page 95: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

worst-case wait time of T1’s request

Bounding the Wait Time of Requests

Page 96: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Bounding the Wait Time of Requests

Page 97: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Bounding the Wait Time of Requests

Page 98: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Bounding the Wait Time of Requests

Page 99: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

At most one of T2’s jobs can overlap with T1’s request.

Bounding the Wait Time of Requests

Page 100: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

Bound number of conflicting requests.

At most one of T2’s jobs can overlap with T1’s request.

Bounding the Wait Time of Requests

Page 101: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2

ILP ConstraintsUnordered Spin Locks

Page 102: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

ILP ConstraintsUnordered Spin Locks

Page 103: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

T1

T2

T3

P1

P2

t

P3

Executing Critical SectionSpinning

X2,1,1 X2,1,2 X2,1,3

X3,1,1 X3,1,2X3,1,1 +X3,1,2 1

X2,1,1 +X2,1,2 +X2,1,3 1

Same constraints for unordered and FIFO-ordered

spin locks.

ILP ConstraintsUnordered Spin Locks

Page 104: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Explicit blocking termsILP formulation

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.Wait-time bounds

Composable constraints

Page 105: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

ChallengesPrior analysis is

pessimistic due to inflation.

Prior analysis is specific to non-preemptable

FIFO-ordered spin locks.

Explicit blocking termsILP formulation

Wait-time boundsComposable constraints

Page 106: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Evaluation

Page 107: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Evaluation

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Page 108: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Evaluation

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Could we reduce pessimism?

Page 109: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Evaluation

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Could we reduce pessimism?

Does the spin lock type matter at all?

Page 110: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Evaluation

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Could we reduce pessimism?

Does the spin lock type matter at all?

Which type should we use?

Page 111: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Evaluation

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Could we reduce pessimism?

Does the spin lock type matter at all?

When can unordered locks be used?

Which type should we use?

Page 112: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Evaluation

Priority-Ordered

Unordered

Priority-Orderedwith FIFO tie-breaking

FIFO-ordered(MSRP)

PreemptableSpinning

Non-PreemptableSpinning

Could we reduce pessimism?

Which type should we use?

Does the spin lock type matter at all?

Should spinning be preemptable or

non-preemptable?

When can unordered locks be used?

Page 113: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Large-scale schedulability experiments:•number of processors : 4, 8, 16•average task utilization: 0.1, 0.2, 0.3• critical section lengths: , •number of resources: •number of requests: 1, 2, 5, 10, 15• resource sharing factors: 0.1, 0.25, 0.4, 0.75

Evaluation

[1µs, 15µs] [1µs, 100µs]

m

m/2, m, 2m

Page 114: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Large-scale schedulability experiments:•number of processors : 4, 8, 16•average task utilization: 0.1, 0.2, 0.3• critical section lengths: , •number of resources: •number of requests: 1, 2, 5, 10, 15• resource sharing factors: 0.1, 0.25, 0.4, 0.75

Evaluation

[1µs, 15µs] [1µs, 100µs]

m

m/2, m, 2m

1296 different configurations

Page 115: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Large-scale schedulability experiments:•number of processors : 4, 8, 16•average task utilization: 0.1, 0.2, 0.3• critical section lengths: , •number of resources: •number of requests: 1, 2, 5, 10, 15• resource sharing factors: 0.1, 0.25, 0.4, 0.75

Evaluation

[1µs, 15µs] [1µs, 100µs]

m

m/2, m, 2m

1296 different configurations

≥1000 samples per data point

in each configuration

Page 116: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Schedulability Experiments

#tasks

less idle timemore contention

fract

ion

of s

ched

ulab

le

task

set

s

Page 117: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Schedulability Experiments

#tasks

less idle timemore contention

fract

ion

of s

ched

ulab

le

task

set

s

higher is better

Page 118: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Notation

F|N

Page 119: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Notation

F|N

FIFO-ordered

Page 120: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Notation

F|N

Non-preemptable

Page 121: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Notation

Type Ordering

F|N FIFO-ordered non-preemptable

P|N Priority-ordered non-preemptable

U|N Unordered non-preemptable

PF|N Priority-ordered non-preemptable with FIFO tie-breaking

Page 122: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Does the new analysis reduce pessimism?

Page 123: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Does the new analysis reduce pessimism?

Configuration: 16 CPUs, avg. utilization: 0.1, 16 shared resources, CS lengths , at most 2 requests per resource, contention = 0.4[1µs, 15µs]

0

0.2

0.4

0.6

0.8

1

40 60 80 100 120 140

schedula

ble

number of tasks

MSRP-classicMSRP-holistic

F|N

Page 124: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

0

0.2

0.4

0.6

0.8

1

40 60 80 100 120 140

schedula

ble

number of tasks

MSRP-classicMSRP-holistic

F|N

Configuration: 16 CPUs, avg. utilization: 0.1, 16 shared resources, CS lengths , at most 2 requests per resource, contention = 0.4[1µs, 15µs]

classic analysis

Does the new analysis reduce pessimism?

Page 125: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

0

0.2

0.4

0.6

0.8

1

40 60 80 100 120 140

schedula

ble

number of tasks

MSRP-classicMSRP-holistic

F|N

Configuration: 16 CPUs, avg. utilization: 0.1, 16 shared resources, CS lengths , at most 2 requests per resource, contention = 0.4[1µs, 15µs]

classic analysis

Does the new analysis reduce pessimism?

holistic analysis [1]

[1] B. Brandenburg, “Scheduling and locking in multiprocessor real-time operating systems,” Ph.D. dissertation, The University of North Carolina at Chapel Hill, 2011.

Page 126: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

0

0.2

0.4

0.6

0.8

1

40 60 80 100 120 140

schedula

ble

number of tasks

MSRP-classicMSRP-holistic

F|N

Configuration: 16 CPUs, avg. utilization: 0.1, 16 shared resources, CS lengths , at most 2 requests per resource, contention = 0.4[1µs, 15µs]

ILP-based analysis

classic analysis

Does the new analysis reduce pessimism?

holistic analysis [1]

[1] B. Brandenburg, “Scheduling and locking in multiprocessor real-time operating systems,” Ph.D. dissertation, The University of North Carolina at Chapel Hill, 2011.

Page 127: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

0

0.2

0.4

0.6

0.8

1

40 60 80 100 120 140

schedula

ble

number of tasks

MSRP-classicMSRP-holistic

U|N

Configuration: 16 CPUs, avg. utilization: 0.1, 16 shared resources, CS lengths , at most 2 requests per resource, contention = 0.4[1µs, 15µs]

ILP-based analysis of unordered spin lock

classic analysis

Does the new analysis reduce pessimism?

holistic analysis [1]

[1] B. Brandenburg, “Scheduling and locking in multiprocessor real-time operating systems,” Ph.D. dissertation, The University of North Carolina at Chapel Hill, 2011.

Page 128: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

0

0.2

0.4

0.6

0.8

1

40 60 80 100 120 140

schedula

ble

number of tasks

MSRP-classicMSRP-holistic

U|N

Configuration: 16 CPUs, avg. utilization: 0.1, 16 shared resources, CS lengths , at most 2 requests per resource, contention = 0.4[1µs, 15µs]

ILP-based analysis of unordered spin lock

classic analysis holistic analysis [1]

[1] B. Brandenburg, “Scheduling and locking in multiprocessor real-time operating systems,” Ph.D. dissertation, The University of North Carolina at Chapel Hill, 2011.

Does the new analysis reduce pessimism?

Less pessimismwith

new blocking analysis

Page 129: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Does the Spin Lock Type matter?

Page 130: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Does the Spin Lock Type matter?

Page 131: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Does the Spin Lock Type matter?

Spin lock type hassignificant impact on schedulability.

Page 132: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

When can unordered locks be used?

Page 133: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

When can unordered locks be used?

Page 134: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

When can unordered locks be used?

Page 135: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

When can unordered locks be used?

Task sets schedulable regardless of spin lock type

Page 136: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

When can unordered locks be used?

Task sets schedulable regardless of spin lock type

Enables use of simpler algorithms and

cheaper hardware!

Page 137: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Handling Unknown Spin Lock Types

Analysis for unordered spin locks makes

no ordering assumptions

Page 138: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Handling Unknown Spin Lock Types

Analysis for unordered spin locks makes

no ordering assumptions

Analysis for unordered spin locks applicable for unknown types!

Page 139: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

What is the impact of allowing preemptable spinning?

Page 140: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

What is the impact of allowing preemptable spinning?

Preemptable spinning can...

Page 141: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Preemptable spinning can...

What is the impact of allowing preemptable spinning?

...decrease schedulability(FIFO-ordered)

Page 142: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Preemptable spinning can...

What is the impact of allowing preemptable spinning?

...decrease schedulability(FIFO-ordered)

...increase schedulability(priority-ordered)

Page 143: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Summaryand

Conclusions

Page 144: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Spin lock type has significant impact on

schedulability.

Specifyspin lock type

Suggested API changes

Page 145: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Spin lock type has significant impact on

schedulability.

Specifyspin lock type

FIFO- and priority ordering required to

support many workloads.

Support FIFO and priority ordering in

AUTOSAR

Suggested API changes

Page 146: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Spin lock type has significant impact on

schedulability.

Specifyspin lock type

FIFO- and priority ordering required to

support many workloads.

Preemptable spinning can improve schedulabiliy.

Support FIFO and priority ordering in

AUTOSAR

Support preemptable spinning with

ordering guarantees

Suggested API changes

Page 147: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Novel blocking analysis for spin locks:

Summary

Page 148: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

support for 8 spin lock types

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Novel blocking analysis for spin locks:

Summary

Page 149: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

support for 8 spin lock types

...including unordered locks:

safe for unknown types

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Novel blocking analysis for spin locks:

Summary

Page 150: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

support for 8 spin lock types

...including unordered locks:

safe for unknown types

asymptotically less pessimistic

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Novel blocking analysis for spin locks:

Summary

Page 151: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

support for 8 spin lock types

...including unordered locks:

safe for unknown types

suggestions for AUTOSAR

response-timeanalysis

with uninflated execution times

inflation-freeblocking analysis

Novel blocking analysis for spin locks:

asymptotically less pessimistic

Summary

Page 152: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Future Work

Current analysis assumes non-nested critical sections.

Page 153: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Current analysis assumes non-nested critical sections.

Nested critical sections:work in progress

Future Work

Page 154: Blocking Analysis of FIFO, Unordered, and Priority-Ordered ...bbb/papers/talks/rtss13a.pdfOn Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin

Fin