• Mark Rutland's avatar
    arm64: initialize per-cpu offsets earlier · 353e228e
    Mark Rutland authored
    The current initialization of the per-cpu offset register is difficult
    to follow and this initialization is not always early enough for
    upcoming instrumentation with KCSAN, where the instrumentation callbacks
    use the per-cpu offset.
    
    To make it possible to support KCSAN, and to simplify reasoning about
    early bringup code, let's initialize the per-cpu offset earlier, before
    we run any C code that may consume it. To do so, this patch adds a new
    init_this_cpu_offset() helper that's called before the usual
    primary/secondary start functions. For consistency, this is also used to
    re-initialize the per-cpu offset after the runtime per-cpu areas have
    been allocated (which can change CPU0's offset).
    
    So that init_this_cpu_offset() isn't subject to any instrumentation that
    might consume the per-cpu offset, it is marked with noinstr, preventing
    instrumentation.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: James Morse <james.morse@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20201005164303.21389-1-mark.rutland@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    353e228e
smp.c 24.3 KB