OpenBSD s New Suspend and Resume Framework



Similar documents
Example of Standard API

Introduction. What is an Operating System?

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

Laptop 2.0. Timo Hönig, Holger Macht, Helmut Schaa. 31. May Laptop 2.0

Frontiers in Cyber Security: Beyond the OS

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

1 Intel Smart Connect Technology Installation Guide:

The easy way! Mark Maszak. Jane Lawrence Program Manager Microsoft. Microsoft

CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure

Plug and Play for Windows 2000

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

USB Bare Metal Restore: Getting Started

The PC Boot Process - Windows XP.

BHyVe. BSD Hypervisor. Neel Natu Peter Grehan

RTOS Debugger for ecos

OPERATING SYSTEM SERVICES

Chapter 1 Computer System Overview

Release Notes. Please refer to the Intel RealSense 3D Camera Software License.rtf for license terms and conditions.

Using GIGABYTE Notebook for the First Time

BIOS Update Release Notes

Input / Output and I/O Strategies

PCI-to-SATA RAID Adapter AEC-6890M. User s Manual Version:1.0

CSE 265: System and Network Administration

Chapter 2 System Structures

A Brief Tutorial on Power Management in Computer Systems. David Chalupsky, Emily Qi, & Ilango Ganga Intel Corporation March 13, 2007

Extending the swsusp Hibernation Framework to ARM. Russell Dill

ReactOS is (not) Windows. Windows internals and why ReactOS couldn t just use a Linux kernel

Race to bare metal: UEFI and hypervisors

CSE 265: System and Network Administration. CSE 265: System and Network Administration

Virtual Private Systems for FreeBSD

Guardian: Hypervisor as Security Foothold for Personal Computers

1. Computer System Structure and Components

IOS110. Virtualization 5/27/2014 1

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Computer Setup (F10) Utility Guide Evo Desktop Family Evo Workstation Family

Using Process Monitor

PARALLELS SERVER 4 BARE METAL README

VMWare Workstation 11 Installation MICROSOFT WINDOWS SERVER 2008 R2 STANDARD ENTERPRISE ED.

BIOS Update Release Notes

Linux Power Management

Operating Systems 4 th Class

Computer Setup (F10) Utility Guide HP Compaq dx2200 Microtower Business PC

I/O Device and Drivers

I/O. Input/Output. Types of devices. Interface. Computer hardware

v1 System Requirements 7/11/07

OSes. Arvind Seshadri Mark Luk Ning Qu Adrian Perrig SOSP2007. CyLab of CMU. SecVisor: A Tiny Hypervisor to Provide

Chapter 3 Operating-System Structures

BIOS Update Release Notes

Using GIGABYTE Notebook for the First Time

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

AP ENPS ANYWHERE. Hardware and software requirements

HP Z220, Z420, Z620, and Z820 Workstations Microsoft Windows XP Installation Reference Guide

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

Intel Desktop Board D925XECV2 Specification Update

HP BUSINESS NOTEBOOK PC F10 SETUP OVERVIEW

US-122L/US-144 Release Notes

vpro Prerequisites and Trade-offs for the dc7700 Business PC with Intel vpro Technology

Have both hardware and software. Want to hide the details from the programmer (user).

Intel Server Board S5000PALR Intel Server System SR1500ALR

Intel Server Board S3420GPV

DisplayLink USB Graphics User Manual

Computer Systems Structure Input/Output

IDE/ATA Interface. Objectives. IDE Interface. IDE Interface

Using AORUS Notebook for the First Time

DSD Native DAC Setup Guide

Chapter 02: Computer Organization. Lesson 04: Functional units and components in a computer organization Part 3 Bus Structures

13 Managing Devices. Your computer is an assembly of many components from different manufacturers. LESSON OBJECTIVES

Booting XP Embedded from USB Flash By Sean D. Liming and John R. Malin

Windows XP Professional x64 Edition for HP Workstations - FAQ

CSE 265: System and Network Administration. CSE 265: System and Network Administration

sndio OpenBSD audio & MIDI framework for music and desktop applications

UEFI on Dell BizClient Platforms

Dynamode External USB3.0 Dual RAID Encloure. User Manual.

PC computer configurations & Windows optimizations (Updated November 2012)

Using GIGABYTE Notebook for the First Time

Monitoring PostgreSQL database with Verax NMS

Machine check handling on Linux

Using GIGABYTE Notebook for the First Time

Models For Modeling and Measuring the Performance of a Xen Virtual Server

Windows 7 XP Mode for HP Business PCs

Using GIGABYTE Notebook for the First Time

Hyper-V vs ESX at the datacenter

Intel Server System S7000FC4URE-HWR

Devices and Device Controllers

About Parallels Desktop 7 for Mac

Intel architecture. Platform Basics. White Paper Todd Langley Systems Engineer/ Architect Intel Corporation. September 2010

ASF: Standards-based Systems Management. Providing remote access and manageability in OS-absent environments

Unit 4 i5/os Work Management

SD Specifications Part A2 SD Host Controller Simplified Specification

CS161: Operating Systems

How to design and implement firmware for embedded systems

Date: December 2009 Version: 1.0. How Does Xen Work?

Release Notes

Attacking Hypervisors via Firmware and Hardware

A Hypervisor IPS based on Hardware assisted Virtualization Technology

Operating System Organization. Purpose of an OS

Transcription:

OpenBSD s New Suspend and Resume Framework Paul Irofti pirofti@openbsd.org 10th European BSD Conference October 6 9, 2011 Maarssen, The Netherlands

