outline - brandon luciaa bug in an intermittent program main {while (true) {m, n =...

36

Upload: others

Post on 03-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c
BRANDON LUCIA
Page 2: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Outline

Energy-harvesting devices

Debugging intermittent programs

Energy-interference-free Debugger (EDB)

Evaluation: debugging with EDB

Related work and conclusion●

2

Page 3: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c
Page 4: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Anatomy of an Energy-Harvesting Computer

4

Energy Harvester Processor

Energy Harvesting DeviceEnergy Source

Capacitor

Page 5: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c
Page 6: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c
Page 7: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

A Bug in an Intermittent Program

main { while (TRUE) {

m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n) }}

Source Code: fibonacci.c

7

1 1

Expected program state Time Observed program state

Non-volatilememory

fib_list

1 1 2

1 1 2 3

1 1 2 3 5

tail

Page 8: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

A Bug in an Intermittent Program

main { while (TRUE) {

m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n) }}

Source Code: fibonacci.c

8

1 1 1 1

Expected program state Time Observed program state

Non-volatilememory

fib_list

1 1 2 1 1 2

1 1 21 1 2 3

1 1 2 3 5 1 1 2 3 8

3

tail

Page 9: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

A Bug in an Intermittent Program

main { while (TRUE) {

m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n) }}

Source Code: fibonacci.c

9

1 1 1 1

Expected program state Time Observed program state

Non-volatilememory

fib_list

1 1 2 1 1 2

1 1 21 1 2 3

1 1 2 3 5 1 1 2 3 8

3

implementation is not correct if interruptedtail

reboot

Page 10: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Debugging an Intermittent Program

Option Clog events on device

Option AJTAG debugger

Option BOscilloscope

10

Page 11: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Debugging an Intermittent Program

JTAG

gdb>WISP

Option Clog events on device

Option AJTAG debugger

Option BOscilloscope

Hides bugs

11

Page 12: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Debugging an Intermittent Program

JTAG

gdb>WISP WISP

Option Clog events on device

Option AJTAG debugger

Option BOscilloscope

Hides bugs No program state

12

Page 13: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Debugging an Intermittent Program

JTAG

gdb> WISPWISP WISP

Option Clog events on device

Option AJTAG debugger

Option BOscilloscope

13

Costs energy and spaceHides bugs No program state

Page 14: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Debugging an Intermittent Program

JTAG

gdb> WISPWISP WISP

Option Clog events on device

Option AJTAG debugger

Option BOscilloscope

14

EDB

Passiv

e

Inte

r-fe

renc

e -fr

e e

Interactive

Costs energy and spaceHides bugs No program state

Our main contribution is the design and implementation of EDB, an energy-interference-free debugger for intermittent energy-harvesting platforms.

Page 15: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

EDB: Energy-interference-free Debugger

Energy-harvestingdevice

EDB

En

erg

y

Implementation possibilities:

● off board● on board● in silicon

15

Energy-harvesting Device

EDBMCU

Digital Level Shifters

USB host

Charge / Discharge Analog

Buffers

Vre

g

Vca

p

RFI

D I/O

Inte

rru

pt

Code M

ark

ers

UA

RT

Page 16: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

EDB Capabilities

Passive

Trace energy level

Trace program events

Decode I/O messages

16

Active

Save energy level

Set energy level

Supply power

Mechanisms

EDB is energy-interference-free

Properties

Page 17: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

2.0 2.5 3.0 3.5 4.0 4.5 5.01.7

1.8

1.9

2.0

2.1

2.2

2.3

2.4

Time (s)

Capa

Cap

aci

tor

Volt

ag

e (

V)

EDB Joins Energy and Program Events

EDB enables new debugging primitives

> break at line 42> break at voltage 1.85V> runBREAKPOINT at line 42, V=2.05V

> continueBREAKPOINT at line 64, V=1.85V

EDB console

Energy-awareWatchpoints

EnergyGuards

I/OMonitors

Keep-aliveAssertions

Energy State Program State

17

Page 18: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Outline

Energy-harvesting devices

Debugging intermittent programs

Energy-interference-free Debugger (EDB)

Evaluation: debugging with EDB

Related work and conclusion●

18

Page 19: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Evaluation Roadmap

Case studies: applying EDB to debugging tasks

● (I) Zero-cost instrumentation● (II) Keep-alive assertions● (III) I/O monitoring

Quantifying energy-interference

● Leakage current● Save-restore resolution

19

Page 20: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Evaluation Case-Study (I):Zero-cost Instrumentation

Program: generate a list of Fibonacci values

main:

while True: append(list, value)

broken_fibonacci.c

20

Page 21: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Evaluation Case-Study (I):Zero-cost Instrumentation

Program: generate a list of Fibonacci values

Problem: invalid values observed on harvested energy●

main:

while True: append(list, value)

broken_fibonacci.c

1 1 2 3 8

21

Page 22: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Evaluation Case-Study (I):Zero-cost Instrumentation

Program: generate a list of Fibonacci values

Problem: invalid values observed on harvested energy●

Approach: add an invariant check

main:

while True: append(list, value)

broken_fibonacci.c

ni = n

i-2 + n

i-1

1 1 2 3 8

22

Page 23: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Evaluation Case-Study (I):Zero-cost Instrumentation

