Search code examples
linuxubuntulinux-kernelperfamd-processor

How can I install perf for Linux kernel 6.1.0-060100-generic on Ubuntu?


I like to try out the new capability of perf c2c/mem for AMD arch (in detai: https://www.phoronix.com/news/Linux-6.1-Perf)

My environment is OS: Ubuntu 22.04.2 LTS x86_64 Kernel: 6.1.0-060100-generic CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz

if I normally execute perf c2c record -a executable

I got a warning

WARNING: perf not found for kernel 6.1.0-060100

  You may need to install the following packages for this specific kernel:
    linux-tools-6.1.0-060100-generic
    linux-cloud-tools-6.1.0-060100-generic

  You may also want to install one of the following packages to keep up to date:
    linux-tools-generic
    linux-cloud-tools-generic

But I cannot install them

sudo apt-get install linux-tools-6.1.0-060100-generic
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-tools-6.1.0-060100-generic
E: Couldn't find any package by glob 'linux-tools-6.1.0-060100-generic'
E: Couldn't find any package by regex 'linux-tools-6.1.0-060100-generic'

Anyone has idea?


Solution

  • Solution

    sudo apt install linux-image-oem-22.04c linux-tools-oem-22.04c

    Reboot into that v6.1 kernel.


    Additional

    If you'd like to list all the versions of perf available, type sudo apt install linux-tools- and press Tab twice to autocomplete, and bash-completion will list out the several hundred available packages.

    This solution works right now for v6.1 because Ubuntu has a v6.1 OEM kernel (provided for later hardware compatibility for OEMs).

    You're lucky there's another v6.1 kernel and tools in the repo for the OEM kernel and its related packages.

    You're currently using Canonical kernel team's mainline package linux-image-6.1.0-060100-generic, but they do not do builds of the other stuff like linux-tools or the debuginfo.

    So if you were using something else, like the very latest v6.2.11, there is no pre-made linux-tools for that kernel version. You'd have to compile perf from the kernel's tools/perf directory or whatever other source directory you got your kernel from.