• Douglas Anderson's avatar
    nmi_backtrace: allow excluding an arbitrary CPU · 8d539b84
    Douglas Anderson authored
    The APIs that allow backtracing across CPUs have always had a way to
    exclude the current CPU.  This convenience means callers didn't need to
    find a place to allocate a CPU mask just to handle the common case.
    
    Let's extend the API to take a CPU ID to exclude instead of just a
    boolean.  This isn't any more complex for the API to handle and allows the
    hardlockup detector to exclude a different CPU (the one it already did a
    trace for) without needing to find space for a CPU mask.
    
    Arguably, this new API also encourages safer behavior.  Specifically if
    the caller wants to avoid tracing the current CPU (maybe because they
    already traced the current CPU) this makes it more obvious to the caller
    that they need to make sure that the current CPU ID can't change.
    
    [akpm@linux-foundation.org: fix trigger_allbutcpu_cpu_backtrace() stub]
    Link: https://lkml.kernel.org/r/20230804065935.v4.1.Ia35521b91fc781368945161d7b28538f9996c182@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    Cc: kernel test robot <lkp@intel.com>
    Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Pingfan Liu <kernelfans@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    8d539b84
stacktrace.c 5.62 KB