s390/gmap: return proper error code on ksm unsharing
Subsystems (4)
PATCH v2 1/1 s390/gmap: return proper error code on ksm unsharing
If a signal is pending we might return -ENOMEM instead of -EINTR. We should propagate the proper error during KSM unsharing.
--- arch/s390/mm/gmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/s390/mm/gmap.c +5 -4
@@ -2552,12 +2552,13 @@ int gmap_mark_unmergeable(void) {struct mm_struct *mm = current->mm;struct vm_area_struct *vma; +int ret;for (vma = mm->mmap; vma; vma = vma->vm_next) { -if (ksm_madvise (vma, vma->vm_start, vma->vm_end, -MADV_UNMERGEABLE , &vma->vm_flags)) { -return -ENOMEM ; - } + ret =ksm_madvise (vma, vma->vm_start, vma->vm_end, +MADV_UNMERGEABLE , &vma->vm_flags); +if (ret) +return ret; } mm->def_flags &= ~VM_MERGEABLE ;return 0 ;
Signature · 1 line
2.25.1
Quoted 23 lines · Christian Borntraeger
If a signal is pending we might return
-ENOMEMinstead of-EINTR. We should propagate the proper error during KSM unsharing.Fixes 3ac8e38015d4 ("s390/mm: disable KSM for storage key enabled pages")Reviewed-by Janosch Frank <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- arch/s390/mm/gmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)arch/s390/mm/gmap.c +1
-1@@ -2552,12 +2552,13 @@ int gmap_mark_unmergeable(void) {struct mm_struct *mm = current->mm;struct vm_area_struct *vma; +int ret;for (vma = mm->mmap; vma; vma = vma->vm_next) { - if (ksm_madvise(vma, vma->vm_start, vma->vm_end,
arch/s390/mm/gmap.c int gmap_mark_unmergeable(void) · line 2564
Quoted 10 lines
arch/s390/mm/gmap.c +4
-3- MADV_UNMERGEABLE, &vma->vm_flags)) { -return -ENOMEM ; - } + ret =ksm_madvise (vma, vma->vm_start, vma->vm_end, +MADV_UNMERGEABLE , &vma->vm_flags); +if (ret) +return ret; } mm->def_flags &= ~VM_MERGEABLE ;return 0 ;
Signature · 3 lines
Thanks, David / dhildenb
Quoted 10 lines · On Fri, 27 Mar 2020 05:23:56 -0400 Christian Borntraeger…
If a signal is pending we might return
-ENOMEMinstead of-EINTR. We should propagate the proper error during KSM unsharing.Fixes 3ac8e38015d4 ("s390/mm: disable KSM for storage key enabled pages")Reviewed-by Janosch Frank <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- arch/s390/mm/gmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Christian Borntraeger
Reviewed-by Janosch Frank Tested-by Marc Hartmayer Reviewed-by David Hildenbrand on v2 1/1Quoted 22 lines · Christian Borntraeger
If a signal is pending we might return
-ENOMEMinstead of-EINTR. We should propagate the proper error during KSM unsharing.Fixes 3ac8e38015d4 ("s390/mm: disable KSM for storage key enabled pages")Reviewed-by Janosch Frank <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- arch/s390/mm/gmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)arch/s390/mm/gmap.c +1
-1@@ -2552,12 +2552,13 @@ int gmap_mark_unmergeable(void) {struct mm_struct *mm = current->mm;struct vm_area_struct *vma; +int ret;for (vma = mm->mmap; vma; vma = vma->vm_next) { - if (ksm_madvise(vma, vma->vm_start, vma->vm_end,
arch/s390/mm/gmap.c int gmap_mark_unmergeable(void) · line 2564
Quoted 10 lines
arch/s390/mm/gmap.c +4
-3- MADV_UNMERGEABLE, &vma->vm_flags)) { -return -ENOMEM ; - } + ret =ksm_madvise (vma, vma->vm_start, vma->vm_end, +MADV_UNMERGEABLE , &vma->vm_flags); +if (ret) +return ret; } mm->def_flags &= ~VM_MERGEABLE ;return 0 ;
After the qemu patch discussion I would add
Documentation/virt/kvm/api.rst +6 -0
@@ -4680,6 +4680,12 @@ KVM_PV_ENABLE command has succeeded, any CPU added via hotplug will become protected during its creation as well. + Errors: + + ===== ============================= + EINTR an unmasked signal is pending + ===== ============================= + KVM_PV_DISABLE Deregister the VM from the Ultravisor and reclaim the memory that
and change the patch description to something like
s390/gmap: return proper error code on ksm unsharing
If a signal is pending we might return -ENOMEM instead of -EINTR. We should propagate the proper error during KSM unsharing. unmerge_ksm_pages returns -ERESTARTSYS on signal_pending. This gets translated by entry.S to -EINTR. It is important to get this error code so that userspace can retry.
Quoted 68 lines · Christian Borntraeger
Quoted 22 lines · Christian Borntraeger
If a signal is pending we might return
-ENOMEMinstead of-EINTR. We should propagate the proper error during KSM unsharing.Fixes 3ac8e38015d4 ("s390/mm: disable KSM for storage key enabled pages")Reviewed-by Janosch Frank <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>--- arch/s390/mm/gmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)arch/s390/mm/gmap.c +1
-1@@ -2552,12 +2552,13 @@ int gmap_mark_unmergeable(void) {struct mm_struct *mm = current->mm;struct vm_area_struct *vma; +int ret;for (vma = mm->mmap; vma; vma = vma->vm_next) { - if (ksm_madvise(vma, vma->vm_start, vma->vm_end,arch/s390/mm/gmap.c int gmap_mark_unmergeable(void) · line 2564
Quoted 10 lines
arch/s390/mm/gmap.c +4
-3- MADV_UNMERGEABLE, &vma->vm_flags)) { -return -ENOMEM ; - } + ret =ksm_madvise (vma, vma->vm_start, vma->vm_end, +MADV_UNMERGEABLE , &vma->vm_flags); +if (ret) +return ret; } mm->def_flags &= ~VM_MERGEABLE ;return 0 ;After the qemu patch discussion I would add
Documentation/virt/kvm/api.rst +6
-0@@ -4680,6 +4680,12 @@ KVM_PV_ENABLE command has succeeded, any CPU added via hotplug will become protected during its creation as well. + Errors: + + ===== ============================= + EINTR an unmasked signal is pending + ===== ============================= + KVM_PV_DISABLE Deregister the VM from the Ultravisor and reclaim the memory thatand change the patch description to something like
s390/gmap: return proper error code on ksm unsharing
If a signal is pending we might return
-ENOMEMinstead of-EINTR. We should propagate the proper error during KSM unsharing.unmerge_ksm_pagesreturns-ERESTARTSYSonsignal_pending. This gets translated byentry.Sto-EINTR. It is important to get this error code so that userspace can retry.
Quoted 7 lines
Fixes 3ac8e38015d4 ("s390/mm: disable KSM for storage key enabled pages")Reviewed-by Janosch Frank <[email protected]>Reported-by Marc Hartmayer <[email protected]>Tested-by Marc Hartmayer <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>
Looks good.
Signature · 3 lines
Thanks, David / dhildenb
Quoted 35 lines · On Fri, 27 Mar 2020 11:23:33 +0100 Christian Borntraeger…
On 27.03.20 10:23, Christian Borntraeger wrote:
After the qemu patch discussion I would add
Documentation/virt/kvm/api.rst +6
-0@@ -4680,6 +4680,12 @@ KVM_PV_ENABLE command has succeeded, any CPU added via hotplug will become protected during its creation as well. + Errors: + + ===== ============================= + EINTR an unmasked signal is pending + ===== ============================= + KVM_PV_DISABLE Deregister the VM from the Ultravisor and reclaim the memory thatand change the patch description to something like
s390/gmap: return proper error code on ksm unsharing
If a signal is pending we might return
-ENOMEMinstead of-EINTR. We should propagate the proper error during KSM unsharing.unmerge_ksm_pagesreturns-ERESTARTSYSonsignal_pending. This gets translated byentry.Sto-EINTR. It is important to get this error code so that userspace can retry.
Quoted 7 lines
Fixes 3ac8e38015d4 ("s390/mm: disable KSM for storage key enabled pages")Reviewed-by Janosch Frank <[email protected]>Reported-by Marc Hartmayer <[email protected]>Tested-by Marc Hartmayer <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>
LGTM
Cornelia Huck
Reviewed-byQuoted 38 lines · On Fri, 27 Mar 2020 11:39:54 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 35 lines · On Fri, 27 Mar 2020 11:23:33 +0100 Christian Borntraeger…
On 27.03.20 10:23, Christian Borntraeger wrote:
After the qemu patch discussion I would add
Documentation/virt/kvm/api.rst +6
-0@@ -4680,6 +4680,12 @@ KVM_PV_ENABLE command has succeeded, any CPU added via hotplug will become protected during its creation as well. + Errors: + + ===== ============================= + EINTR an unmasked signal is pending + ===== ============================= + KVM_PV_DISABLE Deregister the VM from the Ultravisor and reclaim the memory thatand change the patch description to something like
s390/gmap: return proper error code on ksm unsharing
If a signal is pending we might return
-ENOMEMinstead of-EINTR. We should propagate the proper error during KSM unsharing.unmerge_ksm_pagesreturns-ERESTARTSYSonsignal_pending. This gets translated byentry.Sto-EINTR. It is important to get this error code so that userspace can retry.
Quoted 9 lines
Quoted 7 lines
Fixes 3ac8e38015d4 ("s390/mm: disable KSM for storage key enabled pages")Reviewed-by Janosch Frank <[email protected]>Reported-by Marc Hartmayer <[email protected]>Tested-by Marc Hartmayer <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Signed-off-by Christian Borntraeger <[email protected]>LGTM
...well, if you add my