]> Git Repo - linux.git/commitdiff
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <[email protected]>
Tue, 30 Jan 2018 19:15:14 +0000 (11:15 -0800)
committerLinus Torvalds <[email protected]>
Tue, 30 Jan 2018 19:15:14 +0000 (11:15 -0800)
Pull perf updates from Ingo Molnar:
 "Kernel side changes:

   - Clean up the x86 instruction decoder (Masami Hiramatsu)

   - Add new uprobes optimization for PUSH instructions on x86 (Yonghong
     Song)

   - Add MSR_IA32_THERM_STATUS to the MSR events (Stephane Eranian)

   - Fix misc bugs, update documentation, plus various cleanups (Jiri
     Olsa)

  There's a large number of tooling side improvements:

   - Intel-PT/BTS improvements (Adrian Hunter)

   - Numerous 'perf trace' improvements (Arnaldo Carvalho de Melo)

   - Introduce an errno code to string facility (Hendrik Brueckner)

   - Various build system improvements (Jiri Olsa)

   - Add support for CoreSight trace decoding by making the perf tools
     use the external openCSD (Mathieu Poirier, Tor Jeremiassen)

   - Add ARM Statistical Profiling Extensions (SPE) support (Kim
     Phillips)

   - libtraceevent updates (Steven Rostedt)

   - Intel vendor event JSON updates (Andi Kleen)

   - Introduce 'perf report --mmaps' and 'perf report --tasks' to show
     info present in 'perf.data' (Jiri Olsa, Arnaldo Carvalho de Melo)

   - Add infrastructure to record first and last sample time to the
     perf.data file header, so that when processing all samples in a
     'perf record' session, such as when doing build-id processing, or
     when specifically requesting that that info be recorded, use that
     in 'perf report --time', that also got support for percent slices
     in addition to absolute ones.

     I.e. now it is possible to ask for the samples in the 10%-20% time
     slice of a perf.data file (Jin Yao)

   - Allow system wide 'perf stat --per-thread', sorting the result (Jin
     Yao)

     E.g.:

      [root@jouet ~]# perf stat --per-thread --metrics IPC
      ^C
       Performance counter stats for 'system wide':

                  make-22229  23,012,094,032  inst_retired.any   #  0.8 IPC
                   cc1-22419     692,027,497  inst_retired.any   #  0.8 IPC
                   gcc-22418     328,231,855  inst_retired.any   #  0.9 IPC
                   cc1-22509     220,853,647  inst_retired.any   #  0.8 IPC
                   gcc-22486     199,874,810  inst_retired.any   #  1.0 IPC
                    as-22466     177,896,365  inst_retired.any   #  0.9 IPC
                   cc1-22465     150,732,374  inst_retired.any   #  0.8 IPC
                   gcc-22508     112,555,593  inst_retired.any   #  0.9 IPC
                   cc1-22487     108,964,079  inst_retired.any   #  0.7 IPC
       qemu-system-x86-2697       21,330,550  inst_retired.any   #  0.3 IPC
       systemd-journal-551        20,642,951  inst_retired.any   #  0.4 IPC
       docker-containe-17651       9,552,892  inst_retired.any   #  0.5 IPC
       dockerd-current-9809        7,528,586  inst_retired.any   #  0.5 IPC
                  make-22153  12,504,194,380  inst_retired.any   #  0.8 IPC
               python2-22429  12,081,290,954  inst_retired.any   #  0.8 IPC
      <SNIP>
               python2-22429  15,026,328,103  cpu_clk_unhalted.thread
                   cc1-22419     826,660,193  cpu_clk_unhalted.thread
                   gcc-22418     365,321,295  cpu_clk_unhalted.thread
                   cc1-22509     279,169,362  cpu_clk_unhalted.thread
                   gcc-22486     210,156,950  cpu_clk_unhalted.thread
      <SNIP>

           5.638075538 seconds time elapsed

     [root@jouet ~]#

   - Improve shell auto-completion of perf events (Jin Yao)

   - 'perf probe' improvements (Masami Hiramatsu)

   - Improve PMU infrastructure to support amp64's ThunderX2
     implementation defined core events (Ganapatrao Kulkarni)

   - Various annotation related improvements and fixes (Thomas Richter)

   - Clarify usage of 'overwrite' and 'backward' in the evlist/mmap
     code, removing the 'overwrite' parameter from several functions as
     it was always used it as 'false' (Wang Nan)

   - Fix/improve 'perf record' reverse recording support (Wang Nan)

   - Improve command line options documentation (Sihyeon Jang)

   - Optimize sample parsing for ordering events, where we don't need to
     parse all the PERF_SAMPLE_ bits, just the ones leading to the
     timestamp needed to reorder events (Jiri Olsa)

   - Generalize the annotation code to support other source information
     besides objdump/DWARF obtained ones, starting with python scripts,
     that will is slated to be merged soon (Jiri Olsa)

   - ... and a lot more that I failed to list, see the shortlog and
     changelog for details"

* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (262 commits)
  perf trace beauty flock: Move to separate object file
  perf evlist: Remove fcntl.h from evlist.h
  perf trace beauty futex: Beautify FUTEX_BITSET_MATCH_ANY
  perf trace: Do not print from time delta for interrupted syscall lines
  perf trace: Add --print-sample
  perf bpf: Remove misplaced __maybe_unused attribute
  MAINTAINERS: Adding entry for CoreSight trace decoding
  perf tools: Add mechanic to synthesise CoreSight trace packets
  perf tools: Add full support for CoreSight trace decoding
  pert tools: Add queue management functionality
  perf tools: Add functionality to communicate with the openCSD decoder
  perf tools: Add support for decoding CoreSight trace data
  perf tools: Add decoder mechanic to support dumping trace data
  perf tools: Add processing of coresight metadata
  perf tools: Add initial entry point for decoder CoreSight traces
  perf tools: Integrating the CoreSight decoding library
  perf vendor events intel: Update IvyTown files to V20
  perf vendor events intel: Update IvyBridge files to V20
  perf vendor events intel: Update BroadwellDE events to V7
  perf vendor events intel: Update SkylakeX events to V1.06
  ...

1  2 
MAINTAINERS
kernel/events/core.c

diff --combined MAINTAINERS
index 859a28d1c9f25602a64a06f8b25bc5d55fece87b,7eafa087dda38969c077e0d370b87513a08550ec..217a8759e897e951b927eb2aac76b60247e351d9
@@@ -62,15 -62,7 +62,15 @@@ trivial patch so apply some common sens
  
  7.    When sending security related changes or reports to a maintainer
        please Cc: [email protected], especially if the maintainer
 -      does not respond.
 +      does not respond. Please keep in mind that the security team is
 +      a small set of people who can be efficient only when working on
 +      verified bugs. Please only Cc: this list when you have identified
 +      that the bug would present a short-term risk to other users if it
 +      were publicly disclosed. For example, reports of address leaks do
 +      not represent an immediate threat and are better handled publicly,
 +      and ideally, should come with a patch proposal. Please do not send
 +      automated reports to this list either. Such bugs will be handled
 +      better and faster in the usual public places.
  
  8.    Happy hacking.
  
@@@ -329,7 -321,7 +329,7 @@@ F: drivers/acpi/apei
  
  ACPI COMPONENT ARCHITECTURE (ACPICA)
  M:    Robert Moore <[email protected]>
 -M:    Lv Zheng <lv.zheng@intel.com>
 +M:    Erik Schmauss <erik.schmauss@intel.com>
  M:    "Rafael J. Wysocki" <[email protected]>
  L:    [email protected]
  L:    [email protected]
@@@ -875,12 -867,6 +875,12 @@@ S:       Supporte
  F:    drivers/android/
  F:    drivers/staging/android/
  
 +ANDROID GOLDFISH PIC DRIVER
 +M:    Miodrag Dinic <[email protected]>
 +S:    Supported
 +F:    Documentation/devicetree/bindings/interrupt-controller/google,goldfish-pic.txt
 +F:    drivers/irqchip/irq-goldfish-pic.c
 +
  ANDROID GOLDFISH RTC DRIVER
  M:    Miodrag Dinic <[email protected]>
  S:    Supported
@@@ -1327,7 -1313,8 +1327,8 @@@ F:      tools/perf/arch/arm/util/pmu.
  F:    tools/perf/arch/arm/util/auxtrace.c
  F:    tools/perf/arch/arm/util/cs-etm.c
  F:    tools/perf/arch/arm/util/cs-etm.h
