All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liran Alon <liran.alon@oracle.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mtosatti@redhat.com,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	rth@twiddle.net, jmattson@google.com
Subject: Re: [QEMU PATCH v2 0/2]: KVM: i386: Add support for save and restore nested state
Date: Tue, 13 Nov 2018 01:58:46 +0200	[thread overview]
Message-ID: <B6AEEFF2-BAF1-439A-8E44-51352C9E05AE@oracle.com> (raw)
In-Reply-To: <20181112165053.GF2293@work-vm>



> On 12 Nov 2018, at 18:50, Dr. David Alan Gilbert <dgilbert@redhat.com> wrote:
> 
> * Daniel P. Berrangé (berrange@redhat.com) wrote:
>> On Sun, Nov 04, 2018 at 11:19:57PM +0100, Paolo Bonzini wrote:
>>> On 02/11/2018 17:54, Daniel P. Berrangé wrote:
>>>> We have usually followed a rule that new machine types must not
>>>> affect runability of a VM on a host. IOW new machine types should
>>>> not introduce dependancies on specific kernels, or hardware features
>>>> such as CPU flags.
>>> 
>>>> Anything that requires a new kernel feature thus ought to be an
>>>> opt-in config tunable on the CLI, separate from machine type
>>>> choice.
>>> 
>>> Unless someone tinkered with the module parameters, they could not even
>>> use nested virtualization before 4.20.  So for everyone else, "-cpu
>>> ...,+vmx" does count as an "opt-in config tunable on the CLI" that
>>> requires 4.20.
>>> 
>>> For those that did tinker with module parameters, we can grandfather in
>>> the old machine types, so that they can use nested virtualization with
>>> no live migration support.  For those that did not, however, I don't
>>> think it makes sense to say "oh by the way I really want to be able to
>>> migrate this VM" on the command line, or even worse on the monitor.
>> 
>> IIUC, 4.20 is only required from POV of migration state. Is it thus
>> possible to just register a migration blocker if QEMU is launched
>> on a host with kernel < 4.20.
>> 
>> Migration has always been busted historically, so those people using
>> nested VMX already won't be hurt by not having ability to live migrate
>> their VM, but could otherwise continue using them without being forced
>> to upgrade their kernel to fix a feature they're not even using.
> 
> Yes, although I am a bit worried we might have a population of users
> that:
>   a) Have enabled nesting
>   b) Run VMs with vmx enabled
>   c) Don't normally actually run nested guests
>   d) Currently happily migrate.
> 
> Dave

First of all, we should put the entire kvm_nested_state in a VMState subsection that has a .needed() method
that checks if ((format==VMX) && (vmx.vmxon_pa != -1ull));
This will allow migrating a VM that has nested exposed but didn’t really enter VMX operation to still be able
to successfully migrate to old hosts without any issues.

The only problem remaining to be solved that you discuss here is what happens if user runs with modern QEMU
(Including my to-be-written v3 patches discussed here) on a host that has kernel without KVM_CAP_NESTED_STATE.
In this kernel, it is impossible for userspace (e.g. QEMU) to know if guest that was exposed with VMX actually used it.
So for those cases, I see no option but to modify QEMU to also say that if guest is exposed with VMX and
we are running on kernel without KVM_CAP_NESTED_STATE, then this is a migration blocker.

-Liran

> 
>> Regards,
>> Daniel
>> -- 
>> |: https://urldefense.proofpoint.com/v2/url?u=https-3A__berrange.com&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=rs9ZkUUS37SHrs_oZJ9uIiXtpXvUkJBpfVEe9OSiQzk&e=      -o-    https://urldefense.proofpoint.com/v2/url?u=https-3A__www.flickr.com_photos_dberrange&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=u_hnAFyY8BVwto0FsomTcZ3dmLKPYb1hwI_jRXI6EZg&e= :|
>> |: https://urldefense.proofpoint.com/v2/url?u=https-3A__libvirt.org&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=SEIw983ixpJUUySxUwrxtIbnjvHTB9ff3MaqULaulQw&e=         -o-            https://urldefense.proofpoint.com/v2/url?u=https-3A__fstop138.berrange.com&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=yvxjeOrwjXjf08RBhPdX53lJN1W-8WSXT25ZeMSA06k&e= :|
>> |: https://urldefense.proofpoint.com/v2/url?u=https-3A__entangle-2Dphoto.org&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=9TIjtmf6AVFYWbyzI5vl-zXTaNCSCMAxyck92pc8yvY&e=    -o-    https://urldefense.proofpoint.com/v2/url?u=https-3A__www.instagram.com_dberrange&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=Wapdtm0yT4j-9EjMoxwo9QvRZ3h9Fk_CvpQq8J4TDpg&e= :|
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

