ANDROID: virt: gunyah: Correct the nr outval in gunyah_gup_share_parcel
gunyah_gup_share_parcel() has an in/out parameter which indicates the
number of pages requested to be shared in the mem parcel. We were not
returning the number of pages actually shared in the mem parcel and this
caused THPs to be undercounted. Later, when converting the parcel to
demand paged (gunyah_vm_parcel_to_paged), we hit the BUG_ON on line 55
due to the undercount. Fix the BUG_ON by correctly counting the *nr
return value.
Fixes: due to the undercount. Fix the BUG_ON by correctly counting the
*nr return value due to the undercount. Fix the BUG_ON by correctly
counting the *nr return value.
Fixes: 296cceed0844 ("ANDROID: virt: gunyah: Add gup based demand paging support")
Change-Id: I6492b02d075d903ab68d6c89c4bb1cd78af25c28
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Elliot Berman <elliot.berman@oss.qualcomm.com>
This commit is contained in:
committed by
Treehugger Robot
parent
a24b717f84
commit
1a2d547525
@@ -557,6 +557,7 @@ int gunyah_gup_share_parcel(struct gunyah_vm *ghvm, struct gunyah_rm_mem_parcel
|
||||
}
|
||||
folio = page_folio(pages[0]);
|
||||
*gfn -= folio_page_idx(folio, pages[0]);
|
||||
*nr = folio_nr_pages(folio);
|
||||
parcel->mem_entries[0].size = cpu_to_le64(folio_size(folio));
|
||||
parcel->mem_entries[0].phys_addr = cpu_to_le64(PFN_PHYS(folio_pfn(folio)));
|
||||
|
||||
@@ -567,6 +568,7 @@ int gunyah_gup_share_parcel(struct gunyah_vm *ghvm, struct gunyah_rm_mem_parcel
|
||||
cpu_to_le64(folio_size(folio));
|
||||
parcel->mem_entries[entries].phys_addr =
|
||||
cpu_to_le64(PFN_PHYS(folio_pfn(folio)));
|
||||
*nr += folio_nr_pages(folio);
|
||||
entries++;
|
||||
} else {
|
||||
unpin_user_page(pages[i]);
|
||||
|
||||
Reference in New Issue
Block a user