mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-08 07:21:27 +00:00
KVM: arm64: Avoid mapping size adjustment on permission fault
Since we only support PMD-sized mappings for THP, getting a permission fault on a level that results in a mapping being larger than PAGE_SIZE is a sure indication that we have already upgraded our mapping to a PMD. In this case, there is no need to try and parse userspace page tables, as the fault information already tells us everything. Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com> Link: https://lore.kernel.org/r/20210726153552.1535838-4-maz@kernel.org
This commit is contained in:
parent
6011cf68c8
commit
f2cc327303
1 changed files with 8 additions and 3 deletions
|
@ -1076,9 +1076,14 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
|
||||||
* If we are not forced to use page mapping, check if we are
|
* If we are not forced to use page mapping, check if we are
|
||||||
* backed by a THP and thus use block mapping if possible.
|
* backed by a THP and thus use block mapping if possible.
|
||||||
*/
|
*/
|
||||||
if (vma_pagesize == PAGE_SIZE && !(force_pte || device))
|
if (vma_pagesize == PAGE_SIZE && !(force_pte || device)) {
|
||||||
vma_pagesize = transparent_hugepage_adjust(kvm, memslot, hva,
|
if (fault_status == FSC_PERM && fault_granule > PAGE_SIZE)
|
||||||
&pfn, &fault_ipa);
|
vma_pagesize = fault_granule;
|
||||||
|
else
|
||||||
|
vma_pagesize = transparent_hugepage_adjust(kvm, memslot,
|
||||||
|
hva, &pfn,
|
||||||
|
&fault_ipa);
|
||||||
|
}
|
||||||
|
|
||||||
if (fault_status != FSC_PERM && !device && kvm_has_mte(kvm)) {
|
if (fault_status != FSC_PERM && !device && kvm_has_mte(kvm)) {
|
||||||
/* Check the VMM hasn't introduced a new VM_SHARED VMA */
|
/* Check the VMM hasn't introduced a new VM_SHARED VMA */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue