Investigation and Improvement on the Impact of TLB misses in - - PowerPoint PPT Presentation

investigation and improvement on the impact of tlb misses
SMART_READER_LITE
LIVE PREVIEW

Investigation and Improvement on the Impact of TLB misses in - - PowerPoint PPT Presentation

Investigation and Improvement on the Impact of TLB misses in Real-Time Systems Takuya Ishikawa, Toshikazu Kato, Shinya Honda and Hiroaki Takada Nagoya University, Japan


slide-1
SLIDE 1

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Takuya ¡Ishikawa, ¡Toshikazu ¡Kato, ¡ Shinya ¡Honda ¡and ¡Hiroaki ¡Takada ¡

Nagoya ¡University, ¡Japan ¡

Investigation ¡and ¡Improvement ¡

  • n ¡the ¡Impact ¡of ¡TLB ¡misses ¡

in ¡Real-‐‑–Time ¡Systems ¡

slide-2
SLIDE 2

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Introduction ¡(1/2)

l Memory ¡protection ¡for ¡real-‐‑–time ¡systems ¡is ¡

needed ¡to ¡ensure ¡safety

l detects ¡illegal ¡memory ¡access l requires ¡hardware ¡support

l Memory ¡Management ¡Unit ¡(MMU)

l performs ¡address ¡translation ¡with ¡a ¡page ¡table

ü mapping ¡a ¡virtual ¡address ¡to ¡a ¡physical ¡address ü contains ¡a ¡field ¡for ¡access ¡permission

l Translation ¡Lookaside ¡Buffer ¡(TLB)

ü a ¡page ¡table ¡entry ¡is ¡cached

➔ to ¡improve ¡address ¡translation ¡speed ¡ ➔ a ¡page ¡table ¡is ¡in ¡main ¡memory

ü TLB ¡miss ¡: ¡TLB ¡does ¡not ¡contain ¡a ¡required ¡entry

➔ a ¡required ¡entry ¡is ¡obtained ¡from ¡a ¡page ¡table ¡(page ¡ table ¡walk) ¡and ¡loaded ¡it ¡to ¡a ¡TLB ¡entry

2

slide-3
SLIDE 3

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Introduction ¡(2/2)

l In ¡real-‐‑–time ¡systems

l worst ¡case ¡execution ¡time ¡(WCET) ¡is ¡important ¡for ¡

schedulability ¡analysis

l WCET ¡is ¡pessimistically ¡estimated

ü it ¡is ¡difficult ¡to ¡estimate ¡the ¡exact ¡WCET

l TLB ¡have ¡the ¡potential ¡to ¡make ¡WCET ¡more ¡

pessimistic

l it ¡is ¡difficult ¡to ¡predict ¡the ¡occurrence ¡of ¡TLB ¡misses

l Impact ¡of ¡TLB ¡misses ¡on ¡WCETs ¡should ¡be ¡studied l predictability ¡of ¡WCETs ¡with ¡TLB ¡should ¡be ¡improved

3

slide-4
SLIDE 4

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Overview ¡of ¡the ¡Research

  • 1. Impact ¡of ¡TLB ¡misses ¡on ¡WCETs ¡is ¡evaluated

l execution ¡time ¡distribution ¡of ¡a ¡real-‐‑–time ¡task ¡in ¡a ¡

micro-‐‑–benchmark ¡with ¡TLB ¡is ¡measured

  • 2. Methods ¡to ¡improve ¡WCETs ¡with ¡TLB ¡are ¡

proposed

l take ¡advantage ¡of ¡TLB ¡locking

ü inhibit ¡the ¡occurrence ¡of ¡TLB ¡misses ¡related ¡to ¡a ¡ specified ¡TLB ¡entry

l 2 ¡types ¡of ¡methods: ¡static ¡one ¡and ¡dynamic ¡one

ü enable ¡a ¡WCET ¡of ¡a ¡real-‐‑–time ¡task ¡to ¡be ¡estimated

4

slide-5
SLIDE 5

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Evaluation ¡Environment ¡

l target ¡processor: ¡SH7750R(235MHz)

