From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A84BC433E1 for ; Tue, 25 Aug 2020 13:54:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0B2C20786 for ; Tue, 25 Aug 2020 13:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726763AbgHYNyb (ORCPT ); Tue, 25 Aug 2020 09:54:31 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:8129 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726632AbgHYNyO (ORCPT ); Tue, 25 Aug 2020 09:54:14 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4BbVpR39r8z9txlp; Tue, 25 Aug 2020 15:54:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id y3Ex4h2-vb7H; Tue, 25 Aug 2020 15:54:07 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4BbVpR1hHJz9txlk; Tue, 25 Aug 2020 15:54:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id ADA178B822; Tue, 25 Aug 2020 15:54:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id D-iRctOA12bX; Tue, 25 Aug 2020 15:54:08 +0200 (CEST) Received: from po17688vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 148A28B820; Tue, 25 Aug 2020 15:54:05 +0200 (CEST) Received: by po17688vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 616B165D41; Tue, 25 Aug 2020 13:54:05 +0000 (UTC) Message-Id: <4c0893ca6848386eb764a016b2783f368b7d6740.1598363608.git.christophe.leroy@csgroup.eu> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 7/9] powerpc/vdso: Move vdso datapage up front To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 25 Aug 2020 13:54:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the vdso datapage in front of the VDSO area, before vdso test. This will allow to remove the __kernel_datapage_offset symbol and simplify __get_datapage() in the following patch. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/mmu_context.h | 4 +++- arch/powerpc/kernel/vdso.c | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h index 7f3658a97384..be18ad12bb54 100644 --- a/arch/powerpc/include/asm/mmu_context.h +++ b/arch/powerpc/include/asm/mmu_context.h @@ -262,7 +262,9 @@ extern void arch_exit_mmap(struct mm_struct *mm); static inline void arch_unmap(struct mm_struct *mm, unsigned long start, unsigned long end) { - if (start <= mm->context.vdso_base && mm->context.vdso_base < end) + unsigned long vdso_base = mm->context.vdso_base - PAGE_SIZE; + + if (start <= vdso_base && vdso_base < end) mm->context.vdso_base = 0; } diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index b9270923452e..1d72c4b7672f 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c @@ -124,7 +124,7 @@ static int vdso_mremap(unsigned long vdso_pages, if (new_size != vdso_size) return -EINVAL; - current->mm->context.vdso_base = (unsigned long)new_vma->vm_start; + current->mm->context.vdso_base = (unsigned long)new_vma->vm_start + PAGE_SIZE; return 0; } @@ -217,7 +217,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) * install_special_mapping or the perf counter mmap tracking code * will fail to recognise it as a vDSO (since arch_vma_name fails). */ - current->mm->context.vdso_base = vdso_base; + current->mm->context.vdso_base = vdso_base + PAGE_SIZE; /* * our vma flags don't have VM_WRITE so by default, the process isn't @@ -516,8 +516,7 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, return -1; } *((int *)(vdso64_kbase + sym64->st_value - VDSO64_LBASE)) = - (vdso64_pages << PAGE_SHIFT) - - (sym64->st_value - VDSO64_LBASE); + (sym64->st_value - VDSO64_LBASE) - PAGE_SIZE; #endif /* CONFIG_PPC64 */ #ifdef CONFIG_VDSO32 @@ -528,8 +527,7 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, return -1; } *((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) = - (vdso32_pages << PAGE_SHIFT) - - (sym32->st_value - VDSO32_LBASE); + (sym32->st_value - VDSO32_LBASE) - PAGE_SIZE; #endif return 0; @@ -771,10 +769,10 @@ static int __init vdso_init(void) if (!pagelist) goto alloc_failed; - for (i = 0; i < vdso32_pages; i++) - pagelist[i] = virt_to_page(vdso32_kbase + i * PAGE_SIZE); + pagelist[0] = virt_to_page(vdso_data); - pagelist[i++] = virt_to_page(vdso_data); + for (i = 0; i < vdso32_pages; i++) + pagelist[i + 1] = virt_to_page(vdso32_kbase + i * PAGE_SIZE); vdso32_spec.pages = pagelist; } @@ -784,10 +782,10 @@ static int __init vdso_init(void) if (!pagelist) goto alloc_failed; - for (i = 0; i < vdso64_pages; i++) - pagelist[i] = virt_to_page(vdso64_kbase + i * PAGE_SIZE); + pagelist[0] = virt_to_page(vdso_data); - pagelist[i++] = virt_to_page(vdso_data); + for (i = 0; i < vdso64_pages; i++) + pagelist[i + 1] = virt_to_page(vdso64_kbase + i * PAGE_SIZE); vdso64_spec.pages = pagelist; } -- 2.25.0