- F:    tools/perf/util/cs-etm.h
+ F:    tools/perf/util/cs-etm.*
+ F:    tools/perf/util/cs-etm-decoder/*
  
  ARM/CORGI MACHINE SUPPORT
  M:    Richard Purdie <[email protected]>
@@@ -1597,7 -1584,6 +1598,7 @@@ F:      arch/arm/boot/dts/kirkwood
  F:    arch/arm/configs/mvebu_*_defconfig
  F:    arch/arm/mach-mvebu/
  F:    arch/arm64/boot/dts/marvell/armada*
 +F:    drivers/cpufreq/armada-37xx-cpufreq.c
  F:    drivers/cpufreq/mvebu-cpufreq.c
  F:    drivers/irqchip/irq-armada-370-xp.c
  F:    drivers/irqchip/irq-mvebu-*
@@@ -2398,6 -2384,13 +2399,6 @@@ F:     Documentation/devicetree/bindings/in
  F:    drivers/input/touchscreen/atmel_mxt_ts.c
  F:    include/linux/platform_data/atmel_mxt_ts.h
  
 -ATMEL NAND DRIVER
 -M:    Wenyou Yang <[email protected]>
 -M:    Josh Wu <[email protected]>
 -L:    [email protected]
 -S:    Supported
 -F:    drivers/mtd/nand/atmel/*
 -
  ATMEL SAMA5D2 ADC DRIVER
  M:    Ludovic Desroches <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/edac/skx_edac.c
  
 +EDAC-TI
 +M:    Tero Kristo <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/edac/ti_edac.c
 +
  EDIROL UA-101/UA-1000 DRIVER
  M:    Clemens Ladisch <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  F:    drivers/i2c/i2c-stub.c
  
 -i386 BOOT CODE
 -M:    "H. Peter Anvin" <[email protected]>
 -S:    Maintained
 -F:    arch/x86/boot/
 -
 -i386 SETUP CODE / CPU ERRATA WORKAROUNDS
 -M:    "H. Peter Anvin" <[email protected]>
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup.git
 -S:    Maintained
 -
  IA64 (Itanium) PLATFORM
  M:    Tony Luck <[email protected]>
  M:    Fenghua Yu <[email protected]>
@@@ -8196,7 -8193,6 +8197,7 @@@ F:      arch/*/include/asm/rwsem.
  F:    include/linux/seqlock.h
  F:    lib/locking*.[ch]
  F:    kernel/locking/
 +X:    kernel/locking/locktorture.c
  
  LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks)
  M:    "Richard Russon (FlatCap)" <[email protected]>
  S:    Odd Fixes
  F:    drivers/net/wireless/marvell/mwl8k.c
  
 +MARVELL NAND CONTROLLER DRIVER
 +M:    Miquel Raynal <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/mtd/nand/marvell_nand.c
 +F:    Documentation/devicetree/bindings/mtd/marvell-nand.txt
 +
  MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER
  M:    Nicolas Pitre <[email protected]>
  S:    Odd Fixes
@@@ -8966,7 -8955,7 +8967,7 @@@ L:      [email protected]
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git master
 -T:    git git://git.infradead.org/l2-mtd.git master
 +T:    git git://git.infradead.org/linux-mtd.git mtd/next
  S:    Maintained
  F:    Documentation/devicetree/bindings/mtd/
  F:    drivers/mtd/
@@@ -9055,14 -9044,6 +9056,14 @@@ F:    drivers/media/platform/atmel/atmel-i
  F:    drivers/media/platform/atmel/atmel-isc-regs.h
  F:    devicetree/bindings/media/atmel-isc.txt
  
 +MICROCHIP / ATMEL NAND DRIVER
 +M:    Wenyou Yang <[email protected]>
 +M:    Josh Wu <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/mtd/nand/atmel/*
 +F:    Documentation/devicetree/bindings/mtd/atmel-nand.txt
 +
  MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
  M:    Woojung Huh <[email protected]>
  M:    Microchip Linux Driver Support <[email protected]>
@@@ -9105,7 -9086,6 +9106,7 @@@ F:      drivers/usb/image/microtek.
  
  MIPS
  M:    Ralf Baechle <[email protected]>
 +M:    James Hogan <[email protected]>
  L:    [email protected]
  W:    http://www.linux-mips.org/
  T:    git git://git.linux-mips.org/pub/scm/ralf/linux.git
@@@ -9363,7 -9343,7 +9364,7 @@@ L:      [email protected]
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git nand/fixes
 -T:    git git://git.infradead.org/l2-mtd.git nand/next
 +T:    git git://git.infradead.org/linux-mtd.git nand/next
  S:    Maintained
  F:    drivers/mtd/nand/
  F:    include/linux/mtd/*nand*.h
@@@ -9659,8 -9639,8 +9660,8 @@@ F:      include/uapi/linux/sunrpc
  NILFS2 FILESYSTEM
  M:    Ryusuke Konishi <[email protected]>
  L:    [email protected]
 -W:    http://nilfs.sourceforge.net/
 -W:    http://nilfs.osdn.jp/
 +W:    https://nilfs.sourceforge.io/
 +W:    https://nilfs.osdn.jp/
  T:    git git://github.com/konis/nilfs2.git
  S:    Supported
  F:    Documentation/filesystems/nilfs2.txt
@@@ -9764,15 -9744,6 +9765,15 @@@ S:    Supporte
  F:    Documentation/filesystems/ntfs.txt
  F:    fs/ntfs/
  
 +NUBUS SUBSYSTEM
 +M:    Finn Thain <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    arch/*/include/asm/nubus.h
 +F:    drivers/nubus/
 +F:    include/linux/nubus.h
 +F:    include/uapi/linux/nubus.h
 +
  NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER
  M:    Antonino Daplas <[email protected]>
  L:    [email protected]
