From patchwork Sun May 20 12:20:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenzhou X-Patchwork-Id: 10413357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 704D760365 for ; Sun, 20 May 2018 12:21:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54C3028726 for ; Sun, 20 May 2018 12:21:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48AB12872E; Sun, 20 May 2018 12:21:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B07DA28726 for ; Sun, 20 May 2018 12:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6u07ewZN/d4oqiTmbHwUOuV1hWHN5m6teqAkt7pZZF4=; b=Q5NNXST/FoRhJ/ G/vtH4Lpxit+L60JSMCuiH7k9Uq8za3uLvGtOYIyT1KiNImJiEFnSG6QjGGE0zrCg7NEOaYI+3hyR RRBCihU6Qi0DVqlOOYISRERiFL1i8giCFvPD2/NBMZqMDulNY7FgLq3TeY9ufLYYQ0OdU9DCjnRPV jSPk2VfpFEgAciSNyMuEotWSad9bvbZW8SDU75+hm9E1/vs90DxhILMhxYX39EjOc27IqxZloJNcq +FfsvtCF8vaATVrBv8f+LaLN7FE1ZQzvOPzts67tVloOHJYp2U2lzVlh5v7dqex2ybZ/mCSKks6d2 eyz/4MK3BV5l7q97Qc+Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fKNKz-0000fY-Dy; Sun, 20 May 2018 12:21:21 +0000 Received: from [45.249.212.35] (helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fKNKw-0000dm-24 for linux-arm-kernel@lists.infradead.org; Sun, 20 May 2018 12:21:19 +0000 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EC1DDEB931867; Sun, 20 May 2018 20:20:53 +0800 (CST) Received: from localhost.localdomain (10.175.101.84) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.382.0; Sun, 20 May 2018 20:20:47 +0800 From: Chen Zhou To: , , , , , Subject: [PATCH] arm64: kdump: fix out of memory issue in __alloc_bootmem_low Date: Sun, 20 May 2018 20:20:39 +0800 Message-ID: <1526818839-8497-1-git-send-email-chenzhou10@huawei.com> X-Mailer: git-send-email 1.6.0.2 MIME-Version: 1.0 X-Originating-IP: [10.175.101.84] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180520_052118_264894_4A9F48A8 X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mao Wenan On arm64 kdump capture kernel, ACPI runtime code and data are outside of usable memory range and __alloc_bootmem_low may alloc memory below 4G. If we use "crashkernel=Y[@X]" and the start address is above 4G, there will be out of memory. In this patch, we get max_zone_dma_phys by memblock_start_of_DRAM and __pa_symbol(_end). Signed-off-by: Chen Zhou --- arch/arm64/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 1b18b47..df4d212 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -223,7 +223,8 @@ static void __init reserve_elfcorehdr(void) */ static phys_addr_t __init max_zone_dma_phys(void) { - phys_addr_t offset = memblock_start_of_DRAM() & GENMASK_ULL(63, 32); + phys_addr_t offset = max(memblock_start_of_DRAM(), __pa_symbol(_end)) & + GENMASK_ULL(63, 32); return min(offset + (1ULL << 32), memblock_end_of_DRAM()); }