aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/mm
diff options
context:
space:
mode:
authorDominik Dingel <dingel@linux.vnet.ibm.com>2016-01-15 19:57:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-15 20:56:32 -0500
commit4a9e1cda274893eca7d178d7dc265503ccb9d87a (patch)
treeef92b43a0c3c38edeb554beb64ca8962d795eb3b /arch/s390/mm
parentc046c321cb4a0bdac9fb922db3859893ca556d27 (diff)
mm: bring in additional flag for fixup_user_fault to signal unlock
During Jason's work with postcopy migration support for s390 a problem regarding gmap faults was discovered. The gmap code will call fixup_user_fault which will end up always in handle_mm_fault. Till now we never cared about retries, but as the userfaultfd code kind of relies on it. this needs some fix. This patchset does not take care of the futex code. I will now look closer at this. This patch (of 2): With the introduction of userfaultfd, kvm on s390 needs fixup_user_fault to pass in FAULT_FLAG_ALLOW_RETRY and give feedback if during the faulting we ever unlocked mmap_sem. This patch brings in the logic to handle retries as well as it cleans up the current documentation. fixup_user_fault was not having the same semantics as filemap_fault. It never indicated if a retry happened and so a caller wasn't able to handle that case. So we now changed the behaviour to always retry a locked mmap_sem. Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: "Jason J. Herne" <jjherne@linux.vnet.ibm.com> Cc: David Rientjes <rientjes@google.com> Cc: Eric B Munson <emunson@akamai.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Dominik Dingel <dingel@linux.vnet.ibm.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/s390/mm')
-rw-r--r--arch/s390/mm/pgtable.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 4e54492f463a..84bddda8d412 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -585,7 +585,7 @@ int gmap_fault(struct gmap *gmap, unsigned long gaddr,
585 rc = vmaddr; 585 rc = vmaddr;
586 goto out_up; 586 goto out_up;
587 } 587 }
588 if (fixup_user_fault(current, gmap->mm, vmaddr, fault_flags)) { 588 if (fixup_user_fault(current, gmap->mm, vmaddr, fault_flags, NULL)) {
589 rc = -EFAULT; 589 rc = -EFAULT;
590 goto out_up; 590 goto out_up;
591 } 591 }
@@ -727,7 +727,8 @@ int gmap_ipte_notify(struct gmap *gmap, unsigned long gaddr, unsigned long len)
727 break; 727 break;
728 } 728 }
729 /* Get the page mapped */ 729 /* Get the page mapped */
730 if (fixup_user_fault(current, gmap->mm, addr, FAULT_FLAG_WRITE)) { 730 if (fixup_user_fault(current, gmap->mm, addr, FAULT_FLAG_WRITE,
731 NULL)) {
731 rc = -EFAULT; 732 rc = -EFAULT;
732 break; 733 break;
733 } 734 }
@@ -802,7 +803,8 @@ retry:
802 if (!(pte_val(*ptep) & _PAGE_INVALID) && 803 if (!(pte_val(*ptep) & _PAGE_INVALID) &&
803 (pte_val(*ptep) & _PAGE_PROTECT)) { 804 (pte_val(*ptep) & _PAGE_PROTECT)) {
804 pte_unmap_unlock(ptep, ptl); 805 pte_unmap_unlock(ptep, ptl);
805 if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE)) { 806 if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE,
807 NULL)) {
806 up_read(&mm->mmap_sem); 808 up_read(&mm->mmap_sem);
807 return -EFAULT; 809 return -EFAULT;
808 } 810 }