Outline 1 Introduction History The Winds of Change 2 Device Configuration 3 Activate Functions Changes Quiesce 4 APM and ACPI Design APM ACPI 5 Issues Overview Quirks 6 Conclusions

History Early Days KISS Power up Power off

History Time Passes... Power Management Computers start consuming less power The system gains some power control APM enters the scene Machines can suspend and resume via APM

The Winds of Change ACPI The Machine Gets To Be In Charge In theory: Knob fiddling Better control More features

The Winds of Change Implications Reality Check Extremely complex Specifications that nobody respects Every vendor has its own quirks The machine has to do everything

The Winds of Change Results ACPI New power management approach Affects device drivers as well Hard to get right Fit into the APM logic Lots of system changes New MI suspend/resume framework

Structure Kernel Device Tracking Tree hierarchy Everything starts at mainbus(4) Device drivers attach to the proper parent device

Example Dependency view A memory stick is attached to the system sd(4) scsibus(4) umass(4) uhub(4) usb(4) ehci(4) pci(4) mainbus(4) The stick becomes available to the user as sd0.

Configuration Specific functionality Match proper device driver matching Attach attach to a proper place in the device tree Activate activate the device Deactivate turn off the device Detach remove it from the device tree

Suspend and Resume Low Power States Implications ACPI support required: New system states Driver awareness Device notification of state changes Result: The need for new activate actions in autoconf(9)

Changes New Actions DVACT_QUIESCE Prepare to suspend (discussed later on). DVACT_SUSPEND Set the device drivers in a suspend state. DVACT_RESUME Resume the device drivers back to running state.

Changes Expanding autoconf(9) Code Changes config_suspend() Similar with attach/detach activate/deactivate Signals the drivers config_activate_children() Handle the new cases config_suspend() the device s children

Quiesce What is Quiesce? Definition The action of pausing or modifying a given process so that data consistency can be achieved.

Quiesce Why is it important? Because... Some devices need pre-suspend notifications to: Finish-up disk I/O Dump audio buffers VT switch out of X Wait on other actions to finish Do misc. operations requiring a normal running state

Design Starting Point APM Machines APM userland daemon Userland notifies the kernel Kernel APM MD state machines Lots of MD code, specially for devices

Design Integrating Other PM Implementations Rules Keep the same APM mechanism. Mold other implementations into it. Make it opaque to the userland. Let the drivers do the work for them. Implementation specific bits in MD Mostly whacky assembly routines

Design ACPI Implementation Reiterating... ACPI will be fit in the same model Create a fake apm-like kernel ACPI state-machine Keep the same code-paths all the way down No difference from a userland perspective Only the kernel can tell APM and ACPI apart

APM Improvements More MI, Less MD The BIOS does most of the work Remove MD device related code Let the device drivers do it in their activate functions Bare MD APM state machine

APM On Suspend Code Flow wsdisplay_suspend() bufq_quiesce() config_suspend(dvact_quiesce) splhigh() disableintr() config_suspend(dvact_suspend) sys_platform->suspend()

APM On Resume Code Flow sys_platform->resume() config_suspend(dvact_resume) enableintr() splx() bufq_restart() wsdisplay_resume()

ACPI Implementations Microsoft Windows Intel ACPICA OpenBSD

ACPI How It Works System Perspective ACPI is a proxy between the BIOS and the OS Access AML methods according to the ACPI spec. Lots of spec violations Lots of quirks and workarounds The drivers have to handle device state

ACPI APM-like Flow The userland needs no change acpiioctl() notfication ioctl Same commands as APM ACPI tasks (e.g. acpi_sleep_task())

ACPI On Suspend Flow acpi_sleep_task(s3) checks state changes acpi_sleep_mode(s3) handles state changes acpi_prepare_sleep_state(s3) AML nightmare acpi_sleep_machdep(s3) MD code acpi_enter_sleep_state(s3) PM regs fiddling

ACPI Not APM-Like AML Methods TTS transition to state, before device notification PTS prepare to sleep, after device notification SST system status indicator GTS firmware execution before S3 PM power management registers GTE wake registers

ACPI On Resume Completely different from APM Real-mode: ACPI trampoline Real-mode: Might reenable video Real-mode: Enable paging Real-mode: Restore CPU registers Jump to where ACPI code stopped during suspend Clear PM registers Transition to S0 (more AML methods) Reset the lamp Enable runtime GPEs Resume the device drivers

Overview Devices Problems The order in which we suspend/resume them The device registers The memory maps How much state do we need to keep?

Overview ACPI No Man s Land The specifications are just a guide in reality AML is Windows-targeted AML is autogenerated code Magic methods that poke into CMOS and whatnot The AML parser is always finding quirks in production code

Quirks Video Reposting Can be done by: Real-mode BIOS call x86emu The driver itself Need for an PCI ID table nvidia is not supported at all Even then, some cards don t work

Quirks USB Problems Most machines have no problems (luck?) Some machines get their usb ports reset on resume Some don t get them at all Keep usb state vs whack the whole stack

Quirks Other Miscellaneous Mount points for usb drives don t get restored Audio sometimes gets trashed Aucat doesn t handle suspend/resume X doesn t come back on some machines X gets some image noise, fixed by VT switching Taking the cpu to 1-cpu is done at the wrong place Some drivers are not supported yet

Don t Panic It Works! Most laptops are supported Most workstations as well The sub-system is stable The design is good Loongson is the newest user Lots of non suspend/resume bugs in drivers got fixed as a result

So Long, and Thanks for All the Fish Questions?