Bug 663064

Summary: usb autosuspend configuration should be persistent
Product: Red Hat Enterprise Linux 6 Reporter: Glauber Costa <gcosta>
Component: udevAssignee: Harald Hoyer <harald>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: gcosta, harald, kraxel, kvolny, lihuang, mishu, mkenneth, mtosatti, pknirsch, tburke, virt-maint
Target Milestone: rc   
Target Release: 6.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
This release of udev turns on the autosuspend feature of the qemu virtual mouse, tablet and keyboard devices to reduce load on virtual machines.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 11:50:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 632299    
Bug Blocks: 580951    
Attachments:
Description Flags
udev patch none

Description Glauber Costa 2010-12-14 15:30:13 UTC
Description of problem:

In order to reduce idle load of USB devices running on emulated USB buses (mostly virtualization environments), we want the autosuspend feature of USB devices enabled whereas possible.

The sysfs representation of the device, however, won't enable it automatically, nor persist the current value upon reboots.

It would be nice that we could add a udev rule that could enable idle virtualization guests to reduce their load without the need for manual interaction by the sysadmin.

Comment 2 Gerd Hoffmann 2010-12-14 16:29:47 UTC
> > I'm using this in my testing:
> > 
> > [root@fedora64 ~]# cat /lib/udev/usb_autosuspend
> > #!/bin/sh
> > path="$1"
> > if test -f "/sys${path}/power/control"; then
> > 	echo "auto" > "/sys${path}/power/control"
> > elif test -f "/sys${path}/power/level"; then
> > 	echo "auto" > "/sys${path}/power/level"
> > fi
> > [root@fedora64 ~]# cat /lib/udev/rules.d/99-qemu.rules
> > ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", 
> > RUN+="usb_autosuspend %p"
> > 
> > The tricky part here is to figure whenever remote wakeup is going to 
> > work or not.  The emulated HID devices in current qemu advertise remote 
> > wakeup support but they don't actually support it ...
> > 
> > cheers,
> >    Gerd
> > 
Let's add it all to https://bugzilla.redhat.com/show_bug.cgi?id=663064

[x] done.

Comment 3 Phil Knirsch 2010-12-17 14:11:10 UTC
That rule should be added to qemu though, like we do with all other application specific udev rules.

Reassigning to qemu.

Thanks & regards, Phil

Comment 7 Gerd Hoffmann 2011-01-25 10:51:08 UTC
Created attachment 475139 [details]
udev patch

Part one of the (host-side) patches is merged upstream now.
Part two (migration support) hopefully follows shortly.

Submitted patch for the guest-side config to udev upstream (see attachment).
Lets see how it goes.  When upstream accepts it we should backport it to our udev package.  Failing that we can stick the udev files into some guest agent package.

Comment 8 Harald Hoyer 2011-01-25 13:55:24 UTC
I would suggest these rules as mentioned on the hotplug mailing list by Kay:

ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST="power/control", ATTR{power/control}="auto"

ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST="power/level", ATTR{power/level}="auto"

ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST="power/control", ATTR{power/control}="auto"

ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST="power/level", ATTR{power/level}="auto"

ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST="power/control", ATTR{power/control}="auto"

ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST="power/level", ATTR{power/level}="auto"


Do we need both variants for RHEL6.0?

Comment 9 Harald Hoyer 2011-01-25 13:56:01 UTC
s/TEST=/TEST==/

Comment 10 Gerd Hoffmann 2011-01-25 14:34:49 UTC
Wow, that is fast, I just finished reading that mail ;)

RHEL-6 has power/level only, power/control was added in more recent kernels.

Comment 12 Gerd Hoffmann 2011-01-25 15:52:32 UTC
Reassigning to udev for backporting.

Comment 14 Harald Hoyer 2011-02-16 14:25:28 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
This release of udev turns on the autosuspend feature of the qemu virtual mouse, tablet and keyboard devices to reduce load on virtual machines.

Comment 15 Karel Volný 2011-04-21 15:01:35 UTC
the rules got added:

# grep USB /lib/udev/rules.d/42-qemu-usb.rules
ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse",    ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}=="auto"
ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet",   ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}=="auto"
ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}=="auto"

Comment 16 errata-xmlrpc 2011-05-19 11:50:38 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0525.html