@@@ -9833,7 -9804,6 +9834,7 @@@ NXP TFA9879 DRIVE
  M:    Peter Rosin <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
 +F:    Documentation/devicetree/bindings/sound/tfa9879.txt
  F:    sound/soc/codecs/tfa9879*
  
  NXP-NCI NFC DRIVER
@@@ -10920,7 -10890,6 +10921,7 @@@ F:   include/linux/pm.
  F:    include/linux/pm_*
  F:    include/linux/powercap.h
  F:    drivers/powercap/
 +F:    kernel/configs/nopm.config
  
  POWER STATE COORDINATION INTERFACE (PSCI)
  M:    Mark Rutland <[email protected]>
  S:    Orphan
  F:    drivers/net/wireless/ray*
  
 -RCUTORTURE MODULE
 -M:    Josh Triplett <[email protected]>
 -M:    "Paul E. McKenney" <[email protected]>
 -L:    [email protected]
 -S:    Supported
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 -F:    Documentation/RCU/torture.txt
 -F:    kernel/rcu/rcutorture.c
 -
  RCUTORTURE TEST FRAMEWORK
  M:    "Paul E. McKenney" <[email protected]>
  M:    Josh Triplett <[email protected]>
@@@ -11673,8 -11651,8 +11674,8 @@@ F:   drivers/mtd/nand/r852.
  RISC-V ARCHITECTURE
  M:    Palmer Dabbelt <[email protected]>
  M:    Albert Ou <[email protected]>
 -L:    [email protected].org
 -T:    git https://github.com/riscv/riscv-linux
 +L:    [email protected].org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux.git
  S:    Supported
  F:    arch/riscv/
  K:    riscv
@@@ -12255,7 -12233,7 +12256,7 @@@ M:   Security Officers <[email protected]
  S:    Supported
  
  SECURITY SUBSYSTEM
 -M:    James Morris <j[email protected]>
 +M:    James Morris <j[email protected]>
  M:    "Serge E. Hallyn" <[email protected]>
  L:    [email protected] (suggested Cc:)
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
@@@ -12614,12 -12592,6 +12615,12 @@@ F: include/media/soc
  F:    drivers/media/i2c/soc_camera/
  F:    drivers/media/platform/soc_camera/
  
 +SOCIONEXT UNIPHIER SOUND DRIVER
 +M:    Katsuhiro Suzuki <[email protected]>
 +L:    [email protected] (moderated for non-subscribers)
 +S:    Maintained
 +F:    sound/soc/uniphier/
 +
  SOEKRIS NET48XX LED SUPPORT
  M:    Chris Boot <[email protected]>
  S:    Maintained
  W:    http://www.linux-mtd.infradead.org/
  Q:    http://patchwork.ozlabs.org/project/linux-mtd/list/
  T:    git git://git.infradead.org/linux-mtd.git spi-nor/fixes
 -T:    git git://git.infradead.org/l2-mtd.git spi-nor/next
 +T:    git git://git.infradead.org/linux-mtd.git spi-nor/next
  S:    Maintained
  F:    drivers/mtd/spi-nor/
  F:    include/linux/mtd/spi-nor.h
  S:    Maintained
  F:    drivers/platform/x86/topstar-laptop.c
  
 +TORTURE-TEST MODULES
 +M:    Davidlohr Bueso <[email protected]>
 +M:    "Paul E. McKenney" <[email protected]>
 +M:    Josh Triplett <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 +F:    Documentation/RCU/torture.txt
 +F:    kernel/torture.c
 +F:    kernel/rcu/rcutorture.c
 +F:    kernel/locking/locktorture.c
 +
  TOSHIBA ACPI EXTRAS DRIVER
  M:    Azael Avalos <[email protected]>
  L:    [email protected]
