apps with hardware - usenix · apps with hardware enabling run-time ... user (operating system)...

53
Apps with Hardware Enabling Run-time Architectural Customization in Smart Phones Michael Coughlin,Ali Ismail, Eric Keller University of Colorado Boulder

Upload: doliem

Post on 05-Apr-2018

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

AppswithHardwareEnablingRun-timeArchitecturalCustomizationinSmartPhones

MichaelCoughlin,AliIsmail,EricKellerUniversityofColoradoBoulder

Page 2: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

MobileDevices

2

Devicesaredesignedaroundcertainrestrictions

Thisleadsvendorstomaketradeoffs

Whatifusersanddeveloperscouldchoose?

Page 3: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Vision:SmartPhonewithanFPGA

3

HW SW

Android

FPGA ARM

App

Page 4: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Software-definedRadio

4

Page 5: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

High-performanceComputing

5

Cryptography

http://www.nallatech.com/40gbit-aes-encryption-using-opencl-and-fpgas/

Analytics

http://www.datanami.com/2015/03/10/fpga-system-smokes-spark-on-streaming-analytics/

Page 6: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

ArchitecturalEnhancements

6

Somniloquy (NSDI09)(SEC04)

Page 7: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Whyisnowtherighttime?

7

SoCs withProgrammableLogiccoupledwithARMCortexA9 (sameasiPhone4andmanyothersmartphones)

High-levelSynthesisWriteC/C++/SystemC /OpenCL code

Page 8: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

8

FundamentalProblem:

SharingtheFPGAbetweenapplications

Page 9: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Whatwecanalreadydo

9

Processor

Apploads:softwarerunsonprocessor,FPGAconfiguredwithhardware

FPGA

AppX

AppXHardware

AppXSoftware

Page 10: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Whatwecanalreadydo

10

Thisiscurrentlypossible– run-timereconfiguration

Processor FPGAAppXHardware

AppXSoftware

Apploads:softwarerunsonprocessor,FPGAconfiguredwithhardware

Sortof

Page 11: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Whatwecan’tdo

11

Whatifwehavetwoapps?

Processor FPGAAppXHardware

AppXSoftware

AppY

AppYHardware

AppYSoftware

Page 12: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Whatwecan’tdo

12

Whatifit’sasinglechip(andsomeI/OgoesthroughtheFPGA)

I/O

Processor FPGAAppXHardware

AppXSoftware

I/O

AppY

AppYHardware

AppYSoftware

Page 13: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Overadecadeofresearchhasproposedtwomainsolutions:– Run-timeplace-and-route– Slot-basedreconfiguration

Whyhasn’tthisbeensolvedbefore?

13

Page 14: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• ThereisfreespaceintheFPGA• Placeanewmodulethere

14

Approach1:Run-timePlace/Route

Page 15: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Routingcanfail• Routingisalsoverytimeconsuming

• Therefore,isnotpractical

15

Approach1:Run-timePlace/Route

Page 16: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• IdenticalemptyregionsarereservedinFPGA

• Constraintoolsto:– Notusewires/logicinsideofslots– Useexactsamewiresforinterface

16

Approach2:Slot-BasedReconfiguration

Slot1

Slot2

Slot3

Page 17: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Hardwareisloadedintoslots• Problem:ifotherlogicexists,wireroutingbecomesveryconstrained

• Therefore,isalsonotpractical

17

Approach2:Slot-BasedReconfiguration

Slot1

Slot2

Slot3

Page 18: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Run-timePlaceandRoute– Isverycomputationallyexpensive– Canpossiblyfail

• Slot-baseReconfiguration– Constrainedroutingisveryrestrictiveandnotapplicablegenerally

• Therefore,previousresearchisnotpractical

PreviousResearch

18

Page 19: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• AllowsforsharingoftheFPGAbetweengeneralapps

• Usesexistingvendortechnologies

• Adoptstheideaofslotsfrompreviousresearch

• CloudRTRmakesexistingvendortechnologyworkforgeneralapps

IntroducingCloudRTR

19

Page 20: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

TheAppDeploymentModel

20

Page 21: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

CloudRTR

21

Manufacturers

Developer

CloudRTR

Android