Program: generate a list of Fibonacci values

Problem: invalid values observed on harvested energy●

Approach: add an invariant check

main:

while True: append(list, value)

broken_fibonacci.c

for value in list: assert(value is valid)

ni = n

i-2 + n

i-1

1 1 2 3 8

} invariant check on reboot

23

Page 24: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c
Page 25: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c
Page 26: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

2.0

2.5

Loop

40 50 60 70 80 90 100

Volt

age (

V) 3.0

+ 40 + 50 + 60 + 70 + 80 + 90 + 100

Time (ms)

...

Evaluation Case-Study (II):Keep-Alive Assertions

main:

while True: append(...)

broken_fibonacci.c

26

unexpectedbehavior

main loopruns

Without EDB

later

Without EDB

Page 27: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

2.0

2.5

Loop

40 50 60 70 80 90 100

Volt

age (

V) 3.0

+ 40 + 50 + 60 + 70 + 80 + 90 + 100

Time (ms)

...

Evaluation Case-Study (II):Keep-Alive Assertions

main:

while True: append(...)

broken_fibonacci.c

27

unexpectedbehavior

main loopruns

Without EDB

later

Without EDB

Page 28: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

2.0

2.5

Loop

40 50 60 70 80 90 100

Volt

age (

V) 3.0

+ 40 + 50 + 60 + 70 + 80 + 90 + 100

Time (ms)

...

Evaluation Case-Study (II):Keep-Alive Assertions

main:

while True: append(...) assert(...)

broken_fibonacci.c

28

unexpectedbehavior

main loopruns

Without EDB

later

Without EDB

Diagnosis strategy

Page 29: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

2.0

2.5

Loop

LoopLoop

40 50 60 70 80 90 100

2.0

2.5

3.0

Volt

ag

e (

V)

Volt

ag

e (

V)

Time (ms)

3.0

+ 40 + 50 + 60 + 70 + 80 + 90 + 100

1

Tethered power

...

...

Evaluation Case-Study (II):Keep-Alive Assertions

main:

while True: append(...) assert(...)

broken_fibonacci.c

29

EDB keep-alive assert brings the familiar primitive to energy-harvesting platforms.

Assertfailed

Interactivesession

Diagnosis strategy

With EDB

later

Without EDB

later

Without EDB

With EDB

unexpectedbehavior

main loopruns

Page 30: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

1.6

1.8

2.0

2.2

2.4

3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0

RSP_GENERIC

CMD_QUERY

CMD_QUERYREP

5.10 5.15 5.20 5.25

Time (s)

RSP_GENERIC

CMD_QUERY

Volt

ag

e (

V)

Mess

ag

e ID

Evaluation Case-Study (III):Monitoring of RFID I/O

REQUESTS

REPLIES

EDB I/O monitorenables protocoldebugging.

corr

elat

ed

energy level

I/O

30

Messages that reached the device

Energy state

Page 31: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Evaluation Roadmap

Case studies: applying EDB to debugging tasks

● (I) Zero-cost instrumentation● (II) Keep-alive assertions● (III) I/O monitoring

Quantifying energy-interference

● Leakage current● Save-restore resolution

31

Page 32: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Evaluation: Energy-interference:Worst-case Leakage Current

Energy Level Sense & Set

Program Event Monitoring

EDB-TargetInterop

I/OMonitoring

Ileak

≤ 850 nA⋍ 0.4% of min. MCU current

32

MCU MCU\Code Markers

Power System

Charge Monitor

Drain

n

InterruptCmd Interface

I/O Device #1

I/O Device #d

Monitor Rx/Tx

Monitor Rx/Tx

RF In

DC+

-

I/O Monitoring Program Event Monitoring

EDBEnergy-harvesting

device

Debugger-Target Interop

Energy Monitoring & Manipulation

Sources of leakage current

Page 33: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Time (s)

Cap

aci

tor

Volt

ag

e (

V)

Save to 1.8V, tether at 2.3V, restore to 1.8V

Evaluation: Energy-interference:Save-Restore Accuracy

∆V error

EDB saves andrestores energylevel with a finiteprecision, limitedby hardware.

∆V = 54 mV ≋ 4% of energy capacity on WISP device (47µF)

33

Save energy level

Restore energy level

Tetherpower

Page 34: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Related Work

Intermittent computing

Emulation and simulation of energy sources

Debugging battery-powered wireless sensor nodes

Ekho [J. Hester, T. Scott, J. Sorber. SenSys ’14]

CRFID Crash Test Sim [J. Gummeson, S. Clark, K. Fu, D. Ganesan. MobiSys ’10]

Clairvoyant [J. Yang, M. L. Soffa, L. Selavo, K. Whitehouse. SenSys ’07]

Mementos [B. Ransford, J. Sorber, K. Fu. ASPLOS '11]

DINO [B. Lucia, B. Ransford. PLDI '15]

34

Page 35: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c

Conclusion

35

Energy-interference-free Debugger (EDB) is the first system to bring advanced debugging capabilities

to intermittent energy-harvesting platforms.

http://intermittent.systems/

Page 36: Outline - Brandon LuciaA Bug in an Intermittent Program main {while (TRUE) {m, n = get_last_two_elements(fib_list) append_element(fib_list, m + n)}} Source Code: fibonacci.c