]> Git Repo - J-linux.git/commitdiff
Merge tag 'compiler-attributes-for-linus-v5.4' of git://github.com/ojeda/linux
authorLinus Torvalds <[email protected]>
Sat, 21 Sep 2019 16:47:19 +0000 (09:47 -0700)
committerLinus Torvalds <[email protected]>
Sat, 21 Sep 2019 16:47:19 +0000 (09:47 -0700)
Pull asm inline support from Miguel Ojeda:
 "Make use of gcc 9's "asm inline()" (Rasmus Villemoes):

  gcc 9+ (and gcc 8.3, 7.5) provides a way to override the otherwise
  crude heuristic that gcc uses to estimate the size of the code
  represented by an asm() statement. From the gcc docs

      If you use 'asm inline' instead of just 'asm', then for inlining
      purposes the size of the asm is taken as the minimum size, ignoring
      how many instructions GCC thinks it is.

  For compatibility with older compilers, we obviously want a

      #if [understands asm inline]
      #define asm_inline asm inline
      #else
      #define asm_inline asm
      #endif

  But since we #define the identifier inline to attach some attributes,
  we have to use an alternate spelling of that keyword. gcc provides
  both __inline__ and __inline, and we currently #define both to inline,
  so they all have the same semantics.

  We have to free up one of __inline__ and __inline, and the latter is
  by far the easiest.

  The two x86 changes cause smaller code gen differences than I'd
  expect, but I think we do want the asm_inline thing available sooner
  or later, so this is just to get the ball rolling"

* tag 'compiler-attributes-for-linus-v5.4' of git://github.com/ojeda/linux:
  x86: bug.h: use asm_inline in _BUG_FLAGS definitions
  x86: alternative.h: use asm_inline for all alternative variants
  compiler-types.h: add asm_inline definition
  compiler_types.h: don't #define __inline
  lib/zstd/mem.h: replace __inline by inline
  staging: rtl8723bs: replace __inline by inline

1  2 
include/linux/compiler_types.h
init/Kconfig

index b056a40116da9999f66ae5d0efdfe87dc7d3aa7a,2bf316fe0a20406a119ed9777fd1055d5e595bb5..72393a8c1a6c5daeab6bb6403252daeb2aecdb93
@@@ -130,6 -130,10 +130,6 @@@ struct ftrace_likely_data 
  
  /*
   * Force always-inline if the user requests it so via the .config.
 - * GCC does not warn about unused static inline functions for
 - * -Wunused-function.  This turns out to avoid the need for complex #ifdef
 - * directives.  Suppress the warning in clang as well by using "unused"
 - * function attribute, which is redundant but not harmful for gcc.
   * Prefer gnu_inline, so that extern inline functions do not emit an
   * externally visible function. This makes extern inline behave as per gnu89
   * semantics rather than c99. This prevents multiple symbol definition errors
   */
  #if !defined(CONFIG_OPTIMIZE_INLINING)
  #define inline inline __attribute__((__always_inline__)) __gnu_inline \
 -      __maybe_unused notrace
 +      __inline_maybe_unused notrace
  #else
  #define inline inline                                    __gnu_inline \
 -      __maybe_unused notrace
 +      __inline_maybe_unused notrace
  #endif
  
+ /*
+  * gcc provides both __inline__ and __inline as alternate spellings of
+  * the inline keyword, though the latter is undocumented. New kernel
+  * code should only use the inline spelling, but some existing code
+  * uses __inline__. Since we #define inline above, to ensure
+  * __inline__ has the same semantics, we need this #define.
+  *
+  * However, the spelling __inline is strictly reserved for referring
+  * to the bare keyword.
+  */
  #define __inline__ inline
