NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.99k stars 14.01k forks source link

ease the use of `perf probe` #66924

Open teto opened 5 years ago

teto commented 5 years ago

I need to trace some variables in the kernel. I tried using perf on nixos but this was not straightforward strace -olog perf probe -L tcp_cong_avoid_ai fails with

Failed to find the path for the kernel: No such file or directory
  Error: Failed to show lines.

I started developing a patch to add vmlinux (present in ${kernel.dev}/vmlinux) to tools/perf/util/symbol.c but there is no stable path to that file.

I've then stumbled on https://www.mail-archive.com/nix-commits-bounces@lists.science.uu.nl/msg04507.html that puts vmlinux in a stable path but it doesn't explain how perf looks into that folder: @viric do you have a custom patch in your repo ?

teto commented 5 years ago

nevermind, perf help probe explains how to pass a custom path :/

teto commented 5 years ago

usage of perf is not pleasant, thus I reopen the issue to discuss how to make it more straightforward. since the CLI get long. I wonder if we should not patch the perf source to not have to run this kind of command `perf --debug verbose probe -k /nix/store/5am9gvlr7wkcwy48kibhvq16l624iw6h-linux-5.1.0-mptcp_v0.96.0-dev/vmlinux -m /run/booted-system/kernel-modules -s /home/teto/mptcp 'tcp_cong_avoid_ai tp->snd_cwnd_clamp'

Also using compressed modules seem to trouble perf. Maybe with a nixos module we could add some warnings checking for MODULE_COMPRESS settings etc

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.