FPGA ARM

Consumer

StaticDesign

1 2 3

StaticDesign

1 2 3

StaticDesign

1 2 3

Page 22: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Createsastaticdesign– Alllogicthatdoesnotchange

• Designincludesareasreservedforslots

• Sendsthistothecloudcompiler

Manufacturer

22

StaticDesign

1 2 3

GPU AXI

Page 23: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Createanappusingexistingtools

• CreateahardwaredefinitioninC

Developer

23

boolexample(ap_uint<32>*inap_uint<32>*out,bool*enabled,

)

Page 24: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Compileshardwareforeachapp– Foreachdevicevariant– Foreachslotineachvariant

AppStore(CloudCompiler)

24

X

App

[device1:[slot1:a.bit,slot2:b.bit,slot3:c.bit]]

[device2:[slot1:d.bit,slot2:e.bit]]

CloudCompiler

StaticDesign

1 2 3

StaticDesign

1 2 3

StaticDesign

1 2 3

Page 25: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Asystemservicemanagesslots

• Downloadedappsincludeslothardware

• Thesystemserviceloadsapphardwareforapps

User(OperatingSystem)

25

.apk:[device1:[slot1:a.bit,slot2:b.bit,slot3:c.bit]]

FPGAGPU AXI

1 2 3X

Page 26: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Theslotmanagerenforcesaccesstohardware

• However,FPGAscantheoreticallydirectlyaccesssensitiveresources(whilebypassingtheOS)

• Asecureloadingsystemensuresthatappscannotaccesssensitiveresources

SecurityConsiderations

26

Page 27: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Secureloadingsystem

27

Processor

FPGA

Howdoesthesecureloaderwork?

Slot1 Slot2

MemoryController

OperatingSystem SignatureVerification

ReconfigurationModule

ICAP

Page 28: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Secureloadingsystem

28

Processor

FPGA

Slot2

MemoryController

OperatingSystem SignatureVerification

ReconfigurationModule

ICAP

Signedmodule

Slot1

TheOSwantstoreconfigureSlot1

Page 29: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Secureloadingsystem

29

Processor

FPGA

Slot1 Slot2

MemoryController

OperatingSystem SignatureVerification

ReconfigurationModule

ICAP

Signedmodule

Thesignatureofthemoduleisverified

Page 30: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Secureloadingsystem

30

Processor

FPGA

Slot1 Slot2

MemoryController

OperatingSystem SignatureVerification

ReconfigurationModule

ICAP

Signedmodule

ThemoduleiswrittentotheICAP

Page 31: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Secureloadingsystem

31

Processor

FPGA

Slot1 Slot2

MemoryController

OperatingSystem SignatureVerification

ReconfigurationModule

ICAPSignedmodule

TheICAPperformsthereconfiguration

Page 32: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Istherevalueinappswithhardware?

• Isthecloud-basedcompilationofCloudRTRpractical?

Evaluation

32

Page 33: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Microbenchmark1:QAMdemodulator

33

4ordersofmagnitude

Page 34: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Microbenchmark2:AES

34

FPGAis3xvs.

OpenSSL

Page 35: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Wealsoimplementedahardwarememoryscanner

• ItcanscantheentireaddressspacetransparentlytotheOS– 2.7%memoryreadperformancehit– 5.5%memorywriteperformancehit

• WetestedthisusingtheLMbench testbench

Microbenchmark3:MemoryScanner

35

Page 36: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Brute-forcecompilation

36

GooglePlayStore Figures

#ofAppsas of Dec 14 1.43Million

AverageMonthlyAppGrowth 6.10%

#ofAppsforJanuary16 117,521

provided by AppFigures.

Page 37: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Brute-forcecompilation

37

Max#ofApps Compiledperday

#ofSlots

Apps

2 121

3 96

4 76

5 59

6 51

