Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1901808ybt; Sun, 28 Jun 2020 01:33:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtvgVrC3DYza/1riibN+q+4tBP+CAFMG3jnsGts09Qbydmo7/MPse08Vyw9ozfiZWSxgYy X-Received: by 2002:a17:907:405e:: with SMTP id ns22mr9087104ejb.6.1593333230054; Sun, 28 Jun 2020 01:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593333230; cv=none; d=google.com; s=arc-20160816; b=pE0hbF93kIn/XAnIayfylv9oYnrdoPsNTazFKrdeww0CjhzJsj+xeZFHfJdKkhbSkg BaojXb1JVRwuCNcydgLmsPPWC+xAp0aCZ7GDeIDIHvVAbXCGjSJJPvsZYPGcW0y5pV9W oOs/DPEs3CDqftRmrR1VF/MzOdBRitnsfZ4ArKNLmh3M9erDrKSH55SfbkS6TodXE8oh lpJOlHfK/s2cU1NOTu5omUAFbnYtD2fFv2DxPZJHfS9sH9haB3FII3bhcxpGx/yy+HNg tQnMjA2fPgRo3F4Vp0wCXIUzUO4R85N5j1d1vc7dmc+WyK5HwkBI2id0f3gi9/GKnPW6 zVDg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DVieW5naT4Tv0mW0SFdH9VNA9xCrs3QCS4Z7b44zY2M=; b=s/LBdID04vKG6muoKNSueu3ZFpRyIUEWbVi2TeL2r1fvAXXVczdnXYaedsOMqmm3iV 8wKVHpj6ICZ4yxJLcpI6ura/C4X9i4VFoH79MoSBfpqLWSlTJkgrJogFYvJh0noyJcSh Zs84G5HaWdEWPoSPaodvbLgN6ypmhhD/UJUvmRlfmY8XyTGwhDUmmOGAFFQ0KXsF3If7 VEAJ++QdTVmd3lTIApswCj7ut5Wmkz1mZGsNH4WzhcOq6UmLQ4wIEwBnbFidjuj60sLU /6MQvrNQv6b+KotCluLqNczjE2RKxjhX/WzeeeFoS+pnPkqs+1S6HJVlOeuFKPo3bNiF 4NHQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si14757134edo.473.2020.06.28.01.33.27; Sun, 28 Jun 2020 01:33:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726231AbgF1Ia5 (ORCPT + 99 others); Sun, 28 Jun 2020 04:30:57 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59044 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726129AbgF1Ias (ORCPT ); Sun, 28 Jun 2020 04:30:48 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 303A83761374F50AAB1F; Sun, 28 Jun 2020 16:30:45 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Sun, 28 Jun 2020 16:30:36 +0800 From: Chen Zhou To: , , , , , , , , , , , , , , CC: , , , , , , , Subject: [PATCH v9 4/5] arm64: kdump: fix kdump broken with ZONE_DMA reintroduced Date: Sun, 28 Jun 2020 16:34:57 +0800 Message-ID: <20200628083458.40066-5-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200628083458.40066-1-chenzhou10@huawei.com> References: <20200628083458.40066-1-chenzhou10@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32") broken the arm64 kdump. If the memory reserved for crash dump kernel falled in ZONE_DMA32, the devices in crash dump kernel need to use ZONE_DMA will alloc fail. This patch addressed the above issue based on "reserving crashkernel above 4G". Originally, we reserve low memory below 4G, and now just need to adjust memory limit to arm64_dma_phys_limit in reserve_crashkernel_low if ZONE_DMA is enabled. That is, if there are devices need to use ZONE_DMA in crash dump kernel, it is a good choice to use parameters "crashkernel=X crashkernel=Y,low". Signed-off-by: Chen Zhou --- kernel/crash_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index a7580d291c37..e8ecbbc761a3 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -320,6 +320,7 @@ int __init reserve_crashkernel_low(void) unsigned long long base, low_base = 0, low_size = 0; unsigned long total_low_mem; int ret; + phys_addr_t crash_max = 1ULL << 32; total_low_mem = memblock_mem_size(1UL << (32 - PAGE_SHIFT)); @@ -352,7 +353,11 @@ int __init reserve_crashkernel_low(void) return 0; } - low_base = memblock_find_in_range(0, 1ULL << 32, low_size, CRASH_ALIGN); +#ifdef CONFIG_ARM64 + if (IS_ENABLED(CONFIG_ZONE_DMA)) + crash_max = arm64_dma_phys_limit; +#endif + low_base = memblock_find_in_range(0, crash_max, low_size, CRASH_ALIGN); if (!low_base) { pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller size.\n", (unsigned long)(low_size >> 20)); -- 2.20.1