l MMU ¡with ¡TLB ¡which ¡has ¡64 ¡entries ¡for ¡instruction ¡and ¡data

ü page ¡size ¡is ¡4096 ¡bytes ü each ¡entry ¡has ¡ASID ¡(address ¡space ¡identifier)

➔ TLB ¡needs ¡not ¡to ¡be ¡flushed ¡with ¡context ¡switch

l TLB ¡miss ¡exception ¡is ¡handled ¡by ¡software ¡(RTOS)

ü TOPPERS/HRP2 ¡kernel ¡is ¡used ¡as ¡RTOS

➔ ASID ¡identifies ¡a ¡currently ¡running ¡application ➔ each ¡application ¡has ¡its ¡own ¡address ¡space ➔ HRP2 ¡changes ¡ASID ¡with ¡context ¡switch

l to ¡make ¡it ¡easier ¡to ¡evaluate ¡an ¡impact ¡of ¡TLB ¡misses

l cache ¡is ¡disabled ¡(turned ¡off) l interrupts ¡are ¡occurred ¡by ¡only ¡a ¡timer, ¡and ¡the ¡result ¡of ¡

evaluation ¡does ¡not ¡include ¡this ¡interrupt ¡execution ¡time

5

slide-6
SLIDE 6

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Micro-‐‑–Benchmark ¡Software ¡(1/2)

l includes ¡automotive ¡application ¡software ¡and ¡

multimedia ¡application ¡software

l consideration ¡of ¡automotive ¡software ¡integration

ü ex.) ¡both ¡automotive ¡control ¡systems ¡and ¡automotive ¡ navigation ¡systems ¡are ¡in ¡the ¡same ¡electronic ¡control ¡ unit ¡

l automotive ¡software ¡is ¡real-‐‑–time ¡application l multimedia ¡software ¡is ¡non-‐‑–real-‐‑–time ¡application

l benchmark ¡software ¡is ¡included ¡in ¡EEMBC ¡benchmark*

l automotive ¡software ¡is ¡AutoBench l multimedia ¡software ¡is ¡DENBench

  • * ¡EEMBC ¡– ¡The ¡Embedded ¡Microprocessor ¡Benchmark ¡Consortium, ¡

、http://www.eembc.org/ 6

slide-7
SLIDE 7

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Micro-‐‑–Benchmark ¡Software ¡(2/2)

l There ¡are ¡5 ¡real-‐‑–time ¡tasks ¡(RT_̳TASK1,2,...5) ¡and ¡1 ¡

non-‐‑–real-‐‑–time ¡task ¡(NR_̳TASK)

l each ¡task ¡has ¡different ¡ASIDs ¡(is ¡allocated ¡different ¡

application)

l Execution ¡flow

l NR_̳TASK ¡is ¡activated ¡firstly l RT_̳TASK1 ¡is ¡activated ¡periodically l RT_̳TASKn ¡executes ¡the ¡own ¡benchmark, ¡and ¡activates ¡

next ¡RT_̳TASKn+1 ¡ ü RT_̳TASKs ¡are ¡activated ¡10,000 ¡times

7 RT_TASK1 RT_TASK2 ! RT_TASK3 ! RT_TASK4 ! RT_TASK5 ! NR_TASK ! time

50ms !

task ID benchmark name memory size (bytes) RT_TASK1 ttsprk01 58,164 RT_TASK2 a2time01 6,564 RT_TASK3 rspeed01 4,088 RT_TASK4 puwmod01 13,392 RT_TASK5 canrdr01 9,360 NR_TASK djpegv2data4 535,332

real- time ! non- real- time !

slide-8
SLIDE 8

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Impact ¡of ¡TLB ¡misses ¡on ¡WCETs

l evaluation ¡metrics:

l EH ¡: ¡execution ¡time ¡of ¡TLB ¡miss ¡exception ¡handlers l ET ¡: ¡execution ¡time ¡of ¡an ¡evaluated ¡task l a ¡ratio ¡of ¡the ¡execution ¡time ¡of ¡TLB ¡miss ¡exception ¡

handlers ¡to ¡that ¡of ¡an ¡evaluated ¡task ¡with ¡no ¡occurrence ¡

  • f ¡TLB ¡misses

