[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+CzJHoLwgsECeTbXrEVEjU4xzh0DTqiV3yVoLY2twHq5DQ@mail.gmail.com>
Date: Wed, 28 Jun 2017 06:33:56 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
kvm <kvm@...r.kernel.org>,
Radim Krčmář <rkrcmar@...hat.com>,
Wanpeng Li <wanpeng.li@...mail.com>
Subject: Re: [PATCH v4 3/4] KVM: async_pf: Force a nested vmexit if the
injected #PF is async_pf
2017-06-27 21:40 GMT+08:00 Paolo Bonzini <pbonzini@...hat.com>:
>
>
> On 22/06/2017 04:06, Wanpeng Li wrote:
>> From: Wanpeng Li <wanpeng.li@...mail.com>
>>
>> Add an async_page_fault field to vcpu->arch.exception to identify an async
>> page fault, and constructs the expected vm-exit information fields. Force
>> a nested VM exit from nested_vmx_check_exception() if the injected #PF
>> is async page fault. Extending the userspace interface KVM_GET_VCPU_EVENTS
>> and KVM_SET_VCPU_EVENTS for live migration.
>
> I am not sure what would happen if new kernel (that can produce
> async_page_fault=1) runs on top of old userspace (that can consume it).
>
> I think it would be safer to make the new field "nested_apf", and only
> set it if in guest_mode, like
>
> vcpu->arch.exception.nested_apf =
> is_guest_mode(vcpu) && fault->async_page_fault;
> if (vcpu->arch.exception.nested_apf)
> vcpu->arch.apf.nested_apf_token = fault->address;
> else
> vcpu->arch.cr2 = fault->address;
I have already added the same logic in kvm_inject_page_fault in patch
3/4, in addition, there is a guarantee it is in guest mode when we set
svm->vmcb->control.xxxx in nested_svm_check_exception, how about just
as what we do in nested_vmx_check_exception?
+ if (svm->vcpu.arch.exception.async_page_fault)
+ svm->vmcb->control.exit_info_2 = svm->vcpu.arch.apf.nested_apf_token;
+ else
+ svm->vmcb->control.exit_info_2 = svm->vcpu.arch.cr2;
Regards,
Wanpeng Li
Powered by blists - more mailing lists