Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1498055ybv; Fri, 14 Feb 2020 00:38:30 -0800 (PST) X-Google-Smtp-Source: APXvYqynN2JE3FuDt1XyIHyb/EpBJzUBFY49GBN52wd8tfrjV/NrALvavOjfZBg1aoaqgyu1Dkfj X-Received: by 2002:aca:5fc6:: with SMTP id t189mr1177086oib.166.1581669510297; Fri, 14 Feb 2020 00:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581669510; cv=none; d=google.com; s=arc-20160816; b=MNtMJ7izkKX+9z70QXah4tCLq1E9vOyoZyfrYGvdAEtNv+foz9eleBNiOcXmdSQvbN VQNVAOPQ4qVb4G+7/zPThl72zoD+5r3eyRAnpWmQ9uUZ9MdRzUQm5UZrddTMwK8rxoQE P7+NRR3ZyHbc5uNrA1u1P0GeF7rb/2CLcMe8v+tcsamg95l/bS4VkXlQfsnn2GxkNvh1 xTq7tblaTIrFPql806RoU3o+SSWjhRgXyQyqI1allkMF0hKFccb8C/nxNc2f/ZI890lH w98OPCv4HLZEf+rLIQd5DRfAct8ycBUWBMeOY8T/XNG7tmAStzaI0ebMP/TY5uYxjNDv XhqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=ddxc67V5RXhkdNTVaQ7sd3n3LU9GQgEQfAysbLNxMao=; b=vllxCZ0AXxWM728Ol7ar+tdVvSOSpjqJ5qZs4gHp4itzq20QtnTdW7oZnkO7++XHuP di5E/RPaSWLIncNv+c4DaauHbdI2ClkDTlkZaN/9OZD81YjHEDtFV0Tw15p5Lz9M7E8O yqBmdMH7ZJDOLkUwb0DHsDZI1CqtiWqyXsA7mUrX5EK6/9kKnT6MyhotwhX7RM8lD6Fm liahmdpQehV+ENceixGPNR3lsI0wWhGwtqUqa6zf54jy3SVAwGnyB7iSgmBd6g/RGCpf 6jJ6m+5yASKo4IMuwmk1/nO2zxGbrOk805QvSMZ6Zi4iLBuachlYUv7MEb0RDDb5eS3b LQxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=bxnstb7b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w202si2596868oif.121.2020.02.14.00.38.18; Fri, 14 Feb 2020 00:38:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=bxnstb7b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728841AbgBNIhJ (ORCPT + 99 others); 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); >