l evaluate ¡the ¡average ¡and ¡maximum ¡value

l evaluated ¡task

l RT_̳TASK1(ttsprk01)

ü constant ¡input ¡value, ¡which ¡maximizes ¡the ¡execution ¡time

l RT_̳TASK1 ¡with ¡random ¡input ¡value ¡and ¡RT_̳TASK1 ¡to ¡RT_̳TASK5 ¡with ¡

random ¡input ¡value ¡(omitted ¡in ¡this ¡paper...)

l average ¡execution ¡time ¡of ¡each ¡TLB ¡miss ¡

exception ¡handler

l 16.9 ¡microseconds 8

EH ET − EH [%]

slide-9
SLIDE 9

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Result ¡of ¡Evaluation

l execution ¡time ¡distribution ¡and ¡metrics ¡value

  • l the ¡impact ¡of ¡TLB ¡misses ¡on ¡the ¡WCET ¡can ¡be ¡

considerable

9

1 10 100 1000 10000 3130 3150 3170 3190 3210 3230 3250 3270 3290 3310 3330 3350 3370 3390 発 生 頻 度 実行時間 ( 回) ( μ秒)

each TLB miss exception: about 17 microsecond ! no TLB miss ! measured WCET : 15 TLB misses ! maximum metrics value : 8.13 % ! average metrics value : 2.91 % !

Execution time ! Frequency !

(microseconds) ! (times) !

slide-10
SLIDE 10

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Improvement ¡on ¡WCET ¡with ¡TLB ¡Locking

l TLB ¡locking

l makes ¡a ¡specified ¡TLB ¡entry ¡not ¡to ¡be ¡replaced

ü inhibits ¡the ¡occurrence ¡of ¡TLB ¡misses

l assigns ¡a ¡normal ¡entry ¡of ¡TLB ¡as ¡a ¡locked ¡entry

ü after ¡locked ¡entry ¡is ¡released, ¡that ¡can ¡be ¡used ¡as ¡normal ¡one

l implemented ¡in ¡an ¡RTOS ¡(on ¡SH7750R ¡processors)

ü some ¡of ¡ARM ¡processors ¡implement ¡in ¡hardware

l proposed ¡TLB ¡locking ¡methods

l reduce ¡TLB ¡misses ¡while ¡a ¡real-‐‑–time ¡task ¡is ¡running ¡ l improve ¡the ¡WCET ¡of ¡a ¡real-‐‑–time ¡task 10

TLB ! can not be replaced ! can be replaced ! normal entry ! locked entry !

ASID ! virtual page ! attribute ! physical page ! 1 ! 0x80100 RX, Non-Shared ! 0x80100 … ! … ! … ! … 2 ! 0xc0200 RW, Non-Shared ! 0xc0200 1 ! 0xc0f00 RW, Shared ! 0xc0f00 … ! … … ! … 1 ! 0x80108 RX, Non-Shared ! 0x80108

slide-11
SLIDE 11

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Static ¡Locking ¡Method

l locks ¡the ¡target ¡TLB ¡entries ¡during ¡system ¡

initialization

l these ¡entries ¡remain ¡locked ¡while ¡system ¡is ¡running

TLB ¡locking ¡increase ¡only ¡the ¡execution ¡time ¡of ¡system ¡ initialization ¡ 、response ¡time ¡of ¡an ¡entire ¡system ¡can ¡be ¡increased ü TLB ¡entries ¡for ¡NR_̳TASK ¡are ¡reduced, ¡and ¡TLB ¡ misses ¡can ¡be ¡increased ¡while ¡NR_̳TASK ¡is ¡running

11

RT_TASK ! NR_TASK !

time ! TLB !

Normal Entry ! Locked Entry for RT_TASK !

used only RT_TASK !

slide-12
SLIDE 12

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Dynamic ¡Locking ¡Method

l locks ¡the ¡target ¡TLB ¡entries ¡when ¡a ¡job ¡of ¡a ¡

RT_̳TASK ¡is ¡activated, ¡and ¡releases ¡these ¡entries ¡ when ¡a ¡job ¡ends

