Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753893AbaB0RX4 (ORCPT ); Thu, 27 Feb 2014 12:23:56 -0500 Received: from relay1.sgi.com ([192.48.179.29]:55108 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753802AbaB0RXr (ORCPT ); Thu, 27 Feb 2014 12:23:47 -0500 From: Alex Thorlton To: linux-kernel@vger.kernel.org Cc: Alex Thorlton , Gerald Schaefer , Martin Schwidefsky , Heiko Carstens , Christian Borntraeger , Andrew Morton , Paolo Bonzini , "Kirill A. Shutemov" , Mel Gorman , Rik van Riel , Ingo Molnar , Peter Zijlstra , Andrea Arcangeli , Oleg Nesterov , "Eric W. Biederman" , Alexander Viro , linux390@de.ibm.com, linux-s390@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH 2/4] mm, s390: Ignore MADV_HUGEPAGE on s390 to prevent SIGSEGV in qemu Date: Thu, 27 Feb 2014 11:23:24 -0600 Message-Id: X-Mailer: git-send-email 1.7.12.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: linux390@de.ibm.com Cc: linux-s390@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-api@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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/