[libvirt] [PATCH] docs: formatdomain: Note the caveats for CPU policy option "force"

Kashyap Chamarthy posted 1 patch 5 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180612085846.10420-1-kchamart@redhat.com
Test syntax-check passed
docs/formatdomain.html.in | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
[libvirt] [PATCH] docs: formatdomain: Note the caveats for CPU policy option "force"
Posted by Kashyap Chamarthy 5 years, 9 months ago
Eduardo Habkost has pointed out that the current documentation of
libvirt's CPU feature policy "require" vs. "force" does not match
QEMU's behaviour.

Update the documentation by spelling out the QEMU version dependency and
explain in which scenarios the usage of "policy = 'force'" is applicable
or not.

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
---
Wordsmithing / corrections welcome.
---
 docs/formatdomain.html.in | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6912762f28..4d6c3892ee 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1566,8 +1566,17 @@
 
         <dl>
           <dt><code>force</code></dt>
-          <dd>The virtual CPU will claim the feature is supported regardless
-            of it being supported by host CPU.</dd>
+          <dd>The virtual CPU will claim the feature is supported
+          regardless of it being supported by host CPU -- this is only
+          true for QEMU version older than 2.9.0.  I.e. when using the
+          CPU mode 'host-model', libvirt identifies which CPU features
+          to use by looking at host CPUID.  For that to take effect, it
+          is mandatory to use <code>force</code> to tell libvirt that a
+          said CPU feature must be used despite it not existing in the
+          host -- this applicable only for a very limited set of CPU
+          features, such as 'x2apic', virt-ssbd' (for AMD CPUs).</dd>
+          <dd>However, when using QEMU 2.9.0 and above, there should
+          never be any need to use <code>force</code>.</dd>
           <dt><code>require</code></dt>
           <dd>Guest creation will fail unless the feature is supported by the
             host CPU or the hypervisor is able to emulate it.</dd>
-- 
2.17.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: formatdomain: Note the caveats for CPU policy option "force"
Posted by Eduardo Habkost 5 years, 9 months ago
On Tue, Jun 12, 2018 at 10:58:46AM +0200, Kashyap Chamarthy wrote:
> Eduardo Habkost has pointed out that the current documentation of
> libvirt's CPU feature policy "require" vs. "force" does not match
> QEMU's behaviour.
> 
> Update the documentation by spelling out the QEMU version dependency and
> explain in which scenarios the usage of "policy = 'force'" is applicable
> or not.
> 
> Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
> ---
> Wordsmithing / corrections welcome.
> ---
>  docs/formatdomain.html.in | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 6912762f28..4d6c3892ee 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -1566,8 +1566,17 @@
>  
>          <dl>
>            <dt><code>force</code></dt>
> -          <dd>The virtual CPU will claim the feature is supported regardless
> -            of it being supported by host CPU.</dd>
> +          <dd>The virtual CPU will claim the feature is supported
> +          regardless of it being supported by host CPU -- this is only
> +          true for QEMU version older than 2.9.0.  I.e. when using the

This isn't true for any QEMU versions.  QEMU never enables a
feature if it's not supported by the host.


> +          CPU mode 'host-model', libvirt identifies which CPU features
> +          to use by looking at host CPUID.  For that to take effect, it
> +          is mandatory to use <code>force</code> to tell libvirt that a
> +          said CPU feature must be used despite it not existing in the
> +          host -- this applicable only for a very limited set of CPU
> +          features, such as 'x2apic', virt-ssbd' (for AMD CPUs).</dd>
> +          <dd>However, when using QEMU 2.9.0 and above, there should
> +          never be any need to use <code>force</code>.</dd>
>            <dt><code>require</code></dt>
>            <dd>Guest creation will fail unless the feature is supported by the
>              host CPU or the hypervisor is able to emulate it.</dd>
> -- 
> 2.17.0
> 

-- 
Eduardo

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: formatdomain: Note the caveats for CPU policy option "force"
Posted by Jiri Denemark 5 years, 9 months ago
On Tue, Jun 12, 2018 at 10:58:46 +0200, Kashyap Chamarthy wrote:
> Eduardo Habkost has pointed out that the current documentation of
> libvirt's CPU feature policy "require" vs. "force" does not match
> QEMU's behaviour.
> 
> Update the documentation by spelling out the QEMU version dependency and
> explain in which scenarios the usage of "policy = 'force'" is applicable
> or not.
> 
> Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
> ---
> Wordsmithing / corrections welcome.
> ---
>  docs/formatdomain.html.in | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 6912762f28..4d6c3892ee 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -1566,8 +1566,17 @@
>  
>          <dl>
>            <dt><code>force</code></dt>
> -          <dd>The virtual CPU will claim the feature is supported regardless
> -            of it being supported by host CPU.</dd>

