1. 15 Sep, 2019 6 commits
    • Rasmus Villemoes's avatar
      x86: bug.h: use asm_inline in _BUG_FLAGS definitions · 32ee8230
      Rasmus Villemoes authored
      This helps preventing a BUG* or WARN* in some static inline from
      preventing that (or one of its callers) being inlined, so should allow
      gcc to make better informed inlining decisions.
      
      For example, with gcc 9.2, tcp_fastopen_no_cookie() vanishes from
      net/ipv4/tcp_fastopen.o. It does not itself have any BUG or WARN, but
      it calls dst_metric() which has a WARN_ON_ONCE - and despite that
      WARN_ON_ONCE vanishing since the condition is compile-time false,
      dst_metric() is apparently sufficiently "large" that when it gets
      inlined into tcp_fastopen_no_cookie(), the latter becomes too large
      for inlining.
      
      Overall, if one asks size(1), .text decreases a little and .data
      increases by about the same amount (x86-64 defconfig)
      
      $ size vmlinux.{before,after}
         text    data     bss     dec     hex filename
      19709726        5202600 1630280 26542606        195020e vmlinux.before
      19709330        5203068 1630280 26542678        1950256 vmlinux.after
      
      while bloat-o-meter says
      
      add/remove: 10/28 grow/shrink: 103/51 up/down: 3669/-2854 (815)
      ...
      Total: Before=14783683, After=14784498, chg +0.01%
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      32ee8230
    • Rasmus Villemoes's avatar
      x86: alternative.h: use asm_inline for all alternative variants · 40576e5e
      Rasmus Villemoes authored
      Most, if not all, uses of the alternative* family just provide one or
      two instructions in .text, but the string literal can be quite large,
      causing gcc to overestimate the size of the generated code. That in
      turn affects its decisions about inlining of the function containing
      the alternative() asm statement.
      
      New enough versions of gcc allow one to overrule the estimated size by
      using "asm inline" instead of just "asm". So replace asm by the helper
      asm_inline, which for older gccs just expands to asm.
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      40576e5e
    • Rasmus Villemoes's avatar
      compiler-types.h: add asm_inline definition · eb111869
      Rasmus Villemoes authored
      This adds an asm_inline macro which expands to "asm inline" [1] when
      the compiler supports it. This is currently gcc 9.1+, gcc 8.3
      and (once released) gcc 7.5 [2]. It expands to just "asm" for other
      compilers.
      
      Using asm inline("foo") instead of asm("foo") overrules gcc's
      heuristic estimate of the size of the code represented by the asm()
      statement, and makes gcc use the minimum possible size instead. That
      can in turn affect gcc's inlining decisions.
      
      I wasn't sure whether to make this a function-like macro or not - this
      way, it can be combined with volatile as
      
        asm_inline volatile()
      
      but perhaps we'd prefer to spell that
      
        asm_inline_volatile()
      
      anyway.
      
      The Kconfig logic is taken from an RFC patch by Masahiro Yamada [3].
      
      [1] Technically, asm __inline, since both inline and __inline__
      are macros that attach various attributes, making gcc barf if one
      literally does "asm inline()". However, the third spelling __inline is
      available for referring to the bare keyword.
      
      [2] https://lore.kernel.org/lkml/20190907001411.GG9749@gate.crashing.org/
      
      [3] https://lore.kernel.org/lkml/1544695154-15250-1-git-send-email-yamada.masahiro@socionext.com/Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      eb111869
    • Rasmus Villemoes's avatar
      compiler_types.h: don't #define __inline · c30724e9
      Rasmus Villemoes authored
      The spellings __inline and __inline__ should be reserved for uses
      where one really wants to refer to the inline keyword, regardless of
      whether or not the spelling "inline" has been #defined to something
      else. Due to use of __inline__ in uapi headers, we can't easily get
      rid of the definition of __inline__. However, almost all users of
      __inline have been converted to inline, so we can get rid of that
      #define.
      
      The exception is include/acpi/platform/acintel.h. However, that header
      is only included when using the intel compiler (does anybody actually
      build the kernel with that?), and the ACPI_INLINE macro is only used
      in the definition of utterly trivial stub functions, where I doubt a
      small change of semantics (lack of __gnu_inline) changes anything.
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      [Fix trivial typo in message]
      Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      c30724e9
    • Rasmus Villemoes's avatar
      lib/zstd/mem.h: replace __inline by inline · 4bd92428
      Rasmus Villemoes authored
      Currently, compiler_types.h #defines __inline as inline (and further
      #defines inline to automatically attach some attributes), so this does
      not change functionality. It serves as preparation for removing the
      #define of __inline.
      
      While at it, also remove the __attribute__((unused)) - it's already
      included in the definition of the inline macro, and "open-coded"
      __attribute__(()) should be avoided.
      
      Since commit a95b37e2 (kbuild: get <linux/compiler_types.h> out of
      <linux/kconfig.h>), compiler_types.h is automatically included by all
      kernel C code - i.e., the definition of inline including the unused
      attribute is guaranteed to be in effect whenever ZSTD_STATIC is
      expanded.
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      4bd92428
    • Rasmus Villemoes's avatar
      staging: rtl8723bs: replace __inline by inline · 8b160b18
      Rasmus Villemoes authored
      Currently, __inline is #defined as inline in compiler_types.h, so this
      should not change functionality. It is preparation for removing said
      #define.
      
      While at it, change some "inline static" to the customary "static
      inline" order.
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      8b160b18
  2. 08 Sep, 2019 4 commits
  3. 07 Sep, 2019 4 commits
  4. 06 Sep, 2019 17 commits
  5. 05 Sep, 2019 9 commits