From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Tue, 25 Jan 2011 13:39:37 +0000 Subject: Re: [PATCH] udev: add rules for qemu guests Message-Id: List-Id: References: <1295952245-3038-1-git-send-email-kraxel@redhat.com> In-Reply-To: <1295952245-3038-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: linux-hotplug@vger.kernel.org On Tue, Jan 25, 2011 at 11:44, Gerd Hoffmann wrote: > These patches enable usb autosuspend for the qemu emulated HID devices. > This reduces the cpu load for idle guests with a hid device attached > because the linux kernel will suspend the usb bus then and qemu can stop > running a 1000 Hz to emulate the (active) UHCI controller. > +dist_udevrules_DATA += extras/qemu/99-qemu-usb.rules The number should be 10-90 for the default things, or is there a dependency on anything else? > +ACTION="add", SUBSYSTEM="usb", ATTR{product}="QEMU USB Mouse", ATTR{serial}="42", RUN+="qemu-usb-autosuspend %p" This should probably be a simple ATTR{power/control}="auto" > --- /dev/null > +++ b/extras/qemu/qemu-usb-autosuspend > @@ -0,0 +1,7 @@ > +#!/bin/sh If possible, we try to avoid shell scripts. > +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 Which one is the actual one? Is the second try only for older kernels? That could go in the compat rules, udev does not ship rules for older kernels in the default installation. Anyway, why isn't all this done in the kernel? Can't this be made working somehow? Carrying out configuration, and unconditionally applying it from udev rules, should be avoided if possible and if the kernel could do it itself. We ran into serious issues in the past when more recent kernels did not like the config anymore that udev applied. Cheers, Kay