The original content was indented. Also I don't think you're supposed to
add two <dd> elements after single <dt>.

> +          <dd>The virtual CPU will claim the feature is supported
> +          regardless of it being supported by host CPU -- this is only
> +          true for QEMU version older than 2.9.0.

I'd suggest

    Libvirt will ask the hypervisor to enable the feature regardless of
    it being supported by host CPU. The hypervisor will likely ignore
    this request if the feature is not supported by the host CPU or if
    it cannot be emulated. In other words, it is useful for features
    which do not exist in real hardware, such as 'virt-ssbd', or which
    can be emulated, such as 'x2apic'.

> I.e. when using the
> +          CPU mode 'host-model', libvirt identifies which CPU features
> +          to use by looking at host CPUID.  For that to take effect, it
> +          is mandatory to use <code>force</code> to tell libvirt that a
> +          said CPU feature must be used despite it not existing in the
> +          host -- this applicable only for a very limited set of CPU
> +          features, such as 'x2apic', virt-ssbd' (for AMD CPUs).</dd>
> +          <dd>However, when using QEMU 2.9.0 and above, there should
> +          never be any need to use <code>force</code>.</dd>

What was the motivation behind this change? I find it quite confusing
that this is supposed to describe 'force' policy and suddenly you're
talking about host-model CPU mode.

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: formatdomain: Note the caveats for CPU policy option "force"
Posted by Kashyap Chamarthy 5 years, 9 months ago
On Fri, Jun 22, 2018 at 02:19:52PM +0200, Jiri Denemark wrote:
> On Tue, Jun 12, 2018 at 10:58:46 +0200, Kashyap Chamarthy wrote:

[...]

> > diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> > index 6912762f28..4d6c3892ee 100644
> > --- a/docs/formatdomain.html.in
> > +++ b/docs/formatdomain.html.in
> > @@ -1566,8 +1566,17 @@
> >  
> >          <dl>
> >            <dt><code>force</code></dt>
> > -          <dd>The virtual CPU will claim the feature is supported regardless
> > -            of it being supported by host CPU.</dd>
> 
> The original content was indented. Also I don't think you're supposed to
> add two <dd> elements after single <dt>.

Hmm, I made a test locally to see it renders as intented.  Because, I
wnated the second paragraph to be on a separate line.

> 
> > +          <dd>The virtual CPU will claim the feature is supported
> > +          regardless of it being supported by host CPU -- this is only
> > +          true for QEMU version older than 2.9.0.
> 
> I'd suggest
> 
>     Libvirt will ask the hypervisor to enable the feature regardless of
>     it being supported by host CPU. The hypervisor will likely ignore
>     this request if the feature is not supported by the host CPU or if
>     it cannot be emulated. In other words, it is useful for features
>     which do not exist in real hardware, such as 'virt-ssbd', or which
>     can be emulated, such as 'x2apic'.

Yes, your wording is much clearer.

> > I.e. when using the
> > +          CPU mode 'host-model', libvirt identifies which CPU features
> > +          to use by looking at host CPUID.  For that to take effect, it
> > +          is mandatory to use <code>force</code> to tell libvirt that a
> > +          said CPU feature must be used despite it not existing in the
> > +          host -- this applicable only for a very limited set of CPU
> > +          features, such as 'x2apic', virt-ssbd' (for AMD CPUs).</dd>
> > +          <dd>However, when using QEMU 2.9.0 and above, there should
> > +          never be any need to use <code>force</code>.</dd>
> 
> What was the motivation behind this change? I find it quite confusing
> that this is supposed to describe 'force' policy and suddenly you're
> talking about host-model CPU mode.

Hmm, re-reading, indeed the flow from the previous sentence to the "I.e.
when using the CPU mode 'host-model'" seems like a non-sequitur.

My intention was to add a note about in which scenarios specifying
'force' makes sense.  IIRC, I learnt from Dan Berrangé that if you are
using a QEMU version that is older than 2.9.0, then 'force' is required
for a guest that needs features that don't exist in the real CPU.  If
you are using QEMU >= 2.9.0, then 'force' is not required.

-- 
/kashyap

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list