l released ¡entries ¡can ¡be ¡used ¡as ¡normal ¡entries

TLB ¡misses ¡while ¡NR_̳TASK ¡is ¡running ¡can ¡be ¡less ¡than ¡static ¡ locking ¡method execution ¡time ¡of ¡RT_̳TASK ¡can ¡be ¡increased, ¡because ¡of ¡TLB ¡ locking ¡and ¡releasing ü prepare ¡a ¡table ¡for ¡locked ¡TLB ¡entries ¡instead ¡of ¡a ¡page ¡ table ¡walk

12 RT_TASK ! NR_TASK ! time ! TLB ! Normal Entry ! Locked Entry for RT_TASK ! TLB lock, or release lock TLB entries ! release locked entries ! NR_TASK can use all TLB entries !

slide-13
SLIDE 13

ERTL Embedded and Real-Time systems Lab.

Nagoya University

TLB ¡entry ¡invalidation

l an ¡entry ¡which ¡indicates ¡the ¡same ¡virtual ¡page ¡as ¡

a ¡locked ¡entry ¡shall ¡be ¡invalidated ¡before ¡locking

l different ¡TLB ¡entries ¡indicates ¡the ¡same ¡virtual ¡page: ¡exception

l static ¡locking ¡method: ¡invalidate ¡all ¡TLB ¡entries

l invalidation ¡has ¡little ¡impact ¡on ¡subsequent ¡TLB ¡misses l invalidate ¡all ¡entries ¡by ¡one ¡memory ¡access ¡(to ¡memory ¡

mapped ¡MMU ¡register)

l Dynamic ¡locking ¡method: ¡invalidate ¡not ¡all ¡TLB ¡

entries ¡simply

l invalidation ¡has ¡much ¡impact ¡on ¡entire ¡TLB ¡misses 13

Normal Entry ! Locked Entry ! ASID ! 1 ! … ! 2 ! virtual page ! … ! 0x80100 … ! … … ! 0xc0200 ! … ! 1 ! 0xc0100 … ! TLB ! 1 ! 0x80f00 … !

if not invalidate ... !

ASID ! 1 ! … ! 2 ! virtual page ! … ! 0x80100 … ! … … ! 0xc0200 ! … ! 1 ! 0x80100 … ! TLB ! 1 ! 0x80f00 … !

different entries indicates the same virtual page ! lock VP = 0x80100 (ASID = 1) ! exception occurs !

slide-14
SLIDE 14

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Dynamic ¡Invalidation ¡Method ¡I

l invalidates ¡only ¡TLB ¡entries ¡related ¡to ¡locked ¡

entries

l does ¡not ¡invalidate ¡unrelated ¡entries ¡ l invalidation ¡processes ¡are ¡increased ¡by ¡the ¡number ¡of ¡

locked ¡entries

14

Normal Entry ! Locked Entry ! ASID ! 1 ! … ! 2 ! virtual page ! … ! 0x80100 … ! … … ! 0xc0200 ! … ! 1 ! 0xc0100 … ! TLB ! 1 ! 0x80f00 … ! invalidation ! ASID ! … ! 2 ! virtual page ! … ! … … ! 0xc0200 ! … ! 1 ! 0x80100 … ! TLB ! 1 ! 0x80f00 … ! ASID ! … ! 2 ! virtual page ! … ! … … ! 0xc0200 ! … ! 1 ! 0xc0100 … ! TLB ! 1 ! 0x80f00 … ! TLB locking !

iterate this process for each locked entry ! lock VP = 0x80100 (ASID = 1) ! search and invalidate entry for VP = 0x80100 (ASID = 1) !

slide-15
SLIDE 15

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Dynamic ¡Invalidation ¡Method ¡II

l invalidate ¡all ¡TLB ¡entries

l saves ¡all ¡TLB ¡entries ¡to ¡memory ¡before ¡invalidation l restores ¡all ¡TLB ¡entries ¡from ¡memory ¡when ¡locked ¡entries ¡are ¡

released

