Skip to content
  1. Nov 01, 2018
    • Ingo Molnar's avatar
      locking/atomics: Fix scripts/atomic/ script permissions · 4d8e5cd2
      Ingo Molnar authored
      
      
      Mark all these scripts executable.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: linuxdrivers@attotech.com
      Cc: dvyukov@google.com
      Cc: boqun.feng@gmail.com
      Cc: arnd@arndb.de
      Cc: aryabinin@virtuozzo.com
      Cc: glider@google.com
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4d8e5cd2
    • Mark Rutland's avatar
      arm64, locking/atomics: Use instrumented atomics · c0df1081
      Mark Rutland authored
      
      
      Now that the generic atomic headers provide instrumented wrappers of all
      the atomics implemented by arm64, let's migrate arm64 over to these.
      
      The additional instrumentation will help to find bugs (e.g. when fuzzing
      with Syzkaller).
      
      Mostly this change involves adding an arch_ prefix to a number of
      function names and macro definitions. When LSE atomics are used, the
      out-of-line LL/SC atomics will be named __ll_sc_arch_atomic_${OP}.
      
      Adding the arch_ prefix requires some whitespace fixups to keep things
      aligned. Some other unusual whitespace is fixed up at the same time
      (e.g. in the cmpxchg wrappers).
      
      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 <catalin.marinas@arm.com>
      Cc: linuxdrivers@attotech.com
      Cc: dvyukov@google.com
      Cc: boqun.feng@gmail.com
      Cc: arnd@arndb.de
      Cc: aryabinin@virtuozzo.com
      Cc: glider@google.com
      Link: http://lkml.kernel.org/r/20180904104830.2975-7-mark.rutland@arm.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c0df1081
    • Mark Rutland's avatar
      locking/atomics: Check generated headers are up-to-date · 8d325880
      Mark Rutland authored
      
      
      Now that all the generated atomic headers are in place, it would be good
      to ensure that:
      
      a) the headers are up-to-date when scripting changes.
      
      b) developers don't directly modify the generated headers.
      
      To ensure both of these properties, let's add a Kbuild step to check
      that the generated headers are up-to-date.
      
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: catalin.marinas@arm.com
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linuxdrivers@attotech.com
      Cc: dvyukov@google.com
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: arnd@arndb.de
      Cc: aryabinin@virtuozzo.com
      Cc: glider@google.com
      Link: http://lkml.kernel.org/r/20180904104830.2975-6-mark.rutland@arm.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8d325880
    • 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
    • Mark Rutland's avatar
      locking/atomics: Switch to generated atomic-long · b5d47ef9
      Mark Rutland authored
      
      
      As a step towards ensuring the atomic* APIs are consistent, let's switch
      to wrappers generated by gen-atomic-long.h, using the same table that
      gen-atomic-fallbacks.h uses to fill in gaps in the atomic_* and
      atomic64_* APIs.
      
      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.
      
      Other than *_INIT() and *_cond_read_acquire(), all API functions are
      implemented as static inline C functions, ensuring consistent type
      promotion and/or truncation without requiring explicit casts to be
      applied to parameters or return values.
      
      Since we typedef atomic_long_t to either atomic_t or atomic64_t, we know
      these types are equivalent, and don't require explicit casts between
      them. However, as the try_cmpxchg*() functions take a pointer for the
      'old' parameter, which may be an int or s64, an explicit cast is
      generated for this.
      
      There should be no functional change as a result of this patch (i.e.
      existing code should not be affected). However, this introduces a number
      of functions into the atomic_long_* API, bringing it into line with the
      atomic_* and atomic64_* APIs.
      
      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: dvyukov@google.com
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: aryabinin@virtuozzo.com
      Cc: glider@google.com
      Link: http://lkml.kernel.org/r/20180904104830.2975-4-mark.rutland@arm.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b5d47ef9
    • Mark Rutland's avatar
      locking/atomics: Switch to generated fallbacks · 9fa45070
      Mark Rutland authored
      As a step to ensuring the atomic* APIs are consistent, switch to fallbacks
      generated by gen-atomic-fallback.sh.
      
      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.
      
      The new fallback header should be equivalent to the old fallbacks in
      <linux/atomic.h>, but:
      
      * It is formatted a little differently due to scripting ensuring things
        are more regular than they used to be.
      
      * Fallbacks are now expanded in-place as static inline functions rather
        than macros.
      
      * The prototypes for fallbac...
      9fa45070
    • Mark Rutland's avatar
      locking/atomics: Add common header generation files · ace9bad4
      Mark Rutland authored
      
      
      To minimize repetition, to allow for future rework, and to ensure
      regularity of the various atomic APIs, we'd like to automatically
      generate (the bulk of) a number of headers related to atomics.
      
      This patch adds the infrastructure to do so, leaving actual conversion
      of headers to subsequent patches. This infrastructure consists of:
      
      * atomics.tbl - a table describing the functions in the atomics API,
        with names, prototypes, and metadata describing the variants that
        exist (e.g fetch/return, acquire/release/relaxed). Note that the
        return type is dependent on the particular variant.
      
      * atomic-tbl.sh - a library of routines useful for dealing with
        atomics.tbl (e.g. querying which variants exist, or generating
        argument/parameter lists for a given function variant).
      
      * gen-atomic-fallback.sh - a script which generates a header of
        fallbacks, covering cases where architecture omit certain functions
        (e.g. omitting relaxed variants).
      
      * gen-atomic-long.sh - a script which generates wrappers providing the
        atomic_long API atomic of the relevant atomic or atomic64 API,
        ensuring the APIs are consistent.
      
      * gen-atomic-instrumented.sh - a script which generates atomic* wrappers
        atop of arch_atomic* functions, with automatically generated KASAN
        instrumentation.
      
      * fallbacks/* - a set of fallback implementations for atomics, which
        should be used when no implementation of a given atomic is provided.
        These are used by gen-atomic-fallback.sh to generate fallbacks, and
        these are also used by other scripts to determine the set of optional
        atomics (as required to generate preprocessor guards correctly).
      
        Fallbacks may use the following variables:
      
        ${atomic}     atomic prefix: atomic/atomic64/atomic_long, which can be
      		used to derive the atomic type, and to prefix functions
      
        ${int}        integer type: int/s64/long
      
        ${pfx}        variant prefix, e.g. fetch_
      
        ${name}       base function name, e.g. add
      
        ${sfx}        variant suffix, e.g. _return
      
        ${order}      order suffix, e.g. _relaxed
      
        ${atomicname} full name, e.g. atomic64_fetch_add_relaxed
      
        ${ret}        return type of the function, e.g. void
      
        ${retstmt}    a return statement (with a trailing space), unless the
                      variant returns void
      
        ${params}     parameter list for the function declaration, e.g.
                      "int i, atomic_t *v"
      
        ${args}       argument list for invoking the function, e.g. "i, v"
      
        ... for clarity, ${ret}, ${retstmt}, ${params}, and ${args} are
        open-coded for fallbacks where these do not vary, or are critical to
        understanding the logic of the fallback.
      
      The MAINTAINERS entry for the atomic infrastructure is updated to cover
      the new scripts.
      
      There should be no functional change as a result of this patch.
      
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: catalin.marinas@arm.com
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linuxdrivers@attotech.com
      Cc: dvyukov@google.com
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: arnd@arndb.de
      Cc: aryabinin@virtuozzo.com
      Cc: glider@google.com
      Link: http://lkml.kernel.org/r/20180904104830.2975-2-mark.rutland@arm.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ace9bad4
  2. Oct 19, 2018
    • Waiman Long's avatar
      locking/lockdep: Make global debug_locks* variables read-mostly · 01a14bda
      Waiman Long authored
      
      
      Make the frequently used lockdep global variable debug_locks read-mostly.
      As debug_locks_silent is sometime used together with debug_locks,
      it is also made read-mostly so that they can be close together.
      
      With false cacheline sharing, cacheline contention problem can happen
      depending on what get put into the same cacheline as debug_locks.
      
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1539913518-15598-2-git-send-email-longman@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      01a14bda
    • Waiman Long's avatar
      locking/lockdep: Fix debug_locks off performance problem · 9506a742
      Waiman Long authored
      
      
      It was found that when debug_locks was turned off because of a problem
      found by the lockdep code, the system performance could drop quite
      significantly when the lock_stat code was also configured into the
      kernel. For instance, parallel kernel build time on a 4-socket x86-64
      server nearly doubled.
      
      Further analysis into the cause of the slowdown traced back to the
      frequent call to debug_locks_off() from the __lock_acquired() function
      probably due to some inconsistent lockdep states with debug_locks
      off. The debug_locks_off() function did an unconditional atomic xchg
      to write a 0 value into debug_locks which had already been set to 0.
      This led to severe cacheline contention in the cacheline that held
      debug_locks.  As debug_locks is being referenced in quite a few different
      places in the kernel, this greatly slow down the system performance.
      
      To prevent that trashing of debug_locks cacheline, lock_acquired()
      and lock_contended() now checks the state of debug_locks before
      proceeding. The debug_locks_off() function is also modified to check
      debug_locks before calling __debug_locks_off().
      
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1539913518-15598-1-git-send-email-longman@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9506a742
  3. Oct 17, 2018
    • Waiman Long's avatar
      locking/pvqspinlock: Extend node size when pvqspinlock is configured · 0fa809ca
      Waiman Long authored
      
      
      The qspinlock code supports up to 4 levels of slowpath nesting using
      four per-CPU mcs_spinlock structures. For 64-bit architectures, they
      fit nicely in one 64-byte cacheline.
      
      For para-virtualized (PV) qspinlocks it needs to store more information
      in the per-CPU node structure than there is space for. It uses a trick
      to use a second cacheline to hold the extra information that it needs.
      So PV qspinlock needs to access two extra cachelines for its information
      whereas the native qspinlock code only needs one extra cacheline.
      
      Freshly added counter profiling of the qspinlock code, however, revealed
      that it was very rare to use more than two levels of slowpath nesting.
      So it doesn't make sense to penalize PV qspinlock code in order to have
      four mcs_spinlock structures in the same cacheline to optimize for a case
      in the native qspinlock code that rarely happens.
      
      Extend the per-CPU node structure to have two more long words when PV
      qspinlock locks are configured to hold the extra data that it needs.
      
      As a result, the PV qspinlock code will enjoy the same benefit of using
      just one extra cacheline like the native counterpart, for most cases.
      
      [ mingo: Minor changelog edits. ]
      
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1539697507-28084-2-git-send-email-longman@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0fa809ca
    • Waiman Long's avatar
      locking/qspinlock_stat: Count instances of nested lock slowpaths · 1222109a
      Waiman Long authored
      
      
      Queued spinlock supports up to 4 levels of lock slowpath nesting -
      user context, soft IRQ, hard IRQ and NMI. However, we are not sure how
      often the nesting happens.
      
      So add 3 more per-CPU stat counters to track the number of instances where
      nesting index goes to 1, 2 and 3 respectively.
      
      On a dual-socket 64-core 128-thread Zen server, the following were the
      new stat counter values under different circumstances:
      
               State                         slowpath   index1   index2   index3
               -----                         --------   ------   ------   -------
        After bootup                         1,012,150    82       0        0
        After parallel build + perf-top    125,195,009    82       0        0
      
      So the chance of having more than 2 levels of nesting is extremely low.
      
      [ mingo: Minor changelog edits. ]
      
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1539697507-28084-1-git-send-email-longman@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1222109a
  4. Oct 16, 2018
    • Peter Zijlstra's avatar
      locking/qspinlock, x86: Provide liveness guarantee · 7aa54be2
      Peter Zijlstra authored
      
      
      On x86 we cannot do fetch_or() with a single instruction and thus end up
      using a cmpxchg loop, this reduces determinism. Replace the fetch_or()
      with a composite operation: tas-pending + load.
      
      Using two instructions of course opens a window we previously did not
      have. Consider the scenario:
      
      	CPU0		CPU1		CPU2
      
       1)	lock
      	  trylock -> (0,0,1)
      
       2)			lock
      			  trylock /* fail */
      
       3)	unlock -> (0,0,0)
      
       4)					lock
      					  trylock -> (0,0,1)
      
       5)			  tas-pending -> (0,1,1)
      			  load-val <- (0,1,0) from 3
      
       6)			  clear-pending-set-locked -> (0,0,1)
      
      			  FAIL: _2_ owners
      
      where 5) is our new composite operation. When we consider each part of
      the qspinlock state as a separate variable (as we can when
      _Q_PENDING_BITS == 8) then the above is entirely possible, because
      tas-pending will only RmW the pending byte, so the later load is able
      to observe prior tail and lock state (but not earlier than its own
      trylock, which operates on the whole word, due to coherence).
      
      To avoid this we need 2 things:
      
       - the load must come after the tas-pending (obviously, otherwise it
         can trivially observe prior state).
      
       - the tas-pending must be a full word RmW instruction, it cannot be an XCHGB for
         example, such that we cannot observe other state prior to setting
         pending.
      
      On x86 we can realize this by using "LOCK BTS m32, r32" for
      tas-pending followed by a regular load.
      
      Note that observing later state is not a problem:
      
       - if we fail to observe a later unlock, we'll simply spin-wait for
         that store to become visible.
      
       - if we observe a later xchg_tail(), there is no difference from that
         xchg_tail() having taken place before the tas-pending.
      
      Suggested-by: default avatarWill Deacon <will.deacon@arm.com>
      Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: andrea.parri@amarulasolutions.com
      Cc: longman@redhat.com
      Fixes: 59fb586b
      
       ("locking/qspinlock: Remove unbounded cmpxchg() loop from locking slowpath")
      Link: https://lkml.kernel.org/r/20181003130957.183726335@infradead.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      7aa54be2
    • Peter Zijlstra's avatar
      x86/asm: 'Simplify' GEN_*_RMWcc() macros · 288e4521
      Peter Zijlstra authored
      
      
      Currently the GEN_*_RMWcc() macros include a return statement, which
      pretty much mandates we directly wrap them in a (inline) function.
      
      Macros with return statements are tricky and, as per the above, limit
      use, so remove the return statement and make them
      statement-expressions. This allows them to be used more widely.
      
      Also, shuffle the arguments a bit. Place the @cc argument as 3rd, this
      makes it consistent between UNARY and BINARY, but more importantly, it
      makes the @arg0 argument last.
      
      Since the @arg0 argument is now last, we can do CPP trickery and make
      it an optional argument, simplifying the users; 17 out of 18
      occurences do not need this argument.
      
      Finally, change to asm symbolic names, instead of the numeric ordering
      of operands, which allows us to get rid of __BINARY_RMWcc_ARG and get
      cleaner code overall.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: JBeulich@suse.com
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: bp@alien8.de
      Cc: hpa@linux.intel.com
      Link: https://lkml.kernel.org/r/20181003130957.108960094@infradead.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      288e4521
    • Peter Zijlstra's avatar
      locking/qspinlock: Rework some comments · 756b1df4
      Peter Zijlstra authored
      
      
      While working my way through the code again; I felt the comments could
      use help.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: andrea.parri@amarulasolutions.com
      Cc: longman@redhat.com
      Link: https://lkml.kernel.org/r/20181003130257.156322446@infradead.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      756b1df4
    • Peter Zijlstra's avatar
      locking/qspinlock: Re-order code · 53bf57fa
      Peter Zijlstra authored
      
      
      Flip the branch condition after atomic_fetch_or_acquire(_Q_PENDING_VAL)
      such that we loose the indent. This also result in a more natural code
      flow IMO.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: andrea.parri@amarulasolutions.com
      Cc: longman@redhat.com
      Link: https://lkml.kernel.org/r/20181003130257.156322446@infradead.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      53bf57fa
    • Ingo Molnar's avatar
    • Waiman Long's avatar
      locking/lockdep: Remove duplicated 'lock_class_ops' percpu array · 4766ab56
      Waiman Long authored
      
      
      Remove the duplicated 'lock_class_ops' percpu array that is not used
      anywhere.
      
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Fixes: 8ca2b56c
      
       ("locking/lockdep: Make class->ops a percpu counter and move it under CONFIG_DEBUG_LOCKDEP=y")
      Link: http://lkml.kernel.org/r/1539380547-16726-1-git-send-email-longman@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4766ab56
  5. Oct 10, 2018
    • Adam Borowski's avatar
      x86/defconfig: Enable CONFIG_USB_XHCI_HCD=y · 72a9c673
      Adam Borowski authored
      
      
      A spanking new machine I just got has all but one USB ports wired as 3.0.
      Booting defconfig resulted in no keyboard or mouse, which was pretty
      uncool.  Let's enable that -- USB3 is ubiquitous rather than an oddity.
      As 'y' not 'm' -- recovering from initrd problems needs a keyboard.
      
      Also add it to the 32-bit defconfig.
      
      Signed-off-by: default avatarAdam Borowski <kilobyte@angband.pl>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-usb@vger.kernel.org
      Link: http://lkml.kernel.org/r/20181009062803.4332-1-kilobyte@angband.pl
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      72a9c673
  6. Oct 09, 2018
    • Lance Roy's avatar
      futex: Replace spin_is_locked() with lockdep · 4de1a293
      Lance Roy authored
      
      
      lockdep_assert_held() is better suited for checking locking requirements,
      since it won't get confused when the lock is held by some other task. This
      is also a step towards possibly removing spin_is_locked().
      
      Signed-off-by: default avatarLance Roy <ldr709@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Darren Hart <dvhart@infradead.org>
      Link: https://lkml.kernel.org/r/20181003053902.6910-12-ldr709@gmail.com
      4de1a293
    • Waiman Long's avatar
      locking/lockdep: Make class->ops a percpu counter and move it under CONFIG_DEBUG_LOCKDEP=y · 8ca2b56c
      Waiman Long authored
      
      
      A sizable portion of the CPU cycles spent on the __lock_acquire() is used
      up by the atomic increment of the class->ops stat counter. By taking it out
      from the lock_class structure and changing it to a per-cpu per-lock-class
      counter, we can reduce the amount of cacheline contention on the class
      structure when multiple CPUs are trying to acquire locks of the same
      class simultaneously.
      
      To limit the increase in memory consumption because of the percpu nature
      of that counter, it is now put back under the CONFIG_DEBUG_LOCKDEP
      config option. So the memory consumption increase will only occur if
      CONFIG_DEBUG_LOCKDEP is defined. The lock_class structure, however,
      is reduced in size by 16 bytes on 64-bit archs after ops removal and
      a minor restructuring of the fields.
      
      This patch also fixes a bug in the increment code as the counter is of
      the 'unsigned long' type, but atomic_inc() was used to increment it.
      
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/d66681f3-8781-9793-1dcf-2436a284550b@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8ca2b56c
  7. Oct 06, 2018
    • Nadav Amit's avatar
      x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs · 5bdcd510
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block - which is also a minor cleanup for the jump-label code.
      
      As a result the code size is slightly increased, but inlining decisions
      are better:
      
            text     data     bss      dec     hex  filename
        18163528 10226300 2957312 31347140 1de51c4  ./vmlinux before
        18163608 10227348 2957312 31348268 1de562c  ./vmlinux after (+1128)
      
      And functions such as intel_pstate_adjust_policy_max(),
      kvm_cpu_accept_dm_intr(), kvm_register_readl() are inlined.
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181005202718.229565-4-namit@vmware.com
      Link: https://lore.kernel.org/lkml/20181003213100.189959-11-namit@vmware.com/T/#u
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5bdcd510
    • Nadav Amit's avatar
      x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs · d5a581d8
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block - which is pretty pointless indirection in the static_cpu_has()
      case, but is worth it to improve overall inlining quality.
      
      The patch slightly increases the kernel size:
      
            text     data     bss      dec     hex  filename
        18162879 10226256 2957312 31346447 1de4f0f  ./vmlinux before
        18163528 10226300 2957312 31347140 1de51c4  ./vmlinux after (+693)
      
      And enables the inlining of function such as free_ldt_pgtables().
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181005202718.229565-3-namit@vmware.com
      Link: https://lore.kernel.org/lkml/20181003213100.189959-10-namit@vmware.com/T/#u
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d5a581d8
    • Nadav Amit's avatar
      x86/extable: Macrofy inline assembly code to work around GCC inlining bugs · 0474d5d9
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block - which is also a minor cleanup for the exception table
      code.
      
      Text size goes up a bit:
      
            text     data     bss      dec     hex  filename
        18162555 10226288 2957312 31346155 1de4deb  ./vmlinux before
        18162879 10226256 2957312 31346447 1de4f0f  ./vmlinux after (+292)
      
      But this allows the inlining of functions such as nested_vmx_exit_reflected(),
      set_segment_reg(), __copy_xstate_to_user() which is a net benefit.
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181005202718.229565-2-namit@vmware.com
      Link: https://lore.kernel.org/lkml/20181003213100.189959-9-namit@vmware.com/T/#u
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0474d5d9
    • Ingo Molnar's avatar
  8. Oct 05, 2018
  9. Oct 04, 2018
    • Nadav Amit's avatar
      x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops · 494b5168
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block. As a result GCC considers the inline assembly block as
      a single instruction. (Which it isn't, but that's the best we can get.)
      
      In this patch we wrap the paravirt call section tricks in a macro,
      to hide it from GCC.
      
      The effect of the patch is a more aggressive inlining, which also
      causes a size increase of kernel.
      
            text     data     bss      dec     hex  filename
        18147336 10226688 2957312 31331336 1de1408  ./vmlinux before
        18162555 10226288 2957312 31346155 1de4deb  ./vmlinux after (+14819)
      
      The number of static text symbols (non-inlined functions) goes down:
      
        Before: 40053
        After:  39942 (-111)
      
      [ mingo: Rewrote the changelog. ]
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: virtualization@lists.linux-foundation.org
      Link: http://lkml.kernel.org/r/20181003213100.189959-8-namit@vmware.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      494b5168
    • Nadav Amit's avatar
      x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs · f81f8ad5
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block. As a result GCC considers the inline assembly block as
      a single instruction. (Which it isn't, but that's the best we can get.)
      
      This patch increases the kernel size:
      
            text     data     bss      dec     hex  filename
        18146889 10225380 2957312 31329581 1de0d2d  ./vmlinux before
        18147336 10226688 2957312 31331336 1de1408  ./vmlinux after (+1755)
      
      But enables more aggressive inlining (and probably better branch decisions).
      
      The number of static text symbols in vmlinux is much lower:
      
       Before: 40218
       After:  40053 (-165)
      
      The assembly code gets harder to read due to the extra macro layer.
      
      [ mingo: Rewrote the changelog. ]
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181003213100.189959-7-namit@vmware.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f81f8ad5
    • Nadav Amit's avatar
      x86/alternatives: Macrofy lock prefixes to work around GCC inlining bugs · 77f48ec2
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block - i.e. to macrify the affected block.
      
      As a result GCC considers the inline assembly block as a single instruction.
      
      This patch handles the LOCK prefix, allowing more aggresive inlining:
      
            text     data     bss      dec     hex  filename
        18140140 10225284 2957312 31322736 1ddf270  ./vmlinux before
        18146889 10225380 2957312 31329581 1de0d2d  ./vmlinux after (+6845)
      
      This is the reduction in non-inlined functions:
      
        Before: 40286
        After:  40218 (-68)
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181003213100.189959-6-namit@vmware.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      77f48ec2
    • Nadav Amit's avatar
      x86/refcount: Work around GCC inlining bug · 9e1725b4
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block. As a result GCC considers the inline assembly block as
      a single instruction. (Which it isn't, but that's the best we can get.)
      
      This patch allows GCC to inline simple functions such as __get_seccomp_filter().
      
      To no-one's surprise the result is that GCC performs more aggressive (read: correct)
      inlining decisions in these senarios, which reduces the kernel size and presumably
      also speeds it up:
      
            text     data     bss      dec     hex  filename
        18140970 10225412 2957312 31323694 1ddf62e  ./vmlinux before
        18140140 10225284 2957312 31322736 1ddf270  ./vmlinux after (-958)
      
      16 fewer static text symbols:
      
         Before: 40302
          After: 40286 (-16)
      
      these got inlined instead.
      
      Functions such as kref_get(), free_user(), fuse_file_get() now get inlined. Hurray!
      
      [ mingo: Rewrote the changelog. ]
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jan Beulich <JBeulich@suse.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181003213100.189959-5-namit@vmware.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9e1725b4
    • Nadav Amit's avatar
      x86/objtool: Use asm macros to work around GCC inlining bugs · c06c4d80
      Nadav Amit authored
      As described in:
      
        77b0bf55
      
      : ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs")
      
      GCC's inlining heuristics are broken with common asm() patterns used in
      kernel code, resulting in the effective disabling of inlining.
      
      In the case of objtool the resulting borkage can be significant, since all the
      annotations of objtool are discarded during linkage and never inlined,
      yet GCC bogusly considers most functions affected by objtool annotations
      as 'too large'.
      
      The workaround is to set an assembly macro and call it from the inline
      assembly block. As a result GCC considers the inline assembly block as
      a single instruction. (Which it isn't, but that's the best we can get.)
      
      This increases the kernel size slightly:
      
            text     data     bss      dec     hex filename
        18140829 10224724 2957312 31322865 1ddf2f1 ./vmlinux before
        18140970 10225412 2957312 31323694 1ddf62e ./vmlinux after (+829)
      
      The number of static text symbols (i.e. non-inlined functions) is reduced:
      
        Before:  40321
        After:   40302 (-19)
      
      [ mingo: Rewrote the changelog. ]
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Reviewed-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Christopher Li <sparse@chrisli.org>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-sparse@vger.kernel.org
      Link: http://lkml.kernel.org/r/20181003213100.189959-4-namit@vmware.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c06c4d80
    • Nadav Amit's avatar
      kbuild/Makefile: Prepare for using macros in inline assembly code to work... · 77b0bf55
      Nadav Amit authored
      
      kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs
      
      Using macros in inline assembly allows us to work around bugs
      in GCC's inlining decisions.
      
      Compile macros.S and use it to assemble all C files.
      Currently only x86 will use it.
      
      Background:
      
      The inlining pass of GCC doesn't include an assembler, so it's not aware
      of basic properties of the generated code, such as its size in bytes,
      or that there are such things as discontiuous blocks of code and data
      due to the newfangled linker feature called 'sections' ...
      
      Instead GCC uses a lazy and fragile heuristic: it does a linear count of
      certain syntactic and whitespace elements in inlined assembly block source
      code, such as a count of new-lines and semicolons (!), as a poor substitute
      for "code size and complexity".
      
      Unsurprisingly this heuristic falls over and breaks its neck whith certain
      common types of kernel code that use inline assembly, such as the frequent
      practice of putting useful information into alternative sections.
      
      As a result of this fresh, 20+ years old GCC bug, GCC's inlining decisions
      are effectively disabled for inlined functions that make use of such asm()
      blocks, because GCC thinks those sections of code are "large" - when in
      reality they are often result in just a very low number of machine
      instructions.
      
      This absolute lack of inlining provess when GCC comes across such asm()
      blocks both increases generated kernel code size and causes performance
      overhead, which is particularly noticeable on paravirt kernels, which make
      frequent use of these inlining facilities in attempt to stay out of the
      way when running on baremetal hardware.
      
      Instead of fixing the compiler we use a workaround: we set an assembly macro
      and call it from the inlined assembly block. As a result GCC considers the
      inline assembly block as a single instruction. (Which it often isn't but I digress.)
      
      This uglifies and bloats the source code - for example just the refcount
      related changes have this impact:
      
       Makefile                 |    9 +++++++--
       arch/x86/Makefile        |    7 +++++++
       arch/x86/kernel/macros.S |    7 +++++++
       scripts/Kbuild.include   |    4 +++-
       scripts/mod/Makefile     |    2 ++
       5 files changed, 26 insertions(+), 3 deletions(-)
      
      Yay readability and maintainability, it's not like assembly code is hard to read
      and maintain ...
      
      We also hope that GCC will eventually get fixed, but we are not holding
      our breath for that. Yet we are optimistic, it might still happen, any decade now.
      
      [ mingo: Wrote new changelog describing the background. ]
      
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michal Marek <michal.lkml@markovi.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kbuild@vger.kernel.org
      Link: http://lkml.kernel.org/r/20181003213100.189959-3-namit@vmware.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      77b0bf55
    • Nadav Amit's avatar
      kbuild/arch/xtensa: Define LINKER_SCRIPT for the linker script · 35e76b99
      Nadav Amit authored
      
      
      Define the LINKER_SCRIPT when building the linker script as being done
      in other architectures. This is required, because upcoming Makefile changes
      would otherwise break things.
      
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Michal Marek <michal.lkml@markovi.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-xtensa@linux-xtensa.org
      Link: http://lkml.kernel.org/r/20181003213100.189959-2-namit@vmware.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      35e76b99
    • Ingo Molnar's avatar
      c0554d2d
  10. Oct 03, 2018
  11. Oct 02, 2018
    • Greg Kroah-Hartman's avatar
      Merge tag 'fbdev-v4.19-rc7' of https://github.com/bzolnier/linux · 1d2ba7fe
      Greg Kroah-Hartman authored
      Bartlomiej writes:
        "fbdev fixes for v4.19-rc7:
      
         - fix OMAPFB_MEMORY_READ ioctl to not leak kernel memory in omapfb driver
           (Tomi Valkeinen)
      
         - add missing prepare/unprepare clock operations in pxa168fb driver
           (Lubomir Rintel)
      
         - add nobgrt option in efifb driver to disable ACPI BGRT logo restore
           (Hans de Goede)
      
         - fix spelling mistake in fall-through annotation in stifb driver
           (Gustavo A. R. Silva)
      
         - fix URL for uvesafb repository in the documentation (Adam Jackson)"
      
      * tag 'fbdev-v4.19-rc7' of https://github.com/bzolnier/linux:
        video/fbdev/stifb: Fix spelling mistake in fall-through annotation
        uvesafb: Fix URLs in the documentation
        efifb: BGRT: Add nobgrt option
        fbdev/omapfb: fix omapfb_memory_read infoleak
        pxa168fb: prepare the clock
      1d2ba7fe
    • Greg Kroah-Hartman's avatar
      Merge tag 'mmc-v4.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 5e0b19ac
      Greg Kroah-Hartman authored
      Ulf writes:
        "MMC core:
          - Fixup conversion of debounce time to/from ms/us
      
         MMC host:
          - sdhi: Fixup whitelisting for Gen3 types"
      
      * tag 'mmc-v4.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: slot-gpio: Fix debounce time to use miliseconds again
        mmc: core: Fix debounce time to use microseconds
        mmc: sdhi: sys_dmac: check for all Gen3 types when whitelisting
      5e0b19ac
    • Andrew Murray's avatar
      Documentation/lockstat: Fix trivial typo · bccb484b
      Andrew Murray authored
      
      
      Fix incorrect line number in example output
      
      Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Cc: Jiri Kosina <trivial@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-doc@vger.kernel.org
      Link: http://lkml.kernel.org/r/1538391663-54524-1-git-send-email-andrew.murray@arm.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      bccb484b
    • Andrea Parri's avatar
      locking/memory-barriers: Replace smp_cond_acquire() with smp_cond_load_acquire() · 2f359c7e
      Andrea Parri authored
      Amend the changes in commit:
      
        1f03e8d2
      
       ("locking/barriers: Replace smp_cond_acquire() with smp_cond_load_acquire()")
      
      ... by updating the documentation accordingly.
      
      Also remove some obsolete information related to the implementation.
      
      Signed-off-by: default avatarAndrea Parri <andrea.parri@amarulasolutions.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: Akira Yokosawa <akiyks@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Daniel Lustig <dlustig@nvidia.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jade Alglave <j.alglave@ucl.ac.uk>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Luc Maranget <luc.maranget@inria.fr>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: linux-arch@vger.kernel.org
      Cc: parri.andrea@gmail.com
      Link: http://lkml.kernel.org/r/20180926182920.27644-5-paulmck@linux.ibm.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2f359c7e