1. 03 Jul, 2019 3 commits
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-5.3-20190703' of... · a328a259
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-5.3-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      perf metrics:
      
        Andi Kleen:
      
        - Fixes for SkylakeX and CascadeLakeX Intel vendor events.
      
        - Avoid extra ':' for --raw metrics.
      
        - Don't include duration_time in group.
      
      perf script:
      
        Arnaldo Carvalho de Melo/Jiri Olsa:
      
        - Fix processing guest samples.
      
      perf diff:
      
        Jin Yao:
      
        - Do diffs by basic blocks.
      
      objtool:
      
        Jiri Olsa:
      
        - Fix build by linking against tools/lib/ctype.o sources.
      
      perf pmu:
      
        John Garry:
      
        - Support more complex PMU event aliasing.
      
        - Add support for Hisi hip08 DDRC, HHA and L3C PMU aliasing.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a328a259
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-5.3-20190701' of... · a041ede0
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-5.3-20190701' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      perf annotate:
      
        Mao Han:
      
        - Add support for the csky processor architecture.
      
      perf stat:
      
        Andi Kleen:
      
        - Fix metrics with --no-merge.
      
        - Don't merge events in the same PMU.
      
        - Fix group lookup for metric group.
      
      Intel PT:
      
        Adrian Hunter:
      
        - Improve CBR (Core to Bus Ratio) packets support.
      
        - Fix thread stack return from kernel for kernel only case.
      
        - Export power and ptwrite events to sqlite and postgresql.
      
      core libraries:
      
        Arnaldo Carvalho de Melo:
      
        - Find routines in tools/perf/util/ that have implementations in the kernel
          libraries (lib/*.c), such as strreplace(), strim(), skip_spaces() and reuse
          them after making a copy into tools/lib and tools/include/.
      
          This continues the effort of having tools/ code looking as much as possible
          like kernel source code, to help encourage people to work on both the kernel
          and in tools hosted in the kernel sources.
      
          That in turn will help moving stuff that uses those routines to
          tools/lib/perf/ where they will be made available for use in other tools.
      
          In the process ditch old cruft, remove unused variables and add missing
          include directives for headers providing things used in places that were
          building by sheer luck.
      
        Kyle Meyer:
      
        - Bump MAX_NR_CPUS and MAX_CACHES to get these tools to work on more machines.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a041ede0
    • Arnaldo Carvalho de Melo's avatar
      perf script: Allow specifying the files to process guest samples · 15a108af
      Arnaldo Carvalho de Melo authored
      The 'perf kvm' command set up things so that we can record, report, top,
      etc, but not 'script', so make 'perf script' be able to process samples
      by allowing to pass guest kallsyms, vmlinux, modules, etc, and if at
      least one of those is provided, set perf_guest to true so that guest
      samples get properly resolved.
      
      Testing it:
      
        # perf kvm --guest --guestkallsyms /wb/rhel6.kallsyms --guestmodules /wb/rhel6.modules record -e cycles:Gk
      ^C[ perf record: Woken up 7 times to write data ]
        [ perf record: Captured and wrote 3.602 MB perf.data.guest (10492 samples) ]
      
        #
        # perf evlist -i perf.data.guest
      cycles:Gk
        # perf evlist -v -i perf.data.guest
      cycles:Gk: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, exclude_user: 1, exclude_hv: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_host: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
        #
        # perf kvm --guestkallsyms /wb/rhel6.kallsyms --guestmodules /wb/rhel6.modules report --stdio -s sym | head -30
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 10K of event 'cycles:Gk'
        # Event count (approx.): 2434201408
        #
        # Overhead  Symbol
        # ........  ..............................................
        #
            11.93%  [g] avtab_search_node
             3.95%  [g] sidtab_context_to_sid
             2.41%  [g] n_tty_write
             2.20%  [g] _spin_unlock_irqrestore
             1.37%  [g] _aesni_dec4
             1.33%  [g] kmem_cache_alloc
             1.07%  [g] native_write_cr0
             0.99%  [g] kfree
             0.95%  [g] _spin_lock
             0.91%  [g] __memset
             0.87%  [g] schedule
             0.83%  [g] _spin_lock_irqsave
             0.76%  [g] __kmalloc
             0.67%  [g] avc_has_perm_noaudit
             0.66%  [g] kmem_cache_free
             0.65%  [g] glue_xts_crypt_128bit
             0.59%  [g] __d_lookup
             0.59%  [g] __audit_syscall_exit
             0.56%  [g] __memcpy
        #
      
      Then, when trying to use perf script to generate a python script and
      then process the events after adding a python hook for non-tracepoint
      events:
      
        # perf script -i perf.data.guest -g python
        generated Python script: perf-script.py
        # vim perf-script.py
        # tail -2 perf-script.py
        def process_event(param_dict):
              print(param_dict["symbol"])
        #
        # perf script -i perf.data.guest -s perf-script.py  | head
        in trace_begin
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        231
        #
      
      We'd see just the vmx_vmexit, i.e. the samples from the guest don't show
      up.
      
      After this patch:
      
        # perf script --guestkallsyms /wb/rhel6.kallsyms --guestmodules /wb/rhel6.modules -i perf.data.guest -s perf-script.py 2> /dev/null | head -30
        in trace_begin
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        save_args
        do_timer
        drain_array
        inode_permission
        avc_has_perm_noaudit
        run_timer_softirq
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        kvm_guest_apic_eoi_write
        run_posix_cpu_timers
        _spin_lock
        handle_pte_fault
        rcu_irq_enter
        delay_tsc
        delay_tsc
        native_read_tsc
        apic_timer_interrupt
        sys_open
        internal_add_timer
        list_del
        rcu_exit_nohz
        #
      
      Jiri Olsa noticed we need to set 'perf_guest' to true if we want to
      process guest samples and I made it be set if one of the guest files
      settings get set via the command line options added in this patch, that
      match those present in the 'perf kvm' command.
      
      We probably want to have 'perf record', 'perf report' etc to notice that
      there are guest samples and do the right thing, which is to look for
      files with some suffix that make it be associated with the guest used to
      collect the samples, i.e. if a vmlinux file is passed, we can get the
      build-id from it, if not some other identifier or simply looking for
      "kallsyms.guest", for instance, in the current directory.
      Reported-by: default avatarMariano Pache <npache@redhat.com>
      Tested-by: default avatarMariano Pache <npache@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
      Cc: Ali Raza <alirazabhutta.10@gmail.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Larry Woodman <lwoodman@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Orran Krieger <okrieger@redhat.com>
      Cc: Ramkumar Ramachandra <artagnon@gmail.com>
      Cc: Yunlong Song <yunlong.song@huawei.com>
      Link: https://lkml.kernel.org/n/tip-d54gj64rerlxcqsrod05biwn@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      15a108af
  2. 02 Jul, 2019 26 commits
  3. 26 Jun, 2019 11 commits