Re: [PATCH 4/4] KVM: guest_memfd: Stop returning struct page from PFN lookup

Ackerley Tng <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,dev.linux.lists.kvmarm,org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <CAEvNRgG8gxZSmOrsENemNqbaZuDyqNXj35M4VyChA6HQ_ofYVg@mail.gmail.com>
Yan Zhao <[email protected]> writes:

> Hi Ackerley,
>
>> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
>> index 6c941aaa10c63..e5d637a5ec558 100644
>> --- a/arch/arm64/kvm/mmu.c
>> +++ b/arch/arm64/kvm/mmu.c
>> @@ -1613,7 +1613,7 @@ static int gmem_abort(const struct kvm_s2_fault_desc *s2fd)
>>  	enum kvm_pgtable_prot prot = KVM_PGTABLE_PROT_R;
>>  	struct kvm_pgtable *pgt = s2fd->vcpu->arch.hw_mmu->pgt;
>>  	unsigned long mmu_seq;
>> -	struct page *page;
> Just drop the page should be ok, since
>> +	struct page *page = NULL;
>>  	struct kvm *kvm = s2fd->vcpu->kvm;
>>  	void *memcache = NULL;
>>  	kvm_pfn_t pfn;
>> @@ -1641,7 +1641,7 @@ static int gmem_abort(const struct kvm_s2_fault_desc *s2fd)
>>  	/* Pairs with the smp_wmb() in kvm_mmu_invalidate_end(). */
>>  	smp_rmb();
>>
>> -	ret = kvm_gmem_get_pfn(kvm, s2fd->memslot, gfn, &pfn, &page, NULL);
>> +	ret = kvm_gmem_get_pfn(kvm, s2fd->memslot, gfn, &pfn, NULL);
>>  	if (ret) {
>>  		kvm_prepare_memory_fault_exit(s2fd->vcpu, s2fd->fault_ipa, PAGE_SIZE,
>>  					      write_fault, exec_fault, false);
> here missed a hunk:
>  out_unlock:
> -       kvm_release_faultin_page(kvm, page, !!ret, prot & KVM_PGTABLE_PROT_W);
>         kvm_fault_unlock(kvm);
>
> I will fully test this series tomorrow.

Makes sense. gmem_abort() is purely gmem and there's non-gmem path to
fill the page pointer in, so the above is correct.

I'll not be respinning again today, sorry about the flurry of emails!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.