Merge tag 'v4.6-rc3' into perf/core, to refresh the tree
authorIngo Molnar <mingo@kernel.org>
Wed, 13 Apr 2016 06:57:03 +0000 (08:57 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 13 Apr 2016 06:57:03 +0000 (08:57 +0200)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
arch/x86/Kconfig
arch/x86/include/asm/cpufeatures.h
arch/x86/include/asm/msr-index.h
include/linux/perf_event.h
kernel/events/internal.h

diff --combined arch/x86/Kconfig
@@@ -28,6 -28,7 +28,7 @@@ config X8
        select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_FAST_MULTIPLIER
        select ARCH_HAS_GCOV_PROFILE_ALL
+       select ARCH_HAS_KCOV                    if X86_64
        select ARCH_HAS_PMEM_API                if X86_64
        select ARCH_HAS_MMIO_FLUSH
        select ARCH_HAS_SG_CHAIN
        select VIRT_TO_BUS
        select X86_DEV_DMA_OPS                  if X86_64
        select X86_FEATURE_NAMES                if PROC_FS
+       select HAVE_STACK_VALIDATION            if X86_64
+       select ARCH_USES_HIGH_VMA_FLAGS         if X86_INTEL_MEMORY_PROTECTION_KEYS
+       select ARCH_HAS_PKEYS                   if X86_INTEL_MEMORY_PROTECTION_KEYS
  
  config INSTRUCTION_DECODER
        def_bool y
        depends on KPROBES || PERF_EVENTS || UPROBES
  
 -config PERF_EVENTS_INTEL_UNCORE
 -      def_bool y
 -      depends on PERF_EVENTS && CPU_SUP_INTEL && PCI
 -
  config OUTPUT_FORMAT
        string
        default "elf32-i386" if X86_32
@@@ -1038,8 -1046,6 +1042,8 @@@ config X86_THERMAL_VECTO
        def_bool y
        depends on X86_MCE_INTEL
  
 +source "arch/x86/events/Kconfig"
 +
  config X86_LEGACY_VM86
        bool "Legacy VM86 support"
        default n
@@@ -1204,6 -1210,15 +1208,6 @@@ config MICROCODE_OLD_INTERFAC
        def_bool y
        depends on MICROCODE
  
 -config PERF_EVENTS_AMD_POWER
 -      depends on PERF_EVENTS && CPU_SUP_AMD
 -      tristate "AMD Processor Power Reporting Mechanism"
 -      ---help---
 -        Provide power reporting mechanism support for AMD processors.
 -        Currently, it leverages X86_FEATURE_ACC_POWER
 -        (CPUID Fn8000_0007_EDX[12]) interface to calculate the
 -        average power consumption on Family 15h processors.
 -
  config X86_MSR
        tristate "/dev/cpu/*/msr - Model-specific register support"
        ---help---
@@@ -1716,6 -1731,20 +1720,20 @@@ config X86_INTEL_MP
  
          If unsure, say N.
  
+ config X86_INTEL_MEMORY_PROTECTION_KEYS
+       prompt "Intel Memory Protection Keys"
+       def_bool y
+       # Note: only available in 64-bit mode
+       depends on CPU_SUP_INTEL && X86_64
+       ---help---
+         Memory Protection Keys provides a mechanism for enforcing
+         page-based protections, but without requiring modification of the
+         page tables when an application changes protection domains.
+         For details, see Documentation/x86/protection-keys.txt
+         If unsure, say y.
  config EFI
        bool "EFI runtime service support"
        depends on ACPI
@@@ -2433,8 -2462,6 +2451,6 @@@ config PCI_CNB20LE_QUIR
  
          You should say N unless you know you need this.
  
- source "drivers/pci/pcie/Kconfig"
  source "drivers/pci/Kconfig"
  
  # x86_64 have no ISA slots, but can have ISA-style DMA.
@@@ -2590,8 -2617,6 +2606,6 @@@ config AMD_N
  
  source "drivers/pcmcia/Kconfig"
  
- source "drivers/pci/hotplug/Kconfig"
  config RAPIDIO
        tristate "RapidIO support"
        depends on PCI
@@@ -12,7 -12,7 +12,7 @@@
  /*
   * Defines x86 CPU feature bits
   */
- #define NCAPINTS      16      /* N 32-bit words worth of info */
+ #define NCAPINTS      17      /* N 32-bit words worth of info */
  #define NBUGINTS      1       /* N 32-bit bug flags */
  
  /*
  #define X86_FEATURE_PERFCTR_CORE ( 6*32+23) /* core performance counter extensions */
  #define X86_FEATURE_PERFCTR_NB  ( 6*32+24) /* NB performance counter extensions */
  #define X86_FEATURE_BPEXT     (6*32+26) /* data breakpoint extension */
 +#define X86_FEATURE_PTSC      ( 6*32+27) /* performance time-stamp counter */
  #define X86_FEATURE_PERFCTR_L2        ( 6*32+28) /* L2 performance counter extensions */
  #define X86_FEATURE_MWAITX    ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX) */
  
  
  /* AMD-defined CPU features, CPUID level 0x80000008 (ebx), word 13 */
  #define X86_FEATURE_CLZERO    (13*32+0) /* CLZERO instruction */
 +#define X86_FEATURE_IRPERF    (13*32+1) /* Instructions Retired Count */
  
  /* Thermal and Power Management Leaf, CPUID level 0x00000006 (eax), word 14 */
  #define X86_FEATURE_DTHERM    (14*32+ 0) /* Digital Thermal Sensor */
  #define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */
  #define X86_FEATURE_AVIC      (15*32+13) /* Virtual Interrupt Controller */
  
+ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
+ #define X86_FEATURE_PKU               (16*32+ 3) /* Protection Keys for Userspace */
+ #define X86_FEATURE_OSPKE     (16*32+ 4) /* OS Protection Keys Enable */
  /*
   * BUG word(s)
   */
  #define MSR_PKG_C9_RESIDENCY          0x00000631
  #define MSR_PKG_C10_RESIDENCY         0x00000632
  
+ /* Interrupt Response Limit */
+ #define MSR_PKGC3_IRTL                        0x0000060a
+ #define MSR_PKGC6_IRTL                        0x0000060b
+ #define MSR_PKGC7_IRTL                        0x0000060c
+ #define MSR_PKGC8_IRTL                        0x00000633
+ #define MSR_PKGC9_IRTL                        0x00000634
+ #define MSR_PKGC10_IRTL                       0x00000635
  /* Run Time Average Power Limiting (RAPL) Interface */
  
  #define MSR_RAPL_POWER_UNIT           0x00000606
  #define MSR_PP1_ENERGY_STATUS         0x00000641
  #define MSR_PP1_POLICY                        0x00000642
  
+ /* Config TDP MSRs */
  #define MSR_CONFIG_TDP_NOMINAL                0x00000648
  #define MSR_CONFIG_TDP_LEVEL_1                0x00000649
  #define MSR_CONFIG_TDP_LEVEL_2                0x0000064A
  #define MSR_GFX_PERF_LIMIT_REASONS    0x000006B0
  #define MSR_RING_PERF_LIMIT_REASONS   0x000006B1
  
- /* Config TDP MSRs */
- #define MSR_CONFIG_TDP_NOMINAL                0x00000648
- #define MSR_CONFIG_TDP_LEVEL1         0x00000649
- #define MSR_CONFIG_TDP_LEVEL2         0x0000064A
- #define MSR_CONFIG_TDP_CONTROL                0x0000064B
- #define MSR_TURBO_ACTIVATION_RATIO    0x0000064C
  /* Hardware P state interface */
  #define MSR_PPERF                     0x0000064e
  #define MSR_PERF_LIMIT_REASONS                0x0000064f
  #define HWP_PACKAGE_LEVEL_REQUEST_BIT (1<<11)
  
  /* IA32_HWP_CAPABILITIES */
- #define HWP_HIGHEST_PERF(x)           (x & 0xff)
- #define HWP_GUARANTEED_PERF(x)                ((x & (0xff << 8)) >>8)
- #define HWP_MOSTEFFICIENT_PERF(x)     ((x & (0xff << 16)) >>16)
- #define HWP_LOWEST_PERF(x)            ((x & (0xff << 24)) >>24)
+ #define HWP_HIGHEST_PERF(x)           (((x) >> 0) & 0xff)
+ #define HWP_GUARANTEED_PERF(x)                (((x) >> 8) & 0xff)
+ #define HWP_MOSTEFFICIENT_PERF(x)     (((x) >> 16) & 0xff)
+ #define HWP_LOWEST_PERF(x)            (((x) >> 24) & 0xff)
  
  /* IA32_HWP_REQUEST */
  #define HWP_MIN_PERF(x)               (x & 0xff)
  #define MSR_AMD64_IBSOPDATA4          0xc001103d
  #define MSR_AMD64_IBS_REG_COUNT_MAX   8 /* includes MSR_AMD64_IBSBRTARGET */
  
 +/* Fam 17h MSRs */
 +#define MSR_F17H_IRPERF                       0xc00000e9
 +
  /* Fam 16h MSRs */
  #define MSR_F16H_L2I_PERF_CTL         0xc0010230
  #define MSR_F16H_L2I_PERF_CTR         0xc0010231
  #define MSR_F15H_PERF_CTR             0xc0010201
  #define MSR_F15H_NB_PERF_CTL          0xc0010240
  #define MSR_F15H_NB_PERF_CTR          0xc0010241
 +#define MSR_F15H_PTSC                 0xc0010280
  #define MSR_F15H_IC_CFG                       0xc0011021
  
  /* Fam 10h MSRs */
@@@ -838,12 -838,6 +838,12 @@@ extern void perf_event_output(struct pe
                                struct perf_sample_data *data,
                                struct pt_regs *regs);
  
 +static inline bool
 +is_default_overflow_handler(struct perf_event *event)
 +{
 +      return (event->overflow_handler == perf_event_output);
 +}
 +
  extern void
  perf_event_header__init_id(struct perf_event_header *header,
                           struct perf_sample_data *data,
@@@ -977,11 -971,20 +977,20 @@@ DECLARE_PER_CPU(struct perf_callchain_e
  
  extern void perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs);
  extern void perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs);
+ extern struct perf_callchain_entry *
+ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
+                  bool crosstask, bool add_mark);
+ extern int get_callchain_buffers(void);
+ extern void put_callchain_buffers(void);
  
