kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Makarand Sonare <makarandsonare@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, pshier@google.com, jmattson@google.com
Subject: Re: [PATCH v2 1/2] KVM: nVMX: Fix VMX preemption timer migration
Date: Wed, 20 May 2020 22:53:12 +0200	[thread overview]
Message-ID: <d21f47c0-dd48-53f8-ffbb-8d6f8637b50b@redhat.com> (raw)
In-Reply-To: <CA+qz5sppOJe5meVqdgW-H=_2ptmmP+s3H9iVicA0SRBpy4g5tQ@mail.gmail.com>

On 20/05/20 20:53, Makarand Sonare wrote:
>>
>>> +
>>> +		if (get_user(vmx->nested.preemption_timer_deadline,
>>> +			     &user_vmx_nested_state->preemption_timer_deadline)) {
>> ... tt also seems that we expect user_vmx_nested_state to always have
>> all fields, e.g. here the offset of 'preemption_timer_deadline' is
>> static, we always expect it to be after shadow vmcs. I think we need a
>> way to calculate the offset dynamically and not require everything to be
>> present.
>>
> Would it suffice if I move preemption_timer_deadline field to
> kvm_vmx_nested_state_hdr?
> 

Yes, please do so.  The header is exactly for cases like this where we
have small fields that hold non-architectural pieces of state.

Also, I think you should have a boolean field, like
vmx->nested.has_preemption_timer_deadline.
nested_vmx_enter_non_root_mode would use it (negated) instead of
from_vmentry.  You can then set the field to true in
vmx_set_nested_state (if the incoming state has
KVM_STATE_NESTED_PREEMPTION_TIMER set) and in
nested_vmx_enter_non_root_mode; conversely, vmexit will set it to false
and vmx_get_nested_state can also use the field to decide whether to set
KVM_STATE_NESTED_PREEMPTION_TIMER.

This way, if you have an incoming migration where the field is not set,
nested_vmx_enter_non_root_mode will fall back as gracefully as possible.

Thanks,

Paolo


  reply	other threads:[~2020-05-20 20:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 22:22 [PATCH v2 0/2] Fix VMX preemption timer migration Makarand Sonare
2020-05-19 22:22 ` [PATCH v2 1/2] KVM: nVMX: " Makarand Sonare
2020-05-20 17:08   ` Vitaly Kuznetsov
2020-05-20 18:53     ` Makarand Sonare
2020-05-20 20:53       ` Paolo Bonzini [this message]
2020-05-21  8:47         ` Vitaly Kuznetsov
2020-05-21  9:06           ` Paolo Bonzini
2020-05-19 22:22 ` [PATCH v2 2/2] KVM: selftests: VMX preemption timer migration test Makarand Sonare

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=d21f47c0-dd48-53f8-ffbb-8d6f8637b50b@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=makarandsonare@google.com \
    --cc=pshier@google.com \
    --cc=vkuznets@redhat.com \
    /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).