1. 04 6月, 2018 25 次提交
  2. 02 6月, 2018 5 次提交
    • D
      bpf: fix uapi hole for 32 bit compat applications · 36f9814a
      Daniel Borkmann 提交于
      In 64 bit, we have a 4 byte hole between ifindex and netns_dev in the
      case of struct bpf_map_info but also struct bpf_prog_info. In net-next
      commit b85fab0e ("bpf: Add gpl_compatible flag to struct bpf_prog_info")
      added a bitfield into it to expose some flags related to programs. Thus,
      add an unnamed __u32 bitfield for both so that alignment keeps the same
      in both 32 and 64 bit cases, and can be naturally extended from there
      as in b85fab0e.
      
      Before:
      
        # file test.o
        test.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
        # pahole test.o
        struct bpf_map_info {
      	__u32                      type;                 /*     0     4 */
      	__u32                      id;                   /*     4     4 */
      	__u32                      key_size;             /*     8     4 */
      	__u32                      value_size;           /*    12     4 */
      	__u32                      max_entries;          /*    16     4 */
      	__u32                      map_flags;            /*    20     4 */
      	char                       name[16];             /*    24    16 */
      	__u32                      ifindex;              /*    40     4 */
      	__u64                      netns_dev;            /*    44     8 */
      	__u64                      netns_ino;            /*    52     8 */
      
      	/* size: 64, cachelines: 1, members: 10 */
      	/* padding: 4 */
        };
      
      After (same as on 64 bit):
      
        # file test.o
        test.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
        # pahole test.o
        struct bpf_map_info {
      	__u32                      type;                 /*     0     4 */
      	__u32                      id;                   /*     4     4 */
      	__u32                      key_size;             /*     8     4 */
      	__u32                      value_size;           /*    12     4 */
      	__u32                      max_entries;          /*    16     4 */
      	__u32                      map_flags;            /*    20     4 */
      	char                       name[16];             /*    24    16 */
      	__u32                      ifindex;              /*    40     4 */
      
      	/* XXX 4 bytes hole, try to pack */
      
      	__u64                      netns_dev;            /*    48     8 */
      	__u64                      netns_ino;            /*    56     8 */
      	/* --- cacheline 1 boundary (64 bytes) --- */
      
      	/* size: 64, cachelines: 1, members: 10 */
      	/* sum members: 60, holes: 1, sum holes: 4 */
        };
      Reported-by: NDmitry V. Levin <ldv@altlinux.org>
      Reported-by: NEugene Syromiatnikov <esyr@redhat.com>
      Fixes: 52775b33 ("bpf: offload: report device information about offloaded maps")
      Fixes: 675fc275 ("bpf: offload: report device information for offloaded programs")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      36f9814a
    • A
      perf tools intel-pt-decoder: Update insn.h from the kernel sources · 0b3a1838
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in:
      
        ee6a7354 ("kprobes/x86: Prohibit probing on exception masking instructions")
      
      That doesn't entail changes in tooling, but silences this perf build
      warning:
      
        Warning: Intel PT: x86 instruction decoder header at 'tools/perf/util/intel-pt-decoder/insn.h' differs from latest version at 'arch/x86/include/asm/insn.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-o3wfwjnyh7r8l0gi9q3y9f44@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0b3a1838
    • A
      tools headers: Sync x86 cpufeatures.h with the kernel sources · a20d23bb
      Arnaldo Carvalho de Melo 提交于
      To pick up changes found in these csets:
      
       11fb0683 x86/speculation: Add virtualized speculative store bypass disable support
       d1035d97 x86/cpufeatures: Add FEATURE_ZEN
       52817587 x86/cpufeatures: Disentangle SSBD enumeration
       7eb8956a x86/cpufeatures: Disentangle MSR_SPEC_CTRL enumeration from IBRS
       e7c587da x86/speculation: Use synthetic bits for IBRS/IBPB/STIBP
       9f65fb29 x86/bugs: Rename _RDS to _SSBD
       764f3c21 x86/bugs/AMD: Add support to disable RDS on Fam[15,16,17]h if requested
       24f7fc83 x86/bugs: Provide boot parameters for the spec_store_bypass_disable mitigation
       0cc5fa00 x86/cpufeatures: Add X86_FEATURE_RDS
       c456442c x86/bugs: Expose /sys/../spec_store_bypass
      
      The usage of this file in tools doesn't use the newly added X86_FEATURE_
      defines:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
        LD       /tmp/build/perf/bench/perf-in.o
        LD       /tmp/build/perf/perf-in.o
      
      Silencing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-mrwyauyov8c7s048abg26khg@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a20d23bb
    • A
      tools headers: Synchronize prctl.h ABI header · 63b89a19
      Arnaldo Carvalho de Melo 提交于
      To pick up changes from:
      
        $ git log --oneline -2 -i include/uapi/linux/prctl.h
        356e4bff prctl: Add force disable speculation
        b617cfc8 prctl: Add speculation control prctls
      
        $ tools/perf/trace/beauty/prctl_option.sh > before.c
        $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
        $ tools/perf/trace/beauty/prctl_option.sh > after.c
        $ diff -u before.c after.c
        --- before.c	2018-06-01 10:39:53.834073962 -0300
        +++ after.c	2018-06-01 10:42:11.307985394 -0300
        @@ -35,6 +35,8 @@
                [42] = "GET_THP_DISABLE",
                [45] = "SET_FP_MODE",
                [46] = "GET_FP_MODE",
        +       [52] = "GET_SPECULATION_CTRL",
        +       [53] = "SET_SPECULATION_CTRL",
         };
         static const char *prctl_set_mm_options[] = {
       	  [1] = "START_CODE",
        $
      
      This will be used by 'perf trace' to show these strings when beautifying
      the prctl syscall args. At some point we'll be able to say something
      like:
      
      	'perf trace --all-cpus -e prctl(option=*SPEC*)'
      
      To filter by arg by name.
      
        This silences this warning when building tools/perf:
      
          Warning: Kernel ABI header at 'tools/include/uapi/linux/prctl.h' differs from latest version at 'include/uapi/linux/prctl.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-zztsptwhc264r8wg44tqh5gp@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      63b89a19
    • A
      perf trace beauty prctl: Default header_dir to cwd to work without parms · 0d690fc0
      Arnaldo Carvalho de Melo 提交于
      Useful when checking the effects of header synchs for the files it uses
      as a input to generate string tables, in retrospect this is how it
      should've been done from day 1, not requiring the header_dir to be set
      on the Makefile, will change everything later, so that the only parm,
      common to all generators will be $(srctree) and $(beauty_outdir).
      
      So, to see what it generates, just call it without any parameters:
      
        $ tools/perf/trace/beauty/prctl_option.sh
        static const char *prctl_options[] = {
      	  [1] = "SET_PDEATHSIG",
      	  [2] = "GET_PDEATHSIG",
      	  [3] = "GET_DUMPABLE",
      	  [4] = "SET_DUMPABLE",
      	  [5] = "GET_UNALIGN",
      	  [6] = "SET_UNALIGN",
      	  [7] = "GET_KEEPCAPS",
      	  [8] = "SET_KEEPCAPS",
      	  [9] = "GET_FPEMU",
      	  [10] = "SET_FPEMU",
      	  [11] = "GET_FPEXC",
      	  [12] = "SET_FPEXC",
      	  [13] = "GET_TIMING",
      	  [14] = "SET_TIMING",
      	  [15] = "SET_NAME",
      	  [16] = "GET_NAME",
      	  [19] = "GET_ENDIAN",
      	  [20] = "SET_ENDIAN",
      	  [21] = "GET_SECCOMP",
      	  [22] = "SET_SECCOMP",
      	  [25] = "GET_TSC",
      	  [26] = "SET_TSC",
      	  [27] = "GET_SECUREBITS",
      	  [28] = "SET_SECUREBITS",
      	  [29] = "SET_TIMERSLACK",
      	  [30] = "GET_TIMERSLACK",
      	  [35] = "SET_MM",
      	  [36] = "SET_CHILD_SUBREAPER",
      	  [37] = "GET_CHILD_SUBREAPER",
      	  [38] = "SET_NO_NEW_PRIVS",
      	  [39] = "GET_NO_NEW_PRIVS",
      	  [40] = "GET_TID_ADDRESS",
      	  [41] = "SET_THP_DISABLE",
      	  [42] = "GET_THP_DISABLE",
      	  [45] = "SET_FP_MODE",
      	  [46] = "GET_FP_MODE",
        };
        static const char *prctl_set_mm_options[] = {
      	  [1] = "START_CODE",
      	  [2] = "END_CODE",
      	  [3] = "START_DATA",
      	  [4] = "END_DATA",
      	  [5] = "START_STACK",
      	  [6] = "START_BRK",
      	  [7] = "BRK",
      	  [8] = "ARG_START",
      	  [9] = "ARG_END",
      	  [10] = "ENV_START",
      	  [11] = "ENV_END",
      	  [12] = "AUXV",
      	  [13] = "EXE_FILE",
      	  [14] = "MAP",
      	  [15] = "MAP_SIZE",
        };
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-qtotspuztydjttxi7k6mec6h@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0d690fc0
  3. 31 5月, 2018 5 次提交
  4. 30 5月, 2018 2 次提交
    • T
      perf test: "Session topology" dumps core on s390 · d1211091
      Thomas Richter 提交于
      The "perf test Session topology" entry fails with core dump on s390. The root
      cause is a NULL pointer dereference in function check_cpu_topology() line 76
      (or line 82 without -v).
      
      The session->header.env.cpu variable is NULL because on s390 function
      process_cpu_topology() returns with error:
      
          socket_id number is too big.
          You may need to upgrade the perf tool.
      
      and releases the env.cpu variable via zfree() and sets it to NULL.
      
      Here is the gdb output:
      (gdb) n
      76                      pr_debug("CPU %d, core %d, socket %d\n", i,
      (gdb) n
      
      Program received signal SIGSEGV, Segmentation fault.
      0x00000000010f4d9e in check_cpu_topology (path=0x3ffffffd6c8
      	"/tmp/perf-test-J6CHMa", map=0x14a1740) at tests/topology.c:76
      76  pr_debug("CPU %d, core %d, socket %d\n", i,
      (gdb)
      
      Make sure the env.cpu variable is not used when its NULL.
      Test for NULL pointer and return TEST_SKIP if so.
      
      Output before:
      
        [root@p23lp27 perf]# ./perf test -F 39
        39: Session topology  :Segmentation fault (core dumped)
        [root@p23lp27 perf]#
      
      Output after:
      
        [root@p23lp27 perf]# ./perf test -vF 39
        39: Session topology                                      :
        --- start ---
        templ file: /tmp/perf-test-Ajx59D
        socket_id number is too big.You may need to upgrade the perf tool.
        ---- end ----
        Session topology: Skip
        [root@p23lp27 perf]#
      Signed-off-by: NThomas Richter <tmricht@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20180528073657.11743-1-tmricht@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d1211091
    • K
      perf parse-events: Handle uncore event aliases in small groups properly · 369b2308
      Kan Liang 提交于
      Perf stat doesn't count the uncore event aliases from the same uncore
      block in a group, for example:
      
        perf stat -e '{unc_m_cas_count.all,unc_m_clockticks}' -a -I 1000
        #           time             counts unit events
             1.000447342      <not counted>      unc_m_cas_count.all
             1.000447342      <not counted>      unc_m_clockticks
             2.000740654      <not counted>      unc_m_cas_count.all
             2.000740654      <not counted>      unc_m_clockticks
      
      The output is very misleading. It gives a wrong impression that the
      uncore event doesn't work.
      
      An uncore block could be composed by several PMUs. An uncore event alias
      is a joint name which means the same event runs on all PMUs of a block.
      Perf doesn't support mixed events from different PMUs in the same group.
      It is wrong to put uncore event aliases in a big group.
      
      The right way is to split the big group into multiple small groups which
      only include the events from the same PMU.
      
      Only uncore event aliases from the same uncore block should be specially
      handled here. It doesn't make sense to mix the uncore events with other
      uncore events from different blocks or even core events in a group.
      
      With the patch:
        #           time             counts unit events
           1.001557653            140,833      unc_m_cas_count.all
           1.001557653      1,330,231,332      unc_m_clockticks
           2.002709483             85,007      unc_m_cas_count.all
           2.002709483      1,429,494,563      unc_m_clockticks
      Reported-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Agustin Vega-Frias <agustinv@codeaurora.org>
      Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1525727623-19768-1-git-send-email-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      369b2308
  5. 26 5月, 2018 2 次提交
  6. 23 5月, 2018 1 次提交