From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabio Fantoni Subject: Re: [Xen-devel] [PATCH] libxl: change default QEMU machine to pc-i440fx-1.6 Date: Thu, 29 May 2014 10:08:20 +0200 Message-ID: <5386EAF4.8030704@m2r.biz> References: <537F8083.7040802@m2r.biz> <5382F4A6.3000907@m2r.biz> <5385F670.5040207@m2r.biz> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------020701020101000606070800" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Stefano Stabellini Cc: xen-devel , Ian Campbell , Ian Jackson , "qemu-devel@nongnu.org" , Paul Durrant , Anthony PERARD , Tiejun Chen List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020701020101000606070800 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Il 28/05/2014 18:53, Fabio Fantoni ha scritto: > 2014-05-28 18:41 GMT+02:00 Stefano Stabellini > >: > > On Wed, 28 May 2014, Stefano Stabellini wrote: > > On Wed, 28 May 2014, Fabio Fantoni wrote: > > > Il 26/05/2014 10:00, Fabio Fantoni ha scritto: > > > > Il 25/05/2014 16:14, Stefano Stabellini ha scritto: > > > > > On Fri, 23 May 2014, Fabio Fantoni wrote: > > > > > > Il 23/05/2014 18:07, Stefano Stabellini ha scritto: > > > > > > > Choose pc-i440fx-1.6 instead of pc for HVM guests, so > that we know for > > > > > > > sure what is the machine that we are emulating. > > > > > > > > > > > > > > Use pc-i440fx-1.6 regardless of the xen_platform_pci > option. Add the > > > > > > > xen-platform device if requested. Choose slot 2 for > the xen-platform > > > > > > > device for compatibility with current installations. > In case of Intel > > > > > > > graphic passthrough, slot 2 might be needed by the > grafic card. > > > > > > > However > > > > > > > now that we can specify the slot explicitly, it is > easy to change the > > > > > > > position of the xen-platform device on the PCI bus if > graphic > > > > > > > passthrough is enabled. > > > > > > > > > > > > > > Move the machine options earlier, before any other > emulated devices > > > > > > > options. Otherwise the selected PCI slot for the > xen-platform device > > > > > > > is > > > > > > > not available in QEMU. > > > > > > > > > > > > > > Specify > PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off, because > > > > > > > differently from xenfv, the other QEMU machines do not > have that > > > > > > > option > > > > > > > off by default. > > > > > > > > > > > > > > This patch does not change the emulated environment in > the guest. > > > > > > > > > > > > > > Refer to this thread: > > > > > > > http://marc.info/?l=xen-devel&m=140023775929625&w=2 > > > > > > > > > > > > > > Signed-off-by: Stefano Stabellini > > > > > > > > > > > > > > > > diff --git a/tools/libxl/libxl_dm.c > b/tools/libxl/libxl_dm.c > > > > > > > index 8abed7b..fef684f 100644 > > > > > > > --- a/tools/libxl/libxl_dm.c > > > > > > > +++ b/tools/libxl/libxl_dm.c > > > > > > > @@ -476,6 +476,29 @@ static char ** > > > > > > > libxl__build_device_model_args_new(libxl__gc *gc, > > > > > > > flexarray_vappend(dm_args, "-k", keymap, NULL); > > > > > > > } > > > > > > > + flexarray_append(dm_args, "-machine"); > > > > > > > + switch (b_info->type) { > > > > > > > + case LIBXL_DOMAIN_TYPE_PV: > > > > > > > + flexarray_append(dm_args, "xenpv"); > > > > > > > + for (i = 0; b_info->extra_pv && > b_info->extra_pv[i] != NULL; > > > > > > > i++) > > > > > > > + flexarray_append(dm_args, b_info->extra_pv[i]); > > > > > > > + break; > > > > > > > + case LIBXL_DOMAIN_TYPE_HVM: > > > > > > > + flexarray_append(dm_args, "pc-i440fx-1.6,accel=xen"); > > > > > > > > I think that a note in README should be added: qemu >=1.6.1 > is required for > > > > hvm domUs. > > > > > > > > About the other xl parameter to be added I think that should be: > > > > qemu_machine_type="i440fx"|"q35" (when also q35 will be > supported on xen) > > > > qemu_machine_version="x.y" to specify the machine version, > useful for > > > > debug/testing and other some cases. > > > > > > > > > > > + flexarray_append(dm_args, "-global"); > > > > > > > + flexarray_append(dm_args, > > > > > > > "PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off"); > > > > > > I think is good add a comment for remember to remove > this workaround > > > > > > when pc > > > > > > > =2.1 will be the default since qemu 2.1 will fix it. > > > > > > > https://lists.gnu.org/archive/html/qemu-devel/2014-05/msg04789.html > > > > > The workaround is not actually harmful, it doesn't need to > be removed > > > > > when pc >= 2.1 in QEMU. > > > > > > > > > > > > > > > > > + if > (libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) { > > > > > > > + flexarray_append(dm_args, "-device"); > > > > > > > + flexarray_append(dm_args, "xen-platform,addr=0x2"); > > > > > > The fixed pci address to 0x2 probably is a problem with > intel gpu > > > > > > passthrough: > > > > > > > http://lists.gnu.org/archive/html/qemu-devel/2014-05/msg03726.html > > > > > Right, however we cannot really change the default > position of the > > > > > xen-platform device on the PCI bus, otherwise we'll end up > changing the > > > > > emulated environment for all the VMs out there. > > > > > > > > > > I'll leave it to Tiejun to move xen-platform to another > slot when > > > > > graphic passthrough is enabled. > > > > > > > > > > I found another case of problem with xen-platform's fixed pci > slot. > > > I tested this patch and I saw that qemu not start also in > other cases, for > > > example the domU of my test: > > > > qemu-system-i386: -device xen-platform,addr=0x2: PCI: slot 2 > function 0 not > > > > available for xen-platform, in use by intel-hda > > > > qemu-system-i386: -device xen-platform,addr=0x2: Device > initialization > > > > failed. > > > > qemu-system-i386: -device xen-platform,addr=0x2: Device > 'xen-platform' could > > > > not be initialized > > > > > > The domU's xl cfg: > > > > name='W7' > > > > builder="hvm" > > > > #device_model_override="/usr/lib/xen/bin/qemu-gdb" > > > > #device_model_override="/usr/bin/qemu-system-x86_64" > > > > #bios="ovmf" > > > > memory=2048 > > > > vcpus=2 > > > > #nestedhvm=1 > > > > #vif=['model=e1000,bridge=xenbr0'] > > > > vif=['bridge=xenbr0,mac=00:16:3e:42:ae:8f'] > > > > > disk=['/mnt/vm/disks/W7.disk1.xm,raw,hda,rw',',raw,hdb,ro,cdrom'] > > > > boot='dc' > > > > device_model_version="qemu-xen" > > > > viridian=1 > > > > vnc=0 > > > > keymap="it" > > > > on_crash="destroy" > > > > vga="qxl" > > > > #videoram=64 > > > > spice=1 > > > > spicehost='0.0.0.0' > > > > spiceport=6002 > > > > spicedisable_ticketing=1 > > > > spicevdagent=1 > > > > spice_clipboard_sharing=0 > > > > spice_image_compression="off" > > > > spice_streaming_video="filter" > > > > spiceusbredirection=4 > > > > soundhw="hda" > > > > >From the error message, it looks like soundhw is the option that > > conflicts with xen-platform,addr=0x2. > > > > > > > > localtime=1 > > > > usbversion=2 > > > > > > Probably there are also other cases that can create a problem with > > > xen-platform fixed address, FWIK now new usb controller (with > usbversion) is > > > the only other with fixed pci address in libxl, all other > emulated qemu > > > components not. > > > And call it before in qemu binary starts notaffect the pci > slot order because > > > the xen-platform is already before audio. > > > > Actually it looks like that by passing -device xen-platform > before the > > other options, it already tries to assign slot 2 if possible. I > don't > > need to specify addr=0x2. That seems to be the best course of > action. > > However it would still place xen-platform at slot 3 instead of > slot 2 if > soundhw is specified. It seems to me that there is not a perfect > solution to this problem. We can either: > > - Switch to -machine pc-i440fx-1.6 by default and use consistently the > same -machine option no matter the value of xen_platform_pci. > Nice, but > we break compatibility with existing guests if soundhw is specified. > > - Switch to -machine pc-i440fx-1.6 only when xen_platform_pci=0 is > specified and keep xenfv if xen_platform_pci=1. We still break > compatibility when soundhw is specified together with > xen_platform_pci=0. > > > FWIK removing the xen-platform's fixed pci slot will keep > compatibility in any cases, assigning slots as it did before. > I'll try tomorrow. > Otherwise I think there would be problems in other cases, not only > audio case. > Perhaps even with save/restore/migrate. > Removing xen-platform's fixed pci slot works, I not found any case with problem for now. The only problem probably will be only intel graphic passthrough (not tested), same with fixed pci slot of starting patch. --------------020701020101000606070800 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Il 28/05/2014 18:53, Fabio Fantoni ha scritto:
2014-05-28 18:41 GMT+02:00 Stefano Stabellini <stefano.stabellini@eu.citrix.com>:
On Wed, 28 May 2014, Stefano Stabellini wrote:
> On Wed, 28 May 2014, Fabio Fantoni wrote:
> > Il 26/05/2014 10:00, Fabio Fantoni ha scritto:
> > > Il 25/05/2014 16:14, Stefano Stabellini ha scritto:
> > > > On Fri, 23 May 2014, Fabio Fantoni wrote:
> > > > > Il 23/05/2014 18:07, Stefano Stabellini ha scritto:
> > > > > > Choose pc-i440fx-1.6 instead of pc for HVM guests, so that we know for
> > > > > > sure what is the machine that we are emulating.
> > > > > >
> > > > > > Use pc-i440fx-1.6 regardless of the xen_platform_pci option. Add the
> > > > > > xen-platform device if requested. Choose slot 2 for the xen-platform
> > > > > > device for compatibility with current installations. In case of Intel
> > > > > > graphic passthrough, slot 2 might be needed by the grafic card.
> > > > > > However
> > > > > > now that we can specify the slot explicitly, it is easy to change the
> > > > > > position of the xen-platform device on the PCI bus if graphic
> > > > > > passthrough is enabled.
> > > > > >
> > > > > > Move the machine options earlier, before any other emulated devices
> > > > > > options. Otherwise the selected PCI slot for the xen-platform device
> > > > > > is
> > > > > > not available in QEMU.
> > > > > >
> > > > > > Specify PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off, because
> > > > > > differently from xenfv, the other QEMU machines do not have that
> > > > > > option
> > > > > > off by default.
> > > > > >
> > > > > > This patch does not change the emulated environment in the guest.
> > > > > >
> > > > > > Refer to this thread:
> > > > > > http://marc.info/?l=xen-devel&m=140023775929625&w=2
> > > > > >
> > > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > > > >
> > > > > > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> > > > > > index 8abed7b..fef684f 100644
> > > > > > --- a/tools/libxl/libxl_dm.c
> > > > > > +++ b/tools/libxl/libxl_dm.c
> > > > > > @@ -476,6 +476,29 @@ static char **
> > > > > > libxl__build_device_model_args_new(libxl__gc *gc,
> > > > > >            flexarray_vappend(dm_args, "-k", keymap, NULL);
> > > > > >        }
> > > > > >    +    flexarray_append(dm_args, "-machine");
> > > > > > +    switch (b_info->type) {
> > > > > > +    case LIBXL_DOMAIN_TYPE_PV:
> > > > > > +        flexarray_append(dm_args, "xenpv");
> > > > > > +        for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL;
> > > > > > i++)
> > > > > > +            flexarray_append(dm_args, b_info->extra_pv[i]);
> > > > > > +        break;
> > > > > > +    case LIBXL_DOMAIN_TYPE_HVM:
> > > > > > +        flexarray_append(dm_args, "pc-i440fx-1.6,accel=xen");
> > >
> > > I think that a note in README should be added: qemu >=1.6.1 is required for
> > > hvm domUs.
> > >
> > > About the other xl parameter to be added I think that should be:
> > > qemu_machine_type="i440fx"|"q35" (when also q35 will be supported on xen)
> > > qemu_machine_version="x.y" to specify the machine version, useful for
> > > debug/testing and other some cases.
> > >
> > > > > > +        flexarray_append(dm_args, "-global");
> > > > > > +        flexarray_append(dm_args,
> > > > > > "PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off");
> > > > > I think is good add a comment for remember to remove this workaround
> > > > > when pc
> > > > > > =2.1 will be the default since qemu 2.1 will fix it.
> > > > > https://lists.gnu.org/archive/html/qemu-devel/2014-05/msg04789.html
> > > > The workaround is not actually harmful, it doesn't need to be removed
> > > > when pc >= 2.1 in QEMU.
> > > >
> > > >
> > > > > > +        if (libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
> > > > > > +            flexarray_append(dm_args, "-device");
> > > > > > +            flexarray_append(dm_args, "xen-platform,addr=0x2");
> > > > > The fixed pci address to 0x2 probably is a problem with intel gpu
> > > > > passthrough:
> > > > > http://lists.gnu.org/archive/html/qemu-devel/2014-05/msg03726.html
> > > > Right, however we cannot really change the default position of the
> > > > xen-platform device on the PCI bus, otherwise we'll end up changing the
> > > > emulated environment for all the VMs out there.
> > > >
> > > > I'll leave it to Tiejun to move xen-platform to another slot when
> > > > graphic passthrough is enabled.
> > >
> >
> > I found another case of problem with xen-platform's fixed pci slot.
> > I tested this patch and I saw that qemu not start also in other cases, for
> > example the domU of my test:
> > > qemu-system-i386: -device xen-platform,addr=0x2: PCI: slot 2 function 0 not
> > > available for xen-platform, in use by intel-hda
> > > qemu-system-i386: -device xen-platform,addr=0x2: Device initialization
> > > failed.
> > > qemu-system-i386: -device xen-platform,addr=0x2: Device 'xen-platform' could
> > > not be initialized
> >
> > The domU's xl cfg:
> > > name='W7'
> > > builder="hvm"
> > > #device_model_override="/usr/lib/xen/bin/qemu-gdb"
> > > #device_model_override="/usr/bin/qemu-system-x86_64"
> > > #bios="ovmf"
> > > memory=2048
> > > vcpus=2
> > > #nestedhvm=1
> > > #vif=['model=e1000,bridge=xenbr0']
> > > vif=['bridge=xenbr0,mac=00:16:3e:42:ae:8f']
> > > disk=['/mnt/vm/disks/W7.disk1.xm,raw,hda,rw',',raw,hdb,ro,cdrom']
> > > boot='dc'
> > > device_model_version="qemu-xen"
> > > viridian=1
> > > vnc=0
> > > keymap="it"
> > > on_crash="destroy"
> > > vga="qxl"
> > > #videoram=64
> > > spice=1
> > > spicehost='0.0.0.0'
> > > spiceport=6002
> > > spicedisable_ticketing=1
> > > spicevdagent=1
> > > spice_clipboard_sharing=0
> > > spice_image_compression="off"
> > > spice_streaming_video="filter"
> > > spiceusbredirection=4
> > > soundhw="hda"
>
> >From the error message, it looks like soundhw is the option that
> conflicts with xen-platform,addr=0x2.
>
>
> > > localtime=1
> > > usbversion=2
> >
> > Probably there are also other cases that can create a problem with
> > xen-platform fixed address, FWIK now new usb controller (with usbversion) is
> > the only other with fixed pci address in libxl, all other emulated qemu
> > components not.
> > And call it before in qemu binary starts notaffect the pci slot order because
> > the xen-platform is already before audio.
>
> Actually it looks like that by passing -device xen-platform before the
> other options, it already tries to assign slot 2 if possible. I don't
> need to specify addr=0x2. That seems to be the best course of action.

However it would still place xen-platform at slot 3 instead of slot 2 if
soundhw is specified. It seems to me that there is not a perfect
solution to this problem.  We can either:

- Switch to -machine pc-i440fx-1.6 by default and use consistently the
same -machine option no matter the value of xen_platform_pci. Nice, but
we break compatibility with existing guests if soundhw is specified.

- Switch to -machine pc-i440fx-1.6 only when xen_platform_pci=0 is
specified and keep xenfv if xen_platform_pci=1. We still break
compatibility when soundhw is specified together with xen_platform_pci=0.

FWIK removing the xen-platform's fixed pci slot will keep compatibility in any cases, assigning slots as it did before.
I'll try tomorrow.
Otherwise I think there would be problems in other cases, not only audio case.
Perhaps
even with save/restore/migrate
.


Removing xen-platform's fixed pci slot works, I not found any case with problem for now.
The only problem probably will be only intel graphic passthrough (not tested), same with fixed pci slot of starting patch.

--------------020701020101000606070800--