Top Banner
Vampire Mice: Vampire Mice: How USB How USB Power Management Power Management Impacts You Impacts You Sarah Sharp [email protected] Jan 25, 2013
30

Vampire Mice: How USB PM Impacts You

Jun 10, 2015

Download

Technology

saharabeara

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.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Vampire Mice: How USB PM Impacts You

Vampire Mice:Vampire Mice:How USBHow USB

Power ManagementPower ManagementImpacts YouImpacts You

Sarah Sharp

[email protected]

Jan 25, 2013

Page 2: Vampire Mice: How USB PM Impacts You

2Software and Services Group (SSG)

System Software Division (SSD)

Mouse: flickr.com rick-in-rio

Mouse: flickr.com 27048731@N03

Page 3: Vampire Mice: How USB PM Impacts You

3Software and Services Group (SSG)

System Software Division (SSD)

Mouse: flickr.com rick-in-rio

Mouse: flickr.com 27048731@N03

Page 4: Vampire Mice: How USB PM Impacts You

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

Page 5: Vampire Mice: How USB PM Impacts You

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

How USBPower ManagementWorks

Lightbulb: flickr.com hozae

Page 6: Vampire Mice: How USB PM Impacts You

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

Page 7: Vampire Mice: How USB PM Impacts You

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

Page 8: Vampire Mice: How USB PM Impacts You

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

Page 9: Vampire Mice: How USB PM Impacts You

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)

Page 10: Vampire Mice: How USB PM Impacts You

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

How USBPower ManagementDoesn't Work

Broken light bulb: flickr.com ginsnob

Page 11: Vampire Mice: How USB PM Impacts You

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

Page 12: Vampire Mice: How USB PM Impacts You

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

Page 13: Vampire Mice: How USB PM Impacts You

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

Page 14: Vampire Mice: How USB PM Impacts You

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

Page 15: Vampire Mice: How USB PM Impacts You

15Software and Services Group (SSG)

System Software Division (SSD)

Turning on USB PM

Page 16: Vampire Mice: How USB PM Impacts You

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

Page 17: Vampire Mice: How USB PM Impacts You

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

Page 18: Vampire Mice: How USB PM Impacts You

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

USBLink Power Management

Page 19: Vampire Mice: How USB PM Impacts You

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

Page 20: Vampire Mice: How USB PM Impacts You

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

Page 21: Vampire Mice: How USB PM Impacts You

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

Page 22: Vampire Mice: How USB PM Impacts You

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

Page 23: Vampire Mice: How USB PM Impacts You

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

New IntelUSB PM Features

Page 24: Vampire Mice: How USB PM Impacts You

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

Page 25: Vampire Mice: How USB PM Impacts You

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

Page 26: Vampire Mice: How USB PM Impacts You

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

Page 27: Vampire Mice: How USB PM Impacts You

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

Page 28: Vampire Mice: How USB PM Impacts You

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

Summary

www.threadless.com/product/2168/USB_Port

Page 29: Vampire Mice: How USB PM Impacts You

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!

Page 30: Vampire Mice: How USB PM Impacts You

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

Questions?

[email protected]