{"id":2218955,"url":"http://patchwork.ozlabs.org/api/covers/2218955/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/cover/20260402072701.628293-1-ruanjinjie@huawei.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20260402072701.628293-1-ruanjinjie@huawei.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20260402072701.628293-1-ruanjinjie@huawei.com/","date":"2026-04-02T07:26:46","name":"[v12,00/15] arm64/riscv: Add support for crashkernel CMA reservation","submitter":{"id":84791,"url":"http://patchwork.ozlabs.org/api/people/84791/?format=json","name":"Jinjie Ruan","email":"ruanjinjie@huawei.com"},"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/cover/20260402072701.628293-1-ruanjinjie@huawei.com/mbox/","series":[{"id":498443,"url":"http://patchwork.ozlabs.org/api/series/498443/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=498443","date":"2026-04-02T07:26:46","name":"arm64/riscv: Add support for crashkernel CMA reservation","version":12,"mbox":"http://patchwork.ozlabs.org/series/498443/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2218955/comments/","headers":{"Return-Path":"\n <linuxppc-dev+bounces-19192-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=XFyO3HZg;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-19192-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=none smtp.remote-ip=113.46.200.223","lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com","lists.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=XFyO3HZg;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com\n (client-ip=113.46.200.223; helo=canpmsgout08.his.huawei.com;\n envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmYLB1wwpz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 18:25:54 +1100 (AEDT)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fmYL83dlYz2ydq;\n\tThu, 02 Apr 2026 18:25:52 +1100 (AEDT)","from canpmsgout08.his.huawei.com (canpmsgout08.his.huawei.com\n [113.46.200.223])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4fmYL54DMxz2xln\n\tfor <linuxppc-dev@lists.ozlabs.org>; Thu, 02 Apr 2026 18:25:47 +1100 (AEDT)","from mail.maildlp.com (unknown [172.19.163.127])\n\tby canpmsgout08.his.huawei.com (SkyGuard) with ESMTPS id 4fmYBp74XLzmVWV;\n\tThu,  2 Apr 2026 15:19:30 +0800 (CST)","from dggpemf500011.china.huawei.com (unknown [7.185.36.131])\n\tby mail.maildlp.com (Postfix) with ESMTPS id C81BC402AB;\n\tThu,  2 Apr 2026 15:25:42 +0800 (CST)","from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com\n (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 2 Apr\n 2026 15:25:39 +0800"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775114752;\n\tcv=none;\n b=TXtUohDbdz5YKIurSj4PxA4wdOUHltsrGrmzPqT9buLFznAUpcx9EVdZzodX6P3zGS/wgHZJbSfwmKe3Jf1H2YrxNSxh4+B5V6Ln4+UvEmGmt3zSkljFElxO2me6YhI9fVw/coM+mxRypeUq8C/dCseudfg3h6AKvFLjfq6ljyUo3wUA4RiuB7fLElT80cHPAyfFQ/WQ4H+Gye4AoF1rkIG5lohoRxwS794R1hlT+it3H5GaP05RfrbYLJPSH1K8CqJ+EMJ1AzJFneY7+fZdiZ/8w/u53R3pI7Wjy4s6ENptIeuGeAWlvumTKjeckq9M+pmMuU/wYw347OX0ZneefA==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775114752; c=relaxed/relaxed;\n\tbh=bYL91xN0k8SZnYn2ZHMX4edxJPIDmixyuT6I/2tV1KM=;\n\th=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type;\n b=F+zw/6tM1F7DhCPdIR+BrWhqPACp1ozV0C8zH3WCTLWamotx2ceUQREXQ4vUkDt361v7voVTxjn9d/naz2IjhPmSap1tGRuBkLDWbIsgKN4bCtHp7GDE2HNpETm5gF8KaPyc87ylO4/VtPJlcnKOL6WSyQjIKu3Aggx3bMQ/fk55E961F5FlCD1CAdvh6bFBnSNON8gbhAjNTzR1GXR+ANMQgFO2wrh3kK2MPJ4cR15xEwOiIhLI0WF/8X7HXihG4gDyHTWDfFv/FRY+VP/ZjypV/ElullGVzgx5ob91KzGqkFkAfajYX8JjXESJ7Xo2hz9rPz0WGnTaqIIXaAkqiw==","ARC-Authentication-Results":"i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com;\n dkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=XFyO3HZg; dkim-atps=neutral;\n spf=pass (client-ip=113.46.200.223; helo=canpmsgout08.his.huawei.com;\n envelope-from=ruanjinjie@huawei.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com","dkim-signature":"v=1; a=rsa-sha256; d=huawei.com; s=dkim;\n\tc=relaxed/relaxed; q=dns/txt;\n\th=From;\n\tbh=bYL91xN0k8SZnYn2ZHMX4edxJPIDmixyuT6I/2tV1KM=;\n\tb=XFyO3HZgPGaDclg6e0kCRls2FHdfMYpdC5yms5BvvsRgBGd2Mu9MZgAQiTWuWzi6LVfzcOwAC\n\tw0CWALY8ELZuLBpl3hpqaDyz/yC9GzujhZhy2cZMcSjsxlrSaYXfKMw3v6LZsF9y3wsPlsfcowX\n\tMKlW+josArpEIRhERDnXVeU=","From":"Jinjie Ruan <ruanjinjie@huawei.com>","To":"<corbet@lwn.net>, <skhan@linuxfoundation.org>, <catalin.marinas@arm.com>,\n\t<will@kernel.org>, <chenhuacai@kernel.org>, <kernel@xen0n.name>,\n\t<maddy@linux.ibm.com>, <mpe@ellerman.id.au>, <npiggin@gmail.com>,\n\t<chleroy@kernel.org>, <pjw@kernel.org>, <palmer@dabbelt.com>,\n\t<aou@eecs.berkeley.edu>, <alex@ghiti.fr>, <tglx@kernel.org>,\n\t<mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>,\n\t<hpa@zytor.com>, <robh@kernel.org>, <saravanak@kernel.org>,\n\t<akpm@linux-foundation.org>, <bhe@redhat.com>, <vgoyal@redhat.com>,\n\t<dyoung@redhat.com>, <rdunlap@infradead.org>, <peterz@infradead.org>,\n\t<pawan.kumar.gupta@linux.intel.com>, <feng.tang@linux.alibaba.com>,\n\t<dapeng1.mi@linux.intel.com>, <kees@kernel.org>, <elver@google.com>,\n\t<paulmck@kernel.org>, <lirongqing@baidu.com>, <rppt@kernel.org>,\n\t<leitao@debian.org>, <ardb@kernel.org>, <jbohac@suse.cz>,\n\t<cfsworks@gmail.com>, <tangyouling@kylinos.cn>, <sourabhjain@linux.ibm.com>,\n\t<ritesh.list@gmail.com>, <hbathini@linux.ibm.com>, <eajames@linux.ibm.com>,\n\t<guoren@kernel.org>, <songshuaishuai@tinylab.org>, <kevin.brodsky@arm.com>,\n\t<vishal.moola@gmail.com>, <junhui.liu@pigmoral.tech>, <coxu@redhat.com>,\n\t<fuqiang.wang@easystack.cn>, <liaoyuanhong@vivo.com>,\n\t<takahiro.akashi@linaro.org>, <james.morse@arm.com>, <lizhengyu3@huawei.com>,\n\t<x86@kernel.org>, <linux-doc@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>,\n\t<loongarch@lists.linux.dev>, <linuxppc-dev@lists.ozlabs.org>,\n\t<linux-riscv@lists.infradead.org>, <devicetree@vger.kernel.org>,\n\t<kexec@lists.infradead.org>","CC":"<ruanjinjie@huawei.com>","Subject":"[PATCH v12 00/15] arm64/riscv: Add support for crashkernel CMA\n reservation","Date":"Thu, 2 Apr 2026 15:26:46 +0800","Message-ID":"<20260402072701.628293-1-ruanjinjie@huawei.com>","X-Mailer":"git-send-email 2.34.1","X-Mailing-List":"linuxppc-dev@lists.ozlabs.org","List-Id":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"8bit","X-Originating-IP":"[10.90.53.73]","X-ClientProxiedBy":"kwepems100002.china.huawei.com (7.221.188.206) To\n dggpemf500011.china.huawei.com (7.185.36.131)","X-Spam-Status":"No, score=-0.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"The crash memory allocation, and the exclude of crashk_res, crashk_low_res\nand crashk_cma memory are almost identical across different architectures,\nThis patch set handle them in crash core in a general way, which eliminate\na lot of duplication code.\n\nAnd add support for crashkernel CMA reservation for arm64 and riscv.\n\nRebased on v7.0-rc1.\n\nBasic second kernel boot test were performed on QEMU platforms for x86,\nARM64, and RISC-V architectures with the following parameters:\n\n\t\"cma=256M crashkernel=256M crashkernel=64M,cma\"\n\nChanges in v12:\n- Remove the unused \"nr_mem_ranges\" for x86.\n- Add \"Fix crashk_low_res not exclude bug\" test log.\n- Provide a separate patch for each architecture for using\n  crash_prepare_headers(), which will make the review more convenient.\n- Add Reviewed-by and Tested-by.\n- Link to v11: https://lore.kernel.org/all/20260328074013.3589544-1-ruanjinjie@huawei.com/\n\nChanges in v11:\n- Avoid silently drop crash memory if the crash kernel is built without\n  CONFIG_CMA.\n- Remove unnecessary \"cmem->nr_ranges = 0\" for arch_crash_populate_cmem()\n  as we use kvzalloc().\n- Provide a separate patch for each architecture to fix the existing\n  buffer overflow issue.\n- Add Acked-bys for arm64.\n\nChanges in v10:\n- Fix crashk_low_res not excluded bug in the existing\n  RISC-V code.\n- Fix an existing memory leak issue in the existing PowerPC code.\n- Fix the ordering issue of adding CMA ranges to\n  \"linux,usable-memory-range\".\n- Fix an existing concurrency issue. A Concurrent memory hotplug may occur\n  between reading memblock and attempting to fill cmem during kexec_load()\n  for almost all existing architectures.\n- Link to v9: https://lore.kernel.org/all/20260323072745.2481719-1-ruanjinjie@huawei.com/\n\nChanges in v9:\n- Collect Reviewed-by and Acked-by, and prepare for Sashiko AI review.\n- Link to v8: https://lore.kernel.org/all/20260302035315.3892241-1-ruanjinjie@huawei.com/\n\nChanges in v8:\n- Fix the build issues reported by kernel test robot and Sourabh.\n- Link to v7: https://lore.kernel.org/all/20260226130437.1867658-1-ruanjinjie@huawei.com/\n\nChanges in v7:\n- Correct the inclusion of CMA-reserved ranges for kdump kernel in of/kexec\n  for arm64 and riscv.\n- Add Acked-by.\n- Link to v6: https://lore.kernel.org/all/20260224085342.387996-1-ruanjinjie@huawei.com/\n\nChanges in v6:\n- Update the crash core exclude code as Mike suggested.\n- Rebased on v7.0-rc1.\n- Add acked-by.\n- Link to v5: https://lore.kernel.org/all/20260212101001.343158-1-ruanjinjie@huawei.com/\n\nJinjie Ruan (14):\n  riscv: kexec_file: Fix crashk_low_res not exclude bug\n  powerpc/crash: Fix possible memory leak in update_crash_elfcorehdr()\n  x86/kexec: Fix potential buffer overflow in prepare_elf_headers()\n  arm64: kexec_file: Fix potential buffer overflow in\n    prepare_elf_headers()\n  riscv: kexec_file: Fix potential buffer overflow in\n    prepare_elf_headers()\n  LoongArch: kexec: Fix potential buffer overflow in\n    prepare_elf_headers()\n  crash: Add crash_prepare_headers() to exclude crash kernel memory\n  arm64: kexec_file: Use crash_prepare_headers() helper to simplify code\n  x86/kexec: Use crash_prepare_headers() helper to simplify code\n  riscv: kexec_file: Use crash_prepare_headers() helper to simplify code\n  LoongArch: kexec: Use crash_prepare_headers() helper to simplify code\n  crash: Use crash_exclude_core_ranges() on powerpc\n  arm64: kexec: Add support for crashkernel CMA reservation\n  riscv: kexec: Add support for crashkernel CMA reservation\n\nSourabh Jain (1):\n  powerpc/crash: sort crash memory ranges before preparing elfcorehdr\n\n .../admin-guide/kernel-parameters.txt         |  16 +--\n arch/arm64/kernel/machine_kexec_file.c        |  43 +++-----\n arch/arm64/mm/init.c                          |   5 +-\n arch/loongarch/kernel/machine_kexec_file.c    |  43 +++-----\n arch/powerpc/include/asm/kexec_ranges.h       |   1 -\n arch/powerpc/kexec/crash.c                    |   7 +-\n arch/powerpc/kexec/ranges.c                   | 101 +-----------------\n arch/riscv/kernel/machine_kexec_file.c        |  42 +++-----\n arch/riscv/mm/init.c                          |   5 +-\n arch/x86/kernel/crash.c                       |  92 +++-------------\n drivers/of/fdt.c                              |   9 +-\n drivers/of/kexec.c                            |   9 ++\n include/linux/crash_core.h                    |   9 ++\n include/linux/crash_reserve.h                 |   4 +-\n kernel/crash_core.c                           |  89 ++++++++++++++-\n 15 files changed, 193 insertions(+), 282 deletions(-)"}