From patchwork Thu Apr 28 15:18:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Covington X-Patchwork-Id: 8972051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0616D9F1C1 for ; Thu, 28 Apr 2016 15:23:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17425202F2 for ; Thu, 28 Apr 2016 15:23:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A8FC20268 for ; Thu, 28 Apr 2016 15:23:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1avnkh-0001bh-Mp; Thu, 28 Apr 2016 15:21:15 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1avnkO-0001M5-Dt for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2016 15:20:57 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id C631761363; Thu, 28 Apr 2016 15:20:39 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B80E261322; Thu, 28 Apr 2016 15:20:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from illium.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cov@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B103F61348; Thu, 28 Apr 2016 15:20:37 +0000 (UTC) From: Christopher Covington To: Catalin Marinas , criu@openvz.org, Laurent Dufour , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: [RFC 3/5] mm/powerpc: Make VDSO remap generic Date: Thu, 28 Apr 2016 11:18:55 -0400 Message-Id: <1461856737-17071-4-git-send-email-cov@codeaurora.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1461856737-17071-1-git-send-email-cov@codeaurora.org> References: <20151202121918.GA4523@arm.com> <1461856737-17071-1-git-send-email-cov@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160428_082056_677355_6F2AE9A0 X-CRM114-Status: GOOD ( 16.89 ) X-Spam-Score: -2.9 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christopher Covington MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In order to support remapping the VDSO on additional architectures without duplicating code, move the remap code out from arch/powerpc. Architectures that wish to use the generic logic must have an unsigned long vdso in mm->context and can opt in by selecting CONFIG_ARCH_WANT_VDSO_MAP. This allows PowerPC to use mm-arch-hooks.h from include/asm-generic. Signed-off-by: Christopher Covington --- arch/powerpc/include/asm/Kbuild | 1 + arch/powerpc/include/asm/mm-arch-hooks.h | 28 ---------------------------- mm/mremap.c | 10 ++++++++-- 3 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 arch/powerpc/include/asm/mm-arch-hooks.h diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild index ab9f4e0..9dbb372 100644 --- a/arch/powerpc/include/asm/Kbuild +++ b/arch/powerpc/include/asm/Kbuild @@ -7,3 +7,4 @@ generic-y += mcs_spinlock.h generic-y += preempt.h generic-y += rwsem.h generic-y += vtime.h +generic-y += mm-arch-hooks.h diff --git a/arch/powerpc/include/asm/mm-arch-hooks.h b/arch/powerpc/include/asm/mm-arch-hooks.h deleted file mode 100644 index ea6da89..0000000 --- a/arch/powerpc/include/asm/mm-arch-hooks.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Architecture specific mm hooks - * - * Copyright (C) 2015, IBM Corporation - * Author: Laurent Dufour - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _ASM_POWERPC_MM_ARCH_HOOKS_H -#define _ASM_POWERPC_MM_ARCH_HOOKS_H - -static inline void arch_remap(struct mm_struct *mm, - unsigned long old_start, unsigned long old_end, - unsigned long new_start, unsigned long new_end) -{ - /* - * mremap() doesn't allow moving multiple vmas so we can limit the - * check to old_start == vdso. - */ - if (old_start == mm->context.vdso) - mm->context.vdso = new_start; -} -#define arch_remap arch_remap - -#endif /* _ASM_POWERPC_MM_ARCH_HOOKS_H */ diff --git a/mm/mremap.c b/mm/mremap.c index 3fa0a467..59032b7 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -293,8 +293,14 @@ static unsigned long move_vma(struct vm_area_struct *vma, old_addr = new_addr; new_addr = err; } else { - arch_remap(mm, old_addr, old_addr + old_len, - new_addr, new_addr + new_len); +#ifdef CONFIG_ARCH_WANT_VDSO_MAP + /* + * mremap() doesn't allow moving multiple vmas so we can limit the + * check to old_addr == vdso. + */ + if (old_addr == mm->context.vdso) + mm->context.vdso = new_addr; +#endif /* CONFIG_ARCH_WANT_VDSO_MAP */ } /* Conceal VM_ACCOUNT so old reservation is not undone */