linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: Mike Rapoport <rppt@kernel.org>, Paul Walmsley <pjw@kernel.org>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 Alexandre Ghiti <alex@ghiti.fr>,
	Andrew Morton <akpm@linux-foundation.org>,
	 David Hildenbrand <david@kernel.org>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	 Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	 Vlastimil Babka <vbabka@suse.cz>,
	Mike Rapoport <rppt@kernel.org>,
	 Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH v3 24/29] arch, mm: consolidate initialization of SPARSE memory model
Date: Mon, 23 Feb 2026 14:52:45 +0100	[thread overview]
Message-ID: <20260223144108-dcace0b9-02e8-4b67-a7ce-f263bed36f26@linutronix.de> (raw)
In-Reply-To: <20260111082105.290734-25-rppt@kernel.org>

Hi everyone,

On Sun, Jan 11, 2026 at 10:20:58AM +0200, Mike Rapoport wrote:
> Every architecture calls sparse_init() during setup_arch() although the
> data structures created by sparse_init() are not used until the
> initialization of the core MM.
> 
> Beside the code duplication, calling sparse_init() from architecture
> specific code causes ordering differences of vmemmap and HVO initialization
> on different architectures.
> 
> Move the call to sparse_init() from architecture specific code to
> free_area_init() to ensure that vmemmap and HVO initialization order is
> always the same.

This broke the boot on RISC-V 32-bit (rv32_defconfig) for me.

Specifically if sparse_init() is *not* called before the following callchain,
the kernel dies at that point.

start_kernel()
  setup_arch()
    apply_boot_alternatives()
      _apply_alternatives()
        riscv_cpufeature_patch_func()
          patch_text_nosync()
          riscv_alternative_fix_offsets()


Simple reproducer, using kunit:

./tools/testing/kunit/kunit.py run --raw_output=all --make_options LLVM=1 --arch riscv32 --kconfig_add CONFIG_SPARSEMEM_MANUAL=y --kconfig_add CONFIG_SPARSEMEM=y

> 
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
>  Documentation/mm/memory-model.rst                    |  3 ---
>  Documentation/translations/zh_CN/mm/memory-model.rst |  2 --
>  arch/alpha/kernel/setup.c                            |  1 -
>  arch/arm/mm/init.c                                   |  6 ------
>  arch/arm64/mm/init.c                                 |  6 ------
>  arch/csky/kernel/setup.c                             |  2 --
>  arch/loongarch/kernel/setup.c                        |  8 --------
>  arch/mips/kernel/setup.c                             | 11 -----------
>  arch/parisc/mm/init.c                                |  2 --
>  arch/powerpc/include/asm/setup.h                     |  4 ++++
>  arch/powerpc/mm/mem.c                                |  5 -----
>  arch/powerpc/mm/numa.c                               |  2 --
>  arch/riscv/mm/init.c                                 |  1 -
>  arch/s390/mm/init.c                                  |  1 -
>  arch/sh/mm/init.c                                    |  2 --
>  arch/sparc/mm/init_64.c                              |  2 --
>  arch/x86/mm/init_32.c                                |  1 -
>  arch/x86/mm/init_64.c                                |  2 --
>  include/linux/mmzone.h                               |  2 --
>  mm/internal.h                                        |  6 ++++++
>  mm/mm_init.c                                         |  1 +
>  21 files changed, 11 insertions(+), 59 deletions(-)

(...)


  reply	other threads:[~2026-02-23 13:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-11  8:20 [PATCH v3 00/29] arch, mm: consolidate hugetlb early reservation Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 01/29] alpha: introduce arch_zone_limits_init() Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 02/29] arc: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 03/29] arm: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 04/29] arm: make initialization of zero page independent of the memory map Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 05/29] arm64: introduce arch_zone_limits_init() Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 06/29] csky: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 07/29] hexagon: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 08/29] loongarch: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 09/29] m68k: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 10/29] microblaze: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 11/29] mips: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 12/29] nios2: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 13/29] openrisc: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 14/29] parisc: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 15/29] powerpc: " Mike Rapoport
2026-01-13 12:29   ` Ritesh Harjani
2026-01-11  8:20 ` [PATCH v3 16/29] riscv: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 17/29] s390: " Mike Rapoport
2026-01-12  7:02   ` Alexander Gordeev
2026-01-12  7:34     ` Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 18/29] sh: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 19/29] sparc: " Mike Rapoport
2026-01-13 12:28   ` Andreas Larsson
2026-01-11  8:20 ` [PATCH v3 20/29] um: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 21/29] x86: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 22/29] xtensa: " Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 23/29] arch, mm: consolidate initialization of nodes, zones and memory map Mike Rapoport
2026-01-11  8:20 ` [PATCH v3 24/29] arch, mm: consolidate initialization of SPARSE memory model Mike Rapoport
2026-02-23 13:52   ` Thomas Weißschuh [this message]
2026-01-11  8:20 ` [PATCH v3 25/29] mips: drop paging_init() Mike Rapoport
2026-01-11  8:21 ` [PATCH v3 26/29] x86: don't reserve hugetlb memory in setup_arch() Mike Rapoport
2026-01-11  8:21 ` [PATCH v3 27/29] mm, arch: consolidate hugetlb CMA reservation Mike Rapoport
2026-01-11  8:21 ` [PATCH v3 28/29] mm/hugetlb: drop hugetlb_cma_check() Mike Rapoport
2026-01-11  8:21 ` [PATCH v3 29/29] Revert "mm/hugetlb: deal with multiple calls to hugetlb_bootmem_alloc" Mike Rapoport
2026-01-12 22:23 ` [PATCH v3 00/29] arch, mm: consolidate hugetlb early reservation Andrew Morton
2026-01-13  6:50   ` Kalle Niemi
2026-01-13  8:40     ` Kalle Niemi
2026-02-20  4:10 ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260223144108-dcace0b9-02e8-4b67-a7ce-f263bed36f26@linutronix.de \
    --to=thomas.weissschuh@linutronix.de \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox