From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F4E5C43458 for ; Tue, 30 Jun 2026 11:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=18iY+UqjEtoA9zYoHaGzgsc5ir0zJEIGBxP4Fsmo82U=; b=FzbTtzMFL7bx6B 00Q+Akk/SJXJK9Pl25pOFiLIsq4/x4zr+PzAW2FnY6Ct3hGY81q7QGSfxsGgDex1CF0qUSDJMsyFr FaYpoxtB9x40bMEBE1xxZoTa7FoN0LoBo73iaZ3vPOfkQuKDEExRroh1Yq+ZcRUfxBJ1sPRJviEGQ xVuPCKL++/wbD3law99EellvVuKn5IAU3gI+uZgyOc4DSejeTLcva6Guh5AOsODsWW4or1A550zWg x57PDthj24cfWq2wJ3LkP7NGroF4o0xIN7NwLvmfGMzEsyCJqKU5lKoJtnvyluup24wAY+Gz9U7jw GLTV02xJ3lLDs9zEdeKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1weWON-0000000Go5B-2pUw; Tue, 30 Jun 2026 11:12:39 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1weWOL-0000000Go4W-3Fkz; Tue, 30 Jun 2026 11:12:37 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 3DE48409ED; Tue, 30 Jun 2026 11:12:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D92961F000E9; Tue, 30 Jun 2026 11:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782817957; bh=kFi2ufhS9A7S0N/yneP1QPCfIlIbo7VUsBbxmuAgBec=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=MGNhr8eNkW7digT0TFYt+epnd3BW/+YsO4q/eYHOhHz7227q1kCPu/CVHfYs/I4LI iImDvzD+CnJnH7CqEqW/XrPImbYT9ptiNpLpvLD4AdrvLUw3YiFDRAyK6eJiIaRT/L JhxLyvriaMRcYrkq0K/XDMQj9vGMNUQBiU+R8rNahF5oRZ1jxtDuY/aGxoQXEvrG5Q 9hyHAz62Sxg/kpxyVDYrXXapZ8OBaDtqmEJB9A61lTHrO7FNkmY4uFhkJQZyvzel2l 1MbHnImoQCt9VhcZlwlBYGj9EGHAnQ8aEgLQj6yfL92rZX/hhcgHNPJy1GrybDCrkG fk/CJPKbEXU5Q== From: Pratyush Yadav To: Wandun Chen Cc: chenhuacai@kernel.org, kernel@xen0n.name, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh@kernel.org, saravanak@kernel.org, bhe@redhat.com, rppt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, kexec@lists.infradead.org, iommu@lists.linux.dev, zhaomeijing@lixiang.com, catalin.marinas@arm.com, will@kernel.org, alex@ghiti.fr, akpm@linux-foundation.org, pasha.tatashin@soleen.com, pratyush@kernel.org, ruirui.yang@linux.dev, m.szyprowski@samsung.com, robin.murphy@arm.com Subject: Re: [PATCH v4 09/10] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore In-Reply-To: <20260630074715.4126796-10-chenwandun1@gmail.com> (Wandun Chen's message of "Tue, 30 Jun 2026 15:47:13 +0800") References: <20260630074715.4126796-1-chenwandun1@gmail.com> <20260630074715.4126796-10-chenwandun1@gmail.com> Date: Tue, 30 Jun 2026 13:12:31 +0200 Message-ID: <2vxzechoi8o0.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Tue, Jun 30 2026, Wandun Chen wrote: > From: Wandun Chen > > Apply the same non-dumpable reserved memory filtering to RISC-V kdump > as was done for arm64. Use of_reserved_mem_kdump_exclude() to drop > flagged regions from the elfcorehdr PT_LOAD segments, and > of_reserved_mem_kdump_nr_ranges() to pre-size the crash_mem array. > > Signed-off-by: Wandun Chen > --- > arch/riscv/kernel/machine_kexec_file.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/riscv/kernel/machine_kexec_file.c b/arch/riscv/kernel/machine_kexec_file.c > index 59d4bbc848a8..25359d583bc3 100644 > --- a/arch/riscv/kernel/machine_kexec_file.c > +++ b/arch/riscv/kernel/machine_kexec_file.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -64,6 +65,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) > > nr_ranges = 1; /* For exclusion of crashkernel region */ > walk_system_ram_res(0, -1, &nr_ranges, get_nr_ram_ranges_callback); > + nr_ranges += of_reserved_mem_kdump_nr_ranges(); > > cmem = kmalloc_flex(*cmem, ranges, nr_ranges); > if (!cmem) > @@ -77,6 +79,8 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) > > /* Exclude crashkernel region */ > ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end); > + if (!ret) > + ret = of_reserved_mem_kdump_exclude(cmem); > if (!ret) > ret = crash_prepare_elf64_headers(cmem, true, addr, sz); Nit: can you do the usual pattern of if (err) goto err; instead? So this would look like: /* Exclude crashkernel region */ ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end); if (ret) goto out; ret = of_reserved_mem_kdump_exclude(cmem); if (ret) goto out; ret = crash_prepare_elf64_headers(cmem, true, addr, sz); out: ... With this, Acked-by: Pratyush Yadav -- Regards, Pratyush Yadav _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv