Re: [PATCH 2/4] mm, s390: Ignore MADV_HUGEPAGE on s390 to prevent SIGSEGV in qemu

2014-02-28 Thread Christian Borntraeger
On 27/02/14 18:23, Alex Thorlton wrote:
> As Christian pointed out, the recent 'Revert "thp: make MADV_HUGEPAGE
> check for mm->def_flags"' breaks qemu, it does QEMU_MADV_HUGEPAGE for
> all kvm pages but this doesn't work after s390_enable_sie/thp_split_mm.
> 
> Paolo suggested that instead of failing on the call to madvise, we
> simply ignore the call (return 0).
> 
> Reported-by: Christian Borntraeger 
> Suggested-by: Paolo Bonzini 
> Suggested-by: Oleg Nesterov 
> Signed-off-by: Alex Thorlton 
> Cc: Gerald Schaefer 
> Cc: Martin Schwidefsky 
> Cc: Heiko Carstens 
> Cc: Christian Borntraeger 
> Cc: Andrew Morton 
> Cc: Paolo Bonzini 
> Cc: "Kirill A. Shutemov" 
> Cc: Mel Gorman 
> Cc: Rik van Riel 
> Cc: Ingo Molnar 
> Cc: Peter Zijlstra 
> Cc: Andrea Arcangeli 
> Cc: Oleg Nesterov 
> Cc: "Eric W. Biederman" 
> Cc: Alexander Viro 
> Cc: linux...@de.ibm.com
> Cc: linux-s...@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux...@kvack.org
> Cc: linux-...@vger.kernel.org
> 
> ---
>  mm/huge_memory.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index a4310a5..61d234d 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1970,6 +1970,15 @@ int hugepage_madvise(struct vm_area_struct *vma,
>  {
>   switch (advice) {
>   case MADV_HUGEPAGE:
> +#ifdef CONFIG_S390
> + /*
> +  * qemu blindly sets MADV_HUGEPAGE on all allocations, but s390
> +  * can't handle this properly after s390_enable_sie, so we 
> simply
> +  * ignore the madvise to prevent qemu from causing a SIGSEGV.
> +  */
> + if (mm_has_pgste(vma->vm_mm))
> + return 0;
> +#endif
>   /*
>* Be somewhat over-protective like KSM for now!
>*/
> 


Tested-by: Christian Borntraeger 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] mm, s390: Ignore MADV_HUGEPAGE on s390 to prevent SIGSEGV in qemu

2014-02-28 Thread Paolo Bonzini

Il 27/02/2014 18:23, Alex Thorlton ha scritto:

As Christian pointed out, the recent 'Revert "thp: make MADV_HUGEPAGE
check for mm->def_flags"' breaks qemu, it does QEMU_MADV_HUGEPAGE for
all kvm pages but this doesn't work after s390_enable_sie/thp_split_mm.

Paolo suggested that instead of failing on the call to madvise, we
simply ignore the call (return 0).

Reported-by: Christian Borntraeger 
Suggested-by: Paolo Bonzini 
Suggested-by: Oleg Nesterov 
Signed-off-by: Alex Thorlton 
Cc: Gerald Schaefer 
Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: Christian Borntraeger 
Cc: Andrew Morton 
Cc: Paolo Bonzini 
Cc: "Kirill A. Shutemov" 
Cc: Mel Gorman 
Cc: Rik van Riel 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: Andrea Arcangeli 
Cc: Oleg Nesterov 
Cc: "Eric W. Biederman" 
Cc: Alexander Viro 
Cc: linux...@de.ibm.com
Cc: linux-s...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux...@kvack.org
Cc: linux-...@vger.kernel.org

---
 mm/huge_memory.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a4310a5..61d234d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1970,6 +1970,15 @@ int hugepage_madvise(struct vm_area_struct *vma,
 {
switch (advice) {
case MADV_HUGEPAGE:
+#ifdef CONFIG_S390
+   /*
+* qemu blindly sets MADV_HUGEPAGE on all allocations, but s390
+* can't handle this properly after s390_enable_sie, so we 
simply
+* ignore the madvise to prevent qemu from causing a SIGSEGV.
+*/
+   if (mm_has_pgste(vma->vm_mm))
+   return 0;
+#endif
/*
 * Be somewhat over-protective like KSM for now!
 */



Acked-by: Paolo Bonzini 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] mm, s390: Ignore MADV_HUGEPAGE on s390 to prevent SIGSEGV in qemu

2014-02-28 Thread Paolo Bonzini

Il 27/02/2014 18:23, Alex Thorlton ha scritto:

As Christian pointed out, the recent 'Revert thp: make MADV_HUGEPAGE
check for mm-def_flags' breaks qemu, it does QEMU_MADV_HUGEPAGE for
all kvm pages but this doesn't work after s390_enable_sie/thp_split_mm.

Paolo suggested that instead of failing on the call to madvise, we
simply ignore the call (return 0).

Reported-by: Christian Borntraeger borntrae...@de.ibm.com
Suggested-by: Paolo Bonzini pbonz...@redhat.com
Suggested-by: Oleg Nesterov o...@redhat.com
Signed-off-by: Alex Thorlton athorl...@sgi.com
Cc: Gerald Schaefer gerald.schae...@de.ibm.com
Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Cc: Christian Borntraeger borntrae...@de.ibm.com
Cc: Andrew Morton a...@linux-foundation.org
Cc: Paolo Bonzini pbonz...@redhat.com
Cc: Kirill A. Shutemov kirill.shute...@linux.intel.com
Cc: Mel Gorman mgor...@suse.de
Cc: Rik van Riel r...@redhat.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Peter Zijlstra pet...@infradead.org
Cc: Andrea Arcangeli aarca...@redhat.com
Cc: Oleg Nesterov o...@redhat.com
Cc: Eric W. Biederman ebied...@xmission.com
Cc: Alexander Viro v...@zeniv.linux.org.uk
Cc: linux...@de.ibm.com
Cc: linux-s...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux...@kvack.org
Cc: linux-...@vger.kernel.org

---
 mm/huge_memory.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a4310a5..61d234d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1970,6 +1970,15 @@ int hugepage_madvise(struct vm_area_struct *vma,
 {
switch (advice) {
case MADV_HUGEPAGE:
+#ifdef CONFIG_S390
+   /*
+* qemu blindly sets MADV_HUGEPAGE on all allocations, but s390
+* can't handle this properly after s390_enable_sie, so we 
simply
+* ignore the madvise to prevent qemu from causing a SIGSEGV.
+*/
+   if (mm_has_pgste(vma-vm_mm))
+   return 0;
+#endif
/*
 * Be somewhat over-protective like KSM for now!
 */



Acked-by: Paolo Bonzini pbonz...@redhat.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] mm, s390: Ignore MADV_HUGEPAGE on s390 to prevent SIGSEGV in qemu

2014-02-28 Thread Christian Borntraeger
On 27/02/14 18:23, Alex Thorlton wrote:
 As Christian pointed out, the recent 'Revert thp: make MADV_HUGEPAGE
 check for mm-def_flags' breaks qemu, it does QEMU_MADV_HUGEPAGE for
 all kvm pages but this doesn't work after s390_enable_sie/thp_split_mm.
 
 Paolo suggested that instead of failing on the call to madvise, we
 simply ignore the call (return 0).
 
 Reported-by: Christian Borntraeger borntrae...@de.ibm.com
 Suggested-by: Paolo Bonzini pbonz...@redhat.com
 Suggested-by: Oleg Nesterov o...@redhat.com
 Signed-off-by: Alex Thorlton athorl...@sgi.com
 Cc: Gerald Schaefer gerald.schae...@de.ibm.com
 Cc: Martin Schwidefsky schwidef...@de.ibm.com
 Cc: Heiko Carstens heiko.carst...@de.ibm.com
 Cc: Christian Borntraeger borntrae...@de.ibm.com
 Cc: Andrew Morton a...@linux-foundation.org
 Cc: Paolo Bonzini pbonz...@redhat.com
 Cc: Kirill A. Shutemov kirill.shute...@linux.intel.com
 Cc: Mel Gorman mgor...@suse.de
 Cc: Rik van Riel r...@redhat.com
 Cc: Ingo Molnar mi...@kernel.org
 Cc: Peter Zijlstra pet...@infradead.org
 Cc: Andrea Arcangeli aarca...@redhat.com
 Cc: Oleg Nesterov o...@redhat.com
 Cc: Eric W. Biederman ebied...@xmission.com
 Cc: Alexander Viro v...@zeniv.linux.org.uk
 Cc: linux...@de.ibm.com
 Cc: linux-s...@vger.kernel.org
 Cc: linux-kernel@vger.kernel.org
 Cc: linux...@kvack.org
 Cc: linux-...@vger.kernel.org
 
 ---
  mm/huge_memory.c | 9 +
  1 file changed, 9 insertions(+)
 
 diff --git a/mm/huge_memory.c b/mm/huge_memory.c
 index a4310a5..61d234d 100644
 --- a/mm/huge_memory.c
 +++ b/mm/huge_memory.c
 @@ -1970,6 +1970,15 @@ int hugepage_madvise(struct vm_area_struct *vma,
  {
   switch (advice) {
   case MADV_HUGEPAGE:
 +#ifdef CONFIG_S390
 + /*
 +  * qemu blindly sets MADV_HUGEPAGE on all allocations, but s390
 +  * can't handle this properly after s390_enable_sie, so we 
 simply
 +  * ignore the madvise to prevent qemu from causing a SIGSEGV.
 +  */
 + if (mm_has_pgste(vma-vm_mm))
 + return 0;
 +#endif
   /*
* Be somewhat over-protective like KSM for now!
*/
 


Tested-by: Christian Borntraeger borntrae...@de.ibm.com

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] mm, s390: Ignore MADV_HUGEPAGE on s390 to prevent SIGSEGV in qemu

2014-02-27 Thread Alex Thorlton
As Christian pointed out, the recent 'Revert "thp: make MADV_HUGEPAGE
check for mm->def_flags"' breaks qemu, it does QEMU_MADV_HUGEPAGE for
all kvm pages but this doesn't work after s390_enable_sie/thp_split_mm.

Paolo suggested that instead of failing on the call to madvise, we
simply ignore the call (return 0).

Reported-by: Christian Borntraeger 
Suggested-by: Paolo Bonzini 
Suggested-by: Oleg Nesterov 
Signed-off-by: Alex Thorlton 
Cc: Gerald Schaefer 
Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: Christian Borntraeger 
Cc: Andrew Morton 
Cc: Paolo Bonzini 
Cc: "Kirill A. Shutemov" 
Cc: Mel Gorman 
Cc: Rik van Riel 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: Andrea Arcangeli 
Cc: Oleg Nesterov 
Cc: "Eric W. Biederman" 
Cc: Alexander Viro 
Cc: linux...@de.ibm.com
Cc: linux-s...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux...@kvack.org
Cc: linux-...@vger.kernel.org

---
 mm/huge_memory.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a4310a5..61d234d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1970,6 +1970,15 @@ int hugepage_madvise(struct vm_area_struct *vma,
 {
switch (advice) {
case MADV_HUGEPAGE:
+#ifdef CONFIG_S390
+   /*
+* qemu blindly sets MADV_HUGEPAGE on all allocations, but s390
+* can't handle this properly after s390_enable_sie, so we 
simply
+* ignore the madvise to prevent qemu from causing a SIGSEGV.
+*/
+   if (mm_has_pgste(vma->vm_mm))
+   return 0;
+#endif
/*
 * Be somewhat over-protective like KSM for now!
 */
-- 
1.7.12.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] mm, s390: Ignore MADV_HUGEPAGE on s390 to prevent SIGSEGV in qemu

2014-02-27 Thread Alex Thorlton
As Christian pointed out, the recent 'Revert thp: make MADV_HUGEPAGE
check for mm-def_flags' breaks qemu, it does QEMU_MADV_HUGEPAGE for
all kvm pages but this doesn't work after s390_enable_sie/thp_split_mm.

Paolo suggested that instead of failing on the call to madvise, we
simply ignore the call (return 0).

Reported-by: Christian Borntraeger borntrae...@de.ibm.com
Suggested-by: Paolo Bonzini pbonz...@redhat.com
Suggested-by: Oleg Nesterov o...@redhat.com
Signed-off-by: Alex Thorlton athorl...@sgi.com
Cc: Gerald Schaefer gerald.schae...@de.ibm.com
Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Cc: Christian Borntraeger borntrae...@de.ibm.com
Cc: Andrew Morton a...@linux-foundation.org
Cc: Paolo Bonzini pbonz...@redhat.com
Cc: Kirill A. Shutemov kirill.shute...@linux.intel.com
Cc: Mel Gorman mgor...@suse.de
Cc: Rik van Riel r...@redhat.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Peter Zijlstra pet...@infradead.org
Cc: Andrea Arcangeli aarca...@redhat.com
Cc: Oleg Nesterov o...@redhat.com
Cc: Eric W. Biederman ebied...@xmission.com
Cc: Alexander Viro v...@zeniv.linux.org.uk
Cc: linux...@de.ibm.com
Cc: linux-s...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux...@kvack.org
Cc: linux-...@vger.kernel.org

---
 mm/huge_memory.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a4310a5..61d234d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1970,6 +1970,15 @@ int hugepage_madvise(struct vm_area_struct *vma,
 {
switch (advice) {
case MADV_HUGEPAGE:
+#ifdef CONFIG_S390
+   /*
+* qemu blindly sets MADV_HUGEPAGE on all allocations, but s390
+* can't handle this properly after s390_enable_sie, so we 
simply
+* ignore the madvise to prevent qemu from causing a SIGSEGV.
+*/
+   if (mm_has_pgste(vma-vm_mm))
+   return 0;
+#endif
/*
 * Be somewhat over-protective like KSM for now!
 */
-- 
1.7.12.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/