Skip to content
Snippets Groups Projects
  1. Jun 21, 2018
  2. Jun 20, 2018
  3. Jun 18, 2018
  4. Jun 15, 2018
  5. Jun 13, 2018
    • Anders Roxell's avatar
      selftests: bpf: config: add config fragments · 3bce593a
      Anders Roxell authored
      
      Tests test_tunnel.sh fails due to config fragments ins't enabled.
      
      Fixes: 933a741e ("selftests/bpf: bpf tunnel test.")
      Signed-off-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      3bce593a
    • Yonghong Song's avatar
      tools/bpftool: fix a bug in bpftool perf · 73df93c5
      Yonghong Song authored
      
      Commit b04df400 ("tools/bpftool: add perf subcommand")
      introduced bpftool subcommand perf to query bpf program
      kuprobe and tracepoint attachments.
      
      The perf subcommand will first test whether bpf subcommand
      BPF_TASK_FD_QUERY is supported in kernel or not. It does it
      by opening a file with argv[0] and feeds the file descriptor
      and current task pid to the kernel for querying.
      
      Such an approach won't work if the argv[0] cannot be opened
      successfully in the current directory. This is especially
      true when bpftool is accessible through PATH env variable.
      The error below reflects the open failure for file argv[0]
      at home directory.
      
        [yhs@localhost ~]$ which bpftool
        /usr/local/sbin/bpftool
        [yhs@localhost ~]$ bpftool perf
        Error: perf_query_support: No such file or directory
      
      To fix the issue, let us open root directory ("/")
      which exists in every linux system. With the fix, the
      error message will correctly reflect the permission issue.
      
        [yhs@localhost ~]$ which bpftool
        /usr/local/sbin/bpftool
        [yhs@localhost ~]$ bpftool perf
        Error: perf_query_support: Operation not permitted
        HINT: non root or kernel doesn't support TASK_FD_QUERY
      
      Fixes: b04df400 ("tools/bpftool: add perf subcommand")
      Reported-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      73df93c5
  6. Jun 12, 2018
  7. Jun 11, 2018
    • Anders Roxell's avatar
      selftests: bpf: fix urandom_read build issue · 1c9ca7e9
      Anders Roxell authored
      
      gcc complains that urandom_read gets built twice.
      
      gcc -o tools/testing/selftests/bpf/urandom_read
      -static urandom_read.c -Wl,--build-id
      gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf
      -I../../../../include/generated  -I../../../include    urandom_read.c
      urandom_read -lcap -lelf -lrt -lpthread -o
      tools/testing/selftests/bpf/urandom_read
      gcc: fatal error: input file
      ‘tools/testing/selftests/bpf/urandom_read’ is the
      same as output file
      compilation terminated.
      ../lib.mk:110: recipe for target
      'tools/testing/selftests/bpf/urandom_read' failed
      To fix this issue remove the urandom_read target and so target
      TEST_CUSTOM_PROGS gets used.
      
      Fixes: 81f77fd0 ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
      Signed-off-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      1c9ca7e9
  8. Jun 08, 2018
    • Seeteena Thoufeek's avatar
      perf script: Show hw-cache events · fad76d43
      Seeteena Thoufeek authored
      
      'perf script' fails to report hardware cache events (PERF_TYPE_HW_CACHE)
      where as 'perf report' shows the samples. Fix it. Ex,
      
        # perf record -e L1-dcache-loads ./a.out
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.008 MB perf.data (11 samples)]
      
      Before patch:
      
        # perf script | wc -l
        0
      
      After patch:
      
        # perf script | wc -l
        11
      
      Committer testing:
      
        [root@jouet ~]# perf script | head -30 | tail
              Timer 9803 [2] 8.963330:  1554 L1-dcache-loads: 7ffef89baae4 __vdso_clock_gettime+0xf4 ([vdso])
            swapper    0 [2] 8.963343:  5626 L1-dcache-loads: ffffffffa66f4f6b cpuidle_not_av+0xb (/lib/modules/4.17.0-rc5/build/vmlinux)
            firefox 4853 [2] 8.964070: 18935 L1-dcache-loads: 7f0b9a00dc30 xcb_poll_for_event+0x0 (/usr/lib64/libxcb.so.1.1.0)
        Softwar~cTh 4928 [2] 8.964548: 15928 L1-dcache-loads: ffffffffa60d795c update_curr+0x10c (/lib/modules/4.17.0-rc5/build/vmlinux)
            firefox 4853 [2] 8.964675: 14978 L1-dcache-loads: ffffffffa6897018 mutex_unlock+0x18 (/lib/modules/4.17.0-rc5/build/vmlinux)
        gnome-shell 2026 [3] 8.964693: 50670 L1-dcache-loads: 7fa08854de6d g_source_iter_next+0x6d (/usr/lib64/libglib-2.0.so.0.5400.3)
         Compositor 4929 [1] 8.964784: 71772 L1-dcache-loads: 7f0b936bf078 [unknown] (/usr/lib64/firefox/libxul.so)
           Xwayland 2096 [2] 8.964919: 16799 L1-dcache-loads: 7f68ce2fcb8a glXGetCurrentContext+0x1a (/usr/lib64/libGLX.so.0.0.0)
        gnome-shell 2026 [3] 8.964997: 50670 L1-dcache-loads: 7fa08854de6d g_source_iter_next+0x6d (/usr/lib64/libglib-2.0.so.0.5400.3)
        [root@jouet ~]#
      
      Signed-off-by: default avatarSeeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      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>
      Link: http://lkml.kernel.org/r/1528455748-20087-1-git-send-email-s1seetee@linux.vnet.ibm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fad76d43
    • Jiri Olsa's avatar
      perf c2c: Keep struct hist_entry at the end of struct c2c_hist_entry · 4c820527
      Jiri Olsa authored
      
      Exactly as the comment just before 'struct c2c_hist_entry" says, i.e.
      the last entry in struct hist_entry is a zero length array, that when
      allocating space for hist_entry gets extra space if callchains are in
      use, which, if hist_entry is not at the end of c2c_hist_entry, the
      members after it gets corrupted when callchains get added to the rb
      trees collecting them, etc.
      
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Fixes: 7f834c2e ("perf c2c report: Display node for cacheline address")
      Link: http://lkml.kernel.org/n/tip-bh0ke4fh2ygpj3yowna7o1di@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4c820527
    • Alexey Dobriyan's avatar
      tools/testing/selftests/proc: test /proc/*/fd a bit (+ PF_KTHREAD is ABI!) · b2f5de03
      Alexey Dobriyan authored
      * Test lookup in /proc/self/fd.
        "map_files" lookup story showed that lookup is not that simple.
      
      * Test that all those symlinks open the same file.
        Check with (st_dev, st_info).
      
      * Test that kernel threads do not have anything in their /proc/*/fd/
        directory.
      
      Now this is where things get interesting.
      
      First, kernel threads aren't pinned by /proc/self or equivalent,
      thus some "atomicity" is required.
      
      Second, ->comm can contain whitespace and ')'.
      No, they are not escaped.
      
      Third, the only reliable way to check if process is kernel thread
      appears to be field #9 in /proc/*/stat.
      
      This field is struct task_struct::flags in decimal!
      Check is done by testing PF_KTHREAD flags like we do in kernel.
      
      	PF_KTREAD value is a part of userspace ABI !!!
      
      Other methods for determining kernel threadness are not reliable:
      * RSS can be 0 if everything is swapped, even while reading
        from /proc/self.
      
      * ->total_vm CAN BE ZERO if process is finishing
      
      	munmap(NULL, whole address space);
      
      * /proc/*/maps and similar files can be empty because unmapping
        everything works. Read returning 0 can't distinguish between
        kernel thread and such suicide process.
      
      Link: http://lkml.kernel.org/r/20180505000414.GA15090@avx2
      
      
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b2f5de03
    • Matthew Wilcox's avatar
      mm: mark pages in use for page tables · 1d40a5ea
      Matthew Wilcox authored
      Define a new PageTable bit in the page_type and use it to mark pages in
      use as page tables.  This can be helpful when debugging crashdumps or
      analysing memory fragmentation.  Add a KPF flag to report these pages to
      userspace and update page-types.c to interpret that flag.
      
      Note that only pages currently accounted as NR_PAGETABLES are tracked as
      PageTable; this does not include pgd/p4d/pud/pmd pages.  Those will be the
      subject of a later patch.
      
      Link: http://lkml.kernel.org/r/20180518194519.3820-4-willy@infradead.org
      
      
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1d40a5ea
  9. Jun 07, 2018
    • Yonghong Song's avatar
      tools/bpf: fix selftest get_cgroup_id_user · 23316a36
      Yonghong Song authored
      
      Commit f269099a ("tools/bpf: add a selftest for
      bpf_get_current_cgroup_id() helper") added a test
      for bpf_get_current_cgroup_id() helper. The bpf program
      is attached to tracepoint syscalls/sys_enter_nanosleep
      and will record the cgroup id if the tracepoint is hit.
      The test program creates a cgroup and attachs itself to
      this cgroup and expects that the test program process
      cgroup id is the same as the cgroup_id retrieved
      by the bpf program.
      
      In a light system where no other processes called
      nanosleep syscall, the test case can pass.
      In a busy system where many different processes can hit
      syscalls/sys_enter_nanosleep tracepoint, the cgroup id
      recorded by bpf program may not match the test program
      process cgroup_id.
      
      This patch fixed an issue by communicating the test program
      pid to bpf program. The bpf program only records
      cgroup id if the current task pid is the same as
      passed-in pid. This ensures that the recorded cgroup_id
      is for the cgroup within which the test program resides.
      
      Fixes: f269099a ("tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper")
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      23316a36
    • Dan Carpenter's avatar
      kselftest/cgroup: fix a signedness bug · 53c3daf8
      Dan Carpenter authored
      
      "len" needs to be signed for the error handling to work.
      
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
      53c3daf8
Loading