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=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 2AAC7C2BA83 for ; Fri, 14 Feb 2020 08:37:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F20A7217F4 for ; Fri, 14 Feb 2020 08:37:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=c-s.fr header.i=@c-s.fr header.b="bxnstb7b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728924AbgBNIhJ (ORCPT ); Fri, 14 Feb 2020 03:37:09 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:29098 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgBNIhI (ORCPT ); Fri, 14 Feb 2020 03:37:08 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48Jmvk0gCfz9txhn; Fri, 14 Feb 2020 09:37:06 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=bxnstb7b; dkim-adsp=pass; dkim-atps=neutral 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 9ANGaoymhzTK; Fri, 14 Feb 2020 09:37:06 +0100 (CET) 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 48Jmvj6kYRz9txhm; Fri, 14 Feb 2020 09:37:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1581669425; bh=ddxc67V5RXhkdNTVaQ7sd3n3LU9GQgEQfAysbLNxMao=; h=Subject:From:To:Cc:References:Date:In-Reply-To:From; b=bxnstb7bOoshwKDEpC12LAZEnPqZvsQEHDw+7ZngXz7fQ1ewn+wdk7/kGYLNmN82b 6x1eAOdicY8YQc//mS4FHachzifppVcAWniSjZNIR/8UDR11jbHIoXsm8QVdithFsy ZcVZWcj9LCWffy6J+rJbSyB9nyuUxz9VVklzwPk0= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id DC7EF8B87B; Fri, 14 Feb 2020 09:37:06 +0100 (CET) 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 HfggUkm26GkN; Fri, 14 Feb 2020 09:37:06 +0100 (CET) Received: from [172.25.230.102] (po15451.idsi0.si.c-s.fr [172.25.230.102]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A568A8B874; Fri, 14 Feb 2020 09:37:06 +0100 (CET) Subject: Re: [PATCH 1/2] powerpc/8xx: Merge 8M hugepage slice and basepage slice From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , aneesh.kumar@linux.ibm.com Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <4ad03047ac61bfbdad3edb92542dedc807fc3cf4.1581011735.git.christophe.leroy@c-s.fr> Message-ID: <70082b0a-00c4-4d53-8846-ceab9a626328@c-s.fr> Date: Fri, 14 Feb 2020 09:37:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <4ad03047ac61bfbdad3edb92542dedc807fc3cf4.1581011735.git.christophe.leroy@c-s.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 06/02/2020 à 20:21, Christophe Leroy a écrit : > On 8xx, slices are used because hugepages (512k or 8M) and small > pages (4k or 16k) cannot share the same PGD entry. However, as 8M > entirely covers two PGD entries (One PGD entry covers 4M), there > will implicitely be no conflict between 8M pages and any other size. > So 8M is compatible with the basepage size as well. > > Remove the struct slice_mask mask_8m from mm_context_t and make > vma_mmu_pagesize() rely on vma_kernel_pagesize() as the base > slice can now host several sizes. I'm working on getting rid of CONFIG_PPC_MM_SLICES on the 8xx, so this little series is probably not worth merging. Christophe > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 7 ++----- > arch/powerpc/mm/hugetlbpage.c | 3 ++- > 2 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h > index 76af5b0cb16e..54f7f3362edb 100644 > --- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h > +++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h > @@ -215,9 +215,8 @@ typedef struct { > unsigned char low_slices_psize[SLICE_ARRAY_SIZE]; > unsigned char high_slices_psize[0]; > unsigned long slb_addr_limit; > - struct slice_mask mask_base_psize; /* 4k or 16k */ > + struct slice_mask mask_base_psize; /* 4k or 16k or 8M */ > struct slice_mask mask_512k; > - struct slice_mask mask_8m; > #endif > void *pte_frag; > } mm_context_t; > @@ -257,10 +256,8 @@ static inline struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psiz > { > if (psize == MMU_PAGE_512K) > return &ctx->mask_512k; > - if (psize == MMU_PAGE_8M) > - return &ctx->mask_8m; > > - BUG_ON(psize != mmu_virtual_psize); > + BUG_ON(psize != mmu_virtual_psize && psize != MMU_PAGE_8M); > > return &ctx->mask_base_psize; > } > diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c > index edf511c2a30a..0b4ab741bf09 100644 > --- a/arch/powerpc/mm/hugetlbpage.c > +++ b/arch/powerpc/mm/hugetlbpage.c > @@ -551,7 +551,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, > unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) > { > /* With radix we don't use slice, so derive it from vma*/ > - if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) { > + if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !IS_ENABLED(CONFIG_PPC_8xx) && > + !radix_enabled()) { > unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start); > > return 1UL << mmu_psize_to_shift(psize); >