qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Liran Alon <liran.alon@oracle.com>
Cc: qemu-devel@nongnu.org, rth@twiddle.net, ehabkost@redhat.com,
	mtosatti@redhat.com, kvm list <kvm@vger.kernel.org>,
	Jim Mattson <jmattson@google.com>,
	Idan Brown <idan.brown@oracle.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] KVM: i386: Add support for save and restore nested state
Date: Fri, 14 Sep 2018 17:08:46 +0200	[thread overview]
Message-ID: <e15704bf-cd9f-30d6-7371-4adc546b0d96@redhat.com> (raw)
In-Reply-To: <B8ABB04A-A6F5-4409-8E05-9E8D7CE124F5@oracle.com>

On 14/09/2018 16:31, Liran Alon wrote:
>> There is still a problem, however, in that the same input stream would
>> be parsed differently depending on the kernel version.  In particular,
>> if in the future the maximum nested state size grows, you break all
>> existing save files.
> 
> I’m not sure I agree with this.
> 1) Newer kernels should change struct only by utilizing unused fields in current struct
> or enlarging it with extra fields. It should not change the meaning of existing fields.

Newer kernels will return a larger size, which is stored in
env->nested_state_len, and the file format depends on it:

> +        VMSTATE_VBUFFER_UINT32(env.nested_state, X86CPU, 
> +                               0, NULL, 
> +                               env.nested_state_len), 

>>
>> By defining more HF flags.  I'd rather avoid having multiple ways to
>> store the same thing, in case for example in the future HVF implements
>> nested virt.
> 
> I agree it is possible to define more hflags and to translate kvm_nested_flags->flags to flags in hflags and vice-versa.
> However, I am not sure I understand the extra value provided by doing so.
> I think it makes more sense to rename struct kvm_nested_state to struct nested_state and
> use this as a generic interface to get/set nested_state for all hypervisors.
> If a given hypervisor, such as HVF, needs to store different blob than KVM VMX, it can just add another struct field to
> the union-part of struct kvm_nested_state.
> This way, the code that handles the save/restore of nested_state can remain generic for all hypervisors.

I agree that the value is small, but it's there.  For example, the
debugging commands support AMD nested paging, and sharing the flags
means that it works for KVM too, not just TCG.  So I'd prefer to do it
the same way for Intel too.

Paolo

  reply	other threads:[~2018-09-14 15:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14  9:54 [Qemu-devel] [PATCH 2/2] KVM: i386: Add support for save and restore nested state Liran Alon
2018-09-14 10:59 ` Paolo Bonzini
2018-09-14 14:31   ` Liran Alon
2018-09-14 15:08     ` Paolo Bonzini [this message]
2018-09-15 20:48       ` Liran Alon
2018-09-15 20:57         ` Liran Alon
  -- strict thread matches above, loose matches on Subject: below --
2018-09-14  0:38 [Qemu-devel] [PATCH 0/2]: " Liran Alon
2018-09-14  0:38 ` [Qemu-devel] [PATCH 2/2] " Liran Alon
2018-09-14  7:16   ` Paolo Bonzini

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=e15704bf-cd9f-30d6-7371-4adc546b0d96@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=idan.brown@oracle.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=mtosatti@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).