- static inline void perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
+ static inline int perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
  {
-       if (entry->nr < PERF_MAX_STACK_DEPTH)
+       if (entry->nr < PERF_MAX_STACK_DEPTH) {
                entry->ip[entry->nr++] = ip;
+               return 0;
+       } else {
+               return -1; /* no more room, stop walking the stack */
+       }
  }
  
  extern int sysctl_perf_event_paranoid;
diff --combined kernel/events/internal.h
  struct ring_buffer {
        atomic_t                        refcount;
        struct rcu_head                 rcu_head;
 -      struct irq_work                 irq_work;
  #ifdef CONFIG_PERF_USE_VMALLOC
        struct work_struct              work;
        int                             page_order;     /* allocation order  */
  #endif
        int                             nr_pages;       /* nr of data pages  */
        int                             overwrite;      /* can overwrite itself */
 +      int                             paused;         /* can write into ring buffer */
  
        atomic_t                        poll;           /* POLL_ for wakeups */
  
@@@ -65,14 -65,6 +65,14 @@@ static inline void rb_free_rcu(struct r
        rb_free(rb);
  }
  
 +static inline void rb_toggle_paused(struct ring_buffer *rb, bool pause)
 +{
 +      if (!pause && rb->nr_pages)
 +              rb->paused = 0;
 +      else
 +              rb->paused = 1;
 +}
 +
  extern struct ring_buffer *
  rb_alloc(int nr_pages, long watermark, int cpu, int flags);
  extern void perf_event_wakeup(struct perf_event *event);
@@@ -190,8 -182,6 +190,6 @@@ DEFINE_OUTPUT_COPY(__output_copy_user, 
  /* Callchain handling */
  extern struct perf_callchain_entry *
  perf_callchain(struct perf_event *event, struct pt_regs *regs);
- extern int get_callchain_buffers(void);
- extern void put_callchain_buffers(void);
  
  static inline int get_recursion_context(int *recursion)
  {