summaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/priv.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2016-03-08 11:53:35 +0100
committerChristian Borntraeger <borntraeger@de.ibm.com>2016-06-10 12:07:27 +0200
commitd3ed1ceeace311af9973d17a07a114bfaf0ca1b1 (patch)
tree1e9a353c769d89bf8eee9489f931869dcaf0651a /arch/s390/kvm/priv.c
parentc427c42cd612719e8fb8b5891cc9761e7770024e (diff)
downloadop-kernel-dev-d3ed1ceeace311af9973d17a07a114bfaf0ca1b1.zip
op-kernel-dev-d3ed1ceeace311af9973d17a07a114bfaf0ca1b1.tar.gz
s390/mm: set and get guest storage key mmap locking
Move the mmap semaphore locking out of set_guest_storage_key and get_guest_storage_key. This makes the two functions more like the other ptep_xxx operations and allows to avoid repeated semaphore operations if multiple keys are read or written. Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/priv.c')
-rw-r--r--arch/s390/kvm/priv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 95916fa..c6deed7 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -728,9 +728,12 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
if (rc)
return rc;
- if (set_guest_storage_key(current->mm, useraddr,
+ down_read(&current->mm->mmap_sem);
+ rc = set_guest_storage_key(current->mm, useraddr,
vcpu->run->s.regs.gprs[reg1] & PFMF_KEY,
- vcpu->run->s.regs.gprs[reg1] & PFMF_NQ))
+ vcpu->run->s.regs.gprs[reg1] & PFMF_NQ);
+ up_read(&current->mm->mmap_sem);
+ if (rc)
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
}
OpenPOWER on IntegriCloud