- #define __inline   inline
  
 +/*
 + * GCC does not warn about unused static inline functions for -Wunused-function.
 + * Suppress the warning in clang as well by using __maybe_unused, but enable it
 + * for W=1 build. This will allow clang to find unused functions. Remove the
 + * __inline_maybe_unused entirely after fixing most of -Wunused-function warnings.
 + */
 +#ifdef KBUILD_EXTRA_WARN1
 +#define __inline_maybe_unused
 +#else
 +#define __inline_maybe_unused __maybe_unused
 +#endif
 +
  /*
   * Rather then using noinline to prevent stack consumption, use
   * noinline_for_stack instead.  For documentation reasons.
  #define asm_volatile_goto(x...) asm goto(x)
  #endif
  
+ #ifdef CONFIG_CC_HAS_ASM_INLINE
+ #define asm_inline asm __inline
+ #else
+ #define asm_inline asm
+ #endif
  #ifndef __no_fgcse
  # define __no_fgcse
  #endif
diff --combined init/Kconfig
index f4534c58342d7dc6070a6eb12b2e599a2889e105,7fee5978dd737a40e7197043ebf25c2cad3b537f..7020238fd2638d02b6de04f3bf61335a5ef2086d
@@@ -30,9 -30,9 +30,12 @@@ config CC_CAN_LIN
  config CC_HAS_ASM_GOTO
        def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
  
 +config TOOLS_SUPPORT_RELR
 +      def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)
 +
+ config CC_HAS_ASM_INLINE
+       def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null)
  config CC_HAS_WARN_MAYBE_UNINITIALIZED
        def_bool $(cc-option,-Wmaybe-uninitialized)
        help
@@@ -931,28 -931,6 +934,28 @@@ config RT_GROUP_SCHE
  
  endif #CGROUP_SCHED
  
 +config UCLAMP_TASK_GROUP
 +      bool "Utilization clamping per group of tasks"
 +      depends on CGROUP_SCHED
 +      depends on UCLAMP_TASK
 +      default n
 +      help
 +        This feature enables the scheduler to track the clamped utilization
 +        of each CPU based on RUNNABLE tasks currently scheduled on that CPU.
 +
 +        When this option is enabled, the user can specify a min and max
 +        CPU bandwidth which is allowed for each single task in a group.
 +        The max bandwidth allows to clamp the maximum frequency a task
 +        can use, while the min bandwidth allows to define a minimum
 +        frequency a task will always use.
 +
 +        When task group based utilization clamping is enabled, an eventually
 +        specified task-specific clamp value is constrained by the cgroup
 +        specified clamp value. Both minimum and maximum task clamping cannot
 +        be bigger than the corresponding clamping defined at task group level.
 +
 +        If in doubt, say N.
 +
  config CGROUP_PIDS
        bool "PIDs controller"
        help
@@@ -1234,26 -1212,20 +1237,26 @@@ choic
        default CC_OPTIMIZE_FOR_PERFORMANCE
  
  config CC_OPTIMIZE_FOR_PERFORMANCE
 -      bool "Optimize for performance"
 +      bool "Optimize for performance (-O2)"
        help
          This is the default optimization level for the kernel, building
          with the "-O2" compiler flag for best performance and most
          helpful compile-time warnings.
  
 -config CC_OPTIMIZE_FOR_SIZE
 -      bool "Optimize for size"
 +config CC_OPTIMIZE_FOR_PERFORMANCE_O3
 +      bool "Optimize more for performance (-O3)"
 +      depends on ARC
        imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED  # avoid false positives
        help
 -        Enabling this option will pass "-Os" instead of "-O2" to
 -        your compiler resulting in a smaller kernel.
 +        Choosing this option will pass "-O3" to your compiler to optimize
 +        the kernel yet more for performance.
  
 -        If unsure, say N.
 +config CC_OPTIMIZE_FOR_SIZE
 +      bool "Optimize for size (-Os)"
 +      imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED  # avoid false positives
 +      help
 +        Choosing this option will pass "-Os" to your compiler resulting
 +        in a smaller kernel.
  
  endchoice
  
@@@ -2020,14 -1992,6 +2023,14 @@@ config MODVERSION
          make them incompatible with the kernel you are running.  If
          unsure, say N.
  
 +config ASM_MODVERSIONS
 +      bool
 +      default HAVE_ASM_MODVERSIONS && MODVERSIONS
 +      help
 +        This enables module versioning for exported symbols also from
 +        assembly. This can be enabled only when the target architecture
 +        supports it.
 +
  config MODULE_REL_CRCS
        bool
        depends on MODVERSIONS
This page took 0.075817 seconds and 4 git commands to generate.