1. 24 3月, 2017 1 次提交
  2. 23 3月, 2017 2 次提交
    • M
      bpf: Add tests for map-in-map · fb30d4b7
      Martin KaFai Lau 提交于
      Test cases for array of maps and hash of maps.
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fb30d4b7
    • A
      bpf: fix hashmap extra_elems logic · 8c290e60
      Alexei Starovoitov 提交于
      In both kmalloc and prealloc mode the bpf_map_update_elem() is using
      per-cpu extra_elems to do atomic update when the map is full.
      There are two issues with it. The logic can be misused, since it allows
      max_entries+num_cpus elements to be present in the map. And alloc_extra_elems()
      at map creation time can fail percpu alloc for large map values with a warn:
      WARNING: CPU: 3 PID: 2752 at ../mm/percpu.c:892 pcpu_alloc+0x119/0xa60
      illegal size (32824) or align (8) for percpu allocation
      
      The fixes for both of these issues are different for kmalloc and prealloc modes.
      For prealloc mode allocate extra num_possible_cpus elements and store
      their pointers into extra_elems array instead of actual elements.
      Hence we can use these hidden(spare) elements not only when the map is full
      but during bpf_map_update_elem() that replaces existing element too.
      That also improves performance, since pcpu_freelist_pop/push is avoided.
      Unfortunately this approach cannot be used for kmalloc mode which needs
      to kfree elements after rcu grace period. Therefore switch it back to normal
      kmalloc even when full and old element exists like it was prior to
      commit 6c905981 ("bpf: pre-allocate hash map elements").
      
      Add tests to check for over max_entries and large map values.
      Reported-by: NDave Jones <davej@codemonkey.org.uk>
      Fixes: 6c905981 ("bpf: pre-allocate hash map elements")
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8c290e60
  3. 22 3月, 2017 1 次提交
  4. 17 3月, 2017 1 次提交
    • D
      perf symbols: Fix symbols__fixup_end heuristic for corner cases · e7ede72a
      Daniel Borkmann 提交于
      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: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDaniel 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      e7ede72a
  5. 13 3月, 2017 1 次提交
  6. 10 3月, 2017 2 次提交
  7. 09 3月, 2017 1 次提交
    • C
      selftests/powerpc: Replace stxvx and lxvx with stxvd2x/lxvd2x · 605df8d6
      Cyril Bur 提交于
      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: NCyril Bur <cyrilbur@gmail.com>
      Acked-by: Balbir Singh<bsingharora@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      605df8d6
  8. 08 3月, 2017 13 次提交
  9. 07 3月, 2017 2 次提交
  10. 03 3月, 2017 2 次提交
    • S
      selftest/powerpc: Fix false failures for skipped tests · a6d8a215
      Sachin Sant 提交于
      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: NSachin Sant <sachinp@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      a6d8a215
    • L
      give up on gcc ilog2() constant optimizations · 474c9015
      Linus Torvalds 提交于
      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: NLaura 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: NLinus Torvalds <torvalds@linux-foundation.org>
      474c9015
  11. 02 3月, 2017 3 次提交
    • S
      selftests: lib.mk Fix individual test builds · e53aff45
      Shuah Khan 提交于
      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: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
      e53aff45
    • J
      objtool, modules: Discard objtool annotation sections for modules · e390f9a9
      Josh Poimboeuf 提交于
      The '__unreachable' and '__func_stack_frame_non_standard' sections are
      only used at compile time.  They're discarded for vmlinux but they
      should also be discarded for modules.
      
      Since this is a recurring pattern, prefix the section names with
      ".discard.".  It's a nice convention and vmlinux.lds.h already discards
      such sections.
      
      Also remove the 'a' (allocatable) flag from the __unreachable section
      since it doesn't make sense for a discarded section.
      Suggested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Jessica Yu <jeyu@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: d1091c7f ("objtool: Improve detection of BUG() and other dead ends")
      Link: http://lkml.kernel.org/r/20170301180444.lhd53c5tibc4ns77@trebleSigned-off-by: NIngo Molnar <mingo@kernel.org>
      e390f9a9
    • A
      selftests/x86: Add a basic selftest for ioperm · 0eb1d0fa
      Andy Lutomirski 提交于
      This doesn't fully exercise the interaction between KVM and ioperm(),
      but it does test basic functionality.
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
      0eb1d0fa
  12. 01 3月, 2017 11 次提交