ü TLB ¡entries ¡for ¡NR_̳TASK ¡are ¡not ¡expired ü saving ¡and ¡restoring ¡all ¡entries ¡can ¡be ¡increase ¡the ¡response ¡time

15 Normal Entry ! ASID ! 2 ! … ! 2 ! virtual page ! … ! 0x80200 … ! … … ! 0xc0200 ! … ! 1 ! 0xc0100 … ! TLB ! 2 ! 0x80202 … ! invalidate all entries ! ASID ! virtual pgae ! … ! 1 ! 0x80100 … ! TLB ! 1 ! 0x80f00 … ! ASID ! virtual page ! … ! TLB ! TLB locking ! Locked Entry ! Normal Entry !

ASI D ! 2 ! … ! 2 ! 仮想ページ番号 ! … 0x80200 … … … 0xc0200 ! … 1 ! 0xc0100 … 2 ! 0x80202 …

copy of entries ! ! save entries ! restore entries ! TLB locking ! ! TLB releasing ! ! ASID ! 2 ! … ! 2 ! virtual page ! … ! 0x80200 … ! … … ! 0xc0200 ! … ! 1 ! 0xc0100 … ! 2 ! 0x80202 … ! in main memory !

slide-16
SLIDE 16

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Evaluation ¡for ¡TLB ¡Locking

l apply ¡proposed ¡methods ¡to ¡the ¡micro-‐‑–benchmark l evaluation ¡items

1.

execution ¡time ¡distribution ¡of ¡RT_̳TASK ¡and ¡metrics ¡ value

2.

execution ¡time ¡of ¡each ¡dynamic ¡locking ¡method

3.

execution ¡efficiency ¡of ¡the ¡entire ¡micro-‐‑–benchmark ü measure ¡response ¡time, ¡execution ¡time ¡and ¡the ¡ number ¡of ¡TLB ¡misses ¡of ¡NR_̳TASK

l apply ¡TLB ¡locking ¡to

ü RT_̳TASK1 ¡with ¡the ¡constant ¡input

➔ 16 ¡pages ¡are ¡locked

ü RT_̳TASK1 ¡to ¡RT_̳TASK5 ¡(all ¡RT_̳TASKs) ¡with ¡the ¡ random ¡inputs

➔ 49pages ¡are ¡locked

16

slide-17
SLIDE 17

ERTL Embedded and Real-Time systems Lab.

Nagoya University

1 10 100 1000 10000 3130 3150 3170 3190 3210 3230 3250 3270 3290 3310 3330 3350 3370 3390 発 生 頻 度

数 目 盛

  • 実行時間

TLBロッ ク 未適用 TLBロッ ク 適用

( 回) ( μ秒)

Result ¡of ¡Execution ¡Time ¡of ¡RT_̳TASK1

l execution ¡time ¡distribution ¡and ¡metrics ¡value

  • l the ¡metrics ¡value ¡are ¡0 ¡% ¡in ¡all ¡cases

l all ¡TLB ¡locking ¡methods ¡can ¡get ¡rid ¡of ¡TLB ¡misses ¡for ¡RT_̳TASK

17

improve the impact of TLB misses: 8.13 % !

Execution time ! Frequency !

(microseconds) ! (times) !

average and maximum metrics value: 0 %

w/o TLB locking ! w/ TLB locking !

slide-18
SLIDE 18

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Result ¡of ¡Execution ¡Time ¡of ¡Locking

  • l dynamic ¡method ¡I ¡is ¡effective ¡if ¡locked ¡pages ¡are ¡less ¡

l dynamic ¡method ¡II ¡is ¡effective ¡if ¡locked ¡pages ¡are ¡more

ü threshold ¡is ¡52 、 、 、 、

18

200 400 600 800 1000 1200 1 6 11 16 21 26 31 36 41 46 51 56 61 66 処 理 時 間 ページ数

TLBミ ス例外処理 動的ロッ ク 手法① 動的ロッ ク 手法②

( μ秒)

save and restore all entries: 268 microseconds ! gradients: increase 9.6 microseconds / page ! gradients: increase 4.2 microseconds / page ! gradients: increase 17 microseconds / page !

Execution time !

