Skip to content

mm: create a new system state and fix core_kernel_text()

Patrick Talbert requested to merge ptalbert/centos-stream-9:fix_for_mr747 into main

Bugzilla: https://bugzilla.redhat.com/2076713
Upstream Status: mainline

This is needed to fix builds after MR !747 (merged).

commit d2635f2012a44e3d469ab9a4022162dbe0e53f21
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Fri Nov 5 13:40:40 2021 -0700

    mm: create a new system state and fix core_kernel_text()

    core_kernel_text() considers that until system_state in at least
    SYSTEM_RUNNING, init memory is valid.

    But init memory is freed a few lines before setting SYSTEM_RUNNING, so
    we have a small period of time when core_kernel_text() is wrong.

    Create an intermediate system state called SYSTEM_FREEING_INIT that is
    set before starting freeing init memory, and use it in
    core_kernel_text() to report init memory invalid earlier.

    Link: https://lkml.kernel.org/r/9ecfdee7dd4d741d172cb93ff1d87f1c58127c9a.1633001016.git.christophe.leroy@csgroup.eu
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
    Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Paul Mackerras <paulus@ozlabs.org>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Patrick Talbert ptalbert@redhat.com

Edited by Patrick Talbert

Merge request reports