Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5039125ybl; Mon, 9 Dec 2019 22:36:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyh8jug3WJpCO1tndk+lQ+oAuEBagOjrA1cfvceht8Px/rRWBIrs4i2Nn3yZfoy7ssj8wHq X-Received: by 2002:aca:f1c6:: with SMTP id p189mr2752397oih.159.1575959791044; Mon, 09 Dec 2019 22:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575959791; cv=none; d=google.com; s=arc-20160816; b=C3/rU1iuCdEqyyH4ANn0EQxq+8xxXaZJ7mHteDY8/Yek4gJJjuYtvBexHMKnf8f2LQ Qhmh3l3ssh+saQm0R3Qy6+4MpUui+3GXxWfkVQyt1orOoPOvoy3lf1ktQUbJ+4hN2f+M NBMIgeC6JuOfj6M/mmm5ypVBUePv0dudTBL64ib3UUbDqK2VYCaT4V00dQ78imJxNoEO VLj9NlZ17Dwp34S2oTSjqAS7WEe4fn1wtJYo4y7nGay5wS9UVn1L6/MVDVMqm6oQ4xRk MocVZGd75E8O8rsW7U4EDzvST/SACHlrEU61tXHWB+ZrdVTkaP506lEgsrBYx16WAcr9 N2BQ== 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:from:references:to:subject:dkim-signature; bh=EUHakfQZwNjDyNpMu0Q8JwdIe7wmUpTzbd0Lye8z+SQ=; b=JJHXEXfrImPo1Kd93gHZQ7Cu//21TQdKWqLrlxLcUSt5eUD8Ab2Y42yXS/lt2XT1Fq WXKFY5mYjTCinD7grGIqqKDt3kcbqMEDPwtTTnVjskgKw5lE/aRA2Wn2Lrnt3M+mOOoh Q5JZoIh3ruct4sEHUK7dbGPYB41kfQvjH0xlj8DBHw91RsceN06HjQQd45SIqadwkdDh hYyEaXroElp3kmqg0Ja1bRCSnG9bRY+djtwLlAaTWAVTtFDi5h8XFVUAeozsPsQNQt1W oyM30PY+MlzGdei7fNYoEd9MeJ/8D8xkJ4r45tNmJ1dWiVVmP59EzewqjLrIEH+uVzn+ /5lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=FnZPC6Pa; 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 n14si1596850otr.162.2019.12.09.22.36.17; Mon, 09 Dec 2019 22:36:31 -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=FnZPC6Pa; 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 S1727225AbfLJGfT (ORCPT + 99 others); Tue, 10 Dec 2019 01:35:19 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:29864 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbfLJGfS (ORCPT ); Tue, 10 Dec 2019 01:35:18 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47X9Kb5hrrz9vBmx; Tue, 10 Dec 2019 07:35:15 +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=FnZPC6Pa; 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 mLr7XqX7TPBB; Tue, 10 Dec 2019 07:35:15 +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 47X9Kb4HChz9vBmv; Tue, 10 Dec 2019 07:35:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1575959715; bh=EUHakfQZwNjDyNpMu0Q8JwdIe7wmUpTzbd0Lye8z+SQ=; h=Subject:To:References:From:Date:In-Reply-To:From; b=FnZPC6Pa0+yhD/+AxgFA095UyCvnSy+8dA9WpzskPNJpa9JYz8RLDZQmjFZ4fDCcC MPDkpw+RQEw0lBhYKZqX6UcRKNgPIdbmDO3176Htuq0NDMK42R5an/d9/v8zbfGE4n qxqo3oesJHRGuIzPAd50/B6guDsbrzmJAVIeyFWw= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6EFD58B802; Tue, 10 Dec 2019 07:35:16 +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 qPcjq3_4_bHw; Tue, 10 Dec 2019 07:35:16 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BCADD8B754; Tue, 10 Dec 2019 07:35:15 +0100 (CET) Subject: Re: [PATCH v2 1/4] mm: define MAX_PTRS_PER_{PTE,PMD,PUD} To: Daniel Axtens , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kasan-dev@googlegroups.com, aneesh.kumar@linux.ibm.com, bsingharora@gmail.com References: <20191210044714.27265-1-dja@axtens.net> <20191210044714.27265-2-dja@axtens.net> From: Christophe Leroy Message-ID: <80f340f2-0323-8092-7e6d-c93b26fb7cf7@c-s.fr> Date: Tue, 10 Dec 2019 07:35:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191210044714.27265-2-dja@axtens.net> 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 10/12/2019 à 05:47, Daniel Axtens a écrit : > powerpc has boot-time configurable PTRS_PER_PTE, PMD and PUD. The > values are selected based on the MMU under which the kernel is > booted. This is much like how 4 vs 5-level paging on x86_64 leads to > boot-time configurable PTRS_PER_P4D. > > So far, this hasn't leaked out of arch/powerpc. But with KASAN, we > have static arrays based on PTRS_PER_*, so for powerpc support must > provide constant upper bounds for generic code. > > Define MAX_PTRS_PER_{PTE,PMD,PUD} for this purpose. > > I have configured these constants: > - in asm-generic headers > - on arches that implement KASAN: x86, s390, arm64, xtensa and powerpc I think we shoud avoid spreading default values all over the place when all arches but one uses the default. I would drop this patch 1, squash the powerpc part of it in the last patch, and define defaults in patch 2, see my comments there. > > I haven't wired up any other arches just yet - there is no user of > the constants outside of the KASAN code I add in the next patch, so > missing the constants on arches that don't support KASAN shouldn't > break anything. > > Suggested-by: Christophe Leroy > Signed-off-by: Daniel Axtens > --- > arch/arm64/include/asm/pgtable-hwdef.h | 3 +++ > arch/powerpc/include/asm/book3s/64/hash.h | 4 ++++ > arch/powerpc/include/asm/book3s/64/pgtable.h | 7 +++++++ > arch/powerpc/include/asm/book3s/64/radix.h | 5 +++++ > arch/s390/include/asm/pgtable.h | 3 +++ > arch/x86/include/asm/pgtable_types.h | 5 +++++ > arch/xtensa/include/asm/pgtable.h | 1 + > include/asm-generic/pgtable-nop4d-hack.h | 9 +++++---- > include/asm-generic/pgtable-nopmd.h | 9 +++++---- > include/asm-generic/pgtable-nopud.h | 9 +++++---- > 10 files changed, 43 insertions(+), 12 deletions(-) > Christophe