1. 17 Mar, 2017 1 commit
    • Daniel Borkmann's avatar
      perf symbols: Fix symbols__fixup_end heuristic for corner cases · e7ede72a
      Daniel Borkmann authored
      The current symbols__fixup_end() heuristic for the last entry in the rb
      tree is suboptimal as it leads to not being able to recognize the symbol
      in the call graph in a couple of corner cases, for example:
      
       i) If the symbol has a start address (f.e. exposed via kallsyms)
          that is at a page boundary, then the roundup(curr->start, 4096)
          for the last entry will result in curr->start == curr->end with
          a symbol length of zero.
      
      ii) If the symbol has a start address that is shortly before a page
          boundary, then also here, curr->end - curr->start will just be
          very few bytes, where it's unrealistic that we could perform a
          match against.
      
      Instead, change the heuristic to roundup(curr->start, 4096) + 4096, so
      that we can catch such corner cases and have a better chance to find
      that specific symbol. It's still just best effort as the real end of the
      symbol is unknown to us (and could even be at a larger offset than the
      current range), but better than the current situation.
      
      Alexei reported that he recently run into case i) with a JITed eBPF
      program (these are all page aligned) as the last symbol which wasn't
      properly shown in the call graph (while other eBPF program symbols in
      the rb tree were displayed correctly). Since this is a generic issue,
      lets try to improve the heuristic a bit.
      Reported-and-Tested-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Fixes: 2e538c4a ("perf tools: Improve kernel/modules symbol lookup")
      Link: http://lkml.kernel.org/r/bb5c80d27743be6f12afc68405f1956a330e1bc9.1489614365.git.daniel@iogearbox.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e7ede72a
  2. 13 Mar, 2017 1 commit
  3. 10 Mar, 2017 2 commits
  4. 09 Mar, 2017 1 commit
    • Cyril Bur's avatar
      selftests/powerpc: Replace stxvx and lxvx with stxvd2x/lxvd2x · 605df8d6
      Cyril Bur authored
      On POWER8 (ISA 2.07) lxvx and stxvx are defined to be extended mnemonics
      of lxvd2x and stxvd2x. For POWER9 (ISA 3.0) the HW architects in their
      infinite wisdom made lxvx and stxvx instructions in their own right.
      
      POWER9 aware GCC will use the POWER9 instruction for lxvx and stxvx
      causing these selftests to fail on POWER8. Further compounding the
      issue, because of the way -mvsx works it will cause the power9
      instructions to be used regardless of -mcpu=power8 to GCC or -mpower8 to
      AS.
      
      The safest way to address the problem for now is to not use the extended
      mnemonic. We don't care how the CPU loads the values from memory since
      the tests only performs register comparisons, so using stdvd2x/lxvd2x
      does not impact the test.
      Signed-off-by: default avatarCyril Bur <cyrilbur@gmail.com>
      Acked-by: Balbir Singh<bsingharora@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      605df8d6
  5. 08 Mar, 2017 2 commits
  6. 07 Mar, 2017 12 commits
  7. 03 Mar, 2017 1 commit
    • Sachin Sant's avatar
      selftest/powerpc: Fix false failures for skipped tests · a6d8a215
      Sachin Sant authored
      Tests under alignment subdirectory are skipped when executed on previous
      generation hardware, but harness still marks them as failed.
      
        test: test_copy_unaligned
        tags: git_version:unknown
        [SKIP] Test skipped on line 26
        skip: test_copy_unaligned
        selftests: copy_unaligned [FAIL]
      
      The MAGIC_SKIP_RETURN_VALUE value assigned to rc variable is retained till
      the program exit which causes the test to be marked as failed.
      
      This patch resets the value before returning to the main() routine.
      With this patch the test o/p is as follows:
      
        test: test_copy_unaligned
        tags: git_version:unknown
        [SKIP] Test skipped on line 26
        skip: test_copy_unaligned
        selftests: copy_unaligned [PASS]
      Signed-off-by: default avatarSachin Sant <sachinp@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      a6d8a215
  8. 02 Mar, 2017 2 commits
    • Linus Torvalds's avatar
      give up on gcc ilog2() constant optimizations · 474c9015
      Linus Torvalds authored
      gcc-7 has an "optimization" pass that completely screws up, and
      generates the code expansion for the (impossible) case of calling
      ilog2() with a zero constant, even when the code gcc compiles does not
      actually have a zero constant.
      
      And we try to generate a compile-time error for anybody doing ilog2() on
      a constant where that doesn't make sense (be it zero or negative).  So
      now gcc7 will fail the build due to our sanity checking, because it
      created that constant-zero case that didn't actually exist in the source
      code.
      
      There's a whole long discussion on the kernel mailing about how to work
      around this gcc bug.  The gcc people themselevs have discussed their
      "feature" in
      
         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785
      
      but it's all water under the bridge, because while it looked at one
      point like it would be solved by the time gcc7 was released, that was
      not to be.
      
      So now we have to deal with this compiler braindamage.
      
      And the only simple approach seems to be to just delete the code that
      tries to warn about bad uses of ilog2().
      
      So now "ilog2()" will just return 0 not just for the value 1, but for
      any non-positive value too.
      
      It's not like I can recall anybody having ever actually tried to use
      this function on any invalid value, but maybe the sanity check just
      meant that such code never made it out in public.
      Reported-by: default avatarLaura Abbott <labbott@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>,
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      474c9015
    • Shuah Khan's avatar
      selftests: lib.mk Fix individual test builds · e53aff45
      Shuah Khan authored
      In commit a8ba798b ("selftests: enable O and KBUILD_OUTPUT"), added
      support to generate compile targets in a user specified directory. OUTPUT
      variable controls the location which is undefined when tests are built in
      the test directory or with "make -C tools/testing/selftests/x86".
      
      make -C tools/testing/selftests/x86/
      make: Entering directory '/lkml/linux_4.11/tools/testing/selftests/x86'
      Makefile:44: warning: overriding recipe for target 'clean'
      ../lib.mk:51: warning: ignoring old recipe for target 'clean'
      gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
      /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied
      collect2: error: ld returned 1 exit status
      Makefile:50: recipe for target '/single_step_syscall_64' failed
      make: *** [/single_step_syscall_64] Error 1
      make: Leaving directory '/lkml/linux_4.11/tools/testing/selftests/x86'
      
      Same failure with "cd tools/testing/selftests/x86/;make" run.
      
      Fix this with a change to lib.mk to define OUTPUT to be the pwd when
      MAKELEVEL is 0. This covers both cases mentioned above.
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
      e53aff45
  9. 01 Mar, 2017 18 commits