Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4425522pxb; Mon, 21 Feb 2022 21:13:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/lxNP0TdKwlNWR4oWkx5qu2sNAEZaJnnmjMCWieu+DuMV2LZGupa4RpqPH8lZ5zfXsogp X-Received: by 2002:a17:902:ee42:b0:14f:c36e:6558 with SMTP id 2-20020a170902ee4200b0014fc36e6558mr6485238plo.118.1645506808322; Mon, 21 Feb 2022 21:13:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645506808; cv=none; d=google.com; s=arc-20160816; b=Dup6L+WVKSHWBZ2ez61rVhP8ypr4kHKBHat9sPNagwMLBpEqE9dA/Wx5zQr7OuziRl LHHZUH+yrp8KdSrHIh+FY98LGs65molFVvRQA4gVS3/qV4LDVQAoFPHpgif0kPvodkf3 gM5D+nd+msNTbQlNDWGU60eth3ROo1N0Q2Sexyvc9VvZndE0OjSVRdOjaNvEv68TfSMc x+lF0HuGArve4oty0sCY9+egeQ/EIUw3i0IpJIsvZZxvzrpzjSq6yh5qnooLbx3zKN5K SnWziutdGEC1rCSZN6/KO8aV5ZutXa69DSud5I2XLtlcRmnxmhYR/3e87oEqyKeb0nPK 7KiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y/mKilxWngK9pY5wyY9QQAGP2NZFMONeljBqFMdvgck=; b=m0juqnC1eoNvS2CGmkoVcSAF9y/O289uGrfsjPR4wnJMIP1fTUg/742JRdHKUo0eeT YqqPLK59zcdJSooRZaW+QGNFmU3kXcF4g1MBrR/VY+/ELJ0OhlwVCSZZe7Jm+Rk+ckiD Xe7FJr50SypQulI5kg/yNAp7kMol+XOH3EC6tnBSN4lIweZBRAGy7J8BUcjfXvEPB/bI NGF2SCyrBkGSiJnD4kMWEXrJntALKnn9pCFjrdQvqPwyu7Q2BCo+GnBliAD/F/0nM/jW Qb8O9YKcg6hSqNhZ2+fVBjwt8RK0fEsJRf+t/H2A+vfBIvR1FtsSIr+uZbrRvntqafF1 NEtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZZVACbFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c12si14621564pgl.214.2022.02.21.21.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:13:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZZVACbFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C456BDE2C9; Mon, 21 Feb 2022 20:45:54 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352283AbiBUKDr (ORCPT + 99 others); Mon, 21 Feb 2022 05:03:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353022AbiBUJ5C (ORCPT ); Mon, 21 Feb 2022 04:57:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659EF45790; Mon, 21 Feb 2022 01:24:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26C5BB80ECB; Mon, 21 Feb 2022 09:24:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46CA3C340E9; Mon, 21 Feb 2022 09:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435491; bh=n1f98Y30u1MRoTvXq5oADRdUKbZtJKh6KWD/vuLlgzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZVACbFM/ca8sUwtvgst5CeDNdlR9xGCMD9mZ+c8xYZDUNiPe98G6ogAQeMiCM9LB 1M3Z8Ne/ywmKTAMU2PqCgsd+VXGnmJc/SItKGiEXdWY/jmfwzAcCGRWpCdgV9/Tgct U/ulLGUO21PeoQQiJfM29fNulIcVS+2EXmdf5HKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Bizon , Christophe Leroy , Michael Ellerman Subject: [PATCH 5.16 150/227] powerpc/603: Fix boot failure with DEBUG_PAGEALLOC and KFENCE Date: Mon, 21 Feb 2022 09:49:29 +0100 Message-Id: <20220221084939.819973632@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit 9bb162fa26ed76031ed0e7dbc77ccea0bf977758 upstream. Allthough kernel text is always mapped with BATs, we still have inittext mapped with pages, so TLB miss handling is required when CONFIG_DEBUG_PAGEALLOC or CONFIG_KFENCE is set. The final solution should be to set a BAT that also maps inittext but that BAT then needs to be cleared at end of init, and it will require more changes to be able to do it properly. As DEBUG_PAGEALLOC or KFENCE are debugging, performance is not a big deal so let's fix it simply for now to enable easy stable application. Fixes: 035b19a15a98 ("powerpc/32s: Always map kernel text and rodata with BATs") Cc: stable@vger.kernel.org # v5.11+ Reported-by: Maxime Bizon Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/aea33b4813a26bdb9378b5f273f00bd5d4abe240.1638857364.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/head_book3s_32.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/head_book3s_32.S +++ b/arch/powerpc/kernel/head_book3s_32.S @@ -421,14 +421,14 @@ InstructionTLBMiss: */ /* Get PTE (linux-style) and check access */ mfspr r3,SPRN_IMISS -#ifdef CONFIG_MODULES +#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE) lis r1, TASK_SIZE@h /* check if kernel address */ cmplw 0,r1,r3 #endif mfspr r2, SPRN_SDR1 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER rlwinm r2, r2, 28, 0xfffff000 -#ifdef CONFIG_MODULES +#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE) bgt- 112f lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC