Bug 1613990 - Boxes guests, smartcard adds 10% CPU
Summary: Boxes guests, smartcard adds 10% CPU
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 28
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-08 18:22 UTC by Eric P
Modified: 2019-05-21 15:13 UTC (History)
12 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2019-05-21 15:13:15 UTC


Attachments (Terms of Use)

Description Eric P 2018-08-08 18:22:56 UTC
Fedora 28, latest.

1.  Gnome Boxes, create a Fedora 28 guest (any OS, really).
2.  Log in to guest OS, run top, observe 0% cpu usage
3.  In host, run top.  

I expect to see the qemu process for the guest OS to be near 0%.

Instead I see the qemu process using around 20% cpu.

4. Stop the guest OS
5. I use "virsh edit fedora28-ser" to modify the definition.  Here is the diff after removing the smartcard and the ccid controller.

[ericp@neso qemu]$ diff fedora28-ser.xml.original  fedora28-ser.xml
83,85d82
<     <controller type='ccid' index='0'>
<       <address type='usb' bus='0' port='2'/>
<     </controller>
87c84
<       <mac address='52:54:00:4a:07:4d'/>
---
>       <mac address='52:54:00:a8:ae:9f'/>
92,94d88
<     <smartcard mode='passthrough' type='spicevmc'>
<       <address type='ccid' controller='0' slot='0'/>
<     </smartcard>

6. Start the guest OS
7.  In host, run top.  

I expect to see the qemu process for the guest OS to be near 0%.

I do see this; it is now much closer to 0% (avg 5%)

Comment 1 Cole Robinson 2018-08-08 18:56:07 UTC
Eric had a thread here where he narrowed it down to smartcard:

  https://www.spinics.net/linux/fedora/fedora-users/msg485079.html

elmarco have you heard of this?

Comment 2 Eric P 2018-08-09 12:17:14 UTC
PS, I have a Dell XPS 9360.  No smartcard.

Comment 3 Marc-Andre Lureau 2018-08-09 17:02:06 UTC
Just removing the  smartcard isn't enough for me to limit the CPU usage.

However, USB host controller is CPU hungry.

Using:
     <controller type='usb' index='0' model='qemu-xhci'>                                                  

I get down from 20% cpu to ~2% on idle.

Eric, could you confirm?

Comment 4 Eric P 2018-08-10 14:43:04 UTC
Hi Marc-Andre,

I have more usb controllers than just one, and editing the file so far, I haven't been able correctly change the usb controllers.

I noticed from reading comments in Fedora Magazine [0] that Boxes is for a quick setup, and I can reference the libvirt XML configuration documentation [1] to modify the configuration if needed.

[0] https://fedoramagazine.org/getting-started-with-virtualization-in-gnome-boxes/
[1] https://libvirt.org/formatdomain.html

I will learn the libvirt configuration.  In the meantime, here is my guest config file with the multiple usb controllers, if you have a moment to comment on it.

Thanks for your help!

<domain type='kvm'>
  <name>fedora28-ser</name>
  <uuid>880dbce5-211a-4077-b587-8402e3860ef7</uuid>
  <title>Fedora 28 Server</title>
  <metadata>
    <boxes:gnome-boxes xmlns:boxes="https://wiki.gnome.org/Apps/Boxes">
      <os-state>installed</os-state>
      <os-id>http://fedoraproject.org/fedora/28</os-id>
      <media-id>http://fedoraproject.org/fedora/28:2</media-id>
      <media>/home/ericp/Downloads/Fedora-Server-dvd-x86_64-28-1.1.iso</media>
    </boxes:gnome-boxes>
  </metadata>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.11'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>Broadwell-noTSX-IBRS</model>
    <topology sockets='1' cores='2' threads='2'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/home/ericp/.local/share/gnome-boxes/images/fedora28-ser'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:3c:30:2a'/>
      <source bridge='virbr0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='spiceport'>
      <source channel='org.spice-space.webdav.0'/>
      <target type='virtio' name='org.spice-space.webdav.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='3'/>
    </input>
    <input type='mouse' bus='usb'>
      <address type='usb' bus='0' port='4'/>
    </input>
    <input type='keyboard' bus='usb'>
      <address type='usb' bus='0' port='5'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice'>
      <listen type='none'/>
      <image compression='off'/>
    </graphics>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='virtio' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='6'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='1.1'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='1.2'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='1.3'/>
    </redirdev>
    <hub type='usb'>
      <address type='usb' bus='0' port='1'/>
    </hub>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Comment 5 Marc-Andre Lureau 2018-08-10 14:54:10 UTC
You should be able to replace:

    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

with

   <controller type='usb' index='0' model='qemu-xhci'>                                                                                                                                                            
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>                                                                                                                                  
    </controller>

Comment 6 Eric P 2018-08-10 15:54:26 UTC
I had to remove a few USB mappings because anything trying to use usb port 5 and above:

error: XML error: requested USB port 5 not present on USB bus 0
Failed. Try again? [y,n,f,?]: 

I got down to 5% cpu on the host.  I don't know if the original smart card issue is considered a bug or just par for the "default Boxes guest" course.  I appreciate the help you provided and I don't want to take your time from other issues, though.

Comment 7 Ben Cotton 2019-05-02 21:10:23 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 8 Cole Robinson 2019-05-21 15:13:15 UTC
virt-manager and boxes latest releases will use usb3 by default, so that improves the state here. if there's any other remaining issue on latest qemu it should be filed upstream


Note You need to log in before you can comment on or make changes to this bug.