@@ -861,7 +861,7 @@ int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
861
861
862
862
write_lock (& kvm -> mmu_lock );
863
863
ret = kvm_pgtable_stage2_map (pgt , addr , PAGE_SIZE , pa , prot ,
864
- & cache );
864
+ & cache , 0 );
865
865
write_unlock (& kvm -> mmu_lock );
866
866
if (ret )
867
867
break ;
@@ -1156,7 +1156,6 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
1156
1156
gfn_t gfn ;
1157
1157
kvm_pfn_t pfn ;
1158
1158
bool logging_active = memslot_is_logging (memslot );
1159
- bool use_read_lock = false;
1160
1159
unsigned long fault_level = kvm_vcpu_trap_get_fault_level (vcpu );
1161
1160
unsigned long vma_pagesize , fault_granule ;
1162
1161
enum kvm_pgtable_prot prot = KVM_PGTABLE_PROT_R ;
@@ -1191,8 +1190,6 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
1191
1190
if (logging_active ) {
1192
1191
force_pte = true;
1193
1192
vma_shift = PAGE_SHIFT ;
1194
- use_read_lock = (fault_status == FSC_PERM && write_fault &&
1195
- fault_granule == PAGE_SIZE );
1196
1193
} else {
1197
1194
vma_shift = get_vma_page_shift (vma , hva );
1198
1195
}
@@ -1291,15 +1288,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
1291
1288
if (exec_fault && device )
1292
1289
return - ENOEXEC ;
1293
1290
1294
- /*
1295
- * To reduce MMU contentions and enhance concurrency during dirty
1296
- * logging dirty logging, only acquire read lock for permission
1297
- * relaxation.
1298
- */
1299
- if (use_read_lock )
1300
- read_lock (& kvm -> mmu_lock );
1301
- else
1302
- write_lock (& kvm -> mmu_lock );
1291
+ read_lock (& kvm -> mmu_lock );
1303
1292
pgt = vcpu -> arch .hw_mmu -> pgt ;
1304
1293
if (mmu_invalidate_retry (kvm , mmu_seq ))
1305
1294
goto out_unlock ;
@@ -1343,15 +1332,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
1343
1332
* permissions only if vma_pagesize equals fault_granule. Otherwise,
1344
1333
* kvm_pgtable_stage2_map() should be called to change block size.
1345
1334
*/
1346
- if (fault_status == FSC_PERM && vma_pagesize == fault_granule ) {
1335
+ if (fault_status == FSC_PERM && vma_pagesize == fault_granule )
1347
1336
ret = kvm_pgtable_stage2_relax_perms (pgt , fault_ipa , prot );
1348
- } else {
1349
- WARN_ONCE (use_read_lock , "Attempted stage-2 map outside of write lock\n" );
1350
-
1337
+ else
1351
1338
ret = kvm_pgtable_stage2_map (pgt , fault_ipa , vma_pagesize ,
1352
1339
__pfn_to_phys (pfn ), prot ,
1353
- memcache );
1354
- }
1340
+ memcache , KVM_PGTABLE_WALK_SHARED );
1355
1341
1356
1342
/* Mark the page dirty only if the fault is handled successfully */
1357
1343
if (writable && !ret ) {
@@ -1360,10 +1346,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
1360
1346
}
1361
1347
1362
1348
out_unlock :
1363
- if (use_read_lock )
1364
- read_unlock (& kvm -> mmu_lock );
1365
- else
1366
- write_unlock (& kvm -> mmu_lock );
1349
+ read_unlock (& kvm -> mmu_lock );
1367
1350
kvm_set_pfn_accessed (pfn );
1368
1351
kvm_release_pfn_clean (pfn );
1369
1352
return ret != - EAGAIN ? ret : 0 ;
@@ -1569,7 +1552,7 @@ bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
1569
1552
*/
1570
1553
kvm_pgtable_stage2_map (kvm -> arch .mmu .pgt , range -> start << PAGE_SHIFT ,
1571
1554
PAGE_SIZE , __pfn_to_phys (pfn ),
1572
- KVM_PGTABLE_PROT_R , NULL );
1555
+ KVM_PGTABLE_PROT_R , NULL , 0 );
1573
1556
1574
1557
return false;
1575
1558
}
0 commit comments