Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1032065pxb; Fri, 15 Apr 2022 19:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoOzVZFk/ATEEhUAFoiv3OEnLGa5wQhkyXF7+CRQGl7T+HxLlxkL43mrog8jm72tuGiqzY X-Received: by 2002:a65:6bd6:0:b0:39d:4f85:9ecf with SMTP id e22-20020a656bd6000000b0039d4f859ecfmr1370416pgw.336.1650074459157; Fri, 15 Apr 2022 19:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650074459; cv=none; d=google.com; s=arc-20160816; b=X5DPfY9AB4iFVSYlfnLcMGOsmv4tzzv0tCasHtb+jSXsb/8ZRvyHW94Iov81Z9ny7h TsdKDpZeB6C6teuP58bFYZfdFz4/fBt49zZQd7vNyhYEeDvYUSTUKMC4NsX1y8JGPtEv YbQT7xvm4RzuNYSxmloGXYVKTpEYsAVxIy4HmG3fSpBT2oBbcgE1pr1YysEVQD2+rgo3 vfKHVHs1kb8CLHdTmXdQi80paYl50Odze9q0Yi+t8S6Lg+gt1b2Q9QJN8FxLN4z8AUlH JEU+ldxqJKN9Um00NNQ4blpu11npy9+0NQ4KhSNoMGVLHkQ1+HJHPSKpNTiarONNEpwh 0I0g== 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=zrM4I87coqNqOMilDeV51jtbvnKKfMN1qg5TQC5MGTg=; b=b1Q35SAIma0sVVhAGLHk/rq3bJuYGZHl37AtCZNG28eQxJRluGhVXLMqXfUPbMi+Da vsx0yW33HGaQA2ycQITSgndOSBRQ5Em9jEMSFT00h9fPCIvJCNE8jEzZ6vL0ElCUZ5MO XiWh1tLPt4C7bEbPFAdzVMkoWTrMPJu3DJEBF5NB+/AArzybgNoPCPJQ/NHu0l9CmPlz 4GJ/HV9hxx+Pc/PTcbOUgJWMjdkzcDg35vgQjJWq1hs6uqiZECLhJggTe3/pZiLxViIN veNbzcrFT+xDpadE/p23NsHngI2A3ljq8helSSoMGoIzoqiEjro4kBZtO5r2hifwlG0R v6ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=twC8+dOO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id t189-20020a6381c6000000b003816043eec9si2779154pgd.190.2022.04.15.19.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:00:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=twC8+dOO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 7E0D81BBE2E; Fri, 15 Apr 2022 18:20:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343967AbiDNOJf (ORCPT + 99 others); Thu, 14 Apr 2022 10:09:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344051AbiDNNaR (ORCPT ); Thu, 14 Apr 2022 09:30:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0083B5FFE; Thu, 14 Apr 2022 06:26:52 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 90AF060C14; Thu, 14 Apr 2022 13:26:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AD89C385A1; Thu, 14 Apr 2022 13:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649942812; bh=hOcQBWIXcEidzZoSaw/Wg9L7ZuH6XN1zDwSSHKx1hyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=twC8+dOOUJoBOwCkBCho9yrilfHJBuDG8DzX23VhH0QX00QXqGqmwG1IQZP5paMOK wy0Z1ZxUEr4tICxFkk7/vdRNYTuGgJcsqQS6vWrCYf5wqbmj0gc4EbZOsBU9x9vSHh /hMAqwVABGhfyIX8EzcWr7eSZ2zSzYf4wYu/X2Ss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abdul haleem , Sourabh Jain , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 269/338] powerpc: Set crashkernel offset to mid of RMA region Date: Thu, 14 Apr 2022 15:12:52 +0200 Message-Id: <20220414110846.546372308@linuxfoundation.org> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220414110838.883074566@linuxfoundation.org> References: <20220414110838.883074566@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: Sourabh Jain [ Upstream commit 7c5ed82b800d8615cdda00729e7b62e5899f0b13 ] On large config LPARs (having 192 and more cores), Linux fails to boot due to insufficient memory in the first memblock. It is due to the memory reservation for the crash kernel which starts at 128MB offset of the first memblock. This memory reservation for the crash kernel doesn't leave enough space in the first memblock to accommodate other essential system resources. The crash kernel start address was set to 128MB offset by default to ensure that the crash kernel get some memory below the RMA region which is used to be of size 256MB. But given that the RMA region size can be 512MB or more, setting the crash kernel offset to mid of RMA size will leave enough space for the kernel to allocate memory for other system resources. Since the above crash kernel offset change is only applicable to the LPAR platform, the LPAR feature detection is pushed before the crash kernel reservation. The rest of LPAR specific initialization will still be done during pseries_probe_fw_features as usual. This patch is dependent on changes to paca allocation for boot CPU. It expect boot CPU to discover 1T segment support which is introduced by the patch posted here: https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-January/239175.html Reported-by: Abdul haleem Signed-off-by: Sourabh Jain Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220204085601.107257-1-sourabhjain@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/machine_kexec.c | 15 +++++++++++---- arch/powerpc/kernel/rtas.c | 6 ++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index 094c37fb07a9..437c50bfe4e6 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c @@ -148,11 +148,18 @@ void __init reserve_crashkernel(void) if (!crashk_res.start) { #ifdef CONFIG_PPC64 /* - * On 64bit we split the RMO in half but cap it at half of - * a small SLB (128MB) since the crash kernel needs to place - * itself and some stacks to be in the first segment. + * On the LPAR platform place the crash kernel to mid of + * RMA size (512MB or more) to ensure the crash kernel + * gets enough space to place itself and some stack to be + * in the first segment. At the same time normal kernel + * also get enough space to allocate memory for essential + * system resource in the first segment. Keep the crash + * kernel starts at 128MB offset on other platforms. */ - crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2)); + if (firmware_has_feature(FW_FEATURE_LPAR)) + crashk_res.start = ppc64_rma_size / 2; + else + crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2)); #else crashk_res.start = KDUMP_KERNELBASE; #endif diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index b3aa0cea6283..362c20c8c22f 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -1357,6 +1357,12 @@ int __init early_init_dt_scan_rtas(unsigned long node, entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL); sizep = of_get_flat_dt_prop(node, "rtas-size", NULL); +#ifdef CONFIG_PPC64 + /* need this feature to decide the crashkernel offset */ + if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL)) + powerpc_firmware_features |= FW_FEATURE_LPAR; +#endif + if (basep && entryp && sizep) { rtas.base = *basep; rtas.entry = *entryp; -- 2.35.1