(microseconds) ! TLB miss exception ! dynamic method I ! dynamic method II !

Number of pages !

slide-19
SLIDE 19

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Result ¡for ¡NR_̳TASK

19

2 4 6 8 10 12 14 16 0.96 0.97 0.98 0.99 1 1.01 1.02 1.03 1.04 1.05 1.06 1.07 なし 静的 動的① 動的② 相 対 比

ス 回 数

対 比

  • TLBロッ

ク 手法

TLBミ ス回数 応答時間 実行時間

− static ¡locking ¡method

  • difference ¡is ¡about ¡0.1 ¡% ¡if ¡the ¡number ¡of ¡locked ¡page ¡is ¡less

ü decrease ¡response ¡time ¡because ¡decrease ¡execution ¡time ¡of ¡RT_̳TASK1

  • increase ¡response ¡time, ¡execution ¡time ¡and ¡TLB ¡misses ¡if ¡the ¡number ¡of ¡

locked ¡page ¡is ¡more

− dynamic ¡locking ¡method

  • method ¡II ¡has ¡less ¡impact ¡on ¡NR_̳TASK ¡than ¡method ¡I ¡

、 、saving ¡and ¡restoring ¡TLB ¡entries ¡are ¡effective ¡for ¡execution ¡of ¡NR_̳TASK

0.2 0.4 0.6 0.8 1 1.2 0.995 0.996 0.997 0.998 0.999 1 1.001 1.002 1.003 1.004 なし 静的 動的① 動的② 相 対 比

ス 回 数

対 比

  • TLBロッ

ク 手法

apply to RT_TASK1 (lock 16 pages) ! apply to all RT_TASKs (lock 49 pages) ! * vertical axis indicates ratio to w/o TLB locking ! relative time ratio ! relative time ratio ! relative TLB miss ratio ! relative TLB miss ratio !

Number of TLB misses ! response time ! execution time !

TLB locking method !

w/o lock ! w/ static method ! w/ dynamic method I ! w/ dynamic method II !

TLB locking method !

w/o lock ! w/ static method ! w/ dynamic method I ! w/ dynamic method II !

slide-20
SLIDE 20

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Conclusion

l evaluate ¡the ¡impact ¡of ¡TLB ¡misses ¡on ¡WCETs

l TLB ¡misses ¡can ¡have ¡a ¡considerable ¡impact ¡on ¡WCETs ¡

  • f ¡real-‐‑–time ¡tasks

l propose ¡the ¡TLB ¡locking ¡methods

l improve ¡WCETs ¡of ¡real-‐‑–time ¡tasks

ü lock ¡entries ¡related ¡to ¡real-‐‑–time ¡tasks

l static ¡method ¡and ¡2 ¡dynamic ¡methods ¡are ¡proposed

ü evaluation ¡shows ¡features ¡of ¡methods

l Future ¡Works

l the ¡impact ¡of ¡TLB ¡misses ¡and ¡proposed ¡methods ¡should ¡

be ¡evaluated ¡with ¡other ¡environments ü different ¡task ¡sets, ¡hardware ¡TLB ¡management, ¡ enabled ¡cache, ¡...

l methods ¡to ¡select ¡locked ¡entries ¡should ¡be ¡considered

ü for ¡lack ¡of ¡lockable ¡TLB ¡entries

20

slide-21
SLIDE 21

21

slide-22
SLIDE 22

ERTL Embedded and Real-Time systems Lab.

Nagoya University

22

slide-23
SLIDE 23

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Page ¡Table ¡Walk

l implementation ¡in ¡hardware

l a ¡TLB ¡miss ¡is ¡handled ¡by ¡hardware

ü overhead ¡is ¡less

l format ¡of ¡page ¡table ¡is ¡defined ¡by ¡hardware

ü hierarchical ¡page ¡table

l TLB ¡controls ¡by ¡software ¡are ¡limited

ü ex) ¡TLB ¡flush ¡is ¡enabled

l adopted ¡by ¡ARM, ¡SPARC ¡V8 ¡architecture

l implementation ¡in ¡software

l a ¡TLB ¡miss ¡is ¡handled ¡by ¡software

ü overhead ¡is ¡more

l format ¡of ¡page ¡table ¡is ¡freedom, ¡and ¡TLB ¡can ¡be ¡

controlled ¡by ¡software ü flexible

l adopted ¡by ¡SH, ¡MIPS ¡architechture 23

slide-24
SLIDE 24

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Page ¡Table ¡in ¡HRP2 ¡on ¡SH7750R

24

address space ! !

.data_app1 .bss_app1 ! .data_app2 .bss_app2 ! .text_app1 .rodata_app1 ! .text_shared .rodata_shared ! application 1 ! application 2 ! RW, Non-Shared ! RX, Shared ! RW, Non-Shared ! RX, Non-Shared ! RX, Shared !

page table ! !

slide-25
SLIDE 25

ERTL Embedded and Real-Time systems Lab.

Nagoya University

MMU ¡in ¡SH7750R

l paging ¡virtual ¡address ¡space ¡(32 ¡bit)

l page ¡size ¡is ¡1KB, ¡4KB, ¡64KB ¡or ¡1MB

l TLB

l instruction ¡TLB ¡(ITLB) ¡: ¡4 ¡entries, ¡fully ¡associative

ü upper ¡level ¡of ¡UTLB, ¡controlled ¡by ¡hardware

l shared ¡TLB ¡(UTLB): ¡64 ¡entries, ¡fully ¡associative

ü software ¡page ¡table ¡walk

l UTLB ¡controlled ¡by ¡

l LDTLB ¡instruction

ü replaced ¡entry ¡is ¡specified ¡by ¡ MMUCR.URC

➔ each ¡memory ¡access ¡increments

l access ¡to ¡memory ¡mapped ¡TLB

ü UTLB ¡is ¡mapped ¡to ¡memory

25 MMUCR ! 0 ! 63 ! PTEH ! PTEL ! URC ! LDTLB ! n ! : ! : ! UTLB !

slide-26
SLIDE 26

ERTL Embedded and Real-Time systems Lab.

Nagoya University

TLB ¡locking ¡in ¡SH7750R

l TLB ¡locking ¡process

l invalidate ¡the ¡same ¡virtual ¡page ¡entry ¡in ¡TLB

ü stop ¡CPU ¡exception

l modify ¡MMUCR

ü MMUCR.URB ¡configures ¡area ¡where ¡URC ¡is ¡ranged

l load ¡page ¡table ¡entry ¡to ¡UTLB

ü set ¡PTEH, ¡PTEL ¡and ¡MMUCR.URC ¡and ¡issue ¡LDTLB ¡ instruction

l data ¡and ¡code ¡for ¡TLB ¡locking ¡are ¡in ¡TLB-‐‑–

invalidated ¡area

l special ¡virtual ¡address ¡space

l interrupt ¡and ¡exception ¡is ¡

disabled ¡while ¡TLB ¡locking

26

UTLB ! URB !

0 ! ! : ! (n-1) ! ! n ! ! : !63 ! !

URC is ranged in this area ! Locked Entry ! Normal Entry !

slide-27
SLIDE 27

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Address ¡Space ¡of ¡SH7750R

27

slide-28
SLIDE 28

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Static ¡Locking ¡Process

28

entry ! TLB flush ! exit ! complete TLB locking ? ! disable int ! enable int ! save ASID ! restore ASID and set MMUCR.URC to 0 YES ! set a page table entry to PTEH and PTEL ! set MMUCR.URB and MMUCR.URC LDTLB instruction NO !

modify locked area !

  • btain the entry for

the target page ! invalidate all TLB entries !

critical section !

slide-29
SLIDE 29

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Dynamic ¡Locking ¡Process ¡I

l lock l release

29

entry ! invalidate TLB entry ! exit ! complete TLB lock ? ! disable int ! enable int ! save ASID ! restore ASID and set MMUCR.URC to 0 YES ! set a page table entry to PTEH and PTEL ! set MMUCR.URB and MMUCR.URC LDTLB instruction NO ! entry ! disable int ! enable int ! exit ! set MMUCR.URB to 0 !

each entry for locked page is invalidated ! release all locked entries !

