[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad1fd6bd-0dd3-52c0-0343-dc9f0cb4f5f8@amazon.com>
Date: Thu, 8 Feb 2018 19:51:39 +0100
From: KarimAllah Ahmed <karahmed@...zon.com>
To: Jim Mattson <jmattson@...gle.com>,
KarimAllah Ahmed <karahmed@...zon.de>
CC: LKML <linux-kernel@...r.kernel.org>,
kvm list <kvm@...r.kernel.org>,
"Paolo Bonzini" <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>
Subject: Re: [RFC 05/12] KVM/VMX: Use the new host mapping API for mapping
nested vmptr
On 02/05/2018 11:15 PM, Jim Mattson wrote:
> On Mon, Feb 5, 2018 at 10:49 AM KarimAllah Ahmed <karahmed@...zon.de> wrote:
>
>
>> @@ -7410,19 +7410,17 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
>> return kvm_skip_emulated_instruction(vcpu);
>> }
>
>> - page = kvm_vcpu_gpa_to_page(vcpu, vmptr);
>> - if (is_error_page(page)) {
>> + if (!kvm_vcpu_gpa_to_host_mapping(vcpu, vmptr, &mapping, true)) {
>> nested_vmx_failInvalid(vcpu);
>> return kvm_skip_emulated_instruction(vcpu);
>> }
>> - if (*(u32 *)kmap(page) != VMCS12_REVISION) {
>> - kunmap(page);
>> - kvm_release_page_clean(page);
>> + if (*(u32 *)mapping.kaddr != VMCS12_REVISION) {
>> + kvm_release_host_mapping(&mapping, false);
>> nested_vmx_failInvalid(vcpu);
>> return kvm_skip_emulated_instruction(vcpu);
>> }
>> - kunmap(page);
>> - kvm_release_page_clean(page);
>> +
>> + kvm_release_host_mapping(&mapping, false);
>
> Why go through this explicit mapping/release dance? Why not just:
>
> uint32_t revision;
> ...
> if (kvm_read_guest(vcpu->kvm, vmptr, &revision, sizeof(revision)) ||
> revision != VMCS12_REVISION) {
> nested_vmx_failInvalid(vcpu);
> return kvm_skip_emulated_instruction(vcpu);
> }
>
Fair enough, I will update.
Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
Powered by blists - more mailing lists