1

If you try to run a random perf binary that does not match your currently running Linux kernel, it says:

$ perf
WARNING: perf not found for kernel 4.13.0-45

Of course, if I get the perf for this version, it works.

Looking at some popular resources like Linux perf Examples and the Perf wiki I couldn't find the answer for this specific question: why perf strictly needs to be in the same version as the kernel?

0

perf and the kernel are tied fairly closely together, in fact perf is part of the kernel source code. At heart you should think of it as a kernel-specific tool; but packaging practice and requirements in Linux distributions means users end up thinking of it as a “standard” tool.

There is no special perf-private interface between perf and the kernel, so the perf-supporting parts of the kernel have to follow the usual userspace-facing rules — i.e. maintain backward-compatibility; so in theory, it would be possible to run an older version of perf with a newer kernel, since the newer kernel is supposed to support whatever interface the older version of perf uses to communicate with it. However, in practice it turns out that if you need to use perf to investigate performance of a workload on a given kernel, you also need to be able to investigate all the performance-affecting features of that particular kernel; an older version of perf can’t support features which were added after it was released, so you would typically end up needing the matching version of perf anyway. As a result of all this, the pragmatic option is to require a version of perf matching the running kernel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.