Vampire Mice: How USB PM Impacts You

Post on 10-Jun-2015

686 views 0 download

Tags:

description

Did you know that your innocent USB mouse is actually a power-hungry battery-draining monster? This talk explores the impact of USB devices on platform power consumption, and introduces some cool new power features in the Intel Ivy Bridge and Haswell USB host controllers. USB devices have always been battery eaters. A single active USB device will prevent runtime PM of USB host controllers, keep the CPU in higher C-states, and keep the system out of the new Intel S0i3 sleep states. This talk will cover tools that can enable USB power management, including the USB power sysfs interface and the USB power options in PowerTop 2.0. We'll also touch on the horrid little USB devices that break when power management is turned on, and how Linux customers can avoid purchasing them. We'll also cover some cool new USB power management features that Intel has been stuffing into their Ivy Bridge and Haswell chipsets. Ivy Bridge includes support for USB 3.0, and the new "Link Power Management" feature that allows individual links in the USB bus to power down. Haswell includes support for a cool new mechanism to completely turn off USB ports, and a way to place the USB host controller into the deepest PCI power savings state (D3cold). The aim of this talk is to educate users on how USB devices impact their battery life, and to introduce them to cool power savings on new and future Intel systems. This talk targets all users, but will provide deep dives into technical details for the more advanced users.

transcript

Vampire Mice:Vampire Mice:How USBHow USB

Power ManagementPower ManagementImpacts YouImpacts You

Sarah Sharp

sarah.a.sharp@intel.com

Jan 25, 2013

2Software and Services Group (SSG)

System Software Division (SSD)

Mouse: flickr.com rick-in-rio

Mouse: flickr.com 27048731@N03

3Software and Services Group (SSG)

System Software Division (SSD)

Mouse: flickr.com rick-in-rio

Mouse: flickr.com 27048731@N03

4Software and Services Group (SSG)

System Software Division (SSD)

Agenda

• How USB PM works

• ...and how it doesn't work

• New USB 3.0 and 2.1 features

• New features in Intel systems

5 Software and Services Group (SSG)System Software Division (SSD)

How USBPower ManagementWorks

Lightbulb: flickr.com hozae

6Software and Services Group (SSG)

System Software Division (SSD)

USB Power Management

• Three types of PM:• USB device suspend

• USB host suspend

• Link Power Management

Light bulb: flickr.com molotalk

7Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend

• Devices suspended when they're inactive

• Hubs suspend whenall children are suspended

• USB hosts suspend whenall ports are suspended

8Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend

• Implications of active USB host• Active DMA transfers

• Increased C state residency

• Increased power consumption

9Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend

• USB device suspend requirements• Device must support suspend

• Driver must support auto-suspend

• No active USB transfers

• Userspace can't poll

• Remote wakeup (optional)

10 Software and Services Group (SSG)System Software Division (SSD)

How USBPower ManagementDoesn't Work

Broken light bulb: flickr.com ginsnob

11Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend Issues

• Missing driver auto-suspend support

• Impossible to get to idle

• Userspace polls devices

Are we there yet?

Is an SD card inserted yet?

SD card reader: flickr.com osde-info

12Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend Issues

• Many USB devices are broken• Disconnect on resume

• Unsafe suspend behavior

• No remote wakeups

• Event loss during resume

• Firmware updates may help• Device descriptors often

unchanged

Mouse: flickr.com declanjewell

13Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend Issues

• Different systems producedifferent behavior• Electrical issues?

• Host hardware bugs?

• Powered USB hubs?

• Device driver bugs?

dusty computer: flickr.com johnjack

14Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend Issues

• What to do about broken devices?• Huge blacklist in kernel

• Make it userspace's problem!• USB device suspend off by default

• Userspace must turn it on

• # echo auto >/sys/bus/usb/devices/*/power/control

• Powertop can turn it on

Blame: flickr.com iandesign

15Software and Services Group (SSG)

System Software Division (SSD)

Turning on USB PM

16Software and Services Group (SSG)

System Software Division (SSD)

Turning on USB PM

• Powertop auto-suspend enabling doesn't persist across• Device unplug

• Reboot

• Solution: create a udev rule

• github.com/sarahsharp/usb-pm-tools

Boot: flickr.com jamiecat

17Software and Services Group (SSG)

System Software Division (SSD)

USB Device Suspend

Takeaway:

All your USB devicesmust be suspendedto get good platformpower management.

1. Test your devices.

2. Enable auto-suspend

18 Software and Services Group (SSG)System Software Division (SSD)

USBLink Power Management

19Software and Services Group (SSG)

System Software Division (SSD)

Challenges withUSB device suspend

• Users must turn it on

• Requires driver modification

• Timeout is course-grained

• Devices can't refuse suspend

Blame: flickr.com iandesign

20Software and Services Group (SSG)

System Software Division (SSD)

USB 3.0Link Power Management

• USB 3.0 Link PM• Link PM states: U1 and U2

• Idea:• Host & hubs track idleness

• OS sets timeout once

• No driver modification

• Devices can refuse U1/U2

U1

U1U2

21Software and Services Group (SSG)

System Software Division (SSD)

USB 3.0Link Power Management

• Some USB 3.0 devices don't do Link PM

• How to tell?

# lsusb -v -d 1d6b:0003 | grep "Port [0-9]*"

Hub Port Status:

Port 1: 0000.02a0 5Gbps power Rx.Detect

Port 2: 0000.0243 5Gbps power U2 enable connect

Port 3: 0000.02a0 5Gbps power Rx.Detect

Port 4: 0000.02a0 5Gbps power Rx.Detect

22Software and Services Group (SSG)

System Software Division (SSD)

USB 2.1 Link PM

• New 'L1' low power state

• No changes to USB 2.0 hubs

• Only for devices on roothub• Good for integrated devices

L0L0

L1L0

23 Software and Services Group (SSG)System Software Division (SSD)

New IntelUSB PM Features

24Software and Services Group (SSG)

System Software Division (SSD)

Current and FutureIntel Products

• Current gen:• CPU: Ivy Bridge

• Chipset: Panther Point

• Next gen:• CPU: Haswell

• Chipsets: Lynx Point

Panther: flickr.com tim_ellisLynx: flickr.com keithmwilliams

25Software and Services Group (SSG)

System Software Division (SSD)

Intel USB PMImprovements

• Panther Point• Finally has xHCI host controller!

• Only four ports under xHCI

• Supports USB 3.0 Link PM

• Lynx Point• All ports under xHCI

• Supports USB 3.0 andUSB 2.1 Link PM

Panther: flickr.com tim_ellisLynx: flickr.com keithmwilliams

26Software and Services Group (SSG)

System Software Division (SSD)

Intel Lynx PointUSB PM Improvements

• Motivation• Unused internal ports

• Unused internal USB devices

internal laptop: flickr novakreofinger print scanner: flickr mikedent

27Software and Services Group (SSG)

System Software Division (SSD)

Intel Lynx PointUSB PM Improvements

• Idea:• Completely power off port

• Lose USB events:• Disconnect

• Connect

• Remote wakeup events

internal laptop: flickr novakreofinger print scanner: flickr mikedent

28 Software and Services Group (SSG)System Software Division (SSD)

Summary

www.threadless.com/product/2168/USB_Port

29Software and Services Group (SSG)

System Software Division (SSD)

Summary

• USB device suspend is often broken

• Try powertop

• Check out github.com/sarahsharp/usb-pm-tools

• Link PM improvements

• New Intel USB PM features

• Thanks!

30 Software and Services Group (SSG)System Software Division (SSD)

Questions?

sarah.a.sharp@linux.intel.com