@@@ -13890,13 -13850,6 +13891,13 @@@ T: git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  K:    ^Subject:.*(?i)trivial
  
 +TEMPO SEMICONDUCTOR DRIVERS
 +M:    Steven Eckhoff <[email protected]>
 +S:    Maintained
 +F:    sound/soc/codecs/tscs*.c
 +F:    sound/soc/codecs/tscs*.h
 +F:    Documentation/devicetree/bindings/sound/tscs*.txt
 +
  TTY LAYER
  M:    Greg Kroah-Hartman <[email protected]>
  M:    Jiri Slaby <[email protected]>
@@@ -14695,7 -14648,6 +14696,7 @@@ W:   http://www.slimlogic.co.uk/?p=4
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
  S:    Supported
  F:    Documentation/devicetree/bindings/regulator/
 +F:    Documentation/power/regulator/
  F:    drivers/regulator/
  F:    include/dt-bindings/regulator/
  F:    include/linux/regulator/
@@@ -14906,7 -14858,7 +14907,7 @@@ F:   net/x25
  X86 ARCHITECTURE (32-BIT AND 64-BIT)
  M:    Thomas Gleixner <[email protected]>
  M:    Ingo Molnar <[email protected]>
 -M:    "H. Peter Anvin" <[email protected]>
 +R:    "H. Peter Anvin" <[email protected]>
  M:    [email protected]
  L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
