Skip to content
Snippets Groups Projects
  1. Jul 10, 2023
  2. Jul 03, 2023
  3. Jun 19, 2023
  4. Jun 15, 2023
  5. Jun 09, 2023
    • Jim Cromie's avatar
      kmemleak-test: drop __init to get better backtrace · dcb8cbb5
      Jim Cromie authored
      Drop the __init on kmemleak_test_init().  With it, the storage is
      reclaimed, but then the symbol isn't available for "%pS" rendering,
      and the backtrace gets a bare pointer where the actual leak happened.
      
      unreferenced object 0xffff88800a2b0800 (size 1024):
        comm "modprobe", pid 413, jiffies 4294953430
        hex dump (first 32 bytes):
          73 02 00 00 75 01 00 68 02 00 00 01 00 00 00 04  s...u..h........
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<00000000fabad728>] kmalloc_trace+0x26/0x90
          [<00000000ef738764>] 0xffffffffc02350a2
          [<00000000004e5795>] do_one_initcall+0x43/0x210
          [<00000000d768905e>] do_init_module+0x4a/0x210
          [<0000000087135ab5>] __do_sys_finit_module+0x93/0xf0
          [<000000004fcb1fa2>] do_syscall_64+0x34/0x80
          [<00000000c73c8d9d>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      with __init gone, that trace entry renders like:
      
          [<00000000ef738764>] kmemleak_test_init+<offset>/<size>
      
      Link: https://lkml.kernel.org/r/20230525174356.69711-1-jim.cromie@gmail.com
      
      
      Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      dcb8cbb5
  6. Jun 06, 2023
  7. May 31, 2023
  8. May 16, 2023
  9. May 05, 2023
  10. May 01, 2023
  11. Apr 20, 2023
  12. Apr 18, 2023
    • Hao Ge's avatar
      kmemleak-test: fix kmemleak_test.c build logic · 27d9a0fd
      Hao Ge authored
      kmemleak-test.c was moved to the samples directory in 1abbef4f
      ("mm,kmemleak-test.c: move kmemleak-test.c to samples dir").
      
      If CONFIG_DEBUG_KMEMLEAK_TEST=m and CONFIG_SAMPLES is unset,
      kmemleak-test.c will be unnecessarily compiled.
      
      So move the entry for CONFIG_DEBUG_KMEMLEAK_TEST from mm/Kconfig and add a
      new CONFIG_SAMPLE_KMEMLEAK in samples/ to control whether kmemleak-test.c
      is built or not.
      
      Link: https://lkml.kernel.org/r/20230330060904.292975-1-gehao@kylinos.cn
      
      
      Fixes: 1abbef4f ("mm,kmemleak-test.c: move kmemleak-test.c to samples dir")
      Signed-off-by: default avatarHao Ge <gehao@kylinos.cn>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Alex Gaynor <alex.gaynor@gmail.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Finn Behrens <me@kloenk.dev>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Tony Krowiak <akrowiak@linux.ibm.com>
      Cc: Ye Xingchen <ye.xingchen@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      27d9a0fd
  13. Apr 14, 2023
    • Rong Tao's avatar
      samples/bpf: sampleip: Replace PAGE_OFFSET with _text address · 4a1e885c
      Rong Tao authored
      
      Macro PAGE_OFFSET(0xffff880000000000) in sampleip_user.c is inaccurate,
      for example, in aarch64 architecture, this value depends on the
      CONFIG_ARM64_VA_BITS compilation configuration, this value defaults to 48,
      the corresponding PAGE_OFFSET is 0xffff800000000000, if we use the value
      defined in sampleip_user.c, then all KSYMs obtained by sampleip are (user)
      
      Symbol error due to PAGE_OFFSET error:
      
          $ sudo ./sampleip 1
          Sampling at 99 Hertz for 1 seconds. Ctrl-C also ends.
          ADDR                KSYM                             COUNT
          0xffff80000810ceb8  (user)                           1
          0xffffb28ec880      (user)                           1
          0xffff8000080c82b8  (user)                           1
          0xffffb23fed24      (user)                           1
          0xffffb28944fc      (user)                           1
          0xffff8000084628bc  (user)                           1
          0xffffb2a935c0      (user)                           1
          0xffff80000844677c  (user)                           1
          0xffff80000857a3a4  (user)                           1
          ...
      
      A few examples of addresses in the CONFIG_ARM64_VA_BITS=48 environment in
      the aarch64 environment:
      
          $ sudo head /proc/kallsyms
          ffff8000080a0000 T _text
          ffff8000080b0000 t gic_handle_irq
          ffff8000080b0000 T _stext
          ffff8000080b0000 T __irqentry_text_start
          ffff8000080b00b0 t gic_handle_irq
          ffff8000080b0230 t gic_handle_irq
          ffff8000080b03b4 T __irqentry_text_end
          ffff8000080b03b8 T __softirqentry_text_start
          ffff8000080b03c0 T __do_softirq
          ffff8000080b0718 T __entry_text_start
      
      We just need to replace the PAGE_OFFSET with the address _text in
      /proc/kallsyms to solve this problem:
      
          $ sudo ./sampleip 1
          Sampling at 99 Hertz for 1 seconds. Ctrl-C also ends.
          ADDR                KSYM                             COUNT
          0xffffb2892ab0      (user)                           1
          0xffffb2b1edfc      (user)                           1
          0xffff800008462834  __arm64_sys_ppoll                1
          0xffff8000084b87f4  eventfd_read                     1
          0xffffb28e6788      (user)                           1
          0xffff8000081e96d8  rcu_all_qs                       1
          0xffffb2ada878      (user)                           1
          ...
      
      Signed-off-by: default avatarRong Tao <rongtao@cestc.cn>
      Link: https://lore.kernel.org/r/tencent_A0E82E0BEE925285F8156D540731DF805F05@qq.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      4a1e885c
  14. Apr 13, 2023
  15. Apr 10, 2023
  16. Mar 31, 2023
  17. Mar 29, 2023
  18. Mar 28, 2023
  19. Mar 21, 2023
  20. Mar 17, 2023
  21. Mar 14, 2023
  22. Feb 25, 2023
  23. Feb 18, 2023
  24. Feb 16, 2023
  25. Feb 09, 2023
  26. Feb 08, 2023
  27. Feb 07, 2023
  28. Jan 30, 2023
  29. Jan 25, 2023
    • Mark Rutland's avatar
      ftrace: Add sample with custom ops · b56c68f7
      Mark Rutland authored
      When reworking core ftrace code or architectural ftrace code, it's often
      necessary to test/analyse/benchmark a number of ftrace_ops
      configurations. This patch adds a module which can be used to explore
      some of those configurations.
      
      I'm using this to benchmark various options for changing the way
      trampolines and handling of ftrace_ops work on arm64, and ensuring other
      architectures aren't adversely affected.
      
      For example, in a QEMU+KVM VM running on a 2GHz Xeon E5-2660
      workstation, loading the module in various configurations produces:
      
      | # insmod ftrace-ops.ko
      | ftrace_ops: registering:
      |   relevant ops: 1
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 0
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: NO
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 1681558ns (16ns / call)
      
      | # insmod ftrace-ops.ko nr_ops_irrelevant=5
      | ftrace_ops: registering:
      |   relevant ops: 1
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 5
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: NO
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 1693042ns (16ns / call)
      
      | # insmod ftrace-ops.ko nr_ops_relevant=2
      | ftrace_ops: registering:
      |   relevant ops: 2
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 0
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: NO
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 11965582ns (119ns / call)
      
      | # insmod ftrace-ops.ko save_regs=true
      | ftrace_ops: registering:
      |   relevant ops: 1
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 0
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: YES
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 4459624ns (44ns / call)
      
      Link: https://lkml.kernel.org/r/20230103124912.2948963-4-mark.rutland@arm.com
      
      
      
      Cc: Florent Revest <revest@chromium.org>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      b56c68f7
  30. Jan 24, 2023
  31. Jan 23, 2023
Loading