+ All Categories
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]


Top Related