WARNING: multiple messages have this Message-ID (diff)
From: Liran Alon <liran.alon@oracle.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: "\"Daniel P. Berrangé\"" <berrange@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	jmattson@google.com, ehabkost@redhat.com, kvm@vger.kernel.org,
	mtosatti@redhat.com, qemu-devel@nongnu.org, rth@twiddle.net
Subject: Re: [Qemu-devel] [QEMU PATCH v2 0/2]: KVM: i386: Add support for save and restore nested state
Date: Tue, 13 Nov 2018 01:58:46 +0200	[thread overview]
Message-ID: <B6AEEFF2-BAF1-439A-8E44-51352C9E05AE@oracle.com> (raw)
In-Reply-To: <20181112165053.GF2293@work-vm>



> On 12 Nov 2018, at 18:50, Dr. David Alan Gilbert <dgilbert@redhat.com> wrote:
> 
> * Daniel P. Berrangé (berrange@redhat.com) wrote:
>> On Sun, Nov 04, 2018 at 11:19:57PM +0100, Paolo Bonzini wrote:
>>> On 02/11/2018 17:54, Daniel P. Berrangé wrote:
>>>> We have usually followed a rule that new machine types must not
>>>> affect runability of a VM on a host. IOW new machine types should
>>>> not introduce dependancies on specific kernels, or hardware features
>>>> such as CPU flags.
>>> 
>>>> Anything that requires a new kernel feature thus ought to be an
>>>> opt-in config tunable on the CLI, separate from machine type
>>>> choice.
>>> 
>>> Unless someone tinkered with the module parameters, they could not even
>>> use nested virtualization before 4.20.  So for everyone else, "-cpu
>>> ...,+vmx" does count as an "opt-in config tunable on the CLI" that
>>> requires 4.20.
>>> 
>>> For those that did tinker with module parameters, we can grandfather in
>>> the old machine types, so that they can use nested virtualization with
>>> no live migration support.  For those that did not, however, I don't
>>> think it makes sense to say "oh by the way I really want to be able to
>>> migrate this VM" on the command line, or even worse on the monitor.
>> 
>> IIUC, 4.20 is only required from POV of migration state. Is it thus
>> possible to just register a migration blocker if QEMU is launched
>> on a host with kernel < 4.20.
>> 
>> Migration has always been busted historically, so those people using
>> nested VMX already won't be hurt by not having ability to live migrate
>> their VM, but could otherwise continue using them without being forced
>> to upgrade their kernel to fix a feature they're not even using.
> 
> Yes, although I am a bit worried we might have a population of users
> that:
>   a) Have enabled nesting
>   b) Run VMs with vmx enabled
>   c) Don't normally actually run nested guests
>   d) Currently happily migrate.
> 
> Dave

First of all, we should put the entire kvm_nested_state in a VMState subsection that has a .needed() method
that checks if ((format==VMX) && (vmx.vmxon_pa != -1ull));
This will allow migrating a VM that has nested exposed but didn’t really enter VMX operation to still be able
to successfully migrate to old hosts without any issues.

The only problem remaining to be solved that you discuss here is what happens if user runs with modern QEMU
(Including my to-be-written v3 patches discussed here) on a host that has kernel without KVM_CAP_NESTED_STATE.
In this kernel, it is impossible for userspace (e.g. QEMU) to know if guest that was exposed with VMX actually used it.
So for those cases, I see no option but to modify QEMU to also say that if guest is exposed with VMX and
we are running on kernel without KVM_CAP_NESTED_STATE, then this is a migration blocker.

-Liran