slide-30
SLIDE 30

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Dynamic ¡Locking ¡Process ¡II

l lock l release

30

entry ! disable int ! enable int ! exit ! set MMUCR.URB to 0 ! restore all TLB entries ! entry ! TLB flush ! exit ! complete TLB lock ? ! disable int ! enable int ! save ASID ! restore ASID and set MMUCR.URC to 0 YES ! set a page table entry to PTEH and PTEL ! set MMUCR.URB and MMUCR.URC LDTLB instruction NO ! save all TLB entries !

invalidate all TLB entries ! saving TLB ! restoring TLB !

slide-31
SLIDE 31

ERTL Embedded and Real-Time systems Lab.

Nagoya University

TLB ¡miss ¡overhead

l measure ¡execution ¡time ¡from ¡entry ¡of ¡TLB ¡miss ¡

exception ¡handler ¡to ¡end

31

500 1000 1500 2000 2500 16.5 17.0 17.5 18.0 18.5 19.0 発 生 頻 度 実行時間 ( 回) ( μ秒)

Execution time ! Frequency !

(microseconds) ! (times) !

slide-32
SLIDE 32

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Evaluation ¡for ¡Impact ¡of ¡TLB ¡miss

l RT_̳TASK1 ¡with ¡random ¡inputs

  • l RT_̳TASK1 ¡to ¡RT_̳TASK5 ¡(entire ¡RT_̳TASKs)

l average: ¡10.21%, ¡maximum: ¡36.91% 32

10 20 30 40 50 60 70 80 90 6 12 18 24 30 36 42 48 54 60 影 響 度 入力値セッ ト 番号 平均影響度 最大影響度 ( %)

average: 11.01 % maximum: 76.28 %

execution time is several hundreds microseconds ! ID of execution ! metrics value !

(%) !

execution time is several thousand microseconds !

average value ! maximum value !

slide-33
SLIDE 33

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Result ¡of ¡Evaluation ¡for ¡TLB ¡Locking

l Conclusion ¡in ¡this ¡evaluation

l TLB ¡locking ¡is ¡efficient ¡for ¡improvement ¡on ¡WCETs l static ¡locking ¡method ¡is ¡effective ¡if ¡the ¡number ¡of ¡locked ¡

entries ¡is ¡less

l dynamic ¡locking ¡method ¡II ¡is ¡effective ¡if ¡the ¡number ¡of ¡

locked ¡entries ¡is ¡more

33 method WCET

  • verhead

execution efficiency less pages more pages less pages more pages static locking ○ ○ ○ △ × dynamic locking I ○ ○ △ △ △ dynamic locking II ○ × △ ○ ○

slide-34
SLIDE 34

ERTL Embedded and Real-Time systems Lab.

Nagoya University

Related ¡Works

l Cache ¡miss ¡and ¡cache ¡lock ¡[1][2][3][4][5] l Page ¡fault ¡[6] l TLB ¡miss ¡[7]

34

[1] Isabelle Puaut and David Decotigny. Low-Complexity Algorithms for Static Cache Locking in Multitasking Hard Real-Time Systems. [2] Antonio Marti Campoy, Isabelle Puaut, Angel Perles Ivars, and Jose Vicente Busquets Mataix. Cache Contents Selection for Statically-Locked Instruction Caches: An Algorithm Comparison. [3] Heiko Falk, Sascha Plazar, and Henrik Theiling. Compile-time decided instruction cache locking using worst-case execution paths. [4] Tiantian Liu, Minming Li, and Chun Jason Xue. Minimizing WCET for Real-Time Embedded Systems via Static Instruction Cache Locking. [5] Antonio Marti Campoy, Angel Perles Ivars, Francisco Rodriguez, and Jose Vicente Busquets

  • Mataix. Static use of locking caches vs. dynamic use of locking caches for real-time systems.

[6] Isabelle Puaut and Damien Hardy. Predictable Paging in Real-Time Systems: A Compiler Approach. [7] CHEN Chang-Jiu and CHENG Wei-Min. Reducing the TLB Context Switching Miss Ratio With Banked and Prefetching Mechanism.