2SlotsRequirements %ofAprilApps thatuseHardware(#ofAppsUploadedperDay)

0.1(3)

1(34)

10(347)

#ofDeviceVariants

#ofMachines RequiredtoCompileApps

1 1 1 310 1 3 29100 3 29 2881000 29 288 2875

Reasonableformostscenarios

Page 38: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Brute-forcecompilation

38

6SlotsRequirements %ofAprilApps thatuseHardware(#ofAppsUploadedperDay)

0.1(3)

1(34)

10(347)

#ofDeviceVariants

#ofMachines RequiredtoCompileApps

1 1 1 710 1 7 69100 7 69 6811000 69 681 6809

Max#ofApps Compiledperday

#ofSlots

Apps

2 121

3 96

4 76

5 59

6 51

Stillreasonableformostscenarios

Page 39: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Compilationcanbeoffloadedtomanufacturers

• Manufacturerswilllikelyreusedesigns (Qualcomm,ARMchipsareoftenreused)

• Developerswilllikelyuselibraries

Reducingthenumbersevenmore

39

Page 40: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• ToronAndroid

• AESisonthecriticalpath

• ExamineAESasanintegrationstudy

ImplementationCaseStudy:Orbot

40

Page 41: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Whatwefound:• Memoryoperationsarethebottleneck– Datamustbeplacedcorrectlyinmemory– Userspace I/Ohashighoverhead– ManysystemcallsareincompatiblewithUIO

• Itiseasiertobuildanapplicationfromground-up

ImplementationCaseStudy:Orbot

41

Page 42: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Wehavepresentedourvisionofappswithhardware

• CloudRTRimplementsourvisionbyleveragingthemobileappdeploymentmodel

• Wehavedemonstratedthevalueandpracticalityofourvision

Conclusion

42

Page 43: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Email:[email protected]• Sourcecode:https://github.com/nsr-colorado/cloud-rtr

Questions?

43

Page 44: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

VendorSupportedPartialReconfiguration

44

TargetFPGA

StaticDesign

DynamicModule (s)

Vendor tools

• base.bit• partial_1.bit• partial_2.bit

(Partialbitstreams workin1location,andarejustforbase.bit)

Goal:Spacesavingforcustomer

Page 45: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Crypto– Asymmetric(RSA,ECDSA,etc…)– Symmetric(3DES,Twofish,Blowfish)

• Softprocessors• Encoding– Networkencoding(Reed-Solmon,etc…)– Mediaencoding(JPEG,MPEG,etc…)

• DSP– FFTs,Filters,etc…

ExamplesofLibraries

45

Page 46: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

boolexample(ap_uint<32>*inap_uint<32>*out,bool*enabled,

)

Examplehardwaredefinition

46

Page 47: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

typedef ap_uint<32>uint32_t_hw;typedef hls::stream<uint32_t_hw>mem_stream32;

boolaes(volatileunsignedintm_mm2s_ctl[500],volatileunsignedintm_s2mm_ctl[500],volatileunsignedsourceAddress,ap_uint<128>*key_in,ap_uint<128>*iv,volatileunsigneddestinationAddress,unsignedint numBytes,intmode,mem_stream32&s_in,mem_stream32&s_out

)

Morecomplicatedhardwaredefinition

47

Page 48: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Theproblem

48

Let’sexaminetheproblem

Processor FPGA

AppXhardware

AppXsoftware

I/O

I/O

Page 49: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Theproblem

49

Processor FPGA

AppXhardware

AppXsoftware

I/O

I/O

First,therearevariousinterconnectsneeded

Page 50: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Theproblem

50

Processor FPGA

AppXhardware

AppXsoftware

I/O

I/O

Controlsignalsandlogicmustalsobeplaced

Page 51: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

Theproblem

51

Processor FPGA

AppXhardware

AppXsoftware

I/O

I/O

Theappmayhavecomplexinputs,orneedtointeractwithotherlogic

Page 52: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• AtrustedsystemisbootedwithSecureBoot

• Includedisastaticmodulethatreconfiguresslots

• Thismoduleonlyallowssignedmodulesintoslotsthataccesssensitiveresources

Secureloadingsystem

52

Page 53: Apps with Hardware - USENIX · Apps with Hardware Enabling Run-time ... User (Operating System) 25.apk: [device 1: [slot1: a.bit, ... • Cloud RTR implements our vision by leveraging

• Buildsoffofpriorresearch…

• …butinawaythatiscompatiblewithvendortools

• Todothis,weleveragethedeploymentmodelformobileapps

Oursolution

53