Vertically Integrated Analysis and Transformation for Embedded Software John Regehr University of Utah.

Slides:



Advertisements
Similar presentations
Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Advertisements

Ensuring Operating System Kernel Integrity with OSck By Owen S. Hofmann Alan M. Dunn Sangman Kim Indrajit Roy Emmett Witchel Kent State University College.
Research Overview John Regehr Fall Part 1 – Embedded Systems.
Code Compaction of an Operating System Kernel Haifeng He, John Trimble, Somu Perianayagam, Saumya Debray, Gregory Andrews Computer Science Department.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
Overview: Chapter 7  Sensor node platforms must contend with many issues  Energy consumption  Sensing environment  Networking  Real-time constraints.
The Path to Multi-core Tools Paul Petersen. Multi-coreToolsThePathTo 2 Outline Motivation Where are we now What is easy to do next What is missing.
Fast Paths in Concurrent Programs Wen Xu, Princeton University Sanjeev Kumar, Intel Labs. Kai Li, Princeton University.
Computer Systems/Operating Systems - Class 8
Introduction to Operating Systems CS-2301 B-term Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials.
Eliminating Stack Overflow by Abstract Interpretation John Regehr Alastair Reid Kirk Webb University of Utah.
Static Analysis of Embedded C Code John Regehr University of Utah Joint work with Nathan Cooprider.
1 HOIST: A System for Automatically Deriving Static Analyzers for Embedded Systems John Regehr Alastair Reid School of Computing, University of Utah.
1 Efficient Memory Safety for TinyOS Nathan Cooprider Will Archer Eric Eide David Gay † John Regehr University of Utah School of Computing † Intel Research.
Scheduling for Embedded Real-Time Systems Amit Mahajan and Haibo.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
Analysis of power dissipation in embedded systems using real-time operating systems Dick, R.P. Lakshminarayana, G. Raghunathan, A. Jha, N.K. Dept. of Electr.
Random Testing of Interrupt-Driven Software John Regehr University of Utah.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
Lock Inference for Systems Software John Regehr Alastair Reid University of Utah March 17, 2003.
Chapter 13 Embedded Systems
1 Efficient Memory Safety for TinyOS 2.1 Yang Chen Nathan Cooprider Will Archer Eric Eide David Gay † John Regehr University of Utah School of Computing.
Operating Systems Lecture # 3. Recap Hardware Operating System Application System Call Trap Hardware Trap Processor.
High-Level Optimizations for Low-Level Software John Regehr University of Utah.
Concurrency, Threads, and Events Robbert van Renesse.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
1 Chapter 13 Embedded Systems Embedded Systems Characteristics of Embedded Operating Systems.
Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis John Regehr Alastair Reid Kirk Webb Michael Parker Jay Lepreau School.
CS527: (Advanced) Topics in Software Engineering Overview of Software Quality Assurance Tao Xie ©D. Marinov, T. Xie.
Course Outline DayContents Day 1 Introduction Motivation, definitions, properties of embedded systems, outline of the current course How to specify embedded.
A Portable Virtual Machine for Program Debugging and Directing Camil Demetrescu University of Rome “La Sapienza” Irene Finocchi University of Rome “Tor.
EECE **** Embedded System Design
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
Threads, Thread management & Resource Management.
1 Efficient Type and Memory Safety for Tiny Embedded Systems John Regehr Nathan Cooprider Will Archer Eric Eide University of Utah School of Computing.
1 Confidential Enterprise Solutions Group Process and Threads.
Hardware-software Interface Xiaofeng Fan
1 Optimizing compiler tools and building blocks project Alexander Drozdov, PhD Sergey Novikov, PhD.
CML SSDM: Smart Stack Data Management for Software Managed Multicores Jing Lu Ke Bai, and Aviral Shrivastava Compiler Microarchitecture Lab Arizona State.
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 19 & 20 Instruction Formats PDP-8,PDP-10,PDP-11 & VAX Course Instructor: Engr. Aisha Danish.
System-level power analysis and estimation September 20, 2006 Chong-Min Kyung.
CS 484 Designing Parallel Algorithms Designing a parallel algorithm is not easy. There is no recipe or magical ingredient Except creativity We can benefit.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 11 – gdb and Debugging.
CS- 492 : Distributed system & Parallel Processing Lecture 7: Sun: 15/5/1435 Foundations of designing parallel algorithms and shared memory models Lecturer/
Stored Program A stored-program digital computer is one that keeps its programmed instructions, as well as its data, in read-write,
Course: COMS-E6125 Professor: Gail E. Kaiser Student: Shanghao Li (sl2967)
Static WCET Analysis vs. Measurement: What is the Right Way to Assess Real-Time Task Timing? Worst Case Execution Time Prediction by Static Program Analysis.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
Threads, Thread management & Resource Management.
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
High Performance Embedded Computing © 2007 Elsevier Lecture 10: Code Generation Embedded Computing Systems Michael Schulte Based on slides and textbook.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
The Structuring of Systems Using Upcalls By David D. Clark Presented by Samuel Moffatt.
Embedded Real-Time Systems
Processes and threads.
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
YAHMD - Yet Another Heap Memory Debugger
Task Scheduling for Multicore CPUs and NUMA Systems
Capriccio – A Thread Model
High Coverage Detection of Input-Related Security Faults
CSCI1600: Embedded and Real Time Software
Performance Optimization for Embedded Software
Lecture Topics: 11/1 General Operating System Concepts Processes
Lecture 4: Instruction Set Design/Pipelining
COMP755 Advanced Operating Systems
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Vertically Integrated Analysis and Transformation for Embedded Software John Regehr University of Utah

Embedded Systems  Most new microprocessors are embedded  Consumer electronics  Vehicle control systems  Medical equipment  Smart dust

Problem  Compared to general-purpose compilation:  We have a lot more information  We have a lot more constraints  So, using standard toolchain:  Ignores most of the information  Ignores most of the constraints  However:  Strong economic incentive to avoid reinventing the wheel

Vertically Integrated Program Analysis (VIPA)  Framework for combining analyses and transformations operating on a system at multiple levels of abstraction

(1) What good is gcc?  Traditional C/C++ compilers pretty close to end of the line with respect to optimizing embedded SW  However, C/C++ still useful for a while  VIPA:  Keep the compiler around as a code generator  But do analysis and coarse-grain transformation in separate tools

(2) Tradeoffs are hard  Embedded compilers must make difficult tradeoffs between goals  Power use, code size, data size, avoid crashing, etc…  Each embedded system has a different prioritization for these goals  Standard compilers are ill- equipped to do what we want  Mechanism and policy all mixed up

(3) Levels of abstraction  Analyses and transformations need to be performed at multiple levels of abstraction  Model – task mapping, exclusive modes, real-time deadlines  Source – concurrency, exceptions  Binary – memory usage, execution time, bit widths  Standard compilers are ill- equipped to do what we want

(4) Tools are myopic  Analysis tools often return binary results  “System is not schedulable”  “Network acceptor thread contains a potential stack overflow”  Often more information is available but hidden  Which task is blocking schedulability?  What is the path to max stack depth?  This information can be exploited

(5) Analysis good!  Increasing asymmetry between  Resources on a PC and  Resources on a typical embedded system  Program analysis and transformation tools are rapidly becoming more useful and effective  The asymmetry can and should be exploited

VIPA Example 1  Given:  Tool to compute a static upper bound on stack memory usage  Global function inlining tool  Goal:  Reduce the stack memory requirements of an embedded system

Reducing Stack Depth [EMSOFT 2003]  Observation: Function inlining often decreases stack requirements  Avoids pushing registers, frame pointer, return address  Called code can be specialized  Strategy: Use stack tool output as input to global inlining tool

Feedback Loop C compiler (source) stack analyzer (binary) whole program inliner (source) policy here search heuristic

Challenges 1. Inlining causes code bloat  Solution: Minimize user-defined cost function that balances stack memory and code size 2. Inlining sometimes increases stack depth!  Solution: Trial compilations 3. Search space is exponential in number of static function calls  Solution: Heuristic search

Results  Averaged over a bunch of TinyOS kernels…  60% reduction in stack requirements compared to no inlining  32% reduction compared to whole- program inlining not aimed at reducing stack depth

Result Details

VIPA Example 2  Given:  WCET analysis  Synchronization analysis  Race / deadlock detection  Synchronization transformation  Lock elimination  Lock coarsening  Real-time-aware task mapping  Goal: balance response time, efficiency, and memory use

Feedback Loop 2 WCET analysis (binary) synch. analysis (source) C compiler (source) task mapping (model) synch. transform. (source) search heuristic

VIPA Example N  Given:  Many, many tools that exist for analyzing and transforming embedded software  Goal:  Rapidly produce efficient and reliable software

What is VIPA?  Exchange formats for analysis results  Annotated callgraph  Annotated task set  Others?  Type and alias information  Heap allocation / deallocation protocols  Tools “opened up” to read/write the exchange formats

What is VIPA? Cont’d  Strategies for connecting tools  E.g. feedback loops  Policies  Manage tradeoffs between goals  Auxiliary tools (that don’t exist yet)  GUI to help developers specify tradeoffs  Manage interactions between analyses

Research Challenges  Maintaining invariants  Transformations will invalidate some analysis results  Avoiding bloat in the trusted computing base  Embedded developers have a hard time trusting even the compiler  Avoiding long build times  Providing good error messages

Related Work  Phasing of optimizations inside compilers  Model based design of embedded software  MOBIES analysis interchange format

Conclusion  Benefits for developers:  Keep using the standard toolchain  Write straightforward code  Fewer fragile manual specializations  Explicit support for meeting design goals in the presence of tradeoffs  Policies externalized  Benefit for researchers:  Lots of cool tools out there – let’s make them play together

More info here: