Bug 1373223

Summary: Use nec-xhci USB controller by default on ppc64
Product: [oVirt] ovirt-engine Reporter: Andrea Bolognani <abologna>
Component: BLL.VirtAssignee: jniederm
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: medium Docs Contact:
Priority: high    
Version: ---CC: bugs, dzheng, eheftman, hannsj_uhl, jniederm, melewis, michal.skrivanek, mpoledni, sgratch, tjelinek
Target Milestone: ovirt-4.1.0-rcFlags: rule-engine: ovirt-4.1+
rule-engine: planning_ack+
michal.skrivanek: devel_ack+
mavital: testing_ack+
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Previously, if SPICE USB redirection was disabled, libvirt created a default USB controller. With this update, if SPICE USB redirection is disabled then the virtual machine has a new USB controller, which is configurable per guest operating system and cluster version. This is defined in the osinfo-defaults.properties configuration file.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-15 14:51:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1299681, 1359843, 1415048    

Description Andrea Bolognani 2016-09-05 14:13:18 UTC
libvirt currently defaults to pci-ohci on ppc64.

However, this USB controller has some issues (see Bug 1212275)
that are unlikely to ever be fixed; moreover nec-xhci is USB3
as opposed to USB2, which should give better performance anyway.

QEMU has already started using nec-xhci (see Bug 1284333)
because of these reasons.

libvirt, on the other hand, can't change its default due to
the fact that up until very recently the USB controller model
was not formatted in the guest configuration.

oVirt should use nec-xhci by default for new ppc64 guests.

Bug 1373184 has already been filed for virt-manager and
related tools.

Comment 1 Martin Polednik 2016-09-12 09:40:02 UTC
After thinking about the "bug", I think ovirt-engine is the proper place where we should add the controller. All we need is engine to send

{'device': 'usb', 'model': 'nec-xhci', 'type': 'controller'}

for ppc64le guests as VDSM has all the machinery to build the XML.

Comment 2 jniederm 2016-09-15 12:43:18 UTC
Final solution is still being discussed, decreasing priority.

Comment 3 jniederm 2016-10-05 13:17:35 UTC
... not any more

Comment 4 Sharon Gratch 2016-11-24 13:14:27 UTC
Please note that this is relevant also for Bug 1381184 (headless VM RFE):
In case of a headless VM & the if the serial console is disabled- the usb controller should not be added while running this VM. 
Currently is is not supported by libvirt and usb device is always added while starting a VM, eventhough the list sent by engine doesn't include the usb device.

