Bug 1488256

Summary: Fedora 26 guest does not enable autosuspend for QEMU USB Tablet
Product: [Fedora] Fedora Reporter: Jonathan Teh <jonteh>
Component: systemdAssignee: systemd-maint
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 28CC: harald, jsynacek, kay, lnykryn, lpoetter, mschmidt, msekleta, s, systemd-maint, zbyszek
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-28 18:58:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Teh 2017-09-04 22:29:35 UTC
Description of problem:
Fedora 26 guest (LXQt spin, run as a live image with default virt-manager settings) does not automatically enable autosuspend for the QEMU USB Tablet and it stays active:

[root@localhost-live ~]# cd /sys/bus/usb/devices/1-1
[root@localhost-live 1-1]# pwd
/sys/bus/usb/devices/1-1
[root@localhost-live 1-1]# cat product 
QEMU USB Tablet
[root@localhost-live 1-1]# grep . power/*
power/active_duration:172869
power/autosuspend:2
power/autosuspend_delay_ms:2000
power/connected_duration:172870
power/control:on
power/level:on
power/persist:1
power/runtime_active_time:172647
power/runtime_status:active
power/runtime_suspended_time:0
power/wakeup:disabled

Manually enable autosuspend and it does enter the suspended state:

[root@localhost-live 1-1]# echo auto > power/control
[root@localhost-live 1-1]# grep . power/*
power/active_duration:68386
power/autosuspend:2
power/autosuspend_delay_ms:2000
power/connected_duration:94389
power/control:auto
power/level:auto
power/persist:1
power/runtime_active_time:68163
power/runtime_status:suspended
power/runtime_suspended_time:26004
power/wakeup:disabled

The host is also Fedora 26, running these components:

qemu-2.9.0-5.fc26.x86_64
libvirt-3.2.1-5.fc26.x86_64
virt-manager-1.4.2-1.fc26.noarch

I first noticed the problem with a Debian 9 guest on RHEL/CentOS 7.3, and the problem is with the guest OS.

Fedora 26 and Debian 9 are both missing the file /usr/lib/udev/rules.d/42-usb-hid-pm.rules which is present in RHEL/CentOS 7.x. Simply copying the file to an affected guest fixes the issue.

The problem was introduced with this pull request:

https://github.com/systemd/systemd/pull/353

From the date of the merge (26 Jun 2015), the next release was systemd 222 so this first affected Fedora 23 (as well as Debian 9 and Ubuntu 15.10).

Upstream udev have a stated intention of not maintaining power management settings but there doesn't seem to be a replacement, either in hwdb or the kernel. Perhaps the file could be reintroduced but with only the QEMU USB HID rules.

Version-Release number of selected component (if applicable):
systemd-udev-233-6.fc26.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Create a new virtual machine in virt-manager for a Fedora 26 guest, default settings
2. Boot Fedora 26 in a guest VM
3. Check /sys/bus/usb/device/x-y/power/control of the QEMU USB tablet

Actual results:
Contents of the file is 'on'.

Expected results:
Contents of the file should be 'auto' (as it is in Fedora 22 or earlier, and RHEL/CentOS 7.x).

Additional info:
The CPU use by the qemu-system-x86_64 process (or qemu-kvm on CentOS 7) with an idle guest with the tablet suspended compared to active is:

Athlon 5350     2.05GHz: 1.0% to 2.0%
Phenom II X2 550 3.1GHz : 0.3% to 0.7%

This is with the host using the performance CPU frequency governor (to make the measurements consistent). With the default ondemand governor both CPUs end up in the highest P-state and a frequency of 800MHz and the CPU use would be proportionally higher. Starting a 2nd guest increases CPU usage by a smaller amount.

Granted it's a tiny increase in CPU usage, compared to when the rule was first introduced, but it's still an unnecessary increase. This is with the default emulated USB2 host controller, CPU usage does not increase with an emulated USB3/XHCI controller even if the tablet remains active.

Comment 1 Fedora End Of Life 2018-05-03 08:56:50 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 2 Fedora End Of Life 2018-05-29 11:28:27 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 3 Jonathan Teh 2018-05-30 00:00:42 UTC
Issue still exists with a Fedora 28 guest (LXQt spin), on a Fedora 28 host FWIW.

Version-Release number of selected component (if applicable):
systemd-udev-238-7.fc28.1.x86_64

Comment 4 Ben Cotton 2019-05-02 21:40:54 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Ben Cotton 2019-05-28 18:58:43 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.