Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp485379ybh; Sat, 7 Mar 2020 03:07:55 -0800 (PST) X-Google-Smtp-Source: ADFU+vuvzvUujyte7IHB09FuVdT6wgDavasz8TtRvdgR8rK2WNLH1ViZaHQWbNUSVskgBkaFLIte X-Received: by 2002:a05:6830:118c:: with SMTP id u12mr5751631otq.124.1583579275092; Sat, 07 Mar 2020 03:07:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583579275; cv=none; d=google.com; s=arc-20160816; b=UiLY/9QTsm7uweZJlP/upbx6/8QzSQuxt+wNSXKRQzB2GonK+ZyxJHjOV5yaGA7D7M S+VFo+IiAbvQZ7G+Pi22v5c65rrl844UpywRbRmDpz2jkaVz85K6PukY2S7NvHNzFSIV 6SfhPLvvprcQt16uVTB/t50QZdX8k1V0oebFFQx5BZI/CHA069CXQ33UrWoNbWdbDxLf QRABW4T8mrCZm8UDivVmQVdTA4clYGPKfy/gWbVjxbXJFH9rC2J2bZixEC77l4jReYVJ JJEVYAuGwZcpEYtMw1WgXuMKYWqpKum0w2nT6bj4Mo06KCNxQyZBFchUZaNCDhS9Zhzk KNTQ== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=fQ50ArnYKJoB/zUnvln8et3Z8Wn2LaYu4oVbe0zh5Ho=; b=lBCYyMN+IWF2kHqL54Zlm7hQGodUcelJijN4MFXLuH00gQye57ilhowTzbeUx4wsZM XFJxXVX0tzX6Qn67g6ydYIqJiZE+AehgUJsNCzsintc77T6o05zFr2LuYII2u1seyMRV 2NxwY8Sy+Zt3O1vg2wr8jTyVS7OALv9LziS5nE2CnUpmo1FbOwXnoJ8gIu9lO2PrIIlV lYBDhrIq8rv8iOTKvC2p300OdONmg8FS/rJtu3NuGTz55kKQC/6FlYF30d2/cBesZLp4 Xn+vj6ZPu4/hTV6dtVd6h1KupqxXO5Fn7oL4JNKMEV3AahI62pMx5J7xcqzxvV7D7ekJ UHWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si3338889otn.207.2020.03.07.03.07.39; Sat, 07 Mar 2020 03:07:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726114AbgCGLGn (ORCPT + 99 others); Sat, 7 Mar 2020 06:06:43 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11195 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726065AbgCGLGm (ORCPT ); Sat, 7 Mar 2020 06:06:42 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1335413F9D459FCCC85D; Sat, 7 Mar 2020 19:06:38 +0800 (CST) Received: from [127.0.0.1] (10.177.131.64) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Sat, 7 Mar 2020 19:06:29 +0800 Subject: Re: [PATCH v7 2/4] arm64: kdump: reserve crashkenel above 4G for crash dump kernel To: Prabhakar Kushwaha References: <20191223152349.180172-1-chenzhou10@huawei.com> <20191223152349.180172-3-chenzhou10@huawei.com> CC: Thomas Gleixner , , Catalin Marinas , Will Deacon , James Morse , , Bhupesh Sharma , , Linux Doc Mailing List , kexec mailing list , Linux Kernel Mailing List , , linux-arm-kernel , Ganapatrao Prabhakerrao Kulkarni From: Chen Zhou Message-ID: <0c00f14a-15ca-44db-7f82-00f15ddd3c88@huawei.com> Date: Sat, 7 Mar 2020 19:06:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.131.64] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/3/5 18:13, Prabhakar Kushwaha wrote: > On Mon, Dec 23, 2019 at 8:57 PM Chen Zhou wrote: >> >> Crashkernel=X tries to reserve memory for the crash dump kernel under >> 4G. If crashkernel=X,low is specified simultaneously, reserve spcified >> size low memory for crash kdump kernel devices firstly and then reserve >> memory above 4G. >> >> Signed-off-by: Chen Zhou >> --- >> arch/arm64/kernel/setup.c | 8 +++++++- >> arch/arm64/mm/init.c | 31 +++++++++++++++++++++++++++++-- >> 2 files changed, 36 insertions(+), 3 deletions(-) >> >> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c >> index 56f6645..04d1c87 100644 >> --- a/arch/arm64/kernel/setup.c >> +++ b/arch/arm64/kernel/setup.c >> @@ -238,7 +238,13 @@ static void __init request_standard_resources(void) >> kernel_data.end <= res->end) >> request_resource(res, &kernel_data); >> #ifdef CONFIG_KEXEC_CORE >> - /* Userspace will find "Crash kernel" region in /proc/iomem. */ >> + /* >> + * Userspace will find "Crash kernel" region in /proc/iomem. >> + * Note: the low region is renamed as Crash kernel (low). >> + */ >> + if (crashk_low_res.end && crashk_low_res.start >= res->start && >> + crashk_low_res.end <= res->end) >> + request_resource(res, &crashk_low_res); >> if (crashk_res.end && crashk_res.start >= res->start && >> crashk_res.end <= res->end) >> request_resource(res, &crashk_res); >> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c >> index b65dffd..0d7afd5 100644 >> --- a/arch/arm64/mm/init.c >> +++ b/arch/arm64/mm/init.c >> @@ -80,6 +80,7 @@ static void __init reserve_crashkernel(void) >> { >> unsigned long long crash_base, crash_size; >> int ret; >> + phys_addr_t crash_max = arm64_dma32_phys_limit; >> >> ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), >> &crash_size, &crash_base); >> @@ -87,12 +88,38 @@ static void __init reserve_crashkernel(void) >> if (ret || !crash_size) >> return; >> >> + ret = reserve_crashkernel_low(); >> + if (!ret && crashk_low_res.end) { >> + /* >> + * If crashkernel=X,low specified, there may be two regions, >> + * we need to make some changes as follows: >> + * >> + * 1. rename the low region as "Crash kernel (low)" >> + * In order to distinct from the high region and make no effect >> + * to the use of existing kexec-tools, rename the low region as >> + * "Crash kernel (low)". >> + * >> + * 2. change the upper bound for crash memory >> + * Set MEMBLOCK_ALLOC_ACCESSIBLE upper bound for crash memory. >> + * >> + * 3. mark the low region as "nomap" >> + * The low region is intended to be used for crash dump kernel >> + * devices, just mark the low region as "nomap" simply. >> + */ >> + const char *rename = "Crash kernel (low)"; >> + >> + crashk_low_res.name = rename; >> + crash_max = MEMBLOCK_ALLOC_ACCESSIBLE; >> + memblock_mark_nomap(crashk_low_res.start, >> + resource_size(&crashk_low_res)); >> + } >> + >> crash_size = PAGE_ALIGN(crash_size); >> >> if (crash_base == 0) { >> /* Current arm64 boot protocol requires 2MB alignment */ >> - crash_base = memblock_find_in_range(0, arm64_dma32_phys_limit, >> - crash_size, SZ_2M); >> + crash_base = memblock_find_in_range(0, crash_max, crash_size, >> + SZ_2M); >> if (crash_base == 0) { >> pr_warn("cannot allocate crashkernel (size:0x%llx)\n", >> crash_size); >> -- > > I tested this patch series on ARM64-ThunderX2 with no issue with > bootargs crashkenel=X@Y crashkernel=250M,low > > $ dmesg | grep crash > [ 0.000000] crashkernel reserved: 0x0000000b81200000 - > 0x0000000c81200000 (4096 MB) > [ 0.000000] Kernel command line: > BOOT_IMAGE=/boot/vmlinuz-5.6.0-rc4+ > root=UUID=866b8df3-14f4-4e11-95a1-74a90ee9b694 ro > crashkernel=4G@0xb81200000 crashkernel=250M,low nowatchdog earlycon > [ 29.310209] crashkernel=250M,low > > $ kexec -p -i /boot/vmlinuz-`uname -r` > --initrd=/boot/initrd.img-`uname -r` --reuse-cmdline > $ echo 1 > /proc/sys/kernel/sysrq ; echo c > /proc/sysrq-trigger > > But when i tried with crashkernel=4G crashkernel=250M,low as bootargs. > Kernel is not able to allocate memory. > [ 0.000000] cannot allocate crashkernel (size:0x100000000) > [ 0.000000] Kernel command line: > BOOT_IMAGE=/boot/vmlinuz-5.6.0-rc4+ > root=UUID=866b8df3-14f4-4e11-95a1-74a90ee9b694 ro crashkernel=4G > crashkernel=250M,low nowatchdog > [ 29.332081] crashkernel=250M,low > > does crashkernel=X@Y mandatory to get allocated beyond 4G? > am I missing something? I can't reproduce the problem in my environment, can you test with other size, such as "crashkernel=1G crashkernel=250M,low", see if there is the same issue. Besides, crashkernel=X@Y isn't mandatory to get allocated beyond 4G, can you show the whole file /proc/iomem. Thanks, Chen Zhou > > --pk > > . >