Comment 5 Andrea Bolognani 2016-11-24 14:09:26 UTC
(In reply to Sharon Gratch from comment #4)
> Please note that this is relevant also for Bug 1381184 (headless VM RFE):
> In case of a headless VM & the if the serial console is disabled-

Why would you want to have neither graphical nor serial
console? Surely the latter should be present for headless
guests.

> the usb
> controller should not be added while running this VM. 
> Currently is is not supported by libvirt and usb device is always added
> while starting a VM, eventhough the list sent by engine doesn't include the
> usb device.

You can simply include

  <controller type='usb' model='none'/>

in the guest XML to opt out of the default USB controller.

Comment 6 jniederm 2016-12-09 15:27:03 UTC
I suggest following solution:

If (VM dialog > Console > USB Support == Enabled)
    original behavior remains (1 quaterion of controllers ("ich9-uhci3", "ich9-ehci1",
    "ich9-uhci1", "ich9-uhci2") per each started sextuple of required slots)
otherwise
    one controller as defined in osinfo.properties per each started sextuple of required slots

Comment 7 Michal Skrivanek 2016-12-15 12:48:49 UTC
this is required for 4.0 on RHEL 7.3 as well, otherwise bug 1299681 won't get fixed

Comment 8 Andrea Bolognani 2017-01-13 13:54:38 UTC
On Mon, 2017-01-09 at 15:38 +0000, bugzilla wrote:
> --- Doc Text *updated* by jniederm ---
> If SPICE USB redirection is enabled (VM-like dialog > Console > USB Support), the behavior remains unchanged: each VM has a quadruple of usb controllers: ich9-ehci1, ich9-uhci1,ich9-uhci2, ich9-uhci3.
> If SPICE USB redirection is disabled, then VM has newly USB controller as specified in osinfo-defaults.properties configuration file, i.e. it is configurable per guest operating system and effective cluster version. Previously no usb controller was send to libvirt and libvirt created a default usb controller.

Why does the behavior change based on whether or not SPICE
USB redirection is enabled? Is that feature only available
with ICH9 controllers?

> Default for all intel (x86, x86-64) operating systems is "piix3-uhci", for ppc64 systems it is "nec-xhci".

Why piix3-uhci instead of ich9-* for x86 guests?

Moreover, x86/q35 guests should default to nex-xhci just
like ppc64/pseries guests. (And, just for the record, so
should aarch64/virt guests, but I understand aarch64 might
be just considered out of scope.)

-- 
Andrea Bolognani / Red Hat / Virtualization

Comment 9 jniederm 2017-01-17 17:58:37 UTC
(In reply to Andrea Bolognani from comment #8)
> On Mon, 2017-01-09 at 15:38 +0000, bugzilla wrote:
> > --- Doc Text *updated* by jniederm ---
> > If SPICE USB redirection is enabled (VM-like dialog > Console > USB Support), the behavior remains unchanged: each VM has a quadruple of usb controllers: ich9-ehci1, ich9-uhci1,ich9-uhci2, ich9-uhci3.
> > If SPICE USB redirection is disabled, then VM has newly USB controller as specified in osinfo-defaults.properties configuration file, i.e. it is configurable per guest operating system and effective cluster version. Previously no usb controller was send to libvirt and libvirt created a default usb controller.
> 
> Why does the behavior change based on whether or not SPICE
> USB redirection is enabled? Is that feature only available
> with ICH9 controllers?

remove-viewer doesn't support USB 3 redirection yet, it may come with RHEL 7.4. This way a well tested set of spice compatible controllers remained untouched.

> 
> > Default for all intel (x86, x86-64) operating systems is "piix3-uhci", for ppc64 systems it is "nec-xhci".
> 
> Why piix3-uhci instead of ich9-* for x86 guests?

From commit message of https://gerrit.ovirt.org/#/c/68923/:
"piix3-uhci that as opposed to ich9-ehci1 is supposed to work properly with usb devices that require USB-1.0 like smartcard."

> 
> Moreover, x86/q35 guests should default to nex-xhci just
> like ppc64/pseries guests. (And, just for the record, so
> should aarch64/virt guests, but I understand aarch64 might
> be just considered out of scope.)
> 
> -- 
> Andrea Bolognani / Red Hat / Virtualization

Comment 10 Andrea Bolognani 2017-01-19 15:05:20 UTC
(In reply to jniederm from comment #9)
> > Why does the behavior change based on whether or not SPICE
> > USB redirection is enabled? Is that feature only available
> > with ICH9 controllers?
> 
> remove-viewer doesn't support USB 3 redirection yet, it may come with RHEL
> 7.4. This way a well tested set of spice compatible controllers remained
> untouched.
> 
> > > Default for all intel (x86, x86-64) operating systems is "piix3-uhci", for ppc64 systems it is "nec-xhci".
> > 
> > Why piix3-uhci instead of ich9-* for x86 guests?
> 
> From commit message of https://gerrit.ovirt.org/#/c/68923/:
> "piix3-uhci that as opposed to ich9-ehci1 is supposed to work properly with
> usb devices that require USB-1.0 like smartcard."

Okay, so:

  * x86
    - no SPICE -> piix3-uhci
      + you're limited to USB 1.1 but you can have smartcards
    - SPICE -> ich9-ehci1
      + you have USB 2.0 but give up smartcard support
  * non-x86
    - nec-xhci
      + SPICE is not supported

IIUC that means q35 guests will be stuck with USB 2.0 as
well, which is too bad...

Hopefully SPICE will start supporting USB 3.0 (and non-x86
architectures) soon! :)

Comment 11 jniederm 2017-01-19 20:55:24 UTC
(In reply to Andrea Bolognani from comment #10)
> (In reply to jniederm from comment #9)
> > > Why does the behavior change based on whether or not SPICE
> > > USB redirection is enabled? Is that feature only available
> > > with ICH9 controllers?
> > 
> > remove-viewer doesn't support USB 3 redirection yet, it may come with RHEL
> > 7.4. This way a well tested set of spice compatible controllers remained
> > untouched.
> > 
> > > > Default for all intel (x86, x86-64) operating systems is "piix3-uhci", for ppc64 systems it is "nec-xhci".
> > > 
> > > Why piix3-uhci instead of ich9-* for x86 guests?
> > 
> > From commit message of https://gerrit.ovirt.org/#/c/68923/:
> > "piix3-uhci that as opposed to ich9-ehci1 is supposed to work properly with
> > usb devices that require USB-1.0 like smartcard."
> 
> Okay, so:
> 
>   * x86
>     - no SPICE -> piix3-uhci
>       + you're limited to USB 1.1 but you can have smartcards
>     - SPICE -> ich9-ehci1
>       + you have USB 2.0 but give up smartcard support
>   * non-x86
>     - nec-xhci
>       + SPICE is not supported
Yes. I just want to add that non-SPICE branches in tree above shows defaults. User can choose arbitrary controller.

> 
> IIUC that means q35 guests will be stuck with USB 2.0 as
> well, which is too bad...
> 
> Hopefully SPICE will start supporting USB 3.0 (and non-x86
> architectures) soon! :)

Comment 12 Sandro Bonazzola 2017-01-25 07:55:45 UTC
4.0.6 has been the last oVirt 4.0 release, please re-target this bug.

Comment 13 sefi litmanovich 2017-02-05 12:42:41 UTC
Verified with two engines, one with x86_64 DC and one with PPC64 DC, rhevm-4.1.0.4-0.1.el7.noarch and rhevm-4.1.0.2-0.1.el7.noarch respectively.
Verified that on PPC the default usb set in osinfo-defaults.properties is nec-xhci and that it's defined well in vm's xml.
Checked the that the default for x86 is 'piix3-uhci' when usb support is disabled, and 4 controllers ich9-ehci1, ich9-uhci1,ich9-uhci2, ich9-uhci3 when usb support is enabled for spice console.
Verified that the changing the value in osinfo-defaults.properties changes the default controller type successfully.