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