Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp135981imj; Wed, 13 Feb 2019 06:01:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IaKxRKgH1B08kg3ROl6dFuXIoZ2d9H64AHefdibbv+nVDi22jnRhwXQgkJ2f+X2BMPgvUPD X-Received: by 2002:a63:d84b:: with SMTP id k11mr633829pgj.142.1550066462430; Wed, 13 Feb 2019 06:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550066462; cv=none; d=google.com; s=arc-20160816; b=ns+bfboC7p5L7/H/JgirV2qgEv4lplpPmapGfKm2yo4R1Gs1lfgwEB/PadM1weFHCY maKuelWuQgJ909g72CjX2MBvhK4vkpLRsO7v3q55L/WqPXh2SMwgojZAGAbzqVLelvkw Frs3Eur7svc/YyMTiGWc3oyjRLs55R5Kbv0O2J64Q+svaXDUc2dlmdul50iuPw51q+WR NNlUr+5OUSQUaVfwTuO60F3yyq9HYkOay6M4E550RoXY3eglBbs0wgtDzx9lhJ00UG+p /xSl+6Q34QvencvZ9gA7PRjCkYcmAEgNey8Lh1W47EftC7tXIOpvxEV3jDE/VHzTE3lG z87g== 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=grvD19QaJWyGmbCdlmHOR5r0KmCNxQi1h8MV/TdbXDY=; b=sDUE1BaGjzKrnh1PZSJoI6p0BemvWA2dIPTLbBw2caRRe3BiWmm6GC2IOzZ8krHDSW CgLRB8cZHPAmlGcEkEuowZ+/mSeo1jA+Uw5uc4ru/nGUajwFJh8pT2rWzpYmy/iqjIGB gOzI+Z77/1SyQ0GzCtfSqG4683FJMyIXAs+LeUj/jV3lMrbt2WmtNaBB4eFnZ4tlTfrH Fu5pbTlkNNwEU/aUZhrE/hF8o8fI3S7sAg6DZzHdB5My/1VBF1MypC+x2WgJZzimAKae najqKBvLIWy7gL8WClzwgIab/Df5Nz4vVOx3Sc719aTaklKZSrDvs19wr8lUQDkBWey/ pSkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=TNwPDy4S; 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 44si1736418plc.110.2019.02.13.06.00.44; Wed, 13 Feb 2019 06:01:01 -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=TNwPDy4S; 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 S2388196AbfBMMFj (ORCPT + 99 others); Wed, 13 Feb 2019 07:05:39 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:39535 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726324AbfBMMFi (ORCPT ); Wed, 13 Feb 2019 07:05:38 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43zys93WrJzB09ZX; Wed, 13 Feb 2019 13:05:33 +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=TNwPDy4S; 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 ZbLmOWCOCZra; Wed, 13 Feb 2019 13:05:33 +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 43zys9259fzB09ZW; Wed, 13 Feb 2019 13:05:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1550059533; bh=grvD19QaJWyGmbCdlmHOR5r0KmCNxQi1h8MV/TdbXDY=; h=Subject:From:To:Cc:References:Date:In-Reply-To:From; b=TNwPDy4S1ZVq+wEMgiE3kEyD2XWQu0az5qXx86caaXNC/OAWprVvTsu3gZvfP2BGW R0KibYz14rau7dIHrhbUs+B3omqdRdT6Fdi3+Jfer8Aa/d1dMh6s1J7X3rhARbPtYd 1Zalznu7omKVoYJUWjHc+bazEzrr6a1J626+8Adk= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 861CE8B85B; Wed, 13 Feb 2019 13:05:34 +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 RIWoOjI91Dwm; Wed, 13 Feb 2019 13:05:34 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5D10C8B756; Wed, 13 Feb 2019 13:05:34 +0100 (CET) Subject: Re: [PATCH v2 2/2] powerpc/8xx: Map a second 8M text page at startup when needed. From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <6658dcb02424fbd5e19be3c3c9abb1a20253db46.1547801451.git.christophe.leroy@c-s.fr> Message-ID: <7fb43bee-7926-35be-f54f-601b8b05b066@c-s.fr> Date: Wed, 13 Feb 2019 13:05:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: 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 21/01/2019 à 12:34, Christophe Leroy a écrit : > Some debug setup like CONFIG_KASAN generate huge > kernels with text size over the 8M limit. > > This patch maps a second 8M page when _einittext is over 8M. This is not enough for CONFIG_KASAN_INLINE. I'll send a v3 which maps up to 32M based on _einittext. > > Signed-off-by: Christophe Leroy > --- > v2: Using IS_ENABLED() instead of #ifdef in 8xx_mmu.c > > arch/powerpc/kernel/head_8xx.S | 27 +++++++++++++++++++++++++-- > arch/powerpc/mm/8xx_mmu.c | 3 +++ > 2 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S > index 20cc816b3508..3b3b7846247f 100644 > --- a/arch/powerpc/kernel/head_8xx.S > +++ b/arch/powerpc/kernel/head_8xx.S > @@ -337,8 +337,8 @@ InstructionTLBMiss: > rlwinm r10, r10, 16, 0xfff8 > cmpli cr0, r10, PAGE_OFFSET@h > #ifndef CONFIG_PIN_TLB_TEXT > - /* It is assumed that kernel code fits into the first 8M page */ > -0: cmpli cr7, r10, (PAGE_OFFSET + 0x0800000)@h > + /* It is assumed that kernel code fits into the two first 8M pages */ > +0: cmpli cr7, r10, (PAGE_OFFSET + 0x1000000)@h > patch_site 0b, patch__itlbmiss_linmem_top > #endif > #endif > @@ -908,6 +908,29 @@ initial_mmu: > li r8, MI_BOOTINIT /* Create RPN for address 0 */ > mtspr SPRN_MI_RPN, r8 /* Store TLB entry */ > > + /* Map a second 8M page if needed */ > + lis r9, _einittext@h > + oris r9, r9, _einittext@l > + cmpli cr0, r9, (PAGE_OFFSET + 0x8000000)@h Should be 0x800000 here Christophe > + blt 1f > + > +#ifdef CONFIG_PIN_TLB_TEXT > + lis r8, MI_RSV4I@h > + ori r8, r8, 0x1d00 > + > + mtspr SPRN_MI_CTR, r8 /* Set instruction MMU control */ > +#endif > + > + lis r8, (KERNELBASE + 0x800000)@h /* Create vaddr for TLB */ > + ori r8, r8, MI_EVALID /* Mark it valid */ > + mtspr SPRN_MI_EPN, r8 > + li r8, MI_PS8MEG /* Set 8M byte page */ > + ori r8, r8, MI_SVALID /* Make it valid */ > + mtspr SPRN_MI_TWC, r8 > + li r8, MI_BOOTINIT /* Create RPN for address 0 */ > + addis r8, r8, 0x80 > + mtspr SPRN_MI_RPN, r8 /* Store TLB entry */ > +1: > lis r8, MI_APG_INIT@h /* Set protection modes */ > ori r8, r8, MI_APG_INIT@l > mtspr SPRN_MI_AP, r8 > diff --git a/arch/powerpc/mm/8xx_mmu.c b/arch/powerpc/mm/8xx_mmu.c > index 92b677faea8c..b5f6d794281d 100644 > --- a/arch/powerpc/mm/8xx_mmu.c > +++ b/arch/powerpc/mm/8xx_mmu.c > @@ -112,6 +112,9 @@ unsigned long __init mmu_mapin_ram(unsigned long top) > mmu_patch_cmp_limit(&patch__itlbmiss_linmem_top, 0); > } else { > mapped = top & ~(LARGE_PAGE_SIZE_8M - 1); > + if (!IS_ENABLED(CONFIG_PIN_TLB_TEXT)) > + mmu_patch_cmp_limit(&patch__itlbmiss_linmem_top, > + _ALIGN(__pa(_einittext), 8 << 20)); > } > > mmu_patch_cmp_limit(&patch__dtlbmiss_linmem_top, mapped); >