1. 17 Jun, 2019 18 commits
    • Adrian Hunter's avatar
      perf intel-pt: Prepare to synthesize PEBS samples · e62ca655
      Adrian Hunter authored
      Add infrastructure to prepare for synthesizing PEBS samples but leave
      the actual synthesis to later patches.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190610072803.10456-5-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e62ca655
    • Adrian Hunter's avatar
      perf intel-pt: Add decoder support for PEBS via PT · 4c35595e
      Adrian Hunter authored
      PEBS data is encoded in Block Item Packets (BIP). Populate a new structure
      intel_pt_blk_items with the values and, upon a Block End Packet (BEP),
      report them as a new Intel PT sample type INTEL_PT_BLK_ITEMS.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190610072803.10456-4-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4c35595e
    • Adrian Hunter's avatar
      perf intel-pt: Add Intel PT packet decoder test · a0db77bf
      Adrian Hunter authored
      Add Intel PT packet decoder test. This test feeds byte sequences to the
      Intel PT packet decoder and checks the results. Changes to the packet
      context are also checked.
      
      Committer testing:
      
        # perf test "Intel PT"
        65: Intel PT packet decoder                               : Ok
        # perf test -v "Intel PT"
        65: Intel PT packet decoder                               :
        --- start ---
        test child forked, pid 6360
        Decoded ok: 00                                                PAD
        Decoded ok: 04                                                TNT N (1)
        Decoded ok: 06                                                TNT T (1)
        Decoded ok: 80                                                TNT NNNNNN (6)
        Decoded ok: fe                                                TNT TTTTTT (6)
        Decoded ok: 02 a3 02 00 00 00 00 00                           TNT N (1)
        Decoded ok: 02 a3 03 00 00 00 00 00                           TNT T (1)
        Decoded ok: 02 a3 00 00 00 00 00 80                           TNT NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN (47)
        Decoded ok: 02 a3 ff ff ff ff ff ff                           TNT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT (47)
        Decoded ok: 0d                                                TIP no ip
        Decoded ok: 2d 01 02                                          TIP 0x201
        Decoded ok: 4d 01 02 03 04                                    TIP 0x4030201
        Decoded ok: 6d 01 02 03 04 05 06                              TIP 0x60504030201
        Decoded ok: 8d 01 02 03 04 05 06                              TIP 0x60504030201
        Decoded ok: cd 01 02 03 04 05 06 07 08                        TIP 0x807060504030201
        Decoded ok: 11                                                TIP.PGE no ip
        Decoded ok: 31 01 02                                          TIP.PGE 0x201
        Decoded ok: 51 01 02 03 04                                    TIP.PGE 0x4030201
        Decoded ok: 71 01 02 03 04 05 06                              TIP.PGE 0x60504030201
        Decoded ok: 91 01 02 03 04 05 06                              TIP.PGE 0x60504030201
        Decoded ok: d1 01 02 03 04 05 06 07 08                        TIP.PGE 0x807060504030201
        Decoded ok: 01                                                TIP.PGD no ip
        Decoded ok: 21 01 02                                          TIP.PGD 0x201
        Decoded ok: 41 01 02 03 04                                    TIP.PGD 0x4030201
        Decoded ok: 61 01 02 03 04 05 06                              TIP.PGD 0x60504030201
        Decoded ok: 81 01 02 03 04 05 06                              TIP.PGD 0x60504030201
        Decoded ok: c1 01 02 03 04 05 06 07 08                        TIP.PGD 0x807060504030201
        Decoded ok: 1d                                                FUP no ip
        Decoded ok: 3d 01 02                                          FUP 0x201
        Decoded ok: 5d 01 02 03 04                                    FUP 0x4030201
        Decoded ok: 7d 01 02 03 04 05 06                              FUP 0x60504030201
        Decoded ok: 9d 01 02 03 04 05 06                              FUP 0x60504030201
        Decoded ok: dd 01 02 03 04 05 06 07 08                        FUP 0x807060504030201
        Decoded ok: 02 43 02 04 06 08 0a 0c                           PIP 0x60504030201 (NR=0)
        Decoded ok: 02 43 03 04 06 08 0a 0c                           PIP 0x60504030201 (NR=1)
        Decoded ok: 99 00                                             MODE.Exec 16
        Decoded ok: 99 01                                             MODE.Exec 64
        Decoded ok: 99 02                                             MODE.Exec 32
        Decoded ok: 99 20                                             MODE.TSX TXAbort:0 InTX:0
        Decoded ok: 99 21                                             MODE.TSX TXAbort:0 InTX:1
        Decoded ok: 99 22                                             MODE.TSX TXAbort:1 InTX:0
        Decoded ok: 02 83                                             TraceSTOP
        Decoded ok: 02 03 12 00                                       CBR 0x12
        Decoded ok: 19 01 02 03 04 05 06 07                           TSC 0x7060504030201
        Decoded ok: 59 12                                             MTC 0x12
        Decoded ok: 02 73 00 00 00 00 00                              TMA CTC 0x0 FC 0x0
        Decoded ok: 02 73 01 02 00 00 00                              TMA CTC 0x201 FC 0x0
        Decoded ok: 02 73 00 00 00 ff 01                              TMA CTC 0x0 FC 0x1ff
        Decoded ok: 02 73 80 c0 00 ff 01                              TMA CTC 0xc080 FC 0x1ff
        Decoded ok: 03                                                CYC 0x0
        Decoded ok: 0b                                                CYC 0x1
        Decoded ok: fb                                                CYC 0x1f
        Decoded ok: 07 02                                             CYC 0x20
        Decoded ok: ff fe                                             CYC 0xfff
        Decoded ok: 07 01 02                                          CYC 0x1000
        Decoded ok: ff ff fe                                          CYC 0x7ffff
        Decoded ok: 07 01 01 02                                       CYC 0x80000
        Decoded ok: ff ff ff fe                                       CYC 0x3ffffff
        Decoded ok: 07 01 01 01 02                                    CYC 0x4000000
        Decoded ok: ff ff ff ff fe                                    CYC 0x1ffffffff
        Decoded ok: 07 01 01 01 01 02                                 CYC 0x200000000
        Decoded ok: ff ff ff ff ff fe                                 CYC 0xffffffffff
        Decoded ok: 07 01 01 01 01 01 02                              CYC 0x10000000000
        Decoded ok: ff ff ff ff ff ff fe                              CYC 0x7fffffffffff
        Decoded ok: 07 01 01 01 01 01 01 02                           CYC 0x800000000000
        Decoded ok: ff ff ff ff ff ff ff fe                           CYC 0x3fffffffffffff
        Decoded ok: 07 01 01 01 01 01 01 01 02                        CYC 0x40000000000000
        Decoded ok: ff ff ff ff ff ff ff ff fe                        CYC 0x1fffffffffffffff
        Decoded ok: 07 01 01 01 01 01 01 01 01 02                     CYC 0x2000000000000000
        Decoded ok: ff ff ff ff ff ff ff ff ff 0e                     CYC 0xffffffffffffffff
        Decoded ok: 02 c8 01 02 03 04 05                              VMCS 0x504030201
        Decoded ok: 02 f3                                             OVF
        Decoded ok: 02 f3                                             OVF
        Decoded ok: 02 f3                                             OVF
        Decoded ok: 02 82 02 82 02 82 02 82 02 82 02 82 02 82 02 82   PSB
        Decoded ok: 02 82 02 82 02 82 02 82 02 82 02 82 02 82 02 82   PSB
        Decoded ok: 02 82 02 82 02 82 02 82 02 82 02 82 02 82 02 82   PSB
        Decoded ok: 02 23                                             PSBEND
        Decoded ok: 02 c3 88 01 02 03 04 05 06 07 00                  MNT 0x7060504030201
        Decoded ok: 02 12 01 02 03 04                                 PTWRITE 0x4030201 IP:0
        Decoded ok: 02 32 01 02 03 04 05 06 07 08                     PTWRITE 0x807060504030201 IP:0
        Decoded ok: 02 92 01 02 03 04                                 PTWRITE 0x4030201 IP:1
        Decoded ok: 02 b2 01 02 03 04 05 06 07 08                     PTWRITE 0x807060504030201 IP:1
        Decoded ok: 02 62                                             EXSTOP IP:0
        Decoded ok: 02 e2                                             EXSTOP IP:1
        Decoded ok: 02 c2 00 00 00 00 00 00 00 00                     MWAIT 0x0 Hints 0x0 Extensions 0x0
        Decoded ok: 02 c2 01 02 03 04 05 06 07 08                     MWAIT 0x807060504030201 Hints 0x1 Extensions 0x1
        Decoded ok: 02 c2 ff 02 03 04 07 06 07 08                     MWAIT 0x8070607040302ff Hints 0xff Extensions 0x3
        Decoded ok: 02 22 00 00                                       PWRE 0x0 HW:0 CState:0 Sub-CState:0
        Decoded ok: 02 22 01 02                                       PWRE 0x201 HW:0 CState:0 Sub-CState:2
        Decoded ok: 02 22 80 34                                       PWRE 0x3480 HW:1 CState:3 Sub-CState:4
        Decoded ok: 02 22 00 56                                       PWRE 0x5600 HW:0 CState:5 Sub-CState:6
        Decoded ok: 02 a2 00 00 00 00 00                              PWRX 0x0 Last CState:0 Deepest CState:0 Wake Reason 0x0
        Decoded ok: 02 a2 01 02 03 04 05                              PWRX 0x504030201 Last CState:0 Deepest CState:1 Wake Reason 0x2
        Decoded ok: 02 a2 ff ff ff ff ff                              PWRX 0xffffffffff Last CState:15 Deepest CState:15 Wake Reason 0xf
        Decoded ok: 02 63 00                                          BBP SZ 8-byte Type 0x0
        Decoded ok: 02 63 80                                          BBP SZ 4-byte Type 0x0
        Decoded ok: 02 63 1f                                          BBP SZ 8-byte Type 0x1f
        Decoded ok: 02 63 9f                                          BBP SZ 4-byte Type 0x1f
        Decoded ok: 04 00 00 00 00                                    BIP ID 0x00 Value 0x0
        Decoded ok: fc 00 00 00 00                                    BIP ID 0x1f Value 0x0
        Decoded ok: 04 01 02 03 04                                    BIP ID 0x00 Value 0x4030201
        Decoded ok: fc 01 02 03 04                                    BIP ID 0x1f Value 0x4030201
        Decoded ok: 04 00 00 00 00 00 00 00 00                        BIP ID 0x00 Value 0x0
        Decoded ok: fc 00 00 00 00 00 00 00 00                        BIP ID 0x1f Value 0x0
        Decoded ok: 04 01 02 03 04 05 06 07 08                        BIP ID 0x00 Value 0x807060504030201
        Decoded ok: fc 01 02 03 04 05 06 07 08                        BIP ID 0x1f Value 0x807060504030201
        Decoded ok: 02 33                                             BEP IP:0
        Decoded ok: 02 b3                                             BEP IP:1
        Decoded ok: 02 33                                             BEP IP:0
        Decoded ok: 02 b3                                             BEP IP:1
        test child finished with 0
        ---- end ----
        Intel PT packet decoder: Ok
        #
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190610072803.10456-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a0db77bf
    • Adrian Hunter's avatar
      perf intel-pt: Add new packets for PEBS via PT · edff7809
      Adrian Hunter authored
      Add 3 new packets to supports PEBS via PT, namely Block Begin Packet
      (BBP), Block Item Packet (BIP) and Block End Packet (BEP). PEBS data is
      encoded into multiple BIP packets that come between BBP and BEP. The BEP
      packet might be associated with a FUP packet. That is indicated by using
      a separate packet type (INTEL_PT_BEP_IP) similar to other packets types
      with the _IP suffix.
      
      Refer to the Intel SDM for more information about PEBS via PT:
      
        https://software.intel.com/en-us/articles/intel-sdm
        May 2019 version: Vol. 3B 18.5.5.2 PEBS output to Intel® Processor Trace
      
      Decoding of BIP packets conflicts with single-byte TNT packets. Since
      BIP packets only occur in the context of a block (i.e. between BBP and
      BEP), that context must be recorded and passed to the packet decoder.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190610072803.10456-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      edff7809
    • Mathieu Poirier's avatar
      perf: cs-etm: Optimize option setup for CPU-wide sessions · 374d910f
      Mathieu Poirier authored
      Call function cs_etm_set_option() once with all relevant options set
      rather than multiple times to avoid going through the list of CPU more
      than once.
      Suggested-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/20190611204528.20093-1-mathieu.poirier@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      374d910f
    • Raphael Gault's avatar
      perf tests arm64: Compile tests unconditionally · 010e3e8f
      Raphael Gault authored
      In order to subsequently add more tests for the arm64 architecture we
      compile the tests target for arm64 systematically.
      
      Further explanation provided by Mark Rutland:
      
      Given prior questions regarding this commit, it's probably worth
      spelling things out more explicitly, e.g.
      
        Currently we only build the arm64/tests directory if
        CONFIG_DWARF_UNWIND is selected, which is fine as the only test we
        have is arm64/tests/dwarf-unwind.o.
      
        So that we can add more tests to the test directory, let's
        unconditionally build the directory, but conditionally build
        dwarf-unwind.o depending on CONFIG_DWARF_UNWIND.
      
        There should be no functional change as a result of this patch.
      Signed-off-by: default avatarRaphael Gault <raphael.gault@arm.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/20190611125315.18736-2-raphael.gault@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      010e3e8f
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-5.3-20190611' of... · 3ce5aceb
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-5.3-20190611' 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 record:
      
        Alexey Budankov:
      
        - Allow mixing --user-regs with --call-graph=dwarf, making sure that
          the minimal set of registers for DWARF unwinding is present in the
          set of user registers requested to be present in each sample, while
          warning the user that this may make callchains unreliable if more
          that the minimal set of registers is needed to unwind.
      
        yuzhoujian:
      
        - Add support to collect callchains from kernel or user space only,
          IOW allow setting the perf_event_attr.exclude_callchain_{kernel,user}
          bits from the command line.
      
      perf trace:
      
        Arnaldo Carvalho de Melo:
      
        - Remove x86_64 specific syscall numbers from the augmented_raw_syscalls
          BPF in-kernel collector of augmented raw_syscalls:sys_{enter,exit}
          payloads, use instead the syscall numbers obtainer either by the
          arch specific syscalltbl generators or from audit-libs.
      
        - Allow 'perf trace' to ask for the number of bytes to collect for
          string arguments, for now ask for PATH_MAX, i.e. the whole
          pathnames, which ends up being just a way to speficy which syscall
          args are pathnames and thus should be read using bpf_probe_read_str().
      
        - Skip unknown syscalls when expanding strace like syscall groups.
          This helps using the 'string' group of syscalls to work in arm64,
          where some of the syscalls present in x86_64 that deal with
          strings, for instance 'access', are deprecated and this should not
          be asked for tracing.
      
        Leo Yan:
      
        - Exit when failing to build eBPF program.
      
      perf config:
      
        Arnaldo Carvalho de Melo:
      
        - Bail out when a handler returns failure for a key-value pair. This
          helps with cases where processing a key-value pair is not just a
          matter of setting some tool specific knob, involving, for instance
          building a BPF program to then attach to the list of events 'perf
          trace' will use, e.g. augmented_raw_syscalls.c.
      
      perf.data:
      
        Kan Liang:
      
        - Read and store die ID information available in new Intel processors
          in CPUID.1F in the CPU topology written in the perf.data header.
      
      perf stat:
      
        Kan Liang:
      
        - Support per-die aggregation.
      
      Documentation:
      
        Arnaldo Carvalho de Melo:
      
        - Update perf.data documentation about the CPU_TOPOLOGY, MEM_TOPOLOGY,
          CLOCKID and DIR_FORMAT headers.
      
        Song Liu:
      
        - Add description of headers HEADER_BPF_PROG_INFO and HEADER_BPF_BTF.
      
        Leo Yan:
      
        - Update default value for llvm.clang-bpf-cmd-template in 'man perf-config'.
      
      JVMTI:
      
        Jiri Olsa:
      
        - Address gcc string overflow warning for strncpy()
      
      core:
      
        - Remove superfluous nthreads system_wide setup in perf_evsel__alloc_fd().
      
      Intel PT:
      
        Adrian Hunter:
      
        - Add support for samples to contain IPC ratio, collecting cycles
          information from CYC packets, showing the IPC info periodically, because
          Intel PT does not update the cycle count on every branch or instruction,
          the incremental values will often be zero.  When there are values, they
          will be the number of instructions and number of cycles since the last
          update, and thus represent the average IPC since the last IPC value.
      
          E.g.:
      
          # perf record --cpu 1 -m200000 -a -e intel_pt/cyc/u sleep 0.0001
          rounding mmap pages size to 1024M (262144 pages)
          [ perf record: Woken up 0 times to write data ]
          [ perf record: Captured and wrote 2.208 MB perf.data ]
          # perf script --insn-trace --xed -F+ipc,-dso,-cpu,-tid
          #
          <SNIP + add line numbering to make sense of IPC counts e.g.: (18/3)>
          1   cc1 63501.650479626: 7f5219ac27bf _int_free+0x3f   jnz 0x7f5219ac2af0       IPC: 0.81 (36/44)
          2   cc1 63501.650479626: 7f5219ac27c5 _int_free+0x45   cmp $0x1f, %rbp
          3   cc1 63501.650479626: 7f5219ac27c9 _int_free+0x49   jbe 0x7f5219ac2b00
          4   cc1 63501.650479626: 7f5219ac27cf _int_free+0x4f   test $0x8, %al
          5   cc1 63501.650479626: 7f5219ac27d1 _int_free+0x51   jnz 0x7f5219ac2b00
          6   cc1 63501.650479626: 7f5219ac27d7 _int_free+0x57   movq  0x13c58a(%rip), %rcx
          7   cc1 63501.650479626: 7f5219ac27de _int_free+0x5e   mov %rdi, %r12
          8   cc1 63501.650479626: 7f5219ac27e1 _int_free+0x61   movq  %fs:(%rcx), %rax
          9   cc1 63501.650479626: 7f5219ac27e5 _int_free+0x65   test %rax, %rax
         10   cc1 63501.650479626: 7f5219ac27e8 _int_free+0x68   jz 0x7f5219ac2821
         11   cc1 63501.650479626: 7f5219ac27ea _int_free+0x6a   leaq  -0x11(%rbp), %rdi
         12   cc1 63501.650479626: 7f5219ac27ee _int_free+0x6e   mov %rdi, %rsi
         13   cc1 63501.650479626: 7f5219ac27f1 _int_free+0x71   shr $0x4, %rsi
         14   cc1 63501.650479626: 7f5219ac27f5 _int_free+0x75   cmpq  %rsi, 0x13caf4(%rip)
         15   cc1 63501.650479626: 7f5219ac27fc _int_free+0x7c   jbe 0x7f5219ac2821
         16   cc1 63501.650479626: 7f5219ac2821 _int_free+0xa1   cmpq  0x13f138(%rip), %rbp
         17   cc1 63501.650479626: 7f5219ac2828 _int_free+0xa8   jnbe 0x7f5219ac28d8
         18   cc1 63501.650479626: 7f5219ac28d8 _int_free+0x158  testb  $0x2, 0x8(%rbx)
         19   cc1 63501.650479628: 7f5219ac28dc _int_free+0x15c  jnz 0x7f5219ac2ab0       IPC: 6.00 (18/3)
          <SNIP>
      
        - Allow using time ranges with Intel PT, i.e. these features, already
          present but not optimially usable with Intel PT, should be now:
      
              Select the second 10% time slice:
      
              $ perf script --time 10%/2
      
              Select from 0% to 10% time slice:
      
              $ perf script --time 0%-10%
      
              Select the first and second 10% time slices:
      
              $ perf script --time 10%/1,10%/2
      
              Select from 0% to 10% and 30% to 40% slices:
      
              $ perf script --time 0%-10%,30%-40%
      
      cs-etm (ARM):
      
        Mathieu Poirier:
      
        - Add support for CPU-wide trace scenarios.
      
      s390:
      
        Thomas Richter:
      
        - Fix missing kvm module load for s390.
      
        - Fix OOM error in TUI mode on s390
      
        - Support s390 diag event display when doing analysis on !s390
          architectures.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      3ce5aceb
    • Jiri Olsa's avatar
      perf/x86/intel: Disable check_msr for real HW · d0e1a507
      Jiri Olsa authored
      Tom Vaden reported false failure of the check_msr() function, because
      some servers can do POST tracing and enable LBR tracing during
      bootup.
      
      Kan confirmed that check_msr patch was to fix a bug report in
      guest, so it's ok to disable it for real HW.
      Reported-by: default avatarTom Vaden <tom.vaden@hpe.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarTom Vaden <tom.vaden@hpe.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Liang Kan <kan.liang@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190616141313.GD2500@krava
      [ Readability edits. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d0e1a507
    • Jiri Olsa's avatar
      perf/x86/intel: Use ->is_visible callback for default group · b7c9b392
      Jiri Olsa authored
      It's preffered to use group's ->is_visible callback, so
      we do not need to use condition attribute assignment.
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190524132152.GB26617@kravaSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b7c9b392
    • Kan Liang's avatar
      perf/x86/intel/uncore: Add IMC uncore support for Snow Ridge · ee49532b
      Kan Liang authored
      IMC uncore unit can only be accessed via MMIO on Snow Ridge.
      The MMIO space of IMC uncore is at the specified offsets from the
      MEM0_BAR. Add snr_uncore_get_mc_dev() to locate the PCI device with
      MMIO_BASE and MEM0_BAR register.
      
      Add new ops to access the IMC registers via MMIO.
      
      Add 3 new free running counters for clocks, read and write bandwidth.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@kernel.org
      Cc: eranian@google.com
      Link: https://lkml.kernel.org/r/1556672028-119221-7-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ee49532b
    • Kan Liang's avatar
      perf/x86/intel/uncore: Clean up client IMC · 07ce734d
      Kan Liang authored
      The client IMC block is accessed by MMIO. Current code uses an informal
      way to access the block, which is not recommended.
      
      Clean up the code by using __iomem annotation and the accessor
      functions (read[lq]()).
      
      Move exit_box() and read_counter() to generic code, which can be shared
      with the server code later.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@kernel.org
      Cc: eranian@google.com
      Link: https://lkml.kernel.org/r/1556672028-119221-6-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      07ce734d
    • Kan Liang's avatar
      perf/x86/intel/uncore: Support MMIO type uncore blocks · 3da04b8a
      Kan Liang authored
      A new MMIO type uncore box is introduced on Snow Ridge server. The
      counters of MMIO type uncore box can only be accessed by MMIO.
      
      Add a new uncore type, uncore_mmio_uncores, for MMIO type uncore blocks.
      
      Support MMIO type uncore blocks in CPU hot plug. The MMIO space has to
      be map/unmap for the first/last CPU. The context also need to be
      migrated if the bind CPU changes.
      
      Add mmio_init() to init and register PMUs for MMIO type uncore blocks.
      
      Add a helper to calculate the box_ctl address.
      
      The helpers which calculate ctl/ctr can be shared with PCI type uncore
      blocks.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@kernel.org
      Cc: eranian@google.com
      Link: https://lkml.kernel.org/r/1556672028-119221-5-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      3da04b8a
    • Kan Liang's avatar
      perf/x86/intel/uncore: Factor out box ref/unref functions · c8872d90
      Kan Liang authored
      For uncore box which can only be accessed by MSR, its reference
      box->refcnt is updated in CPU hot plug. The uncore boxes need to be
      initalized and exited accordingly for the first/last CPU of a socket.
      
      Starts from Snow Ridge server, a new type of uncore box is introduced,
      which can only be accessed by MMIO. The driver needs to map/unmap
      MMIO space for the first/last CPU of a socket.
      
      Extract the codes of box ref/unref and init/exit for reuse later.
      
      There is no functional change.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@kernel.org
      Cc: eranian@google.com
      Link: https://lkml.kernel.org/r/1556672028-119221-4-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c8872d90
    • Kan Liang's avatar
      perf/x86/intel/uncore: Add uncore support for Snow Ridge server · 210cc5f9
      Kan Liang authored
      The uncore subsystem on Snow Ridge is similar as previous SKX server.
      The uncore units on Snow Ridge include Ubox, Chabox, IIO, IRP, M2PCIE,
      PCU, M2M, PCIE3 and IMC.
      
      - The config register encoding and pci device IDs are changed.
      - For CHA, the umask_ext and filter_tid fields are changed.
      - For IIO, the ch_mask and fc_mask fields are changed.
      - For M2M, the mask_ext field is changed.
      - Add new PCIe3 unit for PCIe3 root port which provides the interface
        between PCIe devices, plugged into the PCIe port, and the components
        (in M2IOSF).
      - IMC can only be accessed via MMIO on Snow Ridge now. Current common
        code doesn't support it yet. IMC will be supported in following
        patches.
      - There are 9 free running counters for IIO CLOCKS and bandwidth In.
      - Full uncore event list is not published yet. Event constrain is not
        included in this patch. It will be added later separately.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@kernel.org
      Cc: eranian@google.com
      Link: https://lkml.kernel.org/r/1556672028-119221-3-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      210cc5f9
    • Kan Liang's avatar
      perf/x86/intel/uncore: Handle invalid event coding for free-running counter · 543ac280
      Kan Liang authored
      Counting with invalid event coding for free-running counter may cause
      OOPs, e.g. uncore_iio_free_running_0/event=1/.
      
      Current code only validate the event with free-running event format,
      event=0xff,umask=0xXY. Non-free-running event format never be checked
      for the PMU with free-running counters.
      
      Add generic hw_config() to check and reject the invalid event coding
      for free-running PMU.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@kernel.org
      Cc: eranian@google.com
      Fixes: 0f519f03 ("perf/x86/intel/uncore: Support IIO free-running counters on SKX")
      Link: https://lkml.kernel.org/r/1556672028-119221-2-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      543ac280
    • Kan Liang's avatar
      perf/x86/intel: Add more Icelake CPUIDs · faaeff98
      Kan Liang authored
      Add new model number for Icelake desktop and server to perf.
      
      The data source encoding for Icelake server is the same as Skylake
      server.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: bp@alien8.de
      Cc: qiuxu.zhuo@intel.com
      Cc: rui.zhang@intel.com
      Cc: tony.luck@intel.com
      Link: https://lkml.kernel.org/r/20190603134122.13853-2-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      faaeff98
    • Kan Liang's avatar
      perf/x86/intel: Add Icelake desktop CPUID · 2a538fda
      Kan Liang authored
      Add new Icelake desktop CPUID for RAPL, CSTATE and UNCORE.
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: bp@alien8.de
      Cc: qiuxu.zhuo@intel.com
      Cc: rui.zhang@intel.com
      Cc: tony.luck@intel.com
      Link: https://lkml.kernel.org/r/20190603134122.13853-3-kan.liang@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2a538fda
    • Ingo Molnar's avatar
  2. 14 Jun, 2019 2 commits
  3. 13 Jun, 2019 1 commit
  4. 10 Jun, 2019 19 commits