Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show help message when perf is permission denied #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dweiller
Copy link

@dweiller dweiller commented Jan 3, 2025

Resolves #17.

See the commit message for details on the message displayed.

Some bikeshedding on the message may be warranted - it's probably reasonable to have a simpler strategy for suggesting the perf_event_paranoid setting suggested. I chose to suggest decrementing the perf_event_paranoid setting by one because:

  • I think it's better to (try to) suggest the least permissive setting possible
  • for most systems, level 2 should be fine, but on Ubuntu (and possibly Debian, but I don't have a system to test on) the least permissive setting that works is higher due to patches that add levels 3 and 4 to perf_events_paranoid, with 3 being sufficient on Ubuntu without elevated privileges
  • detecting a distribution at runtime and maintaining a mapping of distributions to suggested levels seems like an annoying maintenance burden

A simpler strategy would be to just suggest level 2, which I think should work for everyone since poop doesn't ask for kernel events and surely distros with patches changing the levels will preserve the meaning of the mainline ones.

When perf events cannot be opened due to permission being denied, the
user should be able to configure their system so that poop can be run
without elevated permissions (e.g. without using  sudo ). To assist with
this poop will now display a message explaining how the
`kernel.perf_event_paranoid` setting can be changed. The displayed is
based on the one used by the `perf` tool.

Some systems (notably Debian and Ubuntu) carry linux patches that add
additional levels for perf_events_paranoid which means that the highest
(i.e. least permissive) value that allows poop to access perf events is
different on different systems. Due to this, the help message suggests
lowering the perf_event_paranoid setting by one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

detect when perf is permission denied and give the user a helpful message
1 participant