> 
>> Regards,
>> Daniel
>> -- 
>> |: https://urldefense.proofpoint.com/v2/url?u=https-3A__berrange.com&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=rs9ZkUUS37SHrs_oZJ9uIiXtpXvUkJBpfVEe9OSiQzk&e=      -o-    https://urldefense.proofpoint.com/v2/url?u=https-3A__www.flickr.com_photos_dberrange&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=u_hnAFyY8BVwto0FsomTcZ3dmLKPYb1hwI_jRXI6EZg&e= :|
>> |: https://urldefense.proofpoint.com/v2/url?u=https-3A__libvirt.org&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=SEIw983ixpJUUySxUwrxtIbnjvHTB9ff3MaqULaulQw&e=         -o-            https://urldefense.proofpoint.com/v2/url?u=https-3A__fstop138.berrange.com&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=yvxjeOrwjXjf08RBhPdX53lJN1W-8WSXT25ZeMSA06k&e= :|
>> |: https://urldefense.proofpoint.com/v2/url?u=https-3A__entangle-2Dphoto.org&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=9TIjtmf6AVFYWbyzI5vl-zXTaNCSCMAxyck92pc8yvY&e=    -o-    https://urldefense.proofpoint.com/v2/url?u=https-3A__www.instagram.com_dberrange&d=DwIDAw&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=Jk6Q8nNzkQ6LJ6g42qARkg6ryIDGQr-yKXPNGZbpTx0&m=ximE6x4FrQ5vo3D4wF3w-cVsKgtNs85wCTL5GiP_B5Q&s=Wapdtm0yT4j-9EjMoxwo9QvRZ3h9Fk_CvpQq8J4TDpg&e= :|
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  parent reply	other threads:[~2018-11-12 23:58 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-16 12:46 [QEMU PATCH v2 0/2]: KVM: i386: Add support for save and restore nested state Liran Alon
2018-09-16 12:46 ` [Qemu-devel] " Liran Alon
2018-09-16 12:46 ` [QEMU PATCH v2 1/2] i386: Compile CPUX86State xsave_buf only when support KVM or HVF Liran Alon
2018-09-16 12:46   ` [Qemu-devel] " Liran Alon
2018-09-16 12:46 ` [QEMU PATCH v2 2/2] KVM: i386: Add support for save and restore nested state Liran Alon
2018-09-16 12:46   ` [Qemu-devel] " Liran Alon
2018-10-08 17:21 ` [QEMU PATCH v2 0/2]: " Liran Alon
2018-10-08 17:21   ` [Qemu-devel] " Liran Alon
2018-10-15 18:10   ` Liran Alon
2018-10-15 18:10     ` [Qemu-devel] " Liran Alon
2018-10-31  1:03     ` Liran Alon
2018-10-31  1:03       ` [Qemu-devel] " Liran Alon
2018-10-31 18:17       ` Eduardo Habkost
2018-10-31 18:17         ` [Qemu-devel] " Eduardo Habkost
2018-10-31 18:19         ` Paolo Bonzini
2018-10-31 18:19           ` [Qemu-devel] " Paolo Bonzini
2018-10-31 18:50           ` Liran Alon
2018-10-31 18:50             ` [Qemu-devel] " Liran Alon
2018-10-31 18:59             ` Dr. David Alan Gilbert
2018-10-31 18:59               ` [Qemu-devel] " Dr. David Alan Gilbert
2018-10-31 23:17               ` Liran Alon
2018-10-31 23:17                 ` [Qemu-devel] " Liran Alon
2018-11-01 13:10                 ` Dr. David Alan Gilbert
2018-11-01 13:10                   ` [Qemu-devel] " Dr. David Alan Gilbert
2018-11-01 15:23                   ` Liran Alon
2018-11-01 15:23                     ` [Qemu-devel] " Liran Alon
2018-11-01 15:56                     ` Dr. David Alan Gilbert
2018-11-01 15:56                       ` [Qemu-devel] " Dr. David Alan Gilbert
2018-11-01 16:45                       ` Jim Mattson via Qemu-devel
2018-11-01 16:45                         ` [Qemu-devel] " Jim Mattson
2018-11-02  3:46                         ` Liran Alon
2018-11-02  3:46                           ` [Qemu-devel] " Liran Alon
2018-11-02  9:40                           ` Paolo Bonzini
2018-11-02  9:40                             ` [Qemu-devel] " Paolo Bonzini
2018-11-02 12:35                             ` Dr. David Alan Gilbert
2018-11-02 12:35                               ` [Qemu-devel] " Dr. David Alan Gilbert
2018-11-02 12:40                               ` Daniel P. Berrangé
2018-11-02 12:40                                 ` [Qemu-devel] " Daniel P. Berrangé
2018-11-04 22:12                               ` Paolo Bonzini
2018-11-04 22:12                                 ` [Qemu-devel] " Paolo Bonzini
2018-11-02 12:59                             ` Liran Alon
2018-11-02 12:59                               ` [Qemu-devel] " Liran Alon
2018-11-02 16:44                               ` Jim Mattson via Qemu-devel
2018-11-02 16:44                                 ` [Qemu-devel] " Jim Mattson
2018-11-02 16:58                                 ` Daniel P. Berrangé
2018-11-02 16:58                                   ` [Qemu-devel] " Daniel P. Berrangé
2018-11-02 17:01                                   ` Jim Mattson via Qemu-devel
2018-11-02 17:01                                     ` [Qemu-devel] " Jim Mattson
2018-11-02 16:54                             ` Daniel P. Berrangé
2018-11-02 16:54                               ` [Qemu-devel] " Daniel P. Berrangé
2018-11-02 16:58                               ` Dr. David Alan Gilbert
2018-11-02 16:58                                 ` [Qemu-devel] " Dr. David Alan Gilbert
2018-11-04 22:19                               ` Paolo Bonzini
2018-11-04 22:19                                 ` [Qemu-devel] " Paolo Bonzini
2018-11-12 16:18                                 ` Daniel P. Berrangé
2018-11-12 16:18                                   ` [Qemu-devel] " Daniel P. Berrangé
2018-11-12 16:50                                   ` Dr. David Alan Gilbert
2018-11-12 16:50                                     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-11-12 16:53                                     ` Paolo Bonzini
2018-11-12 16:53                                       ` [Qemu-devel] " Paolo Bonzini
2018-11-12 16:54                                     ` Daniel P. Berrangé
2018-11-12 16:54                                       ` [Qemu-devel] " Daniel P. Berrangé
2018-11-13  0:00                                       ` Liran Alon
2018-11-13  0:00                                         ` [Qemu-devel] " Liran Alon
2018-11-13  0:07                                         ` Jim Mattson via Qemu-devel
2018-11-13  0:07                                           ` [Qemu-devel] " Jim Mattson
2018-11-13  0:09                                           ` Liran Alon
2018-11-13  0:09                                             ` [Qemu-devel] " Liran Alon
2018-11-12 23:58                                     ` Liran Alon [this message]
2018-11-12 23:58                                       ` Liran Alon
2018-11-02 16:39                           ` Jim Mattson via Qemu-devel
2018-11-02 16:39                             ` [Qemu-devel] " Jim Mattson
2018-11-03  2:02                             ` Liran Alon
2018-11-03  2:02                               ` [Qemu-devel] " Liran Alon
2018-11-08  0:13                               ` Liran Alon
2018-11-08  0:13                                 ` [Qemu-devel] " Liran Alon
2018-11-08  0:45                                 ` Jim Mattson via Qemu-devel
2018-11-08  0:45                                   ` [Qemu-devel] " Jim Mattson
2018-11-08  9:50                                   ` Paolo Bonzini
2018-11-08  9:50                                     ` [Qemu-devel] " Paolo Bonzini
2018-11-08  9:57                                     ` Liran Alon
2018-11-08  9:57                                       ` [Qemu-devel] " Liran Alon
2018-11-08 17:02                                       ` Paolo Bonzini
2018-11-08 17:02                                         ` [Qemu-devel] " Paolo Bonzini
2018-11-08 18:41                                         ` Liran Alon
2018-11-08 18:41                                           ` [Qemu-devel] " Liran Alon
2018-11-08 20:34                                           ` Paolo Bonzini
2018-11-08 20:34                                             ` [Qemu-devel] " Paolo Bonzini
2018-11-12 14:51                                           ` Dr. David Alan Gilbert
2018-11-12 14:51                                             ` [Qemu-devel] " Dr. David Alan Gilbert
2018-11-01 19:03                       ` Liran Alon
2018-11-01 19:03                         ` [Qemu-devel] " Liran Alon
2018-11-01 19:07                         ` Dr. David Alan Gilbert
2018-11-01 19:07                           ` [Qemu-devel] " Dr. David Alan Gilbert
2018-11-01 19:41                           ` Jim Mattson via Qemu-devel
2018-11-01 19:41                             ` [Qemu-devel] " Jim Mattson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B6AEEFF2-BAF1-439A-8E44-51352C9E05AE@oracle.com \
    --to=liran.alon@oracle.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.