Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2516464pxb; Fri, 8 Oct 2021 09:18:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/3+KiKQRByh8oCNe8hkBZQCrBe20YPT4NXQgpthHYFS0OUYE9bM83IS411x2bvCBT+OUw X-Received: by 2002:a17:903:230e:b0:13f:5f6:3722 with SMTP id d14-20020a170903230e00b0013f05f63722mr9937560plh.84.1633709936239; Fri, 08 Oct 2021 09:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633709936; cv=none; d=google.com; s=arc-20160816; b=zjx3yCqcEew94dfg59sJQOQsUSzwbk1cx5n+leB+swClYoGFsTsRQEyW6J1wkCthuL RY1x58tA3qe0EY0ohUn4ggHoo/nV3bYpSKtlzAfiGOxU1zQw+BdBKtN8X968r3MDsA88 n6nAsKjx8DzbvcqpuOBXH6FuHk9mpsV5FakqlCMb3E9g/C0afjCD9YTiGX/vzuiI2X2N l0s6WNdFv7A91KPQIsKcufgC7kIGXP7AGJUribhAZrdaV7ND4GSaFmKWiYzCb9KXFOTQ PzsVN13CEcMWue9s3+wGDn2d5cPmW2HUNXIYUmjmQc8UUVpEOKOhUCXJeMVtjlFbcsfT YVKA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EBuZXpjgIRsL/OAJ688dtWrAgWHEkN9CyLAn+u+O9PY=; b=acPk7CWFenBBNz/MdKT9ecze+uD/HYNjqGVWu5i2MifI0VJQ5riURLEVKXuDt6qeY8 v5WLRoiLR9muKEclGdp/nquMTVmFQ/Lt+IrRLfuzB7LxwVn1WO834aEOL8qjnC0C0F+d Ytc2rjxXRbT32RU6iwMgtJ91AduVfw9HRPJQaUJ39TIwojBBxTQzkf/xL3NAgqVwvx7q 4+nCH7cgSoXc2pdV0sDYcA0OUDMzupmgzbkP6oTdIjg2o29Gk3QUff3oPjTC2+vEBcBz qNfHNlPUUSDkiKxVJhTtpsfWO9qrroYur8P6UFUb6eqNPN8MlrqdUSsDdtytjNAcfbkC 1COw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=q5A7f3BT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si3821296pgv.160.2021.10.08.09.18.37; Fri, 08 Oct 2021 09:18:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=q5A7f3BT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbhJHQSY (ORCPT + 99 others); Fri, 8 Oct 2021 12:18:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17952 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbhJHQSK (ORCPT ); Fri, 8 Oct 2021 12:18:10 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 198FC65x001569; Fri, 8 Oct 2021 12:16:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=EBuZXpjgIRsL/OAJ688dtWrAgWHEkN9CyLAn+u+O9PY=; b=q5A7f3BT2ouBGZWcWsIBbjucz9g5/LtfGzjGnseXtdfSsPmvsm0QRJGEPcaXbdPLpe5I i7XU71TKhJ0+zXk0t/RLWyMjxs5COFE4oxodj6zUNLP9SqSDjmHG1iUpxgpEq7Ljhan1 SS8bJQl4oLEW+gIHwWNDu7CTQ2ytmjteB4xdAXKU6fXDm61NGEoG4smWyhBD5F44763L 7EXQ86tTFXiOzaMRgRaeR8ltm1qs9dpzWyUvZw8HZhjQAZUkbIiaSHq5FzYqn6QvzpR2 bRRydPvL2L2/rn0RKkKQwexlIXYH8hcBQKXqtZ1doTHIkGSqqbFvWb0eRNRxJ4JEe4tg Yw== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bjrdp9fxd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Oct 2021 12:16:12 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 198GClDE017130; Fri, 8 Oct 2021 16:16:09 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06fra.de.ibm.com with ESMTP id 3beepkg7y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Oct 2021 16:16:08 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 198GAcrc59572512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Oct 2021 16:10:38 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41A76A405F; Fri, 8 Oct 2021 16:16:05 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 155AAA405C; Fri, 8 Oct 2021 16:16:03 +0000 (GMT) Received: from sjain014.ibmuc.com (unknown [9.43.25.237]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 8 Oct 2021 16:16:02 +0000 (GMT) From: Sourabh Jain To: linux-kernel@vger.kernel.org Cc: hbathini@linux.ibm.com, mahesh@linux.vnet.ibm.com, mpe@ellerman.id.au, linuxppc-dev@ozlabs.org, aneesh.kumar@linux.ibm.com, Abdul haleem Subject: [PATCH 3/3] powerpc: Set crashkernel offset to mid of RMA region Date: Fri, 8 Oct 2021 21:45:52 +0530 Message-Id: <20211008161552.211262-4-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211008161552.211262-1-sourabhjain@linux.ibm.com> References: <20211008161552.211262-1-sourabhjain@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _vbWghwOCy6BUQmFBiVRp5FcFQJfByF8 X-Proofpoint-ORIG-GUID: _vbWghwOCy6BUQmFBiVRp5FcFQJfByF8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-08_04,2021-10-07_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 impostorscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110080092 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. Signed-off-by: Sourabh Jain Reported-and-tested-by: Abdul haleem --- arch/powerpc/kernel/rtas.c | 4 ++++ arch/powerpc/kexec/core.c | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index ff80bbad22a5..a49137727370 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -1235,6 +1235,10 @@ 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); + /* 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; + if (basep && entryp && sizep) { rtas.base = *basep; rtas.entry = *entryp; diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c index 48525e8b5730..71b1bfdadd76 100644 --- a/arch/powerpc/kexec/core.c +++ b/arch/powerpc/kexec/core.c @@ -147,11 +147,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 -- 2.31.1