Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1701995

Re: [PATCH v2 1/3] kvm: svm: Add support for additional SVM NPF error codes

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/3] kvm: svm: Add support for additional SVM NPF error codes
Date 2017-08-02 12:50 +0200
Message-ID <u9ZnY-it-3@gated-at.bofh.it> (permalink)
References (3 earlier) <u9l7c-82B-19@gated-at.bofh.it> <u9l7c-82B-17@gated-at.bofh.it> <u9paO-2ga-17@gated-at.bofh.it> <u9paO-2ga-15@gated-at.bofh.it> <u9ZnY-it-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/08/2017 15:36, Brijesh Singh wrote:
>>
>> The flow is:
>>
>>    hardware walks page table; L2 page table points to read only memory
>>    -> pf_interception (code =
>>    -> kvm_handle_page_fault (need_unprotect = false)
>>    -> kvm_mmu_page_fault
>>    -> paging64_page_fault (for example)
>>       -> try_async_pf
>>          map_writable set to false
>>       -> paging64_fetch(write_fault = true, map_writable = false,
>> prefault = false)
>>          -> mmu_set_spte(speculative = false, host_writable = false,
>> write_fault = true)
>>             -> set_spte
>>                mmu_need_write_protect returns true
>>                return true
>>             write_fault == true -> set emulate = true
>>             return true
>>          return true
>>       return true
>>    emulate
>>
>> Without this patch, emulation would have called
>>
>>    ..._gva_to_gpa_nested
>>    -> translate_nested_gpa
>>    -> paging64_gva_to_gpa
>>    -> paging64_walk_addr
>>    -> paging64_walk_addr_generic
>>       set fault (nested_page_fault=true)
>>
>> and then:
>>
>>     kvm_propagate_fault
>>     -> nested_svm_inject_npf_exit
>>
> 
> maybe then safer thing would be to qualify the new error_code check with
> !mmu_is_nested(vcpu) or something like that. So that way it would run on
> L1 guest, and not the L2 guest. I believe that would restrict it avoid
> hitting this case. Are you okay with this change ?

Or check "vcpu->arch.mmu.direct_map"?  That would be true when not using
shadow pages.

> IIRC, the main place where this check was valuable was when L1 guest had
> a fault (when coming out of the L2 guest) and emulation was not needed.

How do I measure the effect?  I tried counting the number of emulations,
and any difference from the patch was lost in noise.

Paolo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 1/3] kvm: svm: Add support for additional SVM NPF error  codes Paolo Bonzini <pbonzini@redhat.com> - 2017-07-31 17:50 +0200
  Re: [PATCH v2 1/3] kvm: svm: Add support for additional SVM NPF  error codes Paolo Bonzini <pbonzini@redhat.com> - 2017-07-31 22:10 +0200
    Re: [PATCH v2 1/3] kvm: svm: Add support for additional SVM NPF error  codes Paolo Bonzini <pbonzini@redhat.com> - 2017-08-02 12:50 +0200
      Re: [PATCH v2 1/3] kvm: svm: Add support for additional SVM NPF error  codes Paolo Bonzini <pbonzini@redhat.com> - 2017-08-04 16:10 +0200

csiph-web