diff --combined kernel/events/core.c
index 5d8f4031f8d589cac999d4e09161be159ef754d0,4e1a1bf8d86701790c92138e7035716f331ede0c..d99fe3fdec8adb18845d42da4d2a75dbcbba6016
@@@ -1231,10 -1231,6 +1231,10 @@@ static void put_ctx(struct perf_event_c
   *          perf_event_context::lock
   *        perf_event::mmap_mutex
   *        mmap_sem
 + *
 + *    cpu_hotplug_lock
 + *      pmus_lock
 + *      cpuctx->mutex / perf_event_context::mutex
   */
  static struct perf_event_context *
  perf_event_ctx_lock_nested(struct perf_event *event, int nesting)
@@@ -4200,7 -4196,6 +4200,7 @@@ int perf_event_release_kernel(struct pe
  {
        struct perf_event_context *ctx = event->ctx;
        struct perf_event *child, *tmp;
 +      LIST_HEAD(free_list);
  
        /*
         * If we got here through err_file: fput(event_file); we will not have
@@@ -4273,7 -4268,8 +4273,7 @@@ again
                                               struct perf_event, child_list);
                if (tmp == child) {
                        perf_remove_from_context(child, DETACH_GROUP);
 -                      list_del(&child->child_list);
 -                      free_event(child);
 +                      list_move(&child->child_list, &free_list);
                        /*
                         * This matches the refcount bump in inherit_event();
                         * this can't be the last reference.
        }
        mutex_unlock(&event->child_mutex);
  
 +      list_for_each_entry_safe(child, tmp, &free_list, child_list) {
 +              list_del(&child->child_list);
 +              free_event(child);
 +      }
 +
  no_ctx:
        put_event(event); /* Must be the 'last' reference */
        return 0;
@@@ -5824,19 -5815,11 +5824,11 @@@ void perf_output_sample(struct perf_out
                perf_output_read(handle, event);
  
        if (sample_type & PERF_SAMPLE_CALLCHAIN) {
-               if (data->callchain) {
-                       int size = 1;
-                       if (data->callchain)
-                               size += data->callchain->nr;
-                       size *= sizeof(u64);
+               int size = 1;
  
-                       __output_copy(handle, data->callchain, size);
-               } else {
-                       u64 nr = 0;
-                       perf_output_put(handle, nr);
-               }
+               size += data->callchain->nr;
+               size *= sizeof(u64);
+               __output_copy(handle, data->callchain, size);
        }
  
        if (sample_type & PERF_SAMPLE_RAW) {
@@@ -5989,6 -5972,26 +5981,26 @@@ static u64 perf_virt_to_phys(u64 virt
        return phys_addr;
  }
  
+ static struct perf_callchain_entry __empty_callchain = { .nr = 0, };
+ static struct perf_callchain_entry *
+ perf_callchain(struct perf_event *event, struct pt_regs *regs)
+ {
+       bool kernel = !event->attr.exclude_callchain_kernel;
+       bool user   = !event->attr.exclude_callchain_user;
+       /* Disallow cross-task user callchains. */
+       bool crosstask = event->ctx->task && event->ctx->task != current;
+       const u32 max_stack = event->attr.sample_max_stack;
+       struct perf_callchain_entry *callchain;
+       if (!kernel && !user)
+               return &__empty_callchain;
+       callchain = get_perf_callchain(regs, 0, kernel, user,
+                                      max_stack, crosstask, true);
+       return callchain ?: &__empty_callchain;
+ }
  void perf_prepare_sample(struct perf_event_header *header,
                         struct perf_sample_data *data,
                         struct perf_event *event,
                int size = 1;
  
                data->callchain = perf_callchain(event, regs);
-               if (data->callchain)
-                       size += data->callchain->nr;
+               size += data->callchain->nr;
  
                header->size += size * sizeof(u64);
        }
@@@ -8525,29 -8526,6 +8535,29 @@@ fail_clear_files
        return ret;
  }
  
 +static int
 +perf_tracepoint_set_filter(struct perf_event *event, char *filter_str)
 +{
 +      struct perf_event_context *ctx = event->ctx;
 +      int ret;
 +
 +      /*
 +       * Beware, here be dragons!!
 +       *
 +       * the tracepoint muck will deadlock against ctx->mutex, but the tracepoint
 +       * stuff does not actually need it. So temporarily drop ctx->mutex. As per
 +       * perf_event_ctx_lock() we already have a reference on ctx.
 +       *
 +       * This can result in event getting moved to a different ctx, but that
 +       * does not affect the tracepoint state.
 +       */
 +      mutex_unlock(&ctx->mutex);
 +      ret = ftrace_profile_set_filter(event, event->attr.config, filter_str);
 +      mutex_lock(&ctx->mutex);
 +
 +      return ret;
 +}
 +
  static int perf_event_set_filter(struct perf_event *event, void __user *arg)
  {
        char *filter_str;
  
        if (IS_ENABLED(CONFIG_EVENT_TRACING) &&
            event->attr.type == PERF_TYPE_TRACEPOINT)
 -              ret = ftrace_profile_set_filter(event, event->attr.config,
 -                                              filter_str);
 +              ret = perf_tracepoint_set_filter(event, filter_str);
        else if (has_addr_filter(event))
                ret = perf_event_set_addr_filter(event, filter_str);
  
@@@ -9199,13 -9178,7 +9209,13 @@@ static int perf_try_init_event(struct p
        if (!try_module_get(pmu->module))
                return -ENODEV;
  
 -      if (event->group_leader != event) {
 +      /*
 +       * A number of pmu->event_init() methods iterate the sibling_list to,
 +       * for example, validate if the group fits on the PMU. Therefore,
 +       * if this is a sibling event, acquire the ctx->mutex to protect
 +       * the sibling_list.
 +       */
 +      if (event->group_leader != event && pmu->task_ctx_nr != perf_sw_context) {
                /*
                 * This ctx->mutex can nest when we're called through
                 * inheritance. See the perf_event_ctx_lock_nested() comment.
@@@ -10740,6 -10713,19 +10750,19 @@@ inherit_event(struct perf_event *parent
        if (IS_ERR(child_event))
                return child_event;
  
+       if ((child_event->attach_state & PERF_ATTACH_TASK_DATA) &&
+           !child_ctx->task_ctx_data) {
+               struct pmu *pmu = child_event->pmu;
+               child_ctx->task_ctx_data = kzalloc(pmu->task_ctx_size,
+                                                  GFP_KERNEL);
+               if (!child_ctx->task_ctx_data) {
+                       free_event(child_event);
+                       return NULL;
+               }
+       }
        /*
         * is_orphaned_event() and list_add_tail(&parent_event->child_list)
         * must be under the same lock in order to serialize against
        if (is_orphaned_event(parent_event) ||
            !atomic_long_inc_not_zero(&parent_event->refcount)) {
                mutex_unlock(&parent_event->child_mutex);
+               /* task_ctx_data is freed with child_ctx */
                free_event(child_event);
                return NULL;
        }
This page took 0.154785 seconds and 4 git commands to generate.