lkml.org 
[lkml]   [2019]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 2/2] kvm: Use huge pages for DAX-backed files
From
Date


> On 13 Dec 2019, at 19:50, Sean Christopherson <sean.j.christopherson@intel.com> wrote:
>
> On Fri, Dec 13, 2019 at 07:31:55PM +0200, Liran Alon wrote:
>>
>>> On 13 Dec 2019, at 19:19, Sean Christopherson <sean.j.christopherson@intel.com> wrote:
>>>
>>> Then allowed_hugepage_adjust() would look something like:
>>>
>>> static void allowed_hugepage_adjust(struct kvm_vcpu *vcpu, gfn_t gfn,
>>> kvm_pfn_t *pfnp, int *levelp, int max_level)
>>> {
>>> kvm_pfn_t pfn = *pfnp;
>>> int level = *levelp;
>>> unsigned long mask;
>>>
>>> if (is_error_noslot_pfn(pfn) || !kvm_is_reserved_pfn(pfn) ||
>>> level == PT_PAGE_TABLE_LEVEL)
>>> return;
>>>
>>> /*
>>> * mmu_notifier_retry() was successful and mmu_lock is held, so
>>> * the pmd/pud can't be split from under us.
>>> */
>>> level = host_pfn_mapping_level(vcpu->kvm, gfn, pfn);
>>>
>>> *levelp = level = min(level, max_level);
>>> mask = KVM_PAGES_PER_HPAGE(level) - 1;
>>> VM_BUG_ON((gfn & mask) != (pfn & mask));
>>> *pfnp = pfn & ~mask;
>>
>> Why don’t you still need to kvm_release_pfn_clean() for original pfn and
>> kvm_get_pfn() for new huge-page start pfn?
>
> That code is gone in kvm/queue. thp_adjust() is now called from
> __direct_map() and FNAME(fetch), and so its pfn adjustment doesn't bleed
> back to the page fault handlers. The only reason the put/get pfn code
> existed was because the page fault handlers called kvm_release_pfn_clean()
> on the pfn, i.e. they would have put the wrong pfn.

Ack. Thanks for the explaining this.


\
 
 \ /
  Last update: 2019-12-13 19:11    [W:0.042 / U:8.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site