From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221358; b=CZ+W1CvLxy6LFEddTUh5SN9FUuTI8iX2FEhyBOWqkTtcgAe/IjnlwPikZwTXFm6rYxGP QXXCY/9ltfZ4qUuMIae91H24rFzQ4q8kgsrBR2PaOflga0YdqtrPly2BQT0WNnNlijqIu zZMFOfjcblTKaQViGdOpxMgw0JgUODoYj6MeHDPAqnDnwNuR99uzQ0PnfafkKHcP6Y2f6 lon7OZVlhZRocnUUI/9I3/3FI1qshJc5+S1BwKnHPmdg82nZrJFbWsafG1EjBnEOY5Lb6 PsH/TZ+pNt4k9IPYFMaJ2RJZ+FTy2liMGLhjXPJ7wcyYOoDi7h1hatWBU4HUUlSjP0A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221358; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=cE8R7lRlFYx0GJbm6o2BF9b/NxtXRA16Rmno3/KjqZs=; b=jxFqvzNYm8UX6WnbXTr/Y1aXT/k6Ukn7/k1VdaBwf5BxOrQzZqjSPfPKnG6eq3zZ6u45 N79ynHyyVftigVKUZWObtZnMZM2RqfSM6USWtUH4AQ0gl+D9FTqd/VNmbhKAuAfkTT7Fa ONhub2fF23ZIUxP5AGYQKoaZD1cq59z98u1cfT5AVSCK0vgrFMQnVTRWAXZir7u37Nkj0 ATgNLB5PHCLPLi7IlS0HggIp8Kl7faYs8UV57a/gYlizT/PnVFvnrG+Ody9mPbxYO0xNu nBmIXcHhKurgesurDxo3xwKH0yOdqgiTBD1hkKywhIpTFK6JKKWrT6/stk8AT7k/vbQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ug1y5FIw; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A83C606A31A for ; Wed, 2 Dec 2026 14:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ug1y5FIw Received: by smtp.kernel.org (Postfix) with ESMTPSA id 673781F00896; Wed, 2 Dec 2026 14:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221357; bh=cE8R7lRlFYx0GJbm6o2BF9b/NxtXRA16Rmno3/KjqZs=; h=Subject:To:Cc:From:Date; b=Ug1y5FIwOaffzUFEGj6czdi7GJSF2sZIovm1yHCN5uR4cT2/etFTmW84M8R8g2Vi1 jAqAr6lj7An0P3+2+bZ4nMZYjaUgxkamKnvba7cFw4QJgUnyd4TPOLcpChr72jATG+ qZqbeeaCV4pw7dtUgYTzNFpctdEAgY1nW52By6W0= Subject: FAILED: patch "[PATCH] riscv: mm: reserve the DTB before scanning reserved memory" failed to apply to 6.18-stable tree To: m.szyprowski@samsung.com,pjw@kernel.org Cc: From: Date: Wed, 02 Dec 2026 14:41:30 +0100 Message-ID: <2026120230-phonics-sandy-b5fb@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y git checkout FETCH_HEAD git cherry-pick -x fc91dacd0c2b4f9ca7e0ce30016f5aee6256cba5 # git commit -s git send-email --to '' --in-reply-to '2026120230-phonics-sandy-b5fb@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From fc91dacd0c2b4f9ca7e0ce30016f5aee6256cba5 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Wed, 4 Nov 2026 11:46:03 +0100 Subject: [PATCH] riscv: mm: reserve the DTB before scanning reserved memory early_init_fdt_scan_reserved_mem() allocates memory from memblock while it scans /reserved-memory: the reserved_mem array, and the regions that are placed dynamically by size. On RISC-V the DTB was only reserved after that scan, so memblock could hand out the memory the DTB occupies while the DTB was still being parsed. Reserve the DTB before the scan, so that memblock never allocates from it. Fixes: ef69d2559fe9 ("riscv: Move early dtb mapping into the fixmap region") Closes: https://lore.kernel.org/all/b71ac175-fba5-4f61-bbdb-0b98dec9ccee@samsung.com/ Signed-off-by: Marek Szyprowski Link: https://patch.msgid.link/20261104104604.3370384-1-m.szyprowski@samsung.com Cc: stable@vger.kernel.org Signed-off-by: Paul Walmsley diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 070ee69eabb3..d73688402b50 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -294,13 +294,6 @@ static void __init setup_bootmem(void) reserve_initrd_mem(); - /* - * No allocation should be done before reserving the memory as defined - * in the device tree, otherwise the allocation could end up in a - * reserved region. - */ - early_init_fdt_scan_reserved_mem(); - /* * If DTB is built in, no need to reserve its memblock. * Otherwise, do reserve it but avoid using @@ -309,6 +302,13 @@ static void __init setup_bootmem(void) */ if (!IS_ENABLED(CONFIG_BUILTIN_DTB)) memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va)); + + /* + * No allocation should be done before reserving the memory as defined + * in the device tree, otherwise the allocation could end up in a + * reserved region. + */ + early_init_fdt_scan_reserved_mem(); } #ifdef CONFIG_RELOCATABLE