• Michael Ellerman's avatar
    powerpc/nohash: Fix use of mmu_has_feature() in setup_initial_memory_limit() · 4868e350
    Michael Ellerman authored
    setup_initial_memory_limit() is called from early_init_devtree(), which
    runs prior to feature patching. If the kernel is built with CONFIG_JUMP_LABEL=y
    and CONFIG_JUMP_LABEL_FEATURE_CHECKS=y then we will potentially get the
    wrong value.
    
    If we also have CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG=y we get a warning
    and backtrace:
    
      Warning! mmu_has_feature() used prior to jump label init!
      CPU: 0 PID: 0 Comm: swapper Not tainted 4.11.0-rc4-gccN-next-20170331-g6af2434c #1
      Call Trace:
      [c000000000fc3d50] [c000000000a26c30] .dump_stack+0xa8/0xe8 (unreliable)
      [c000000000fc3de0] [c00000000002e6b8] .setup_initial_memory_limit+0xa4/0x104
      [c000000000fc3e60] [c000000000d5c23c] .early_init_devtree+0xd0/0x2f8
      [c000000000fc3f00] [c000000000d5d3b0] .early_setup+0x90/0x11c
      [c000000000fc3f90] [c000000000000520] start_here_multiplatform+0x68/0x80
    
    Fix it by using early_mmu_has_feature().
    
    Fixes: c12e6f24 ("powerpc: Add option to use jump label for mmu_has_feature()")
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    4868e350
tlb_nohash.c 19.8 KB