I try to use Instruction Based Sampling on a Dell poweredge R7425 machine equipped with 2 EPYC 7451 cpu running on Debian buster (Linux kernel 18.104.22.168, gcc 7.3.0), but neither µProf nor perf_event "see" that IBS is available:
- in µProf, in the "select configuration type", there's no "Instruction-based Sampling" configuration
- "perf list" does not show any ibs_op event, and when I try to use perf_event_open, I get "Invalid argument" errors
It seems that the problem is that Linux does not detect IBS: there's no /sys/devices/ibs_op entry in the filesystem, and I can't find any info related to IBS in dmesg output.
I saw on another thread (Instruction Based Sampling broken for Threadripper? ), that IBS may be enabled in BIOS, but I didn't find any option in my machine's BIOS.
I tried the AMD research instruction based sampling toolkit (GitHub - jlgreathouse/AMD_IBS_Toolkit: AMD Research Instruction Based Sampling Toolkit ), and it works, so IBS is indeed available, but not through Linux /sys/devices/ibs_op.
How could I make IBS work using perf ?
Try with "Select Profile Type" > "Custom Profile" > Choose "All IBS Op Samples". Remove all other events from the "Monitored Events" table on the right side except chosen events. You should be able to profile IBS events using custom profile. Let us know if how it goes.
I tried this, but it doesn't work
I can choose "All IBS Op Samples", but run I click "Start profile", I get the following error message:
"Support for IBS profiling is not available in this Linux kernel version. It is supported from Linux kernel version 3.5 onwards".
I am using Linux kernel version 4.16.0-2 (from Debian buster), so IBS should be supported (it was supported on another AMD Opteron machine running Debian a few months ago).
Unfortunately that error message is misleading. We will fix that in the next release. I overlooked your original message saying "no /sys/devices/ibs_op". uProf looks for these files and if missing then IBS profiling would fail to start. Usually IBS profiling should work fine with Kernel 4.16. Is there a possibility that Debian Buster disabled /sys/devices/ibs_op & /sys/devices/ibs_fetch on this development version? Though officially we don't test uProf on Debian, but it should work on Debian. Just see if you can check this behavior on Ubuntu with kernel version newer than 4.10. As far as I know Debian 9 has kernel 4.9 or so, hence EPYC profiling would not work there.
I'm the author of the AMD Research IBS Toolkit that you mentioned in your post. I might have a guess for why that toolkit works with IBS, but you can't use it in uProf and why those devices are not available in your Linux installation.
As mentioned in your post and as seen in the other community post, Family 17h Model 01h processors do not necessarily have IBS enabled in the hardware by default. There are a series of steps the BIOS must go through to enable IBS, and your system's BIOS may not have that turned on by default. As such, because IBS would appear to be disabled by the hardware, your Linux installation would not show the IBS op and fetch devices in /sys/devices.
The AMD Research IBS Toolkit performs a series of steps to enable IBS even if the BIOS does not turn on IBS. We do this specifically so that systems without the proper BIOS settings can still use the IBS hardware (see this comment in our driver).
I would recommend that you look again in your system's BIOS for an option to enable IBS or Instruction Based Sampling. If there is no setting to enable this, you may want to contact your system vendor (Dell, in your case) to see if they've renamed the option or if it's hidden in some sub-menu. If they've not made the option available, you may want to request a BIOS update that has this setting available. We make IBS enable/disable available as part of our AGESA system that we release to BIOS vendors, so it should not be a particularly large amount of work for your vendor to do this (though I cannot promise that they will want to do this, or that it would not require them a while as they would want to validate the option).
P.S. Depending on what type of application profiling you want to do, while you wait for your system vendor to respond, you may still be able to use the toolkit that you linked. Check out the "ibs_run_and_annotate" program. If there are any features you would like added, please submit a GitHub issue and I'll try to see how easy it would be to add them.
Thanks ! I'll contact Dell as suggested
In the meantime, I use the AMD toolkit for prototyping, but since I'm developing a performance analysis tool (GitHub - numamma/numamma ), I'd prefer to use a portable solution (eg. Linux perf_event).
For what you want to do, you may want to check out the README file that we put together as part of the AMD Research IBS Toolkit. That file explains how, if you write something that interfaces directly with our IBS driver, you can later modify your tool to interface directly with Linux's perf_events subsystem. This should help you write your code using the AMD Research IBS Toolkit and quickly port it to work with perf_events after you get that working. This is actually one of the major reasons we released the toolkit.