Skip to content
  • Mark Rutland's avatar
    locking/atomics: Switch to generated instrumentation · aa525d06
    Mark Rutland authored
    
    
    As a step towards ensuring the atomic* APIs are consistent, let's switch
    to wrappers generated by gen-atomic-instrumented.h, using the same table
    used to generate the fallbacks and atomic-long wrappers.
    
    These are checked in rather than generated with Kbuild, since:
    
    * This allows inspection of the atomics with git grep and ctags on a
      pristine tree, which Linus strongly prefers being able to do.
    
    * The fallbacks are not affected by machine details or configuration
      options, so it is not necessary to regenerate them to take these into
      account.
    
    * These are included by files required *very* early in the build process
      (e.g. for generating bounds.h), and we'd rather not complicate the
      top-level Kbuild file with dependencies.
    
    Generating the atomic headers means that the instrumented wrappers will
    remain in sync with the rest of the atomic APIs, and we gain all the
    ordering variants of each atomic without having to manually expanded
    them all.
    
    The KASAN checks are automatically generated based on the function
    parameters defined in atomics.tbl. Note that try_cmpxchg() now correctly
    treats 'old' as a parameter that may be written to, and not only read as
    the hand-written instrumentation assumed.
    
    Other than the change to try_cmpxchg(), existing code should not be
    affected by this patch. The patch introduces instrumentation for all
    optional atomics (and ordering variants), along with the ifdeffery this
    requires, enabling other architectures to make use of the instrumented
    atomics.
    
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: default avatarWill Deacon <will.deacon@arm.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: catalin.marinas@arm.com
    Cc: linuxdrivers@attotech.com
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Alexander Potapenko <glider@google.com>
    Link: http://lkml.kernel.org/r/20180904104830.2975-5-mark.rutland@arm.com
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    aa525d06