Commit e52f8b61 authored by David Hildenbrand's avatar David Hildenbrand Committed by Christian Borntraeger

s390/mm: take the mmap_sem in kvm_s390_shadow_fault()

Instead of doing it in the caller, let's just take the mmap_sem
in kvm_s390_shadow_fault(). By taking it as read, we allow parallel
faulting on shadow page tables, gmap shadow code is prepared for that.
Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 0f7f8489
...@@ -1091,26 +1091,24 @@ int kvm_s390_shadow_fault(struct gmap *sg, unsigned long saddr, int write) ...@@ -1091,26 +1091,24 @@ int kvm_s390_shadow_fault(struct gmap *sg, unsigned long saddr, int write)
int dat_protection; int dat_protection;
int rc; int rc;
down_read(&sg->mm->mmap_sem);
rc = gmap_shadow_pgt_lookup(sg, saddr, &pgt, &dat_protection); rc = gmap_shadow_pgt_lookup(sg, saddr, &pgt, &dat_protection);
if (rc) {
rc = kvm_s390_shadow_tables(sg, saddr, &pgt, &dat_protection);
if (rc) if (rc)
return rc; rc = kvm_s390_shadow_tables(sg, saddr, &pgt, &dat_protection);
}
vaddr.addr = saddr; vaddr.addr = saddr;
if (!rc)
rc = gmap_read_table(sg->parent, pgt + vaddr.px * 8, &pte.val); rc = gmap_read_table(sg->parent, pgt + vaddr.px * 8, &pte.val);
if (rc) if (!rc && pte.i)
return rc; rc = PGM_PAGE_TRANSLATION;
if (pte.i) if (!rc && (pte.z || pte.co))
return PGM_PAGE_TRANSLATION; rc = PGM_TRANSLATION_SPEC;
if (pte.z || pte.co)
return PGM_TRANSLATION_SPEC;
dat_protection |= pte.p; dat_protection |= pte.p;
if (write && dat_protection) if (!rc && write && dat_protection)
return PGM_PROTECTION; rc = PGM_PROTECTION;
if (!rc)
rc = gmap_shadow_page(sg, saddr, __pte(pte.val)); rc = gmap_shadow_page(sg, saddr, __pte(pte.val));
if (rc) up_read(&sg->mm->mmap_sem);
return rc; return rc;
return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment